summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pipelineobj.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: fix _mesa_free_pipeline_data() use-after-free bugBrian Paul2014-09-121-2/+2
| | | | | | | | | | | | | Unreference the ctx->_Shader object before we delete all the pipeline objects in the hash table. Before, ctx->_Shader could point to freed memory when _mesa_reference_pipeline_object(ctx, &ctx->_Shader, NULL) was called. Fixes crash when exiting the piglit rendezvous_by_location test on Windows. Cc: [email protected] Reviewed-by: Ian Romanick <[email protected]>
* util: Move ralloc to a new src/util directory.Kenneth Graunke2014-08-041-1/+1
| | | | | | | | | | | | | | | | | | For a long time, we've wanted a place to put utility code which isn't directly tied to Mesa or Gallium internals. This patch creates a new src/util directory for exactly that purpose, and builds the contents as libmesautil.la. ralloc seemed like a good first candidate. These days, it's directly used by mesa/main, i965, i915, and r300g, so keeping it in src/glsl didn't make much sense. Signed-off-by: Kenneth Graunke <[email protected]> v2 (Jason Ekstrand): More realloc uses and some scons fixes Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa/sso: Refactor new function _mesa_bind_pipelineIan Romanick2014-05-021-3/+10
| | | | | | | | | Pull most of the guts out of _mesa_BindPipeline into a new utility function that can be use elsewhere (e.g., meta). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: move GLbitfield any_valid_stages declaration before codeBrian Paul2014-03-251-1/+2
| | | | To fix MSVC build.
* mesa/sso: Implement ValidateProgramPipelineGregory Hainaut2014-03-251-3/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementation note: I don't use context for ralloc (don't know how). The check on PROGRAM_SEPARABLE flags is also done when the pipeline isn't bound. It doesn't make any sense in a DSA style API. Maybe we could replace _mesa_validate_program by _mesa_validate_program_pipeline. For example we could recreate a dummy pipeline object. However the new function checks also the TEXTURE_IMAGE_UNIT number not sure of the impact. V2: Fix memory leak with ralloc_strdup Formatting improvement V3 (idr): * Actually fix the leak of the InfoLog. :) * Directly generate logs in to gl_pipeline_object::InfoLog via ralloc_asprintf isntead of using a temporary buffer. * Split out from previous uber patch. * Change spec references to include section numbers, etc. * Fix a bug in checking that a different program isn't active in a stage between two stages that have the same program. Specifically, if (pipe->CurrentVertexProgram->Name == pipe->CurrentGeometryProgram->Name && pipe->CurrentGeometryProgram->Name != pipe->CurrentVertexProgram->Name) should have been if (pipe->CurrentVertexProgram->Name == pipe->CurrentFragmentProgram->Name && pipe->CurrentGeometryProgram->Name != pipe->CurrentVertexProgram->Name) v4 (idr): Rework to use CurrentProgram array in loops. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa/sso: Add gl_pipeline_object::InfoLog supportGregory Hainaut2014-03-251-3/+22
| | | | | | | | | | | V2 (idr): * Keep the behavior of other info logs in Mesa: and empty info log reports a GL_INFO_LOG_LENGTH of zero. * Use a NULL pointer to denote an empty info log. * Split out from previous uber patch. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa/sso: Implement _mesa_BindProgramPipelineGregory Hainaut2014-03-251-0/+69
| | | | | | | | | | | | | | | | | | | | Test become green in piglit: The updated ext_transform_feedback-api-errors:useprogstage_noactive useprogstage_active bind_pipeline arb_separate_shader_object-GetProgramPipelineiv arb_separate_shader_object-IsProgramPipeline For the moment I reuse Driver.UseProgram but I guess it will be better to create a UseProgramStages functions. Opinion is welcome V2: formatting & rename V3 (idr): * Change spec references to core OpenGL versions instead of issues in the extension spec. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa/sso: Implement _mesa_UseProgramStagesGregory Hainaut2014-03-251-0/+102
| | | | | | | | | | | | | | | | | | | Now arb_separate_shader_object-GetProgramPipelineiv should pass. V3 (idr): * Change spec references to core OpenGL versions instead of issues in the extension spec. * Split out from previous uber patch. v4 (idr): Use _mesa_has_geometry_shaders in _mesa_UseProgramStages to detect availability of geometry shaders. v5 (idr): Whitespace cleanup, use _mesa_lookup_shader_program_err instead of open-coding it again, and update some comments at the end of _mesa_UseProgramStages. All suggested by Eric. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa/sso: replace Shader binding point with _ShaderGregory Hainaut2014-03-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid NULL pointer check a default pipeline object is installed in _Shader when no program is current The spec say that UseProgram/UseShaderProgramEXT/ActiveProgramEXT got an higher priority over the pipeline object. When default program is uninstall, the pipeline is used if any was bound. Note: A careful rename need to be done now... V2: formating improvement V3 (idr): * Build fix. The original patch added calls to _mesa_use_shader_program with 4 parameters, but the fourth parameter isn't added to that function until a much later patch. Just drop that parameter for now. * Trivial reformatting. * Updated comment of gl_context::_Shader v4 (idr): Reformat spec quotations to look like spec quotations. Update comments describing what gl_context::_Shader can point to. Bot suggested by Eric. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: switch to c11 mutex functionsBrian Paul2014-03-031-6/+6
| | | | Reviewed-by: José Fonseca <[email protected]>
* mesa/sso: Fix typo of 'unsigned'.Vinson Lee2014-02-211-1/+1
| | | | | | | | | | | | Fix build error introduced with commit f4c13a890fa24ff1f998e7cac0ecc31505a29403. CC pixeltransfer.lo main/pipelineobj.c: In function '_mesa_delete_pipeline_object': main/pipelineobj.c:59:4: error: unknown type name 'unsinged' unsinged i; ^ Signed-off-by: Vinson Lee <[email protected]>
* mesa/sso: Implement _mesa_GetProgramPipelineivGregory Hainaut2014-02-211-0/+58
| | | | | | | | | | | | | | | | This was originally included in another patch, but it was split out by Ian Romanick. v2 (idr): * Trivial reformatting. * Remove GL_COMPUTE_SHADER. Compute shaders don't participate in pipeline objects anyway. Suggested by Matt Turner. v3 (idr): * Use _mesa_has_geometry_shaders. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/sso: Implement _mesa_ActiveShaderProgramGregory Hainaut2014-02-211-0/+28
| | | | | | | | | | | This was originally included in another patch, but it was split out by Ian Romanick. v2 (idr): Return early from _mesa_ActiveShaderProgram if _mesa_lookup_shader_program_err returns an error. Suggested by Jordan. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]> [v2]
* mesa/sso: Implement _mesa_IsProgramPipelineGregory Hainaut2014-02-211-1/+7
| | | | | | | | | | Implement IsProgramPipeline based on the VAO code. This was originally included in another patch, but it was split out by Ian Romanick. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/sso: Implement _mesa_GenProgramPipelinesGregory Hainaut2014-02-211-0/+30
| | | | | | | | | | Implement GenProgramPipelines based on the VAO code. This was originally included in another patch, but it was split out by Ian Romanick. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/sso: Implement _mesa_DeleteProgramPipelinesGregory Hainaut2014-02-211-0/+33
| | | | | | | | | | Implement DeleteProgramPipelines based on the VAO code. This was originally included in another patch, but it was split out by Ian Romanick. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/sso: Add pipeline container/stateGregory Hainaut2014-02-211-1/+158
| | | | | | | | | | | | | | | | | | | | | | | | | V1: * Extend gl_shader_state as pipeline object state * Add a new container gl_pipeline_shader_state that contains binding point of the previous object * Update mesa init/free shader state due to the extension of the attibute * Add an init/free pipeline function for the context V2: * Rename gl_shader_state to gl_pipeline_object * Rename Pipeline.PipelineObj to Pipeline.Current * Formatting improvement V3 (idr): * Split out from previous uber patch. * Remove '#if 0' debug printfs. V4 (idr): * Fix some errors in comments. Suggested by Jordan. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/sso: Add extension entry points for GL_ARB_separate_shader_objectsGregory Hainaut2014-02-211-0/+133
Nothings implemented yet but glProgramUniform* which are mostly a copy/paste of the older function glUniform* I create dedicated pipelineobj.[ch] file that will contains function related to the "new" pipeline container object. V2: formatting improvement V3: * indentation fix * Update copyright * Add a comment on ProgramParameteri already present in another extension * Remove TODO, will be readded on correct patch V4 (idr): * Fix dispatch_sanity unit test * Make extension string available in core profiles (instead of just compatibility). * Trivial reformating Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>