summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: do not leak ctx->Shader.ReferencedProgram referencesJose Dapena Paz2018-05-251-0/+3
| | | | | | | | | | | | When glUseProgram is used, references to the included shaders are added in ctx->Shader.ReferencedProgram. But those references are not decreased when the shader data is deallocated. Thus, those shaders are leaked. Explicitely remove the pending references to these shaders. Fixes: e6506b3cd23 ("mesa: retain gl_shader_programs after glDeleteProgram if they are in use") Reviewed-by: Timothy Arceri <[email protected]>
* main: return 0 length when the queried program object's not linkedXiong, James2018-05-101-1/+1
| | | | | Signed-off-by: Xiong, James <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: include dispatch.h lessMarek Olšák2018-04-121-1/+0
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: Update vertex processing mode on _mesa_UseProgram.Mathias Fröhlich2018-02-231-0/+2
| | | | | | | | | | | | The change is a bug fix for 92d76a169: mesa: Provide an alternative to get_vp_mode() that actually got exposed through 4562a7b0: vbo: Make use of _DrawVAO from the dlist code. Fixes: KHR-GLES31.core.shader_image_load_store.advanced-sso-simple Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105229 Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: rename has_core_gs -> has_gs in get_programivMarek Olšák2018-02-231-5/+5
| | | | | | | This is also true for GLES. Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Provide an alternative to get_vp_mode()Mathias Fröhlich2018-02-231-0/+5
| | | | | | | | | | | | | | | | | To get equivalent information than get_vp_mode(), track the vertex processing mode in a per context variable at gl_vertex_program_state::_VPMode. This aims to replace get_vp_mode() as seen in the vbo module. But instead of the get_vp_mode() implementation which only gives correct answers past calling _mesa_update_state() this context variable is immediately tracked when the vertex processing state is modified. The correctness of this value is asserted on state validation. With this in place we should be able to untangle the dependency with varying_vp_inputs and state invalidation. Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: change gl_link_status enums to uppercaseBrian Paul2018-01-261-4/+4
| | | | | | follow the convention of other enums. Reviewed-by: Neha Bhende <[email protected]>
* mesa: change gl_compile_status enums to uppercaseBrian Paul2018-01-261-2/+2
| | | | | | To follow the convention of other enums. Reviewed-by: Neha Bhende <[email protected]>
* Fix use of alloca() without #include <c99_alloca.h>Jon Turney2018-01-091-0/+1
| | | | | ../../../src/mesa/main/shaderapi.c: In function ‘_mesa_ShaderBinary’: ../../../src/mesa/main/shaderapi.c:2188:9: error: implicit declaration of function ‘alloca’ [-Werror=implicit-function-declaration]
* mesa: refuse to compile SPIR-V shaders or link mixed shadersNicolai Hähnle2017-12-121-0/+12
| | | | | | | | | | | | Note that gl_shader::CompileStatus will also indicate whether a shader has been successfully specialized. v2: Use the 'spirv_data' member of gl_shader to know if it is a SPIR-V shader, instead of a dedicated flag. (Timothy Arceri) v3: Use bool instead of GLboolean. (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* mesa/shaderapi: add a getter for GL_SPIR_V_BINARY_ARBNicolai Hähnle2017-12-121-0/+3
| | | | | | | v2: Use the 'spirv_data' member of gl_shader instead of a dedicated flag. (Timothy Arceri) Reviewed-by: Ian Romanick <[email protected]>
* mesa: implement SPIR-V loading in glShaderBinaryNicolai Hähnle2017-12-121-3/+43
| | | | | | | | | | | | | | | | | | v2: * Add a gl_shader_spirv_data member to gl_shader, which already encapsulates a gl_spirv_module where the binary will be saved. (Eduardo Lima) * Just use the 'spirv_data' member to know whether a gl_shader has the SPIR_V_BINARY_ARB state. (Timothy Arceri) * Remove redundant argument checks. Move extension presence check to API entry point where the rest of checks are. Retype 'n' and 'length'arguments to use the correct and more standard types. (Ian Romanick) * Fix some nitpicks. (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* main: Clear shader program data whenever ProgramBinary is calledJordan Justen2017-12-081-0/+3
| | | | | | | | | | | | | | | The GL_ARB_get_program_binary extension spec says: "If ProgramBinary fails to load a binary, no error is generated, but any information about a previous link or load of that program object is lost." v2: * Re-initialize shProg->data after clear. (Jordan) (Required after 6a72eba755fea15a0d97abb913a6315d9d32e274) Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* main: add binary support to ProgramBinaryJordan Justen2017-12-081-17/+19
| | | | | | | | | | V2: call generic mesa_program_binary() helper rather than driver function directly to allow greater code sharing. Signed-off-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> (v1) Reviewed-by: Nicolai Hähnle <[email protected]> (v1) Reviewed-by: Tapani Pälli <[email protected]>
* main: add binary support to GetProgramBinaryJordan Justen2017-12-081-6/+9
| | | | | | | | | | V2: call generic _mesa_get_program_binary() helper rather than driver function directly to allow greater code sharing. Signed-off-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> (v1) Reviewed-by: Nicolai Hähnle <[email protected]> (v1) Reviewed-by: Tapani Pälli <[email protected]>
* main: Support getting GL_PROGRAM_BINARY_LENGTHJordan Justen2017-12-081-1/+6
| | | | | | | | | | | V2: call generic _mesa_get_program_binary_length() helper rather than driver function directly to allow greater code sharing. Signed-off-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> (v1) Reviewed-by: Nicolai Hähnle <[email protected]>i (v1) Reviewed-by: Tapani Pälli <[email protected]>
* mesa: Deal with size differences between GLuint and GLhandleARB in ↵Jeremy Huddleston Sequoia2017-09-131-7/+15
| | | | | | | GetAttachedObjectsARB Signed-off-by: Jeremy Huddleston Sequoia <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: add KHR_no_error support to glLinkProgram()Samuel Pitoiset2017-08-021-0/+18
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add link_program() and link_program_error() helpersSamuel Pitoiset2017-08-021-13/+33
| | | | | | | And call link_program_error() from _mesa_link_program(). Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add KHR_no_error support to glShaderSource()Samuel Pitoiset2017-08-021-0/+9
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add shader_source() helperSamuel Pitoiset2017-08-021-11/+23
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: rename shader_source() to set_shader_source()Samuel Pitoiset2017-08-021-2/+2
| | | | | | | | There is already get_shader_source(), and shader_source() will be used for adding KHR_no_error support. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add KHR_no_error support to glDetachShader() and glDetachObjectARB()Samuel Pitoiset2017-07-311-0/+23
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add detach_shader_error() helperSamuel Pitoiset2017-07-311-9/+21
| | | | | | | And make detach_shader() always inline. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add KHR_no_error support to glProgramParameteri()Samuel Pitoiset2017-07-311-0/+10
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add program_parameteri() helperSamuel Pitoiset2017-07-311-14/+24
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add KHR_no_error support to glPatchParameteri()Samuel Pitoiset2017-07-311-0/+8
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: do not use format string as literal stringJuan A. Suarez Romero2017-06-281-2/+2
| | | | | | | | | | | | | | | | This fixes a couple of errors when building in Android: external/mesa3d/src/mesa/main/shaderapi.c:293:49: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] _mesa_error(ctx, GL_INVALID_OPERATION, caller); ^~~~~~ external/mesa3d/src/mesa/main/shaderapi.c:293:49: note: treat the string as an argument to avoid this _mesa_error(ctx, GL_INVALID_OPERATION, caller); ^ Reviewed-by: Samuel Pitoiset <[email protected]> Signed-off-by: Juan A. Suarez Romero <[email protected]>
* mesa: add KHR_no_error support for glCreateShader() and ↵Samuel Pitoiset2017-06-281-0/+16
| | | | | | | glCreateShaderObjectARB() Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: rename create_shader() to create_shader_err()Samuel Pitoiset2017-06-281-10/+19
| | | | | | | And add a no_error variant. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: pass the 'caller' function to create_shader()Samuel Pitoiset2017-06-281-6/+6
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add KHR_no_error support for glAttachShader() and glAttachObjectARB()Samuel Pitoiset2017-06-281-0/+15
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: rename attach_shader() to attach_shader_err()Samuel Pitoiset2017-06-281-17/+36
| | | | | | | And add a no_error variant. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: pass the 'caller' function to attach_shader()Samuel Pitoiset2017-06-281-9/+10
| | | | | | | In order to fix GL error messages. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: don't flag _NEW_PROGRAM_CONSTANTS for GLSL programs for st/mesaMarek Olšák2017-06-221-2/+6
| | | | | | | | | v2: also update _mesa_uniform_handle for bindless textures Reviewed-by: Nicolai Hähnle <[email protected]> (v1) Reviewed-by: Brian Paul <[email protected]> (v1) Reviewed-by: Timothy Arceri <[email protected]> (v1) Reviewed-by: Samuel Pitoiset <[email protected]>
* mesa: GL_ARB_shader_subroutine is not optional in core profileIan Romanick2017-05-221-40/+0
| | | | | | | | | | | text data bss dec hex filename 7038459 235248 37280 7310987 6f8e8b 32-bit i965_dri.so before 7038227 235248 37280 7310755 6f8da3 32-bit i965_dri.so after 6681438 303400 50608 7035446 6b5a36 64-bit i965_dri.so before 6681254 303400 50608 7035262 6b597e 64-bit i965_dri.so after Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: add an env var to force cache fallbackTimothy Arceri2017-05-201-0/+2
| | | | | | | | | | | | | | | | | For the gallium state tracker a tgsi binary may have been evicted from the cache to make space. In this case we would take the fallback path and recompile/link the shader. On i965 there are a number of reasons we can get to the program upload stage and have neither IR nor a valid cached binary. For example the binary may have been evicted from the cache or we need a variant that wasn't previously cached. This environment variable enables us to force the fallback path that would be taken in these cases and makes it easier to debug these otherwise hard to reproduce scenarios. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: add KHR_no_error support for glUseProgramTimothy Arceri2017-05-171-20/+45
| | | | | | V3: use always_inline attribute (Suggested by Nicolai) Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: move use_program() inside _mesa_use_program()Timothy Arceri2017-05-171-29/+21
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: remove _CurrentFragmentProgram from gl_pipeline_objectTimothy Arceri2017-05-111-22/+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: small _mesa_UseProgram() tidy upTimothy Arceri2017-05-111-4/+1
| | | | | | Makes the code easier to follow. Reviewed-by: Eric Anholt <[email protected]>
* mesa: Remove unnecessary locking from container objects.Matt Turner2017-04-221-3/+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 MESA_GLSL=optTimothy Arceri2017-03-311-2/+0
| | | | | | | | | This is unused. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: remove MESA_GLSL=no_opts env optionTimothy Arceri2017-03-311-2/+0
| | | | | | | | | | | | This is confusing because is only applys to GL_ARB_vertex/fragment_program, and because of that its also not very useful. If someone requires this for debugging they can just make an ad-hoc code change. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa/glsl: introduce new gl_compile_status enumTimothy Arceri2017-03-121-3/+3
| | | | | | | This will allow us to tell if a shader really has been compiled or if the shader cache has just seen it before. Acked-by: Marek Olšák <[email protected]>
* glsl: use correct shader source in case of cache fallbackTimothy Arceri2017-02-171-3/+12
| | | | | | | | | | | | | | | | | The scenario is: glShaderSource glCompileShader <-- deferred due to cache hit of shader glShaderSource <-- with new source code glAttachShader glLinkProgram <-- no cache hit for program At this point we need to compile the original source when we fallback. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: retain gl_shader_programs after glDeleteProgram if they are in useTimothy Arceri2017-02-161-5/+9
| | | | | | | | | | | | | | 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]>
* glsl: add param to force shader recompileTimothy Arceri2017-02-091-1/+1
| | | | | | This will be used to skip checking the cache and force a recompile. Reviewed-by: Anuj Phogat <[email protected]>
* st/mesa/i965: create link status enumTimothy Arceri2017-02-091-5/+5
| | | | | | | | | | | | For the on-disk shader cache we want to be able to differentiate between a program that was linked and one that was loaded from cache. V2: - don't return the new enum directly to the application when queried, instead return GL_TRUE or GL_FALSE as required. Fixes google-chrome corruptions when using cache. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: add new MESA_GLSL flag for printing shader cache debug infoTimothy Arceri2017-01-311-0/+2
| | | | Reviewed-by: Eric Anholt <[email protected]>