summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
Commit message (Collapse)AuthorAgeFilesLines
* mesa: modified _mesa_align_free() to accept NULL pointerSiavash Eliasi2013-12-041-5/+4
| | | | | | | | | | | So that it acts like ordinary free(). This lets us remove a bunch of if statements where the function is called. v2: - Avoiding compile error on MSVC and possible warnings on other compilers. - Added comment regards passing NULL pointer being safe. Reviewed-by: Brian Paul <brianp@vmware.com>
* vbo: map indirect buffer and extract params if doing sw primitive restartChris Forbes2013-11-251-0/+33
| | | | | | | | | V2: Check for mapping failure (thanks Brian) V3: - Change error on mapping failure to OUT_OF_MEMORY (Brian) - Unconst; remove casting away of const. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: pass indirect buffer to sw primitive restartChris Forbes2013-11-253-3/+5
| | | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
* vbo: Flesh out implementation of indirect drawsChris Forbes2013-11-251-0/+218
| | | | | | | | | Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: add indirect_offset, is_indirect to _mesa_primChris Forbes2013-11-254-1/+12
| | | | | | | | | V3: Add missing cases V4: Add indirect_offset here too Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* glapi: add plumbing for GL_ARB_draw_indirect and GL_ARB_multi_draw_indirectChris Forbes2013-11-251-0/+35
| | | | | | | | Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: add indirect drawing buffer parameter to draw functionsChristoph Bumiller2013-11-258-12/+13
| | | | | | | | | | | | Split from patch implementing ARB_draw_indirect. v2: Const-qualify the struct gl_buffer_object *indirect argument. v3: Fix up some more draw calls for new argument. v4: Fix up rebase conflicts in i965. v5: Undo const-qualification Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
* vbo: add 10_11_11 support to vbo_attrib_tmpChris Forbes2013-11-081-6/+26
| | | | | Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: Rename gl_array_object::VertexAttrib to _VertexAttribFredrik Höglund2013-11-071-6/+6
| | | | | | | | This will become derived state as part of the ARB_vertex_attrib_binding support. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: Add a new GetTransformFeedbackVertexCount() driver hook.Kenneth Graunke2013-10-311-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DrawTransformFeedback() needs to obtain the number of vertices written to a particular stream during the last Begin/EndTransformFeedback block. The new driver hook returns exactly that information. Gallium drivers already implement this by passing the transform feedback object to the drawing function, counting the number of vertices written on the GPU, and using draw indirect. This is efficient, but doesn't always work: If vertex data comes from user arrays, then the VBO module needs to know how many vertices to upload, so we need to synchronously count. Gallium drivers are currently broken in this case. It also doesn't work if primitive restart is done in software. For normal drawing, vbo_draw_arrays() performs software primitive restart, splitting the draw call in two. vbo_draw_transform_feedback() currently doesn't because it has no idea how many vertices need to be drawn. The new driver hook gives it that information, allowing us to reuse the existing vbo_draw_arrays() code to do everything right. On Intel hardware (at least Ivybridge), using the draw indirect approach is difficult since the hardware counts primitives, rather than vertices, which requires doing some simple math. So we always use this hook. Gallium drivers will likely want to use this hook in some cases, but want to use the existing draw indirect approach where possible. Hence, I've added a flag to allow drivers to opt-in to this call. v2: Make it possible to implement this hook but only use this path when necessary (suggested by Marek). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* vbo: fix MSVC double->float conversion warningsBrian Paul2013-10-311-2/+2
|
* vbo: access VBO memory more efficiently when building display listsBrian Paul2013-10-161-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use GL_MAP_INVALIDATE_RANGE, UNSYNCHRONIZED and FLUSH_EXPLICIT flags when mapping VBOs during display list compilation. This mirrors what we do for immediate-mode VBO building in vbo_exec_vtx_map(). This improves performance for applications which interleave display list compilation with execution. For example: glNewList(A); glBegin/End prims; glEndList(); glCallList(A); glNewList(B); glBegin/End prims; glEndList(); glCallList(B); Mesa's vbo module tries to combine the vertex data from lists A and B into the same VBO when there's room. Before, when we mapped the VBO for building list B, we did so with GL_MAP_WRITE_BIT only. Even though we were writing to an unused part of the buffer, the map would stall until the preceeding drawing call finished. Use the extra map flags and FlushMappedBufferRange() to avoid the stall. Reviewed-by: José Fonseca <jfonseca@vmware.com>
* vbo: assorted minor clean-upsBrian Paul2013-10-114-14/+14
| | | | | Use GL_TRUE/FALSE instead of 1/0. Remove extraneous parentheses. Remove trailing whitespace.
* vbo: Implement new gs prim types in vbo_count_tessellated_primitives.Paul Berry2013-09-091-0/+12
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: Rename gl_context::swtnl_im to vbo_context; use proper type.Kenneth Graunke2013-09-032-3/+3
| | | | | | | | | | | | | | | The main GL context's swtnl_im field is the VBO module's vbo_context structure. Using the name "swtnl" in the name is confusing since some drivers use hardware texturing and lighting, but still rely on the VBO module for drawing. v2: Forward declare the type and use that instead of void * (suggested by Eric Anholt). v3: Remove unnecessary cast (pointed out by by Topi Pohjolainen). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Paul Berry <stereotype441@gmail.com>
* mesa/main: Check for 0 size draws after validation.Fabian Bieler2013-08-271-0/+12
| | | | | | | | | | | | | | | | | | | 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 <fabianbieler@fastmail.fm> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
* mesa/vbo: Fix handling of attribute 0 in non-compatibilty contextsIan Romanick2013-08-151-23/+59
| | | | | | | | | | | | | | | | It is only in OpenGL compatibility-style contexts where generic attribute 0 and GL_VERTEX_ARRAY have a bizzare, aliasing relationship. Moreover, it is only in OpenGL compatibility-style contexts and OpenGL ES 1.x where one of these attributes provokes the vertex. In all other APIs each implicit call to glArrayElement provokes a vertex regardless of which attributes are enabled. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Robert Bragg <robert@sixbynine.org> Cc: "9.0 9.1 9.2" <mesa-stable@lists.freedesktop.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55503 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66292 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67548
* mesa: add const qualifier to glMultiDrawElementsEXT() indices paramBrian Paul2013-06-262-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>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-0513-13/+0
| | | | Signed-off-by: Brian Paul <brianp@vmware.com>
* vbo: Use the new primitive restart index helper function.Kenneth Graunke2013-05-292-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>
* vbo: Ignore PRIMITIVE_RESTART_FIXED_INDEX for glDrawArrays().Kenneth Graunke2013-05-291-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>
* mesa: skip _MaxElement computation unless driver needs strict bounds checkingMarek Olšák2013-05-111-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>
* vbo: add comments, const qualifiersBrian Paul2013-05-032-9/+24
| | | | Reviewed-by: José Fonseca <jfonseca@vmware.com>
* vbo: use new no-op ArrayElement in _mesa_noop_vtxfmt_init()Brian Paul2013-05-031-2/+7
| | | | | | As we do for the other commands which can appear between glBegin/End. Reviewed-by: José Fonseca <jfonseca@vmware.com>
* mesa; change ctx->Driver.SaveNeedFlush to boolean, and document it.Brian Paul2013-05-031-4/+4
| | | | Reviewed-by: José Fonseca <jfonseca@vmware.com>
* vbo: update comments for vbo_save_NotifyBegin()Brian Paul2013-05-031-2/+10
| | | | Reviewed-by: José Fonseca <jfonseca@vmware.com>
* vbo: implement primitive merging for glBegin/End sequencesBrian Paul2013-05-032-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>
* vbo: create a few utility functions for merging primitivesBrian Paul2013-05-032-0/+109
| | | | | | | To be used by following commit. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: José Fonseca <jfonseca@vmware.com>
* mesa: remove GLvertexformat::EvalMesh1(), EvalMesh2()Brian Paul2013-05-024-146/+107
| | | | | | See previous commit comments. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa: remove GLvertexformat::Rectf()Brian Paul2013-05-024-49/+22
| | | | | | As with the glDraw* functions, this doesn't have to be in GLvertexformat. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa: simplify dispatch for glDraw* functionsBrian Paul2013-05-025-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>
* vbo: add new vbo_initialize_exec_dispatch(), vbo_initialize_save_dispatch()Brian Paul2013-05-023-0/+68
| | | | | | First step in simplifying the vertex array / glDraw dispatch code. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa: remove _MESA_INIT_EVAL_VTXFMT() macroBrian Paul2013-05-023-3/+24
| | | | Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa: remove _MESA_INIT_ARRAYELT_VTXFMT() macroBrian Paul2013-05-023-3/+3
| | | | Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa: remove _MESA_INIT_DLIST_VTXFMT() macroBrian Paul2013-05-023-3/+7
| | | | | | Just expand the code. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* vbo: fix initial value of ctx->Driver.CurrentSavePrimitiveBrian Paul2013-05-021-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>
* vbo: fix error detection in vbo_save_playback_vertex_list()Brian Paul2013-05-021-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>
* vbo: remove redundant vfmt->Begin = _save_Begin assignmentBrian Paul2013-05-021-1/+0
| | | | | | The same assignment appears later in the function. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* vbo: fix parameter validation for saving dlist glDraw* functionsBrian Paul2013-05-021-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>
* mesa: remove unused PRIM_INSIDE_UNKNOWN_PRIM constantBrian Paul2013-05-021-2/+1
| | | | Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa: fix CurrentSavePrimitive <= GL_POLYGON testsBrian Paul2013-05-021-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>
* vbo: fix possible use-after-free segfault after a VAO is deletedMarek Olšák2013-05-013-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>
* mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke2013-04-2315-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>
* mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.Kenneth Graunke2013-04-2315-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>
* mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.Kenneth Graunke2013-04-2313-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>
* mesa: use new _mesa_inside_dlist_begin_end() functionBrian Paul2013-04-231-2/+1
| | | | | Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: use new _mesa_inside_begin_end() functionBrian Paul2013-04-233-8/+8
| | | | | Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: remove #include "mfeatures.h" from numerous source filesBrian Paul2013-04-1711-11/+0
| | | | | | None of the remaining FEATURE_x symbols in mfeatures.h are used anymore. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* vbo: fix crash found with shared display listsBrian Paul2013-03-071-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.
* vbo: Merge GL_QUADS drawing requests in display lists.Eric Anholt2013-02-111-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>