aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_draw.c
Commit message (Collapse)AuthorAgeFilesLines
* st/mesa: Go back to using ctx->Array.RestartIndex, not _RestartIndex.Kenneth Graunke2013-05-291-1/+1
| | | | | | | | | | | | | The derived _RestartIndex field is an attempt to support both GL_PRIMITIVE_RESTART and GL_PRIMITIVE_RESTART_FIXED_INDEX (part of ES 3.0). Gallium drivers don't appear to support ES 3.0 yet, so they don't need to use it. Plus, it's broken and going to go away soon. NOTE: This is a candidate for the 9.1 branch. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* st/mesa: generate GL_OUT_OF_MEMORY if we can't create the index bufferBrian Paul2013-05-091-1/+1
| | | | | | | | | | | Before, if we failed to allocate the index buffer we'd silently return from st_draw_vbo() without drawing anything. We should raise GL_OUT_OF_MEMORY to give some indication that something went wrong. Note: This is a candidate for the stable branches. Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: remove #include mfeatures.hBrian Paul2013-04-091-1/+0
| | | | | | None of these were needed. Reviewed-by: Jordan Justen <[email protected]>
* st/mesa: fix trimming of GL_QUAD_STRIPBrian Paul2013-02-221-1/+1
| | | | | | | | | | | | | | We sometimes convert GL_QUAD_STRIP prims into GL_TRIANGLE_STRIP, but that changes the results of the u_trim_pipe_prim() call. We need to pass the original primitive type to the trim function. Note that OpenGL's GL_x prim type values match Gallium's PIPE_PRIM_x values. Fixes a failure in the new piglit degenerate-prims test. Note: This is a candidate for the stable branches. Reviewed-by: José Fonseca <[email protected]>
* st/mesa: do proper error checking for u_upload_alloc() callsBrian Paul2013-01-251-4/+17
| | | | | | | | | We weren't properly checking the return value of these calls (and calls to u_upload_data()) to detect OOM errors. Note: This is a candidate for the 9.0 branch. Reviewed-by: Jose Fonseca <[email protected]>
* st/mesa: add some simple buffer/draw debug codeBrian Paul2013-01-141-0/+9
| | | | Reviewed-by: José Fonseca <[email protected]>
* mesa/es3: Add support for GL_PRIMITIVE_RESTART_FIXED_INDEXIan Romanick2013-01-111-2/+2
| | | | | | | | | | | | | 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 <[email protected]>
* mesa: remove FEATURE_feedback define.Oliver McFadden2012-09-151-4/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* st/mesa: use STATIC_ASSERT in a few placesBrian Paul2012-07-271-3/+3
|
* st/mesa: Add support for GL_ARB_base_instanceFredrik Höglund2012-06-191-0/+1
| | | | Reviewed-by: Brian Paul <[email protected]>
* st/mesa: atomize vertex array stateMarek Olšák2012-06-151-570/+3
| | | | This moves the state validation to where all the other states are validated.
* st/mesa: remove unused pipe variableBrian Paul2012-05-191-1/+0
|
* state_tracker: remove software handling of primitive restartJordan Justen2012-05-171-178/+2
| | | | | | | | The VBO module now can handle primitive restart in software if required. Therefore this support is no londer required. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* Merge branch 'gallium-userbuf'Marek Olšák2012-05-111-182/+58
|\ | | | | | | | | | | | | | | Conflicts: src/gallium/docs/source/screen.rst src/gallium/drivers/nv50/nv50_state.c src/gallium/include/pipe/p_defines.h src/mesa/state_tracker/st_draw.c
| * st/mesa: unmap upload buffer after uploading indices and constantsMarek Olšák2012-04-301-0/+1
| |
| * st/mesa: reorder code in draw_vboMarek Olšák2012-04-301-12/+12
| |
| * st/mesa: remove more unnecessary code in draw_vboMarek Olšák2012-04-301-16/+1
| | | | | | | | The variables set here are not used anywhere.
| * gallium: add void *user_buffer in pipe_index_bufferMarek Olšák2012-04-301-10/+7
| | | | | | | | | | | | | | Adapted drivers: i915, llvmpipe, r300, r600, radeonsi, softpipe. User index buffers have been disabled in nv30, nv50, nvc0 and svga to keep things working.
| * gallium: add void *user_buffer in pipe_vertex_bufferMarek Olšák2012-04-301-125/+17
| | | | | | | | | | | | | | | | | | | | | | | | This reduces CPU overhead in st_draw_vbo and removes a lot of unnecessary code in that function which was required only to comply with the gallium interface, but wasn't any useful really. Adapted drivers: i915, llvmpipe, r300, softpipe. No changes required in: r600, radeonsi. User vertex buffers have been disabled in nv30, nv50, nvc0 and svga to keep things working.
| * st/mesa: make user index buffers optionalMarek Olšák2012-04-301-0/+5
| | | | | | | | v2: use a separate upload buffer for indices
| * st/mesa: only set index buffer when drawing is indexedMarek Olšák2012-04-301-25/+21
| | | | | | | | and restructure the code a bit
* | mesa: add gl_context::NewDriverState and use it for vertex arraysMarek Olšák2012-05-081-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vbo module recomputes its states if _NEW_ARRAY is set, so it shouldn't use the same flag to notify the driver. Since we've run out of bits in NewState and NewState is for core Mesa anyway, we need to find another way. This patch is the first to start decoupling the state flags meant only for core Mesa and those only for drivers. The idea is to have two flag sets: - gl_context::NewState - used by core Mesa only - gl_context::NewDriverState - used by drivers only (the flags are defined by the driver and opaque to core Mesa) It makes perfect sense to use NewState|=_NEW_ARRAY to notify the vbo module that the user changed vertex arrays, and the vbo module in turn sets a driver-specific flag to notify the driver that it should update its vertex array bindings. The driver decides which bits of NewDriverState should be set and stores them in gl_context::DriverFlags. Then, Core Mesa can do this: ctx->NewDriverState |= ctx->DriverFlags.NewArray; This patch implements this behavior and adapts st/mesa. DriverFlags.NewArray is set to ST_NEW_VERTEX_ARRAYS. Core Mesa only sets NewDriverState. It's the driver's responsibility to read it whenever it wants and reset it to 0. Reviewed-by: Brian Paul <[email protected]>
* | mesa: move gl_client_array*[] from vbo_draw_func into gl_contextMarek Olšák2012-05-081-1/+1
|/ | | | | | | | | | | | | | | | | | In the future we'd like to treat vertex arrays as a state and not as a parameter to the draw function. This is the first step towards that goal. Part of the goal is to avoid array re-validation for every draw call. This commit adds: const struct gl_client_array **gl_context::Array::_DrawArrays. The pointer is changed in: * vbo_draw_method * vbo_rebase_prims - unused by gallium * vbo_split_prims - unused by gallium * st_RasterPos Reviewed-by: Brian Paul <[email protected]>
* st/mesa: use cso_set_index_buffer and cso_draw_vboMarek Olšák2012-04-241-7/+9
| | | | Reviewed-by: Brian Paul <[email protected]>
* st/mesa: fix max_offset computation for base vertexBrian Paul2012-04-061-2/+18
| | | | | | | | | | | | | | Add the maximum base vertex offset to max_index for computing the buffer size. Fixes a failed assertion in the u_upload_mgr.c code with the VMware svga driver. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=48141 v2: incorporate Marek's suggestions. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Marek Olšák <[email protected]>
* Revert "st/mesa: don't unreference user attribs up front."Brian Paul2012-03-011-6/+3
| | | | | | | This reverts commit 72931ca4b9fb1002f5b62b74f7f7f32e94e80fde. This commit caused a few piglit regressions (quad-invariance, draw-batch, etc) with the vmware svga driver.
* st/mesa: remove old assertionBrian Paul2012-02-291-3/+0
|
* st/mesa: don't unreference user attribs up front.Dave Airlie2012-02-281-3/+6
| | | | | | | | postpone unreferences until end of function, as the ones in use will get naturally dereferenced. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vbo: introduce vbo_get_minmax_indices functionYuanhan Liu2012-01-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | 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]>
* gallium: fix behavior of pipe_buffer_map_rangeMarek Olšák2012-01-051-5/+6
| | | | | | | To match what transfer_map returns. Really, subtracting the offset leads to bugs if someone expects it to work exactly like transfer_map. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: use SINT/UINT formats for VertexAttribIPointerChristoph Bumiller2012-01-031-4/+60
| | | | | | Reviewed-by: Dave Airlie <[email protected]> v2: added assertion that packed formats are not pure integer
* vbo: introduce vbo_sizeof_ib_type() functionYuanhan Liu2011-12-301-14/+1
| | | | | | | | | | introduce vbo_sizeof_ib_type() function to return the index data type size. I see some place use switch(ib->type) to get the index data type, which is sort of duplicate. Signed-off-by: Yuanhan Liu <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* st/mesa: implement EXT_transform_feedback and ARB_transform_feedback2Marek Olšák2011-12-151-2/+10
|
* mesa: implement DrawTransformFeedback from ARB_transform_feedback2Marek Olšák2011-12-151-1/+3
| | | | | | | | | | | | | | 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: check for null ptr in _mesa_is_bufferobj()Brian Paul2011-11-281-5/+5
| | | | | | | This simplifies a few callers. And it adds a bit of robustness. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Yuanhan Liu <[email protected]>
* st/mesa: rewrite the primitive restart fallback codeBrian Paul2011-11-181-101/+145
| | | | | | | | | | | | | | | | | Previously we were mapping/unmapping the index buffer each time we found the restart index in the buffer. This is bad when the restart index is frequently used. Now just map the index buffer once, scan it to produce a list of sub-primitives, unmap the buffer, then draw the sub-primitives. Also, clean up the logic of testing for indexed primitives and calling handle_fallback_primitive_restart(). Don't call it for non-indexed primitives. v2: per Jose, only map the relevant part of the index buffer with pipe_buffer_map_range() Reviewed-by: José Fonseca <[email protected]>
* st/mesa: check for missing VBO in setup_interleaved_attribs()Brian Paul2011-11-151-3/+3
| | | | | | This fixes a crash with the piglit vbo-too-small test. Reviewed-by: José Fonseca <[email protected]>
* Delete code made dead by previous uniform related patchesIan Romanick2011-11-071-1/+0
| | | | | Signed-off-by: Ian Romanick <[email protected]> Tested-by: Tom Stellard <[email protected]>
* mesa: Rewrite the way uniforms are tracked and handledIan Romanick2011-11-071-4/+6
| | | | | | | | | | | | | | | | | | | | | Switch all of the code in ir_to_mesa, st_glsl_to_tgsi, glUniform*, glGetUniform, glGetUniformLocation, and glGetActiveUniforms to use the gl_uniform_storage structures in the gl_shader_program. A couple of notes: * Like most rewrite-the-world patches, this should be reviewed by applying the patch and examining the modified functions. * This leaves a lot of dead code around in linker.cpp and uniform_query.cpp. This will be deleted in the next patches. v2: Update the comment block (previously a FINISHME) in _mesa_uniform about generating GL_INVALID_VALUE when an out-of-range sampler index is specified. Signed-off-by: Ian Romanick <[email protected]> Tested-by: Tom Stellard <[email protected]>
* st/mesa: add some null pointer checking to better handle out of memoryBrian Paul2011-11-071-10/+44
| | | | Reviewed-by: José Fonseca <[email protected]>
* st/mesa: fix a bug in and re-org setup_interleaved_attribs()Brian Paul2011-10-211-31/+76
| | | | | | | | | | | | | | | | | | | | | | | | | We were mis-computing the size of the user-space vertex buffer in some circumstances. This led to a failed assertion at u_inlines.h:222 when using the VMware svga driver. For example, if we had arrays such as: array[0]: element_offset = 12, stride = 24 array[1]: element_offset = 0, stride = 24 We'd mistakenly compute 'bytes' to be 12 bytes too small. I've reorganized the function too. By time it's called, we know that we've got interleaved arrays either all in one VBO or all in user memory and the stride is equal for all arrays. Move the code that lived inside the attr==0 test after the loop. In the loop we compute the true vertex size. That size factors into the pipe->redefine_user_buffer() call later. Using the vertex size instead of array[0]'s element_offset fixes the failed assertion. Reviewed-by: José Fonseca <[email protected]>
* st/mesa: Initialize variable.Vinson Lee2011-10-201-0/+2
| | | | | | | | ptr is uninitialized if ib is NULL. Fixes Coverity uninitialized pointer read defect. Reviewed-by: Jakob Bornecrantz <[email protected]>
* st/mesa: remove primitive restart assertionBrian Paul2011-10-191-6/+4
| | | | Reviewed-by: Jakob Bornecrantz <[email protected]>
* st/mesa: Don't have indices buffers map when calling drawJakob Bornecrantz2011-10-191-22/+31
|
* st/mesa: Implement primitive restart in softwareJakob Bornecrantz2011-10-191-1/+128
|
* st/mesa: don't compute index buffer bounds for per-instance dataMarek Olšák2011-09-291-3/+5
|
* mesa/st: add support for 2101010 vertex format conversion.Dave Airlie2011-09-061-1/+34
| | | | Signed-off-by: Dave Airlie <[email protected]>
* st/mesa: fix all_varyings_in_vbos() regressionBrian Paul2011-06-241-1/+17
| | | | | Fixes regression from d631c19db47181129811080bfa772b210d762d4d. See http://bugs.freedesktop.org/show_bug.cgi?id=38626
* st/mesa: replace st->ctx with ctxBrian Paul2011-06-141-2/+2
|
* st/mesa: fix comments, whitespaceBrian Paul2011-06-141-3/+4
|