summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/state.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: optionally associate a gl_program to ATI_fragment_shaderMiklós Máté2016-03-271-1/+13
| | | | | | | | | the state tracker will use it Acked-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Miklós Máté <mtmkls@gmail.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
* mesa: replace gl_context->Multisample._Enabled with ↵Bas Nieuwenhuizen2016-03-241-17/+0
| | | | | | | | | | | | _mesa_is_multisample_enabled. This removes any dependency on driver validation of the number of framebuffer samples. Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Brian Paul <brianp@vmware.com>
* mesa: use default geometry's samples when there are no attachmentsIlia Mirkin2016-02-021-1/+1
| | | | | | | | | Whether multisampling is turned on depends, in part, on whether attachments are themselves multisample surfaces. However when there are no attachments, we should rely on the default geometry for this. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* mesa: short-cut new_state == _NEW_LINE in _mesa_update_state_locked()Brian Paul2015-10-151-1/+5
| | | | | | | | | | | We can skip to the end of _mesa_update_state_locked() if only the _NEW_LINE flag is set since none of the derived state depends on it (just like _NEW_CURRENT_ATTRIB). Note that we still call the ctx->Driver.UpdateState() function, of course. v2: use bitmask-based test, per Eric. Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: add misc tessellation shader stuffFabian Bieler2015-07-231-4/+50
| | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: don't rebind constant buffers after every state change if GS is activeMarek Olšák2015-06-161-9/+3
| | | | Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: use GL_GEOMETRY_PROGRAM_NV instead of MESA_GEOMETRY_PROGRAMMarek Olšák2015-06-051-1/+1
| | | | | | | | There's no reason to use our own definition. Tessellation will use the NV definitions too. Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* main: Refactor _mesa_update_draw_buffer_bounds.Laura Ekstrand2015-05-141-1/+1
| | | | | Reviewed-by: Fredrik Höglund <fredrik@kde.org> Signed-off-by: Fredrik Höglund <fredrik@kde.org>
* main: Refactor _mesa_update_framebuffer.Laura Ekstrand2015-05-141-1/+1
| | | | | | | | | _mesa_update_framebuffer now operates on arbitrary read and draw framebuffers. This allows BlitNamedFramebuffer to update the state of its arbitrary read and draw framebuffers. Reviewed-by: Fredrik Höglund <fredrik@kde.org> Signed-off-by: Fredrik Höglund <fredrik@kde.org>
* mesa/cs: Add compute support to update_program().Paul Berry2015-05-021-0/+21
| | | | | | Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* main: replace __FUNCTION__ with __func__Marius Predut2015-04-141-1/+1
| | | | | | | | | | | Consistently just use C99's __func__ everywhere. The patch was verified with Microsoft Visual studio 2013 redistributable package(RTM version number: 18.0.21005.1) Next MSVC versions intends to support __func__. No functional changes. Acked-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Marius Predut <marius.predut@intel.com>
* mesa: Remove the _WindowMap from gl_viewport_attrib.Mathias Froehlich2015-04-051-25/+0
| | | | | | | | The _WindowMap can be dropped from gl_viewport_attrib now. Simplify gl_viewport_attrib handling where possible. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-1/+1
| | | | Acked-by: Eric Anholt <eric@anholt.net>
* mesa: Implement ARB_clip_control.Mathias Fröhlich2014-10-241-0/+16
| | | | | | | | | | | | | | | Implement the mesa parts of ARB_clip_control. So far no driver enables this. v3: Restrict getting clip control state to the availability of ARB_clip_control. Move to transformation state. Handle clip control state with the GL_TRANSFORM_BIT. Move _FrontBit update into state.c. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
* mesa: Refactor viewport transform computation.Mathias Fröhlich2014-10-241-4/+5
| | | | | | | | | | This is for preparation of ARB_clip_control. v3: Add comments. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
* mesa: Delete VAO _MaxElement code and index buffer bounds checking.Kenneth Graunke2014-09-191-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fredrik's implementation of ARB_vertex_attrib_binding introduced new gl_vertex_attrib_array and gl_vertex_buffer_binding structures, and converted Mesa's older gl_client_array to be derived state. Ultimately, we'd like to drop gl_client_array and use those structures directly. One hitch is that gl_client_array::_MaxElement doesn't correspond to either structure (unlike every other field), so we'd have to figure out where to store it. The _MaxElement computation uses values from both structures, so it doesn't really belong in either place. We could put it in the VAO, but we'd have to pass it around everywhere. It turns out that it's only used when ctx->Const.CheckArrayBounds is set, which is only set by the (rarely used) classic swrast driver. It appears that drivers/x11 used to set it as well, which was intended to avoid segmentation faults on out-of-bounds memory access in the X server (probably for indirect GLX clients). However, ajax deleted that code in 2010 (commit 1ccef926be46dce3b6b5c76e812e2fae4e205ce7). The bounds checking apparently doesn't actually work, either. Non-VBO attributes arbitrarily set _MaxElement to 2 * 1000 * 1000 * 1000. vbo_save_draw and vbo_exec_draw remark /* ??? */ when setting it, and the i965 code contains a comment noting that _MaxElement is often bogus. Given that the code is complex, rarely used, and dubiously functional, it doesn't seem worth maintaining going forward. This patch drops it. This will probably mean the classic swrast driver may begin crashing on out of bounds vertex buffer access in some cases, but I believe that is allowed by OpenGL (and probably happened for non-VBO accesses anyway). There do not appear to be any Piglit regressions, either. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Roland Scheidegger <sroland@vmware.com>
* mesa/sso: rename Shader to the pointer _ShaderGregory Hainaut2014-03-251-7/+7
| | | | | | | | | | | | | | | | Basically a sed but shaderapi.c and get.c. get.c => GL_CURRENT_PROGAM always refer to the "old" UseProgram behavior shaderapi.c => the old api stil update the Shader object directly V2: formatting improvement V3 (idr): * Rebase fixes after a block of code was moved from ir_to_mesa.cpp to shaderapi.c. * Trivial reformatting. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: Rename _mesa_..._array_obj functions to _mesa_..._vao.Kenneth Graunke2014-02-031-2/+2
| | | | | | | | | | | | | | | _mesa_update_vao_client_arrays() is less of a mouthful than _mesa_update_array_object_client_arrays(), and generally clearer. Generated by: $ find . -type f -print0 | xargs -0 sed -i \ 's/_mesa_\([^_]*\)_array_object/_mesa_\1_vao/g' with manual whitespace and indentation fixes applied. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Rename ArrayObj to VAO and DefaultArrayObj to DefaultVAO.Kenneth Graunke2014-02-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When reading through the Mesa drawing code, it's not immediately obvious to me that "ArrayObj" (gl_array_object) is the Vertex Array Object (VAO) state. The comment above the structure explains this, but readers still have to remember this and translate accordingly. Out of context, "array object" is a fairly vague. Even in context, "array" has a lot of meanings: glDrawArrays, vertex data stored in user arrays, gl_client_arrays, gl_vertex_attrib_arrays, and so on. Using the term "VAO" immediately associates these fields with the OpenGL concept, clarifying the situation and aiding programmer sanity. Completely generated by: $ find . -type f -print0 | xargs -0 sed -i \ -e 's/ArrayObj;/VAO;/g' \ -e 's/->ArrayObj/->VAO/g' \ -e 's/Array\.ArrayObj/Array.VAO/g' \ -e 's/Array\.DefaultArrayObj/Array.DefaultVAO/g' v2: Rerun command to resolve conflicts with Ian's meta patches. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Fold long lines introduced by the previous patch.Paul Berry2014-01-211-3/+6
| | | | | Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Replace ctx->Shader.Current{Vertex,Fragment,Geometry}Program with an ↵Paul Berry2014-01-211-4/+4
| | | | | | | | | | | | | | | | | | | | | array. These are replaced with ctx->Shader.CurrentProgram[MESA_SHADER_{VERTEX,FRAGMENT,GEOMETRY}]. In patches to follow, this will allow us to replace a lot of ad-hoc logic with a variable index into the array. With the exception of the changes to mtypes.h, this patch was generated entirely by the command: find src -type f '(' -iname '*.c' -o -iname '*.cpp' ')' \ -print0 | xargs -0 sed -i \ -e 's/\.CurrentVertexProgram/.CurrentProgram[MESA_SHADER_VERTEX]/g' \ -e 's/\.CurrentGeometryProgram/.CurrentProgram[MESA_SHADER_GEOMETRY]/g' \ -e 's/\.CurrentFragmentProgram/.CurrentProgram[MESA_SHADER_FRAGMENT]/g' Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Initialize all the viewportsIan Romanick2014-01-201-5/+8
| | | | | | | | | | | | | v2: Use MAX_VIEWPORTS instead of ctx->Const.MaxViewports because the driver may not set ctx->Const.MaxViewports yet. v3: Handle all viewport entries in update_viewport_matrix and _mesa_copy_context too. This was previously in an earlier patch. Having the code in the earlier patch could cause _mesa_copy_context to access a matrix that hadn't been constructed. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v2]
* mesa: Convert gl_context::Viewport to gl_context::ViewportArrayCourtney Goeltzenleuchter2014-01-201-4/+4
| | | | | | | | | | | Only element 0 of the array is used anywhere at this time, so there should be no changes. v4: Split out from a single megapatch. Suggested by Ken. Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: Add ARB_vertex_attrib_bindingFredrik Höglund2013-11-071-0/+3
| | | | | | | update_array() and update_array_format() are changed to update the new attrib and binding states, and the client arrays become derived state. Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: Restore gl_array_object::NewArrayFredrik Höglund2013-11-071-0/+1
| | | | | | | | This will be used by the ARB_vertex_attrib_binding implementation. This reverts commit db38e9a0e179441f59274f6f2a751912c29872e2. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <brianp@vmware.com>
* mesa: skip _MaxElement computation unless driver needs strict bounds checkingMarek Olšák2013-05-111-1/+3
| | | | | | | | | | | | If Const.CheckArrayBounds is false, the only code using _MaxElement is glDrawRangeElements, so I changed it and explained in the code why _MaxElement is not very useful there. BTW, the big magic number was copied to the letter from _mesa_update_array_max_element. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove unused gl_array_object::NewArrayMarek Olšák2013-05-111-1/+0
| | | | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke2013-04-231-3/+4
| | | | | | | | | | | | | | The previous commit introduced extra words, breaking the formatting. This text transformation was done automatically via the following shell command: $ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript where 'vimscript' is a file containing: /THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * ' :wq Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | This brings the license text in line with the MIT License as published on the Open Source Initiative website: http://opensource.org/licenses/mit-license.php Generated automatically be the following shell command: $ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {} This introduces some wrapping issues, to be fixed in the next commit. Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | | Generated automatically be the following shell command: $ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/BRIAN PAUL/THE AUTHORS/' {} The intention here is to protect all authors, not just Brian Paul. I believe that was already the sensible interpretation, but spelling it out is probably better. More practically, it also prevents people from accidentally copy & pasting the license into a new file which says Brian is not liable when he isn't even one of the authors. Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: remove DD_TRI_LIGHT_TWOSIDE flagBrian Paul2013-04-171-27/+0
| | | | | | v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove DD_TRI_UNFILLED flagBrian Paul2013-04-171-9/+0
| | | | | | | Use alternate code in intel, r200, radeon drivers. v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove DD_TRI_SMOOTH flagBrian Paul2013-04-171-2/+0
| | | | Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove DD_TRI_STIPPLE flagBrian Paul2013-04-171-2/+0
| | | | | | | Make it a local macro for the i915 driver. v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove DD_TRI_OFFSET flagBrian Paul2013-04-171-23/+0
| | | | | | | Make it a local macro for the i915 driver. v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove DD_POINT_ATTEN flagBrian Paul2013-04-171-8/+0
| | | | | | | For the i915 driver, make it a local macro. v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove DD_POINT_SMOOTH flagBrian Paul2013-04-171-2/+0
| | | | Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove DD_LINE_STIPPLE flagBrian Paul2013-04-171-8/+0
| | | | | | | For the i915 driver, make it a local macro. v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove DD_SEPARATE_SPECULAR flagBrian Paul2013-04-171-15/+0
| | | | Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: remove unused DD_LINE_SMOOTH flagBrian Paul2013-04-171-2/+0
| | | | Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: move updating clamp control derived state out of mesa_update_state_lockedMarek Olšák2013-04-061-36/+0
| | | | | | | | | It has 2 dependencies: glClampColor and the framebuffer, we might just as well do the update where those two are changed. v2: cosmetic changes from Brian's email Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: don't set _ClampFragmentColor to TRUE if it has no effectMarek Olšák2013-04-061-1/+11
| | | | | | | | This should reduce shader recompilations with drivers that emulate fragment color clamping, because we want the clamping to be enabled only if there is a signed normalized or floating-point colorbuffer. Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor clamping controls, get rid of _ClampReadColorMarek Olšák2013-04-061-26/+3
| | | | | | v2: cosmetic changes from Brian's email Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Flag _NEW_VARYING_VP_INPUTS when TexEnv programs are active.Kenneth Graunke2012-10-051-1/+2
| | | | | | | | | | | | | | | | | The idea here is to not flag _NEW_VARYING_VP_INPUTS when shaders (either GLSL or ARB vp/fp) are in use. If either TNL or TexEnv programs are active, at least one stage is using fixed function. On Pineview, fixes 20 Piglit, 60 oglconforms, and 7 ES 1.1 conformance tests, as well as missing textures in Xonotic. These were all regressions since commit fb4a34e60eb4c1bdc7b0fdcd98d1bf3038c354e8. NOTE: This is a candidate for the 9.0 branch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49127 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54807 Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: use gl_program cast wrappersBrian Paul2012-07-181-10/+5
| | | | | | | In a few cases, remove unneeded casts. And fix a few other const-correctness issues. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: move gl_array_attrib::NewState to gl_array_object::NewArraysBrian Paul2012-04-201-1/+1
| | | | | | | | The field wasn't actually used before and it's not used now either. But this is a more logical place for it and will hopefully allow doing smarter draw/array validation (per array object) in the future. Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
* Revert "mesa: only update _MaxElement when we actually need it"Marek Olšák2012-04-191-3/+1
| | | | | | | This reverts commit 0de5a21470b3bff9b7c8714e5d960d5ed9d01b9c. I was wrong, we use it in the vbo module too. This fixes a performance regression in Nexuiz.
* mesa: set _NEW_VARYING_VP_INPUTS flag only if fixed-func VP is enabled & validMarek Olšák2012-04-191-1/+10
| | | | | Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
* mesa: add _NEW_VARYING_VP_INPUTS for gl_context::varying_vp_inputsMarek Olšák2012-04-191-5/+6
| | | | | | | | | This is a frequently-updated state and _NEW_ARRAY already causes revalidation of the vbo module. It's kinda counter-productive to recompute arrays in the vbo module if _NEW_ARRAY is set and then set _NEW_ARRAY again. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>