aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_draw.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa/sso: rename Shader to the pointer _ShaderGregory Hainaut2014-03-251-1/+1
| | | | | | | | | | | | | | | | Basically a sed but shaderapi.c and get.c. get.c => GL_CURRENT_PROGAM always refer to the "old" UseProgram behavior shaderapi.c => the old api stil update the Shader object directly V2: formatting improvement V3 (idr): * Rebase fixes after a block of code was moved from ir_to_mesa.cpp to shaderapi.c. * Trivial reformatting. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* st/mesa: drop the lowering of quad strips to triangle stripsMarek Olšák2014-03-211-10/+0
| | | | | | | | | | | | | | | This fallback to triangle strips is silly and should be done in drivers if they need it. This should fix the case when quad strips are used with flatshading that is enabled by the "flat" GLSL varying modifier. It also fixes primitive restart for quad strips. This fixes piglit: NV_primitive_restart/primitive-restart-draw-mode-quad_strip Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: Remove ad-hoc arrays of gl_shader_program.Paul Berry2014-01-211-5/+1
| | | | | | | | Now that we have a ctx->Shader.CurrentProgram array, we can just use it directly. Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Replace ctx->Shader.Current{Vertex,Fragment,Geometry}Program with an ↵Paul Berry2014-01-211-3/+3
| | | | | | | | | | | | | | | | | | | | | array. These are replaced with ctx->Shader.CurrentProgram[MESA_SHADER_{VERTEX,FRAGMENT,GEOMETRY}]. In patches to follow, this will allow us to replace a lot of ad-hoc logic with a variable index into the array. With the exception of the changes to mtypes.h, this patch was generated entirely by the command: find src -type f '(' -iname '*.c' -o -iname '*.cpp' ')' \ -print0 | xargs -0 sed -i \ -e 's/\.CurrentVertexProgram/.CurrentProgram[MESA_SHADER_VERTEX]/g' \ -e 's/\.CurrentGeometryProgram/.CurrentProgram[MESA_SHADER_GEOMETRY]/g' \ -e 's/\.CurrentFragmentProgram/.CurrentProgram[MESA_SHADER_FRAGMENT]/g' Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* s/Tungsten Graphics/VMware/José Fonseca2014-01-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the old copyright name is creating unnecessary confusion, hence this change. This was the sed script I used: $ cat tg2vmw.sed # Run as: # # git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed # # Rename copyrights s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./ s/TUNGSTEN GRAPHICS/VMWARE/g # Rename emails s/[email protected]/[email protected]/ s/[email protected]/[email protected]/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\[email protected]/[email protected]/g s/keithw\[email protected]/[email protected]/g s/[email protected]/[email protected]/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/[email protected]/[email protected]/ # Remove dead links s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g # C string src/gallium/state_trackers/vega/api_misc.c s/"Tungsten Graphics, Inc"/"VMware, Inc"/ Reviewed-by: Brian Paul <[email protected]>
* mesa: add indirect drawing buffer parameter to draw functionsChristoph Bumiller2013-11-251-1/+2
| | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* st/mesa: move out of memory check in st_draw_vbo()Brian Paul2013-10-291-3/+4
| | | | | | | | | | | Before we were only checking the st->vertex_array_out_of_memory flag after updating array state. But if there's two consecutive glDrawArrays calls and the first one is skipped because of OOM, the second one should be skipped too. Cc: 9.2 <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: minor whitespace, comment changes in st_draw.cBrian Paul2013-10-221-8/+11
|
* 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]>