aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Add validation helpers for new indirect drawsChris Forbes2013-11-251-0/+192
| | | | | | | | | | | | | | | | | Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series. V3: - Disallow primcount==0 for DrawMulti*Indirect. The spec is unclear on this, but it's silly. We might go back on this later if it turns out to be a problem. - Make it clear that the caller has dealt with stride==0 V4: - Allow primcount==0 again. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Add ARB_vertex_attrib_bindingFredrik Höglund2013-11-071-3/+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: Rename gl_array_object::VertexAttrib to _VertexAttribFredrik Höglund2013-11-071-3/+3
| | | | | | | | This will become derived state as part of the ARB_vertex_attrib_binding support. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: fix transform feedback when a geometry shader is active.Bryan Cain2013-10-151-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a geometry shader is active, the transform feedback primitive type ("mode") needs to be validated against the geometry shader output primitive type, not the primitive type passed to the glDraw*() function. Fixes the following piglit tests: - glsl-1.50-geometry-primitive-types GL_LINES - glsl-1.50-geometry-primitive-types GL_LINES_ADJACENCY - glsl-1.50-geometry-primitive-types GL_LINE_STRIP - glsl-1.50-geometry-primitive-types GL_LINE_STRIP_ADJACENCY - glsl-1.50-geometry-primitive-types GL_TRIANGLES - glsl-1.50-geometry-primitive-types GL_TRIANGLES_ADJACENCY - glsl-1.50-geometry-primitive-types GL_TRIANGLE_FAN Exposes previously hidden failures in the following piglit tests: - glsl-1.50-geometry-primitive-id-restart GL_LINES other - glsl-1.50-geometry-primitive-id-restart GL_LINES_ADJACENCY other - glsl-1.50-geometry-primitive-id-restart GL_LINE_LOOP ffs - glsl-1.50-geometry-primitive-id-restart GL_LINE_LOOP other - glsl-1.50-geometry-primitive-id-restart GL_LINE_STRIP other - glsl-1.50-geometry-primitive-id-restart GL_LINE_STRIP_ADJACENCY other - glsl-1.50-geometry-primitive-id-restart GL_TRIANGLES other - glsl-1.50-geometry-primitive-id-restart GL_TRIANGLES_ADJACENCY other - glsl-1.50-geometry-primitive-id-restart GL_TRIANGLE_FAN ffs - glsl-1.50-geometry-primitive-id-restart GL_TRIANGLE_FAN other - glsl-1.50-geometry-primitive-id-restart GL_TRIANGLE_STRIP other - glsl-1.50-geometry-primitive-id-restart GL_TRIANGLE_STRIP_ADJACENCY other (These failures were previously hidden due to a flaw in the test: it doesn't check for GL errors. I'll fix the test shortly). Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/main: Check for 0 size draws after validation.Fabian Bieler2013-08-271-21/+30
| | | | | | | | | | | | | | | | | | | When validating draw parameters move check for 0 draw count last (drawing with count 0 is not an error), so that other parameters (e.g.: the primitive type) are validated and the correct errors (if applicable) are generated. >From the OpenGL 3.3 spec page 33 (page 48 of the PDF): "[Regarding DrawArraysOneInstance, in terms of which other draw operations are defined:] If count is negative, an INVALID_VALUE error is generated." This patch also changes the bahavior of MultiDrawElements to perform the draw operation if some primitive's index counts are zero. Signed-off-by: Fabian Bieler <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* mesa: Validate the drawing primitive against the geometry shader input ↵Fabian Bieler2013-08-011-0/+68
| | | | | | | | primitive type. Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* main: Allow for the possibility of GL 3.2 without ARB_geometry_shader4.Paul Berry2013-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | Previously, we assumed that the only way Mesa would expose geometry shader support was via the ARB_geometry_shader4 extension. But this extension has some extra complications over GL 3.2 (interactions with compatibility-only features, and link-time initialization of the constant gl_VerticesIn). So we want to allow for the possibility of supporting GL 3.2 (with GLSL 1.50 style geometry shaders) even if ctx->Extensions.ARB_geometry_shader4 is false. This patch adds a new function, _mesa_has_geometry_shaders(), which returns true if either ARB_geometry_shader4 is supported or the GL version is at least 3.2 desktop. Since compute_version() only enables GL 3.2 functionality when GLSL 1.50 support is present, a sufficient way for a back-end to advertise geometry shader support is to set ctx->Const.GLSLVersion >= 150. v2: Remove unnecessary ctx->Const.GeometryShaders150 constant. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* mesa: refactor _mesa_valid_prim_mode()Brian Paul2013-05-021-13/+20
| | | | | | | ...in terms of new _mesa_is_valid_prim_mode(). We need a mode validater function that doesn't depend on current state for the display list code. Reviewed-by: Jose Fonseca <[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 #include "mfeatures.h" from numerous source filesBrian Paul2013-04-171-1/+0
| | | | | | None of the remaining FEATURE_x symbols in mfeatures.h are used anymore. Reviewed-by: Jordan Justen <[email protected]>
* mesa: Drop manual checks for outside begin/end.Eric Anholt2013-01-211-7/+0
| | | | | | | | | | | We now have a separate dispatch table for begin/end that prevent these functions from being entered during that time. The ASSERT_OUTSIDE_BEGIN_END_WITH_RETVALs are left because I don't want to change any return values or introduce new error-only stubs at this point. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Make a function is_transform_feedback_active_and_unpaused.Paul Berry2012-12-181-13/+7
| | | | | | | | | | The rather unweildy logic for determining this condition was repeated in a large number of places. This patch consolidates it to a single inline function. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa/gles3: Generate error on draw call if transform feedback would overflow.Paul Berry2012-12-181-0/+51
| | | | | | | | | | | | | | | | | In desktop GL, if a draw call would cause transform feedback buffers to overflow, the draw call should succeed, and the extra primitives should simply not be recorded in the transform feedback buffers. In GLES3, however, if a draw call would cause transform feedback buffers to overflow, the draw call is supposed to produce an INVALID_OPERATION error and no drawing should occur. This patch implements the GLES3-required behaviour. Fixes GLES3 conformance test "transform_feedback_overflow.test". Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/gles3: Generate error on DrawElements* calls if transform feedback active.Paul Berry2012-12-181-0/+45
| | | | | | | | In GLES3, only glDrawArrays() and glDrawArraysInstanced() calls are allowed when transform feedback is active. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa: Rename API_OPENGL to API_OPENGL_COMPAT.Paul Berry2012-11-291-2/+2
| | | | | | | | | | This should help avoid confusion now that we're using the gl_api enum to distinguishing between core and compatibility API's. The corresponding enum value for core API's is API_OPENGL_CORE. Acked-by: Eric Anholt <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* mesa: remove ASSERT_NO_FEATURE macroBrian Paul2012-10-161-1/+1
| | | | | | Was only used in one place. Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove FEATURE_EXT_transform_feedback define.Oliver McFadden2012-09-151-4/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_es2_glsl and related defines.Oliver McFadden2012-09-151-6/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa/es: Validate primitive modes in Mesa code rather than the ES wrapperIan Romanick2012-08-291-2/+5
| | | | | | v2: Add proper core-profile filtering. Signed-off-by: Ian Romanick <[email protected]>
* mesa: Refactor _mesa_valid_prim_mode to use a switch-statementIan Romanick2012-08-291-5/+27
| | | | | | This makes the next change a bit easier. Signed-off-by: Ian Romanick <[email protected]>
* mesa: Refactor element type checking into its own functionIan Romanick2012-08-241-23/+25
| | | | | | | | | | | | This consolidates the tests and makes the emitted error message consistent. v2: Rename _mesa_valid_element_type to valid_elements_type. Log the enum string instead of the hex value in error messages. Based on review comments from Brian Paul and Ken Graunke. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add support for using API_OPENGL_COREJordan Justen2012-07-301-0/+1
| | | | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: implement new DrawTransformFeedback functionsMarek Olšák2012-07-121-5/+21
| | | | Acked-by: Ian Romanick <[email protected]>
* mesa: use FLUSH_CURRENT and not FLUSH_VERTICES in _mesa_validate_*Marek Olšák2012-07-021-7/+14
| | | | | | | | | | | | | | | | ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL calls FLUSH_VERTICES, which is not what we want. This fixes a breakage in classic drivers, introduced in: 62b971673950148eb949ba23d7fdc47debea16f0 vbo: first ASSERT_OUTSIDE_BEGIN_END then FLUSH, not the other way around It should fix: https://bugs.freedesktop.org/show_bug.cgi?id=51629 https://bugs.freedesktop.org/show_bug.cgi?id=51642 Reviewed-by: Brian Paul <[email protected]>
* vbo: optimize validation for glMultiDrawElementsMarek Olšák2012-06-281-0/+70
| | | | | | | | | Some parameters need to be checked only once. check_valid_to_render needs to be called only once. The validate function is based on the one for DrawElements. Reviewed-by: Brian Paul <[email protected]>
* vbo: first ASSERT_OUTSIDE_BEGIN_END then FLUSH, not the other way aroundMarek Olšák2012-06-281-6/+6
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: Validate the drawing primitive against the transform feedback mode.Eric Anholt2012-03-191-2/+43
| | | | | | Fixes piglit GL_EXT_transform_feedback/negative-prims. Reviewed-by: Brian Paul <[email protected]>
* mesa: Fold error generation into _mesa_valid_prim_mode().Eric Anholt2012-03-191-15/+9
| | | | | | | | | | | | | We want to start emitting an INVALID_OPERATION from here for transform feedback. Note that this forced dlist.c to almost not use this function, since it wants different behavior during dlist compile. Just pull the non-TF, non-GS test out for compile, because: 1) TF doesn't matter in that case because there's no drawing. 2) I don't think we're going to see GSes and display lists in the same context, if we don't do GL_ARB_compatibility. Reviewed-by: Brian Paul <[email protected]>
* mesa: Add missing error check for first < 0 in glDrawArraysInstanced().Eric Anholt2012-02-291-0/+6
| | | | | | Fixes piglit GL_ARB_draw_instanced/negative-arrays-first-negative. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Fix display list handling for GL_ARB_draw_instanced.Eric Anholt2012-02-291-6/+0
| | | | | | | | | When you called them in a display list compile before, you would just end up calling through NULL. Fixes piglit GL_ARB_draw_instanced/dlist. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: check_index_bounds off-by-one fixRoland Scheidegger2012-02-061-1/+1
| | | | | | | | in check_index_bounds the comparison needs to be "greater equal" since contrary to the name _MaxElement is the count of the array (this matches similar code in vbo_exec_DrawRangeElementsBaseVertex). Reviewed-by: Kenneth Graunke <[email protected]>
* vbo: introduce vbo_get_minmax_indices functionYuanhan Liu2012-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Introduce vbo_get_minmax_indices() function to handle the min/max index computation for nr_prims(>= 1). The old code just compute the first prim's min/max index; this would results an error rendering if user called functions like glMultiDrawElements(). This patch servers as fixing this issue. As when nr_prims = 1, we can pass 1 to paramter nr_prims, thus I made vbo_get_minmax_index() static. v2: per Roland's suggestion, put the indices address compuation into vbo_get_minmax_index() instead. Also do comination if possible to reduce map/unmap count v3: per Brian's suggestion, use a pointer for start_prim to avoid structure copy per loop. Signed-off-by: Yuanhan Liu <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: implement DrawTransformFeedback from ARB_transform_feedback2Marek Olšák2011-12-151-0/+34
| | | | | | | | | | | | | | It's like DrawArrays, but the count is taken from a transform feedback object. This removes DrawTransformFeedback from dd_function_table and adds the same function to GLvertexformat (with the function parameters matching GL). The vbo_draw_func callback has a new parameter "struct gl_transform_feedback_object *tfb_vertcount". The rest of the code just validates states and forwards the transform feedback object into vbo_draw_func.
* mesa: Use VERT_ATTRIB_* indexed array in gl_array_object.Mathias Fröhlich2011-11-291-3/+3
| | | | | | | | | | | | 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]>
* mesa: move ElementArrayBufferObj to gl_array_objectYuanhan Liu2011-11-291-7/+7
| | | | | | | | | | | | | | | According opengl spec 4.2.pdf table 6.12 (Vertex Array Object State) at page 515, the element buffer object is listed in vertex array object. So, move the ElementArrayBufferObj inside gl_array_object to make element buffer object per-vao. This would fix most of(3 left) intel oglc vao test fail NOTE: this is a candidate for the 7.11 branch. Signed-off-by: Yuanhan Liu <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: check glBegin()/glDrawArrays()/etc mode with _mesa_valid_prim_mode()Brian Paul2011-09-211-5/+26
| | | | | | | | | We now raise an GL_INVALID_ENUM in glBegin() if mode is illegal, as was done in Yuanhan Liu's original patch. Take geometry shaders support into account too. Reviewed-by: Yuanhan Liu <[email protected]>
* mesa: Eliminate dd_function_table::MapBufferIan Romanick2011-08-231-1/+2
| | | | | | | | | | Replace all calls to dd_function_table::MapBuffer with appropriate calls to dd_function_table::MapBufferRange, then remove all the cruft. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Remove target parameter from dd_function_table::MapBufferIan Romanick2011-08-231-2/+1
| | | | | | | | | | No driver used that parameter, and most drivers ended up with a bunch of unused-parameter warnings because it was there. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Remove target parameter from dd_function_table::UnmapBufferIan Romanick2011-08-231-1/+1
| | | | | | | | | | No driver used that parameter, and most drivers ended up with a bunch of unused-parameter warnings because it was there. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: add implementation of glDrawElementsInstancedBaseVertexPierre-Eric Pelloux-Prayer2011-06-021-2/+3
| | | | Signed-off-by: Brian Paul <[email protected]>
* mesa: fix vertex array enable checking in check_valid_to_render()Brian Paul2011-05-191-6/+28
| | | | | | | | | | In particular, this fixes the case where a vertex shader only uses generic vertex attributes (non-0th). Before, we were no-op'ing the glDrawArrays/Elements(). This fixes the new piglit pos-array test. NOTE: This is a candidate for the 7.10 branch.
* mesa: s/primcount/numInstances/Brian Paul2011-01-171-8/+8
| | | | | primcount is also a parameter to glMultiDrawElements(). Use numInstances to avoid confusion between these things.
* mesa: Include mfeatures.h in api_validate.c for FEATURE_* symbols.Vinson Lee2010-11-061-0/+1
|
* Drop GLcontext typedef and use struct gl_context insteadKristian Høgsberg2010-10-131-8/+8
|
* mesa: GL_TRIANGLE_STRIP_ADJACENCY_ARB is the last valid primitiveZack Rusin2010-07-101-5/+5
|
* mesa: Handle FEATURE_es2_glsl differences at runtime tooKristian Høgsberg2010-05-241-12/+22
| | | | | | | Now that we can support different APIs at runtime, we need to check the context for the API we're currently providing as well. https://bugs.freedesktop.org/show_bug.cgi?id=28194
* mesa: new validation functions for GL_ARB_draw_instancedBrian Paul2010-04-041-1/+106
|