summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
Commit message (Collapse)AuthorAgeFilesLines
* vbo: convert display list GL_LINE_LOOP prims to GL_LINE_STRIPBrian Paul2015-10-201-0/+53
| | | | | | | | | | | | | When a long GL_LINE_LOOP prim was split across primitives we drew stray lines. See previous commit for details. This patch converts GL_LINE_LOOP prims into GL_LINE_STRIP prims so that drivers don't have to worry about the _mesa_prim::begin/end flags. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81174 Reviewed-by: Jose Fonseca <[email protected]> Acked-by: Sinclair Yeh <[email protected]>
* vbo: fix GL_LINE_LOOP stray line bugBrian Paul2015-10-203-3/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When long GL_LINE_LOOP primitives don't fit in one vertex buffer they have to be split across buffers. The code to do this was basically correct but drivers had to pay special attention to the _mesa_prim::begin,end flags in order to draw the sections of the line loop properly. Apparently, the only drivers to do this were those using the old 'tnl' module for software vertex processing. Now we convert the split pieces of GL_LINE_LOOP prims into GL_LINE_STRIP primitives so that drivers don't have to worry about the special begin/end flags. The only time a driver will get a GL_LINE_LOOP prim is when the whole thing fits in one vertex buffer. Mostly fixes bug 81174, but not completely. There's another bug somewhere in the src/gallium/auxiliary/draw/ code. If the piglit lineloop test is run with -count 4096, rendering is correct, but with -count 4097 there are stray lines. 4096 is a magic number in the draw code (search for "4096"). Also note that this does not fix long line loops in display lists. The next patch fixes that. v2: fix incorrect -1 in vbo_compute_max_verts(), per Charmaine. Remove incorrect assertion which was added in vbo_copy_vertices(). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81174 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49779 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28130 Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
* vbo: add new vbo_compute_max_verts() helper functionBrian Paul2015-10-203-4/+16
| | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
* vbo: simplify some code in vbo_exec_End()Brian Paul2015-10-201-4/+3
| | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
* vbo: simplify some code in vbo_copy_vertices()Brian Paul2015-10-201-6/+5
| | | | | | | | | | | As before, use a new 'last_prim' pointer to simplify things. Plus, add some const qualifiers. v2: use 'sz' in another place, per Sinclair. And update subject line. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
* vbo: simplify some code in vbo_exec_wrap_buffers()Brian Paul2015-10-201-6/+4
| | | | | | | | | | Use a new 'last_prim' pointer to simplify things. v2: remove unneeded assert(exec->vtx.prim_count > 0) Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
* vbo: replace the comment on vbo_copy_vertices()Brian Paul2015-10-201-3/+7
| | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
* vbo: make vbo_exec_vtx_wrap() staticBrian Paul2015-10-202-3/+2
| | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
* vbo: remove unneeded ctx parameter for merge_prims()Brian Paul2015-10-201-3/+2
| | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
* vbo: reduce number of vertex buffer mappings for vertex attributesBrian Paul2015-10-201-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever we got a glColor, glNormal, glTexCoord, etc. call outside a glBegin/End pair, we'd immediately map a vertex buffer to begin accumulating vertex data. In some cases, such as with display lists, this led to excessive vertex buffer mapping. For example, if we have a display list such as: glNewList(42, GL_COMPILE); glBegin(prim); glVertex2f(); ... glVertex2f(); glEnd(); glEndList(); Then did: glColor3f(); glCallList(42); We'd map a vertex buffer as soon as we saw glColor3f but we'd never actually write anything to it. Note that the vertex position data was put into a vertex buffer during display list compilation. With this change, we delay mapping the vertex buffer until we actually have a vertex to write to it (triggered by a glVertex() call). In the above case, we no longer map a vertex buffer when setting the color and calling the list. For drivers such as VMware's, reducing buffer mappings gives improved performance. Reviewed-by: Marek Olšák <[email protected]>
* vbo: make void vbo_exec_BeginVertices() staticBrian Paul2015-10-132-21/+20
| | | | | | Not called from any other file. Rename and move before use. Reviewed-by: Marek Olšák <[email protected]>
* vbo: document vbo_exec_context fieldsBrian Paul2015-10-131-7/+8
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: minor clean-ups for vbo_exec_fixup_vertex()Brian Paul2015-10-131-2/+5
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: add assertion in ATTR_UNION macroBrian Paul2015-10-131-0/+3
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: add comments, braces in ATTR_UNION() in vbo_exec_api.cBrian Paul2015-10-131-2/+12
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: fix whitespace in vbo_exec_draw.cBrian Paul2015-10-131-13/+12
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: move 'tmp' var initializationBrian Paul2015-10-131-1/+2
| | | | | | Improve readability a bit. Reviewed-by: Marek Olšák <[email protected]>
* vbo: improve fprintf() formattingBrian Paul2015-10-131-1/+1
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: simplify vertex array initializations in vbo_context.cBrian Paul2015-10-131-52/+43
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: get rid of needless NR_MAT_ATTRIBS constantBrian Paul2015-10-131-6/+3
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: fix incorrect switch statement in init_mat_currval()Brian Paul2015-10-131-1/+1
| | | | | | | | | | | | The variable 'i' is a value in [0, MAT_ATTRIB_MAX-1] so subtracting VERT_ATTRIB_GENERIC0 gave a bogus value and we executed the default switch clause for all loop iterations. This doesn't fix any known issues but was clearly incorrect. Cc: [email protected] Reviewed-by: Marek Olšák <[email protected]>
* mesa: remove Driver.EndCallListMarek Olšák2015-10-033-10/+1
| | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove Driver.BeginCallListMarek Olšák2015-10-033-2/+1
| | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove Driver.EndListMarek Olšák2015-10-033-2/+1
| | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove Driver.NewListMarek Olšák2015-10-033-2/+1
| | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove Driver.NotifySaveBeginMarek Olšák2015-10-034-7/+2
| | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove Driver.SaveFlushVerticesMarek Olšák2015-10-034-3/+2
| | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove Driver.FlushVerticesMarek Olšák2015-10-034-3/+11
| | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove Driver.BeginVerticesMarek Olšák2015-10-032-3/+2
| | | | | | Nothing overrides it. Reviewed-by: Brian Paul <[email protected]>
* vbo: pass the stream from DrawTransformFeedbackStream to driversMarek Olšák2015-08-068-18/+19
| | | | Reviewed-by: Dave Airlie <[email protected]>
* vbo: Avoid double promotion.Matt Turner2015-07-292-5/+5
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: Rename _mesa_lookup_enum_by_nr() to _mesa_enum_to_string().Kenneth Graunke2015-07-201-29/+29
| | | | | | | Generated by sed; no manual changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* gles/es3.1: Enable dispatch of almost all new GLES 3.1 functionsIan Romanick2015-05-281-1/+4
| | | | | | | | | | | | | | | | | | | A couple functions are missing because there are no implementations of them yet. These are: glFramebufferParameteri (from GL_ARB_framebuffer_no_attachments) glGetFramebufferParameteriv (from GL_ARB_framebuffer_no_attachments) glMemoryBarrierByRegion v2: Rebase on updated dispatch_sanity.cpp test. v3: Add support for glDraw{Arrays,Elements}Indirect in vbo_exec_array.c. The updated dispatch_sanity.cpp test discovered this omission. v4: Rebase on glapi changes. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa/vbo: add support for 64-bit vertex attributes. (v1)Dave Airlie2015-05-085-35/+199
| | | | | | | | | | | | This adds support in the vbo and array code to handle double vertex attributes. v0.2: merge code to handle doubles in vbo layer. v1: don't use v0, merge api_array elt code. Acked-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* Fix a few typosZoë Blade2015-04-272-2/+2
| | | | Reviewed-by: Francisco Jerez <[email protected]>
* vbo: replace __FUNCTION__ with __func__Marius Predut2015-04-144-5/+5
| | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Signed-off-by: Marius Predut <[email protected]>
* i965: Fix software primitive restart with indirect draws.Kenneth Graunke2015-04-141-2/+4
| | | | | | | | | | | | | | | | | new_prim was declared as a stack variable within a nested scope; we tried to retain a pointer to that data beyond the scope, which is bogus. GCC with -O1 eliminated most of the code that set new_prim's fields. Move the declaration to fix the bug. v2: Also fix new_ib (thanks to Matt Turner and Ben Widawsky). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81025 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ben Widawsky <[email protected]> Cc: [email protected]
* vbo: improve the code style by adjust the preprocessing c code directivesMarius Predut2015-03-112-42/+34
| | | | | | | | | | Brian Paul review suggestion: there's more macro use here than necessary. Removed and redefine some #define preprocessing directives. Removed the directive input parameter 'T' . No functional changes. Signed-off-by: Marius Predut <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* Fix invalid extern "C" around header inclusion.Mark Janes2015-03-052-0/+16
| | | | | | | | | | | System headers may contain C++ declarations, which cannot be given C linkage. For this reason, include statements should never occur inside extern "C". This patch moves the C linkage statements to enclose only the declarations within a single header. Reviewed-by: Jose Fonseca <[email protected]>
* mesa: include stdio.h where neededBrian Paul2015-03-055-0/+6
| | | | | | | Instead of relying on glapi.h or some other header to provide it. Acked-by: Matt Turner <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* mesa/vbo: replace Elements() with ARRAY_SIZE()Brian Paul2015-03-025-18/+18
| | | | Acked-by: Ilia Mirkin <[email protected]>
* mesa: use fi_type in vertex attribute codeMarius Predut2015-02-259-80/+97
| | | | | | | | | | | | | | | | | | | | | | | For 32-bit builds, floating point operations use x86 FPU registers, not SSE registers. If we're actually storing an integer in a float variable, the value might get modified when written to memory. This patch changes the VBO code to use the fi_type (float/int union) to store/copy vertex attributes. Also, this can improve performance on x86 because moving floats with integer registers instead of FP registers is faster. Neil Roberts review: - include changes on all places that are storing attribute values. - check with and without -O3 compiler flag. Brian Paul review: - use fi_type type instead gl_constant_value type - fix a bunch of nit-picks. - fix compiler warnings Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668 Signed-off-by: Marius Predut <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa/vbo: Use unreachable to silence uninitialized var warning.Matt Turner2015-02-231-2/+1
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-235-17/+17
| | | | Acked-by: Eric Anholt <[email protected]>
* vbo: fix an unitialized-variable warningMarek Olšák2015-02-211-0/+1
| | | | | | | It looks like a bug to me. Cc: 10.5 10.4 10.3 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: fix display list 8-byte alignment issueBrian Paul2015-01-301-1/+4
| | | | | | | | | | | | | | | | | | | | | The _mesa_dlist_alloc() function is only guaranteed to return a pointer with 4-byte alignment. On 64-bit systems which don't support unaligned loads (e.g. SPARC or MIPS) this could lead to a bus error in the VBO code. The solution is to add a new _mesa_dlist_alloc_aligned() function which will return a pointer to an 8-byte aligned address on 64-bit systems. This is accomplished by inserting a 4-byte NOP instruction in the display list when needed. The only place this actually matters is the VBO code where we need to allocate a 'struct vbo_save_vertex_list' which needs to be 8-byte aligned (just as if it were malloc'd). The gears demo and others hit this bug. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88662 Cc: "10.4" <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* mesa: Fix some signed-unsigned comparison warningsJan Vesely2015-01-211-1/+2
| | | | | | | | v2: s/unsigned int/unsigned/ in prog_optimize.c Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* vbo: ignore primitive restart if FixedIndex is enabled in DrawArraysMarek Olšák2015-01-071-1/+2
| | | | | | | | | | | | | | From GL 4.4 Core profile: If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX is used. 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 *DrawEle- ments*. Cc: 10.2 10.3 10.4 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Silence unused parameter warnings in _mesa_validate_Draw functionsIan Romanick2014-12-021-12/+11
| | | | | | | | | | | | | | | | ../../src/mesa/main/api_validate.c: In function '_mesa_validate_DrawElements': ../../src/mesa/main/api_validate.c:376:37: warning: unused parameter 'basevertex' [-Wunused-parameter] ../../src/mesa/main/api_validate.c: In function '_mesa_validate_MultiDrawElements': ../../src/mesa/main/api_validate.c:394:65: warning: unused parameter 'basevertex' [-Wunused-parameter] ../../src/mesa/main/api_validate.c: In function '_mesa_validate_DrawRangeElements': ../../src/mesa/main/api_validate.c:452:35: warning: unused parameter 'basevertex' [-Wunused-parameter] ../../src/mesa/main/api_validate.c: In function '_mesa_validate_DrawArrays': ../../src/mesa/main/api_validate.c:473:25: warning: unused parameter 'start' [-Wunused-parameter] ../../src/mesa/main/api_validate.c: In function '_mesa_validate_DrawElementsInstanced': ../../src/mesa/main/api_validate.c:590:44: warning: unused parameter 'basevertex' [-Wunused-parameter] Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* vbo: also print buffer object pointer in vbo_print_vertex_list()Brian Paul2014-12-011-2/+6
| | | | Reviewed-by: Kenneth Graunke <[email protected]>