summaryrefslogtreecommitdiff
path: root/src/mesa/vbo
AgeCommit message (Collapse)AuthorFilesLines
2013-06-26mesa: add const qualifier to glMultiDrawElementsEXT() indices paramBrian Paul2-2/+2
The 20130624 version of glext.h changed this to match the glMultiDrawElements() function which already had the extra const qualifier. Fixes warnings/errors that seem to vary from one compiler to the next. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-06-05mesa: remove outdated version lines in commentsRico Schüller13-13/+0
Signed-off-by: Brian Paul <brianp@vmware.com>
2013-05-29vbo: Use the new primitive restart index helper function.Kenneth Graunke2-2/+3
This gets the correct restart index for unsigned byte/short types when using GL_PRIMITIVE_RESTART_FIXED_INDEX. NOTE: This is a candidate for the 9.1 branch. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-05-29vbo: Ignore PRIMITIVE_RESTART_FIXED_INDEX for glDrawArrays().Kenneth Graunke1-5/+5
The derived _PrimitiveRestart enable flag combines the PrimitiveRestart and PrimitiveRestartFixedIndex enable flags. However, DrawArrays is not supposed to do FixedIndex restart: From the OpenGL 4.3 Core specification, section 10.3.5 (page 302): "If PRIMITIVE_RESTART_FIXED_INDEX is enabled, primitive restart is not performed for array elements transferred by any drawing command not taking a type parameter, including all of the *Draw* commands other than *DrawElements*." The OpenGL ES 3.0 specification agrees by omission: "When DrawElements, DrawElementsInstanced, or DrawRangeElements transfers a set of generic attribute array elements to the GL..." Notably, DrawArrays is not included in the list of draw calls that take PRIMITIVE_RESTART_FIXED_INDEX into consideration. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-05-11mesa: skip _MaxElement computation unless driver needs strict bounds checkingMarek Olšák1-3/+23
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>
2013-05-03vbo: add comments, const qualifiersBrian Paul2-9/+24
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-05-03vbo: use new no-op ArrayElement in _mesa_noop_vtxfmt_init()Brian Paul1-2/+7
As we do for the other commands which can appear between glBegin/End. Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-05-03mesa; change ctx->Driver.SaveNeedFlush to boolean, and document it.Brian Paul1-4/+4
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-05-03vbo: update comments for vbo_save_NotifyBegin()Brian Paul1-2/+10
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-05-03vbo: implement primitive merging for glBegin/End sequencesBrian Paul2-14/+38
A surprising number of apps and benchmarks have poor code like this: glBegin(GL_LINE_STRIP); glVertex(v1); glVertex(v2); glEnd(); // Possibly some no-op state changes here glBegin(GL_LINE_STRIP); glVertex(v3); glVertex(v4); glEnd(); // repeat many, many times. The above sequence can be converted into: glBegin(GL_LINES); glVertex(v1); glVertex(v2); glVertex(v3); glVertex(v4); glEnd(); Similarly for GL_POINTS, GL_TRIANGLES, etc. Merging was already implemented for GL_QUADS in the display list code. Now other prim types are handled and it's also done for immediate mode. In one case: before after ----------------------------------------------- number of st_draw_vbo() calls: 141 45 number of _mesa_prims issued: 7520 632 Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-05-03vbo: create a few utility functions for merging primitivesBrian Paul2-0/+109
To be used by following commit. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-05-02mesa: remove GLvertexformat::EvalMesh1(), EvalMesh2()Brian Paul4-146/+107
See previous commit comments. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02mesa: remove GLvertexformat::Rectf()Brian Paul4-49/+22
As with the glDraw* functions, this doesn't have to be in GLvertexformat. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02mesa: simplify dispatch for glDraw* functionsBrian Paul5-272/+0
Remove all the glDraw* functions from the GLvertexformat structure. The point of that dispatch struct is to handle all the functions which dispatch differently depending on whether we're inside glBegin/End. glDraw* are never allowed inside glBegin/End so we can remove those entries. This simplifies the code paths and gets rid of quite a bit of code. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02vbo: add new vbo_initialize_exec_dispatch(), vbo_initialize_save_dispatch()Brian Paul3-0/+68
First step in simplifying the vertex array / glDraw dispatch code. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02mesa: remove _MESA_INIT_EVAL_VTXFMT() macroBrian Paul3-3/+24
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02mesa: remove _MESA_INIT_ARRAYELT_VTXFMT() macroBrian Paul3-3/+3
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02mesa: remove _MESA_INIT_DLIST_VTXFMT() macroBrian Paul3-3/+7
Just expand the code. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02vbo: fix initial value of ctx->Driver.CurrentSavePrimitiveBrian Paul1-1/+1
This is set during context creation/initialization. We know we're not inside glBegin/glEnd at this point so use PRIM_OUTSIDE_BEGIN_END. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02vbo: fix error detection in vbo_save_playback_vertex_list()Brian Paul1-11/+6
The old code didn't make sense. The clause in question did the same thing as the next else-if clause. If we're already executing a glBegin/End pair and we're starting a new primitive, that's an error. Fixes more failures in piglit gl-1.0-beginend-coverage test. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02vbo: remove redundant vfmt->Begin = _save_Begin assignmentBrian Paul1-1/+0
The same assignment appears later in the function. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02vbo: fix parameter validation for saving dlist glDraw* functionsBrian Paul1-4/+39
The _save_OBE_DrawArrays/Elements/RangeElements() functions are called when building a display list and we know we're outside glBegin/End. We shouldn't call the normal _mesa_validate_DrawArrays/Elements() functions here because those functions only work properly in immediate mode or during dlist execution. At dlist compile time, we can't call _mesa_update_state(), etc. and examine the current state since it won't apply when the list is executed later. Fixes several failures in piglit's gl-1.0-beginend-coverage test. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02mesa: remove unused PRIM_INSIDE_UNKNOWN_PRIM constantBrian Paul1-2/+1
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-02mesa: fix CurrentSavePrimitive <= GL_POLYGON testsBrian Paul1-1/+1
Use the new PRIM_MAX value instead so that new geometry shader primitive types are accounted for. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-01vbo: fix possible use-after-free segfault after a VAO is deletedMarek Olšák3-4/+25
This like the fifth attempt to fix the issue. Also with the new "validating" flag, we can set recalculate_inputs to FALSE earlier in vbo_bind_arrays, because _mesa_update_state won't change it. NOTE: This is a candidate for the stable branches. v2: fixed a typo Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke15-45/+60
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>
2013-04-23mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.Kenneth Graunke15-15/+15
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>
2013-04-23mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.Kenneth Graunke13-13/+13
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>
2013-04-23mesa: use new _mesa_inside_dlist_begin_end() functionBrian Paul1-2/+1
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-04-23mesa: use new _mesa_inside_begin_end() functionBrian Paul3-8/+8
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-04-17mesa: remove #include "mfeatures.h" from numerous source filesBrian Paul11-11/+0
None of the remaining FEATURE_x symbols in mfeatures.h are used anymore. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-03-07vbo: fix crash found with shared display listsBrian Paul1-1/+1
This fixes a crash when a display list is created in one context but executed from a second one. The vbo_save_context::vertex_store memeber will be NULL if we never created a display list with the context. Just check for that before dereferencing the pointer. Fixes http://bugzilla.redhat.com/show_bug.cgi?id=918661 Note: This is a candidate for the stable branches.
2013-02-11vbo: Merge GL_QUADS drawing requests in display lists.Eric Anholt1-0/+43
minecraft apparently has its piles of display lists each contain 6 instances of glBegin(GL_QUADS)/verts/glEnd(), which appear in the compiled list as 6 prims of 4 verts each in one draw call. We can reduce driver overhead even more by making that one prim of 24 verts. Improves minecraft performance by 1.6% +/- .25% (n=446) Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-02-11vbo: Print display list debug using printf() like dlist.c does.Eric Anholt1-8/+8
Otherwise, the stderr and stdout debug end up interleaved wrong when I pipe them to a file. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-25vbo: add a null pointer check to handle OOM instead of crashingBrian Paul1-0/+5
Note: This is a candidate for the 9.0 branch.
2013-01-21mesa: Drop manual checks for outside begin/end.Eric Anholt1-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 <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21mesa: Install a minimal dispatch table during glBegin()/glEnd().Eric Anholt1-0/+17
This is a step toward getting rid of ASSERT_OUTSIDE_BEGIN_END() in Mesa. v2: Finish create_beginend_table() comment, move loopback API init into it, and add a const flag. (suggestions by Brian) Reviewed-by: Brian Paul <brianp@vmware.com> (v1) Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
2013-01-21mesa: Remove the dead PrepareExecBegin() driver hook.Eric Anholt1-3/+0
This was used in i965 for a while, but no more. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-21mesa: Use an early return to unindent most of vbo_exec_Begin/End().Eric Anholt1-55/+54
Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-11mesa/es3: Add support for GL_PRIMITIVE_RESTART_FIXED_INDEXIan Romanick2-9/+9
This requires some derived state. The cut vertex used is either the value specified by glPrimitiveRestartIndex or it's hard-coded to ~0. The derived state gl_array_attrib::_RestartIndex captures this value. In addition, the derived state gl_array_attrib::_PrimitiveRestart is set whenever either gl_array_attrib::PrimitiveRestart or gl_array_attrib::PrimitiveRestartFixedIndex is set. v2: Use _mesa_is_gles3. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-12-18mesa: Change args to vbo_count_tessellated_primitives.Paul Berry2-16/+21
No functional change--this simply paves the way to allow futures patches to call vbo_count_tessellated_primitives() during error checking, before the _mesa_prim struct has been constructed. This will be needed for GLES3, which requires draw calls to fail if there is not enough space available in transform feedback buffers to accommodate the primitives to be drawn. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2012-12-16mesa: don't initialize VBO vtxfmt in _vbo_CreateContextJordan Justen3-9/+0
The driver should call _mesa_initialize_vbo_vtxfmt after computing the context version. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-11-29mesa: Rename API_OPENGL to API_OPENGL_COMPAT.Paul Berry2-5/+5
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 <eric@anholt.net> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2012-11-27vbo: move another line of code after declarationsBrian Paul1-1/+1
Signed-off-by: Brian Paul <brianp@vmware.com>
2012-11-27vbo: move code after declarations to fix MSVC errorsBrian Paul1-7/+7
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-11-27vbo: minor whitespace fixBrian Paul1-1/+1
2012-11-27mesa/vbo: Check for invalid types in various packed vertex functions.Kenneth Graunke1-0/+43
According to the ARB_vertex_type_2_10_10_10_rev specification: "The error INVALID_ENUM is generated by VertexP*, NormalP*, TexCoordP*, MultiTexCoordP*, ColorP*, or SecondaryColorP if <type> is not UNSIGNED_INT_2_10_10_10_REV or INT_2_10_10_10_REV." Fixes 7 subcases of oglconform's packed-vertex test. v2: Add "gl" prefix to error messages (pointed out by Brian). Also rebase atop the ctx plumbing. Reviewed-by: Brian Paul <brianp@vmware.com>
2012-11-27mesa/vbo: Support the ES 3.0 signed normalized scaling rules.Kenneth Graunke1-2/+38
Traditionally, OpenGL has had two separate equations for converting from signed normalized fixed-point data to floating point data. One was used primarily for vertex data, while the other was primarily for texturing and framebuffer data. However, ES 3.0 and GL 4.2 change this, declaring there's only one equation to be used in all cases. Unfortunately, it's the other one. v2: Correctly convert 0b10 to -1.0, as pointed out by Chris Forbes. Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
2012-11-27mesa/vbo: Plumb ctx through to the conv_i(10|2)_to_norm_float functions.Kenneth Graunke1-59/+59
The rules for converting these values actually depend on the current context API and version. The next patch will implement those changes. v2: Mark ctx as const, as suggested by Brian. Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
2012-11-21mesa/vbo: Fix scaling issue in 2-bit signed normalized packing.Kenneth Graunke1-1/+1
Since a signed 2-bit integer can only represent -1, 0, or 1, it is tempting to simply to convert it directly to a float. This maps it onto the correct range of [-1.0, 1.0]. However, it gives different values compared to the usual equation: (2.0 * 1.0 + 1.0) * (1.0 / 3.0) = +1.0 (same) (2.0 * 0.0 + 1.0) * (1.0 / 3.0) = +0.33333333... (different) (2.0 * -1.0 + 1.0) * (1.0 / 3.0) = -0.33333333... (different) According to the GL_ARB_vertex_type_2_10_10_10_rev extension, signed normalization is performed using equation 2.2 from the GL 3.2 specification, which is: f = (2c + 1)/(2^b - 1). (2.2) Comments below that equation state: "In general, this representation is used for signed normalized fixed-point parameters in GL commands, such as vertex attribute values." Which is what we're doing here. The 3.2 specification goes on to declare an alternate formula: f = max{c/(2^(b-1) - 1), -1.0} (2.3) which is closer to the existing code, and maps the end points to exactly -1.0 and 1.0. Comments below the equation state: "In general, this representation is used for signed normalized fixed-point texture or framebuffer values." Which is *not* what we're doing here. It then states: "Everywhere that signed normalized fixed-point values are converted, the equation used is specified." This is the real clincher: the extension explicitly specifies that we must use equation 2.2, not 2.3. So we need to do (2x + 1) / 3. This matches the behavior expected by oglconform's packed-vertex test, and is correct for desktop GL (pre-4.2). It's not correct for ES 3.0, but a future patch will correct that. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Tested-by: Marek Olšák <maraeo@gmail.com>