summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pipelineobj.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: fix KHR_no_error SSO supportTimothy Arceri2017-05-131-1/+1
| | | | | Fixes: 00c5119a5e821 ("mesa: add KHR_no_error support for glUseProgramStages()") Reviewed-by: Samuel Pitoiset <[email protected]>
* mesa: remove _CurrentFragmentProgram from gl_pipeline_objectTimothy Arceri2017-05-111-2/+0
| | | | | | | | | | | | | This was added in b527dd65c830a as a work around because fixed function fragment shaders were tracked in ctx->FragmentProgram._Current as a gl_program rather than gl_shader_program. However after my refactoring of the program and shader structs at the end of 2016 which culminated in c505d6d85222, we no longer need gl_shader_program to track the current program making _CurrentFragmentProgram obsolete. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add KHR_no_error support for glBindProgramPipeline()Timothy Arceri2017-05-111-0/+26
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: add KHR_no_error support for glActiveShaderProgram()Timothy Arceri2017-05-111-0/+18
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: add KHR_no_error support for glUseProgramStages()Timothy Arceri2017-05-111-0/+21
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: create use_program_stages() helperTimothy Arceri2017-05-111-32/+39
| | | | | | | This will be used to create a KHR_no_error version of glUseProgramStages(). Reviewed-by: Eric Anholt <[email protected]>
* mesa: don't lock hashtables that are not shared across contextsTimothy Arceri2017-04-221-3/+3
| | | | | | | | | | | | | | | | | | | From Chapter 5 'Shared Objects and Multiple Contexts' of the OpenGL 4.5 spec: "Objects which contain references to other objects include framebuffer, program pipeline, query, transform feedback, and vertex array objects. Such objects are called container objects and are not shared" For we leave locking in place for framebuffer objects because the EXT fbo extension allowed sharing. We could maybe just replace the hash with an ordinary hash table but for now this should remove most of the unnecessary locking. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* mesa: Remove deleteFlag pattern from container objects.Matt Turner2017-04-221-3/+1
| | | | | | | | This pattern was only useful when we used mutex locks, which the previous commit removed. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* mesa: Remove unnecessary locking from container objects.Matt Turner2017-04-221-6/+0
| | | | | | | | | | | | | | | | | | | From Chapter 5 'Shared Objects and Multiple Contexts' of the OpenGL 4.5 spec: "Objects which contain references to other objects include framebuffer, program pipeline, query, transform feedback, and vertex array objects. Such objects are called container objects and are not shared" For we leave locking in place for framebuffer objects because the EXT fbo extension allowed sharing. V2: (Timothy Arceri) - rebased and dropped changes to framebuffer objects Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* mesa: remove fallback RefCount == 0 patternTimothy Arceri2017-04-221-10/+4
| | | | | | | | We should never get here if this is 0 unless there is a bug. Replace the check with an assert. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* mesa: retain gl_shader_programs after glDeleteProgram if they are in useTimothy Arceri2017-02-161-2/+4
| | | | | | | | | | | | | | Fixes regressions from c505d6d852220f4aaaee161465dd2c579647e672. Switching from using gl_shader_program to gl_program for the pipline objects CurrentProgram array meant we were freeing gl_shader_programs immediately after glDeleteProgram was called, but the spec states the program should only get deleted once it is no longer in use. To work around this we add a new ReferencedPrograms array to track gl_shader_programs in use. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: use gl_program for CurrentProgram rather than gl_shader_programTimothy Arceri2017-01-231-33/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes much more sense and should be more performant in some critical paths such as SSO validation which is called at draw time. Previously the CurrentProgram array could have contained multiple pointers to the same struct which was confusing and we would often need to fish out the information we were really after from the gl_program anyway. Also it was error prone to depend on the _LinkedShader array for programs in current use because a failed linking attempt will lose the infomation about the current program in use which is still valid. V2: fix validate_io() to compare linked_stages rather than the consumer and producer to decide if we are looking at inward facing shader interfaces which don't need validation. Acked-by: Edward O'Callaghan <[email protected]> To avoid build regressions the following 2 patches were squashed in to this commit: mesa/meta: rewrite _mesa_shader_program_use() and _mesa_program_use() These are rewritten to do what the function name suggests, that is _mesa_shader_program_use() sets the use of all stage and _mesa_program_use() sets the use of a single stage. Reviewed-by: Lionel Landwerlin <[email protected]> Acked-by: Edward O'Callaghan <[email protected]> mesa: update active relinked program This likely fixes a subroutine bug were _mesa_shader_program_init_subroutine_defaults() would never have been called for the relinked program as we previously just set _NEW_PROGRAM as dirty and never called the _mesa_use* functions when linking. Acked-by: Edward O'Callaghan <[email protected]>
* mesa: change init subroutine defaults helper to work per gl_programTimothy Arceri2017-01-191-2/+8
| | | | | | | A later patch will result in SSO programs calling this helper per gl_program rather than per gl_shader_program. Reviewed-by: Lionel Landwerlin <[email protected]>
* mesa: make _CurrentFragmentProgram a gl_program struct pointerTimothy Arceri2017-01-061-1/+1
| | | | | | | | Making this point to a gl_program struct rather than a gl_shader_program struct will allow use to later also make the CurrentProgram array hold gl_program structs which in turn will allow for code simpilifcation. Reviewed-by: Eric Anholt <[email protected]>
* mesa: optimise interleaved sso validationTimothy Arceri2016-11-301-11/+14
| | | | | | | | | | Now that we have a linked_stages bitfield we can use this to check if the program is used at a later stage. This change is also required to be able to use gl_program rather than gl_shader_program in the CurrentProgram array. Reviewed-by: Ian Romanick <[email protected]>
* st/mesa/glsl/nir/i965: make use of new gl_shader_program_data in ↵Timothy Arceri2016-11-191-2/+2
| | | | | | gl_shader_program Reviewed-by: Emil Velikov <[email protected]>
* mesa: fix empty program log lengthTapani Pälli2016-11-181-1/+2
| | | | | | | | | | | | | | | | | | | In case we have empty log (""), we should return 0. This fixes Khronos WebGL conformance test 'program-infolog'. From OpenGL ES 3.1 (and OpenGL 4.5 Core) spec: "If pname is INFO_LOG_LENGTH , the length of the info log, including a null terminator, is returned. If there is no info log, zero is returned." v2: apply same fix for get_shaderiv and _mesa_GetProgramPipelineiv (Ian) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> (v1) Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97321 Cc: "13.0" <[email protected]>
* mesa/subroutines: start adding per-context subroutine index support (v1.1)Dave Airlie2016-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | One piece of ARB_shader_subroutine I ignored was the fact that it needs to store the subroutine index data per context and not per shader program. There is one CTS test that tests this: GL45-CTS.shader_subroutine.multiple_contexts However the test only does a write to context and readback, it never renders using the values, so this is enough to fix the test however not enough to do what the spec says. So with this patch the info is now stored per context, but it gets updated into the program at UseProgram and when the values are inserted into the context, which won't help if multiple contexts are in use in multiple threads. v1.1: cleanups and nit-picks (Andres) Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Andres Gomez <[email protected]>
* mesa: remove dd_function_table::UseProgramMarek Olšák2016-07-301-3/+0
| | | | | | finally unused Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: Silence unused parameter warningIan Romanick2016-06-201-1/+1
| | | | | | | | | | main/pipelineobj.c: In function ‘delete_pipelineobj_cb’: main/pipelineobj.c:110:30: warning: unused parameter ‘id’ [-Wunused-parameter] delete_pipelineobj_cb(GLuint id, void *data, void *userData) ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: If validation fails in a debug context just emit a debug messageIan Romanick2016-06-161-2/+15
| | | | | | | | | | | | | There are quite a few pipelines that desktop applications (including a bunch of piglit test) can expect to have run but don't meet the GLES requirements. Instead of failing validation, just emit a debug message. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96358 Cc: "12.0" <[email protected]> Cc: Gregory Hainaut <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Only validate SSO shader IO in OpenGL ES or debug contextIan Romanick2016-05-261-2/+16
| | | | | | | | | v2: Move later in series to avoid issues with Gallium drivers and debug contexts. Suggested by Ilia. Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Timothy Arceri <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa/subroutines: fix reset on bindpipelineDave Airlie2016-05-231-0/+4
| | | | | | | | Fixes: GL45-CTS.shader_subroutine.subroutine_uniform_reset Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa/main: removing double semi-colonsJakob Sinclair2016-04-261-1/+1
| | | | | | | | | | Trivial change. Removing unnecessary semi-colons from the code. I don't have push access so someone reviewing this can push it. Signed-off-by: Jakob Sinclair <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* mesa: avoid segfault in GetProgramPipelineInfoLog when no lengthIlia Mirkin2016-02-121-4/+1
| | | | | | | | | | | | | If there is no pipe info log, we would unconditionally deref length, which was only optionally there. _mesa_copy_string handles the source being null, as well as the length, so may as well just always call it. Fixes a segfault in dEQP-GLES31.functional.state_query.program_pipeline.info_log Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glsl: move to compiler/Emil Velikov2016-01-261-2/+2
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Jose Fonseca <[email protected]>
* mesa: invalidate pipeline status after glUseProgramStagesTapani Pälli2015-12-101-0/+2
| | | | | | | | | | | | This will cause validation to run during next draw, this is done because possible changes in used stages and programs can cause invalid pipeline state. This fixes a subtest in following CTS test: ES31-CTS.sepshaderobjs.StateInteraction Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: move GL_INVALID_OPERATION error to rendering callTimothy Arceri2015-12-071-21/+9
| | | | | | | | The validation api doesn't trigger this error so just move it to the code called during rendering. Reviewed-by: Tapani Pälli <[email protected]> Cc: Kenneth Graunke <[email protected]>
* mesa: move pipeline input/output validation inside ↵Timothy Arceri2015-12-071-15/+15
| | | | | | | | | | | | _mesa_validate_program_pipeline() This allows validation to be done on rendering calls also. Fixes 3 dEQP-GLES31.functional.separate tests. Cc: "11.1" <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Cc: Kenneth Graunke <[email protected]>
* glsl: don't generate extra errors in ValidateProgramPipelineTimothy Arceri2015-11-271-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | From Section 11.1.3.11 (Validation) of the GLES 3.1 spec: "An INVALID_OPERATION error is generated by any command that trans- fers vertices to the GL or launches compute work if the current set of active program objects cannot be executed, for reasons including:" It then goes on to list the rules we validate in the _mesa_validate_program_pipeline() function. For ValidateProgramPipeline the only mention of generating an error is: "An INVALID_OPERATION error is generated if pipeline is not a name re- turned from a previous call to GenProgramPipelines or if such a name has since been deleted by DeleteProgramPipelines," Which we handle separately. This fixes: ES31-CTS.sepshaderobjs.PipelineApi No regressions on the eEQP 3.1 tests. Cc: Gregory Hainaut <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: implement recent spec update to SSO validationTimothy Arceri2015-11-241-0/+24
| | | | | | | | | | | | | Enables 200+ dEQP SSO tests to proceed past validation, and fixes a ES31-CTS.sepshaderobjs.PipelineApi subtest. V2: split out change that reverts a previous patch into its own commit, move variable declaration to top of function, and fix some formatting all suggested by Ian. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Cc: "11.1" <[email protected]>
* Revert "mesa: return initial value for VALIDATE_STATUS if pipe not bound"Timothy Arceri2015-11-241-2/+1
| | | | | | | | | | | | | | This reverts commit ba02f7a3b6a0e4314753a8e5080db61241563f9c. The commit checked whether the pipeline was currently bound instead of checking whether it had ever been bound. The previous setting of Validated during object creation makes this unnecessary. The real problem was that Validated was not properly set to false elsewhere in the code. This is fixed by a later patch. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Cc: "11.1" <[email protected]>
* mesa: validate precision of varyings during ValidateProgramPipelineTapani Pälli2015-11-121-0/+15
| | | | | | | | | | | Fixes following failing ES3.1 CTS tests: ES31-CTS.sepshaderobjs.InterfacePrecisionMatchingFloat ES31-CTS.sepshaderobjs.InterfacePrecisionMatchingInt ES31-CTS.sepshaderobjs.InterfacePrecisionMatchingUInt Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa/sso: Add compute shader supportJordan Justen2015-11-011-0/+11
| | | | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]> [[email protected]: Reviewed-by for all except the ctx->_Shader change] Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa/sso: Add MESA_VERBOSE=api trace supportJordan Justen2015-11-011-0/+33
| | | | | | | | v2: * Use %u for unsigned values (Iago) Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: clean up #includes in pipelineobj.cBrian Paul2015-10-011-3/+3
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* mesa: return initial value for VALIDATE_STATUS if pipe not boundTapani Pälli2015-09-171-1/+2
| | | | | | | | | | | | | | | | | | From OpenGL 4.5 Core spec (7.13): "If pipeline is a name that has been generated (without subsequent deletion) by GenProgramPipelines, but refers to a program pipeline object that has not been previously bound, the GL first creates a new state vector in the same manner as when BindProgramPipeline creates a new program pipeline object." I interpret this as "If GetProgramPipelineiv gets called without a bound (but valid) pipeline object, the state should reflect initial state of a new pipeline object." This is also expected behaviour by ES31-CTS.sepshaderobjs.PipelineApi conformance test. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]>
* mesa: require VS if TCS or TES is present in pipelineChris Forbes2015-07-231-1/+3
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: allow tess stages in glUseProgramStagesChris Forbes2015-07-231-4/+9
| | | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: support tess stages in glGetProgramPipelineivFabian Bieler2015-07-231-4/+11
| | | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Rename _mesa_lookup_enum_by_nr() to _mesa_enum_to_string().Kenneth Graunke2015-07-201-1/+1
| | | | | | | Generated by sed; no manual changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: add GL_PROGRAM_PIPELINE support in KHR_debug callsIlia Mirkin2015-06-181-10/+11
| | | | | | | | | | This was apparently missed when ARB_sso support was added. Add label support to pipeline objects just like all the other debug-related objects. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Cc: "10.5 10.6" <[email protected]>
* mesa: generalize sso stage interleaving checkChris Forbes2015-06-161-17/+38
| | | | | | | | For tessellation. v2: cleanup by Marek Olšák Reviewed-by: Brian Paul <[email protected]>
* Revert "mesa: Add ARB_direct_state_access checks in program pipeline functions"Ian Romanick2015-05-281-6/+0
| | | | | | | This reverts commit bebf3c6ab314bde05ac5a3b4d3e63fd36243c58e. Acked-by: Fredrik Höglund <[email protected]> Cc: "10.6" <[email protected]>
* mesa: Add ARB_direct_state_access checks in program pipeline functionsFredrik Höglund2015-05-141-0/+6
| | | | | Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* main: Added entry point for glCreateProgramPipelinesMartin Peres2015-03-251-6/+29
| | | | | | | | v2: - add spaces in an error message (Laura) Reviewed-by: Laura Ekstrand <[email protected]> Signed-off-by: Martin Peres <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-3/+3
| | | | Acked-by: Eric Anholt <[email protected]>
* 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]>