summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/state.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-1/+1
| | | | Acked-by: Eric Anholt <[email protected]>
* 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 <[email protected]> Signed-off-by: Mathias Froehlich <[email protected]>
* 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 <[email protected]> Signed-off-by: Mathias Froehlich <[email protected]>
* 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 <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Roland Scheidegger <[email protected]>
* 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 <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* 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 <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* 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 <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Fold long lines introduced by the previous patch.Paul Berry2014-01-211-3/+6
| | | | | Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* 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 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* 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 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> [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 <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* 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 <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unused gl_array_object::NewArrayMarek Olšák2013-05-111-1/+0
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* mesa: remove DD_TRI_LIGHT_TWOSIDE flagBrian Paul2013-04-171-27/+0
| | | | | | v2: use conditional operator instead of bit shifting Reviewed-by: Eric Anholt <[email protected]>
* 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 <[email protected]>
* mesa: remove DD_TRI_SMOOTH flagBrian Paul2013-04-171-2/+0
| | | | Reviewed-by: Eric Anholt <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* mesa: remove DD_POINT_SMOOTH flagBrian Paul2013-04-171-2/+0
| | | | Reviewed-by: Eric Anholt <[email protected]>
* 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 <[email protected]>
* mesa: remove DD_SEPARATE_SPECULAR flagBrian Paul2013-04-171-15/+0
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unused DD_LINE_SMOOTH flagBrian Paul2013-04-171-2/+0
| | | | Reviewed-by: Eric Anholt <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* 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 <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa,vbo: properly detect when vertex arrays need to be recalculatedMarek Olšák2012-04-191-2/+0
| | | | | | | | | | | | | | | | | | | This moves the RebindArrays flag into the vbo module, consolidates the code, and adds missing vbo_draw_method calls. Also with this change, the vertex arrays are not needlessly recalculated twice. The issue with the old code was: - If recalculate_input_bindings updates vp_varying_inputs, _NEW_ARRAY is set. - _mesa_update_state is called and the vp_varying_inputs change causes regeneration of the fixed-function shaders, which also sets _NEW_PROGRAM. - The occurence of either _NEW_ARRAY or _NEW_PROGRAM sets the recalculate_inputs flag to TRUE again. - The new code sets the flag to FALSE after the second _mesa_update_state, because there can't possibly be any change which would require recalculating the arrays. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa: only update _MaxElement when we actually need itMarek Olšák2012-04-191-1/+3
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa: remove unused DD_TRI_CULL_FRONT_BACKBrian Paul2012-03-121-8/+2
| | | | | Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unused DD_FLATSHADEBrian Paul2012-03-121-2/+0
| | | | | Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unused DD_TRI_TWOSTENCILBrian Paul2012-03-121-6/+0
| | | | | Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: define _MESA_NEW_SEPARATE_SPECULARBrian Paul2012-03-121-2/+2
| | | | | | | | This will replace the soon-to-be-removed _DD_NEW_SEPARATE_SPECULAR flag. Note: there's a similar composite _MESA_NEW_NEED_EYE_COORDS flag set already. Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Make sure _TexEnvProgram points at the current ff fragment programIan Romanick2012-01-241-0/+9
| | | | | | | | | | | | | At least one place, the _mesa_need_secondary_color function in state.h, uses this to make decisions. The next patch in this series will add another dependency. Ideally, this field would go away and be replace by a flag or something. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: include arrayobj.h to silence implicit function declaration warningBrian Paul2012-01-201-0/+1
| | | | Caused by commit 7a1e941ebee43cb97a2c77fd2269999b202308a2.
* mesa: Fix and speedup gl_array_object::_MaxElement computation.Mathias Fröhlich2012-01-201-125/+1
| | | | | | | | | | Use a bitmask approach to compute gl_array_object::_MaxElement. To make this work correctly depending on the shader type actually used, make use of the newly introduced typed bitmask getters. With this change I gain about 5% draw time on some osgviewer examples. Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove const qualifier from fProg to silence warningBrian Paul2012-01-111-1/+1
| | | | The args to _mesa_reference_shader_program() can't be const.
* mesa: Track fixed-function fragment shader as a shaderIan Romanick2012-01-111-0/+10
| | | | | | | | | | | | Previously the fixed-function fragment shader was tracked as a gl_program. This means that it shows up in the driver as a Mesa IR program instead of as a GLSL IR program. If a driver doesn't generate Mesa IR from the GLSL IR, that program is empty. If the program is empty there is either no rendering or a GPU hang. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* mesa: Use VERT_ATTRIB_* indexed array in gl_array_object.Mathias Fröhlich2011-11-291-40/+43
| | | | | | | | | | | | Replace the distinct struct gl_client_array members in gl_array_object by an array of gl_client_arrays indexed by VERT_ATTRIB_*. Renumber the vertex attributes slightly to keep the old semantics of the distinct array members. Make use of the upper 32 bits in VERT_BIT_*. Update all occurances of the distinct struct members with the array equivalents. Signed-off-by: Mathias Froehlich <[email protected]> Reviewed-by: Eric Anholt <[email protected]>