summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: fix empty program log lengthTapani Pälli2016-11-241-2/+4
| | | | | | | | | | | | | | | | | | | | 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 <tapani.palli@intel.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1) Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97321 Cc: "13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit ec4e71f75e9b8a1c427994efa32a61593e3172f9)
* mesa: Drop PATH_MAX usage.Kenneth Graunke2016-11-241-26/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GNU/Hurd does not define PATH_MAX since it doesn't have such arbitrary limitation, so this failed to compile. Apparently glibc does not enforce PATH_MAX restrictions anyway, so it's kind of a hoax: https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html MSVC uses a different name (_MAX_PATH) as well, which is annoying. We don't really need it. We can simply asprintf() the filenames. If the filename exceeds an OS path limit, presumably fopen() will fail, and we already check that. (We actually use ralloc_asprintf because Mesa provides that everywhere, and it doesn't look like we've provided an implementation of GNU's asprintf() for all platforms.) Fixes the build on GNU/Hurd. Cc: "13.0" <mesa-stable@lists.freedesktop.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98632 Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit 9bfee7047b70cb0aa026ca9536465762f96cb2b1) [Emil Velikov: s|prog->Id|base->Id|] Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Conflicts: src/mesa/main/arbprogram.c
* mesa/main: add support for ARB_compute_variable_groups_sizeSamuel Pitoiset2016-10-071-0/+1
| | | | | | | | | | | | | v5: - replace fixed_local_size by !LocalSizeVariable (Nicolai) v4: - slightly indent spec quotes (Nicolai) - drop useless _mesa_has_compute_shaders() check (Nicolai) - move the fixed local size outside of the loop (Nicolai) - add missing check for invalid use of work group count v2: - update formatting spec quotations (Ian) - move the total_invocations check outside of the loop (Ian) Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* glsl: don't crash when dumping shaders if some come from cacheTimothy Arceri2016-09-281-2/+7
| | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: Remove redundant _mesa_has_shader_subroutineIan Romanick2016-08-261-8/+8
| | | | | | | | | | The checks in _mesa_has_shader_subroutine are slightly different than _mesa_has_ARB_shader_subroutine, but they're not different in a way that matters. The only way to have ctx->Version >= 40 is if ctx->Extensions.ARB_shader_subroutine is set. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
* shaderapi: don't generate not linked error on GetProgramStage in generalAlejandro Piñeiro2016-08-241-1/+18
| | | | | | | | | | Both ARB_shader_subroutine and the GL core spec doesn't list any error when the program is not linked. We left a error generation for the uniform location, in order to be consistent with other methods from the spec that generate them. Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
* mesa/subroutines: drop the old subroutine index uploads.Dave Airlie2016-08-231-6/+0
| | | | | | | | | We used to upload the indices when they changed, now we rely on the drivers calling the correct hook to have the values updated from the context storage. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Andres Gomez <agomez@igalia.com>
* mesa: add api to write subroutine indicies to the program storage.Dave Airlie2016-08-231-0/+10
| | | | | | | | | | | | This writes the subroutine indicies to the program storage for a stage. This API is intended to be used by drivers to update the uniform storage before uploading to the hw. This isn't the most thread safe effort, but it will be significantly more multi-context safe. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Andres Gomez <agomez@igalia.com>
* mesa/subroutines: start adding per-context subroutine index support (v1.1)Dave Airlie2016-08-231-30/+48
| | | | | | | | | | | | | | | | | | | | | | | 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 <airlied@redhat.com> Reviewed-by: Andres Gomez <agomez@igalia.com>
* mesa: remove dd_function_table::UseProgramMarek Olšák2016-07-301-6/+0
| | | | | | finally unused Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* mesa: Make MESA_SHADER_CAPTURE_PATH skip shaders with Name == -1.Kenneth Graunke2016-07-261-1/+1
| | | | | | | | Shaders with shProg->Name == ~0 (aka 4294967295) are internal meta shaders that we don't really want to capture. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl/mesa: move duplicate shader fields into new struct gl_shader_infoTimothy Arceri2016-06-301-19/+19
| | | | Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl/main: remove unused params and make function staticTimothy Arceri2016-06-301-1/+1
| | | | Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl/mesa: split gl_shader in twoTimothy Arceri2016-06-301-8/+11
| | | | | | | | | | | | | | | | | There are two distinctly different uses of this struct. The first is to store GL shader objects. The second is to store information about a shader stage thats been linked. The two uses actually share few fields and there is clearly confusion about their use. For example the linked shaders map one to one with a program so can simply be destroyed along with the program. However previously we were calling reference counting on the linked shaders. We were also creating linked shaders with a name even though it is always 0 and called the driver version of the _mesa_new_shader() function unnecessarily for GL shader objects. Acked-by: Iago Toral Quiroga <itoral@igalia.com>
* mesa: don't use drivers NewShader function when creating shader objectsTimothy Arceri2016-06-301-2/+1
| | | | | | | The drivers function only needs to be used when creating a struct for linked shaders. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl/mesa: stop duplicating geom and tcs layout valuesTimothy Arceri2016-06-231-15/+28
| | | | | | | | | | | | We already store these in gl_shader and gl_program here we remove it from gl_shader_program and just use the values from gl_shader. This will allow us to keep the shader cache restore code as simple as it can be while making it somewhat clearer where these values originate from. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl/mesa: stop duplicating tes layout valuesTimothy Arceri2016-06-231-12/+22
| | | | | | | | | | | | | | | We already store this in gl_shader and gl_program here we remove it from gl_shader_program and just use the values from gl_shader. This will allow us to keep the shader cache restore code as simple as it can be while making it somewhat clearer where these values originate from. V2: remove unnecessary NULL check Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Iago Toral <itoral@igalia.com>
* mesa/glsl: stop using GL shader type internallyTimothy Arceri2016-06-161-9/+11
| | | | | | | | | | | | Instead use the internal gl_shader_stage enum everywhere. This makes things more consistent and gets rid of unnecessary conversions. Ideally it would be nice to remove the Type field from gl_shader altogether but currently it is used to differentiate between gl_shader and gl_shader_program in the ShaderObjects hash table. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: Try to unbreak the MSVC build.Kenneth Graunke2016-06-051-0/+4
| | | | | | | PATH_MAX is apparently not a thing on Windows. Borrow the hack from pipe_loader.c to try and make this work. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: Add MESA_SHADER_CAPTURE_PATH for writing .shader_test files.Kenneth Graunke2016-06-051-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This writes linked shader programs to .shader_test files to $MESA_SHADER_CAPTURE_PATH in the format used by shader-db (http://cgit.freedesktop.org/mesa/shader-db). It supports both GLSL shaders and ARB programs. All stages that are linked together are written in a single .shader_test file. This eliminates the need for shader-db's split-to-files.py, as Mesa produces the desired format directly. It's much more reliable than parsing stdout/stderr, as those may contain extraneous messages, or simply be closed by the application and unavailable. We have many similar features already, but this is a bit different: - MESA_GLSL=dump writes to stdout, not files. - MESA_GLSL=log writes each stage to separate files (rather than all linked shaders in one file), at draw time (not link time), with uniform data and state flag info. - Tapani's shader replacement mechanism (MESA_SHADER_DUMP_PATH and MESA_SHADER_READ_PATH) also uses separate files per shader stage, but allows reading in files to replace an app's shader code. v2: Dump ARB programs too, not just GLSL. v3: Don't dump bogus 0.shader_test file. v4: Add "GL_ARB_separate_shader_objects" to the [require] block. v5: Print "GLSL 4.00" instead of "GLSL 4.0" in the [require] block. v6: Don't hardcode /tmp/mesa. v7: Fix memoization of getenv(). v8: Also print "SSO ENABLED" (suggested by Timothy). v9: Also handle ES shaders (suggested by Ilia). v10: Guard against MESA_SHADER_CAPTURE_PATH being too long; add _mesa_warning calls on error handling (suggested by Ben). v11: Fix crash when variable is unset introduced in v10. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
* subroutines: handle explicit indexes properlyDave Airlie2016-05-231-4/+12
| | | | | | | | | | | | | | The code didn't deal with explicit function indexes properly. It also handed out the indexes at link time, when we really need them in the lowering pass to create the correct if ladder. So this patch moves assigning the non-explicit indexes earlier, fixes the lowering pass and the lookups to get the correct values. This fixes a few of: GL45-CTS.explicit_uniform_location.subroutine-index-* Signed-off-by: Dave Airlie <airlied@redhat.com>
* mesa/subroutines: fix reset on bindpipelineDave Airlie2016-05-231-1/+3
| | | | | | | | Fixes: GL45-CTS.shader_subroutine.subroutine_uniform_reset Reviewed-by: Chris Forbes <chrisforbes@google.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* mesa/subroutines: count number subroutines properly.Dave Airlie2016-05-231-2/+2
| | | | | | | | | | | | | The code was implementing the ACTIVE_SUBROUTINE_UNIFORMS incorrectly, using the number of types not the number of uniforms. This is different than the locations as the locations may be sparsly allocated. This fixes: GL43-CTS.shader_subroutine.four_subroutines_with_two_uniforms Reviewed-by: Chris Forbes <chrisforbes@google.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* mesa/subroutines: don't generate error in GetSubroutineIndex.Dave Airlie2016-05-231-1/+0
| | | | | | | | | | GLSL spec says this doesn't generate an error. Fixes: GL45-CTS.explicit_uniform_location.subroutine-loc Reviewed-by: Chris Forbes <chrisforbes@google.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* arb_shader_subroutine: check active subroutine limitDave Airlie2016-05-231-0/+5
| | | | | | | | | | _mesa_GetActiveSubroutineUniformiv needs to check against the number of types here. Noticed while playing with ogl conform. Reviewed-by: Chris Forbes <chrisforbes@google.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* mesa: Replace uses of Shared->Mutex with hash-table mutexesMatt Turner2016-05-201-2/+8
| | | | | | | | | | | | | | | We were locking the Shared->Mutex and then using calling functions like _mesa_HashInsert that do additional per-hash-table locking internally. Instead just lock each hash-table's mutex and use functions like _mesa_HashInsertLocked and the new _mesa_HashRemoveLocked. In order to do this, we need to remove the locking from _mesa_HashFindFreeKeyBlock since it will always be called with the per-hash-table lock taken. Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa/main: Add support for GL_ARB_cull_distance (v2)Tobias Klausmann2016-05-141-0/+3
| | | | | | | | | | | | airlied: v2: rename LowerClipDistance to LowerCombinedClipCullDistnace. I don't think we want any other behaviour with any current hw. Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
* glShaderSource must not change compile status.Jamey Sharp2016-05-011-1/+0
| | | | | | | | | | | | | | | | OpenGL 4.5 Core Profile section 7.1, in the documentation for CompileShader, says: "Changing the source code of a shader object with ShaderSource does not change its compile status or the compiled shader code." According to Karol Herbst, the game "Divinity: Original Sin - Enhanced Edition" depends on this odd quirk of the spec. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93551 Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* 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 <sinclair.jakob@openmailbox.org> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
* glsl: fully split apart buffer block arraysTimothy Arceri2016-04-061-1/+1
| | | | | | | | | | | | With this change we create the UBO and SSBO arrays separately from the beginning rather than putting them into a combined array and splitting it apart later. A bug is with UBO and SSBO stage reference querying is also fixed as we now use the block index to lookup the references in the separate arrays not the combined buffer block array. Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
* mesa: remove initialized field from uniform storageTimothy Arceri2016-03-291-2/+1
| | | | | | | | The only place this was used was in a gallium debug function that had to be manually enabled. Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Expose compile_shader() and link_program() beyond the file.Kenneth Graunke2016-03-161-10/+10
| | | | | | | | This will allow me to use them directly from Meta, bypassing the versions that work with GL integer handles. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: Make link_program() take a gl_shader_program, not a GLuint.Kenneth Graunke2016-03-161-6/+4
| | | | | | | | In half the callers, we already have a pointer, and don't need to look it up again. This will also help with upcoming meta work. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: Make compile_shader() take a gl_shader, not a GLuint.Kenneth Graunke2016-03-161-9/+6
| | | | | | | | In half the callers, we already have a pointer, and don't need to look it up again. This will also help with upcoming meta work. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: store shared size in gl_compute_programSamuel Pitoiset2016-02-131-0/+1
| | | | | | | | | The size of shared variables needs to be stored in gl_compute_program in order to set up pipe_compute_state::req_local_mem. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* glsl: move to compiler/Emil Velikov2016-01-261-4/+4
| | | | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
* Revert "mesa: Deal with size differences between GLuint and GLhandleARB in ↵Jeremy Huddleston Sequoia2016-01-221-17/+1
| | | | | | | | | GetAttachedObjectsARB" This reverts commit 739ac3d39dacdede853d150b9903001524453330. This will be done a differnet way. See http://lists.freedesktop.org/archives/mesa-dev/2016-January/105642.html
* mesa: Deal with size differences between GLuint and GLhandleARB in ↵Jeremy Huddleston Sequoia2016-01-211-1/+17
| | | | | | | GetAttachedObjectsARB Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Nicolai Hähnle <nhaehnle@gmail.com>
* mesa: Fix format warningsJeremy Huddleston Sequoia2016-01-211-1/+1
| | | | | | | | | | main/shaderapi.c:1318:51: warning: format specifies type 'unsigned int' but the argument has type 'GLhandleARB' (aka 'unsigned long') [-Wformat] _mesa_debug(ctx, "glDeleteObjectARB(%u)\n", obj); ~~ ^~~ %lu Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* mesa: Fix some function prototype mismatchingJeremy Huddleston Sequoia2016-01-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | main/api_exec.c:543:36: warning: incompatible pointer types passing 'void (GLhandleARB, GLuint, const GLcharARB *)' (aka 'void (unsigned long, unsigned int, const char *)') to parameter of type 'void (*)(GLuint, GLuint, const GLchar *)' (aka 'void (*)(unsigned int, unsigned int, const char *)') [-Wincompatible-pointer-types] SET_BindAttribLocation(exec, _mesa_BindAttribLocation); ^~~~~~~~~~~~~~~~~~~~~~~~ ./main/dispatch.h:7590:88: note: passing argument to parameter 'fn' here static inline void SET_BindAttribLocation(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, const GLchar *)) { ^ main/api_exec.c:547:31: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned int)') [-Wincompatible-pointer-types] SET_CompileShader(exec, _mesa_CompileShader); ^~~~~~~~~~~~~~~~~~~ ./main/dispatch.h:7612:83: note: passing argument to parameter 'fn' here static inline void SET_CompileShader(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) { ^ main/api_exec.c:568:33: warning: incompatible pointer types passing 'void (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)' (aka 'void (unsigned long, unsigned int, int, int *, int *, unsigned int *, char *)') to parameter of type 'void (*)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *)' (aka 'void (*)(unsigned int, unsigned int, int, int *, int *, unsigned int *, char *)') [-Wincompatible-pointer-types] SET_GetActiveAttrib(exec, _mesa_GetActiveAttrib); ^~~~~~~~~~~~~~~~~~~~~ ./main/dispatch.h:7711:85: note: passing argument to parameter 'fn' here static inline void SET_GetActiveAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLsizei , GLsizei *, GLint *, GLenum *, GLchar *)) { ^ main/api_exec.c:571:35: warning: incompatible pointer types passing 'GLint (GLhandleARB, const GLcharARB *)' (aka 'int (unsigned long, const char *)') to parameter of type 'GLint (*)(GLuint, const GLchar *)' (aka 'int (*)(unsigned int, const char *)') [-Wincompatible-pointer-types] SET_GetAttribLocation(exec, _mesa_GetAttribLocation); ^~~~~~~~~~~~~~~~~~~~~~~ ./main/dispatch.h:7744:88: note: passing argument to parameter 'fn' here static inline void SET_GetAttribLocation(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLuint, const GLchar *)) { ^ main/api_exec.c:585:33: warning: incompatible pointer types passing 'void (GLhandleARB, GLsizei, GLsizei *, GLcharARB *)' (aka 'void (unsigned long, int, int *, char *)') to parameter of type 'void (*)(GLuint, GLsizei, GLsizei *, GLchar *)' (aka 'void (*)(unsigned int, int, int *, char *)') [-Wincompatible-pointer-types] SET_GetShaderSource(exec, _mesa_GetShaderSource); ^~~~~~~~~~~~~~~~~~~~~ ./main/dispatch.h:7788:85: note: passing argument to parameter 'fn' here static inline void SET_GetShaderSource(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, GLsizei *, GLchar *)) { ^ main/api_exec.c:597:29: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned int)') [-Wincompatible-pointer-types] SET_LinkProgram(exec, _mesa_LinkProgram); ^~~~~~~~~~~~~~~~~ ./main/dispatch.h:7909:81: note: passing argument to parameter 'fn' here static inline void SET_LinkProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) { ^ main/api_exec.c:628:30: warning: incompatible pointer types passing 'void (GLhandleARB, GLsizei, const GLcharARB *const *, const GLint *)' (aka 'void (unsigned long, int, const char *const *, const int *)') to parameter of type 'void (*)(GLuint, GLsizei, const GLchar *const *, const GLint *)' (aka 'void (*)(unsigned int, int, const char *const *, const int *)') [-Wincompatible-pointer-types] SET_ShaderSource(exec, _mesa_ShaderSource); ^~~~~~~~~~~~~~~~~~ ./main/dispatch.h:7920:82: note: passing argument to parameter 'fn' here static inline void SET_ShaderSource(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLchar * const *, const GLint *)) { ^ main/api_exec.c:653:28: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned int)') [-Wincompatible-pointer-types] SET_UseProgram(exec, _mesa_UseProgram); ^~~~~~~~~~~~~~~~ ./main/dispatch.h:8173:80: note: passing argument to parameter 'fn' here static inline void SET_UseProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) { ^ main/api_exec.c:655:33: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned int)') [-Wincompatible-pointer-types] SET_ValidateProgram(exec, _mesa_ValidateProgram); ^~~~~~~~~~~~~~~~~~~~~ ./main/dispatch.h:8184:85: note: passing argument to parameter 'fn' here static inline void SET_ValidateProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) { main/dlist.c:9457:26: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned int)') [-Wincompatible-pointer-types] SET_UseProgram(table, save_UseProgramObjectARB); ^~~~~~~~~~~~~~~~~~~~~~~~ ./main/dispatch.h:8173:80: note: passing argument to parameter 'fn' here static inline void SET_UseProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) { ^ 1 warning generated. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* mesa: fix segfault in glUniformSubroutinesuiv()Timothy Arceri2016-01-181-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | From Section 7.9 (SUBROUTINE UNIFORM VARIABLES) of the OpenGL 4.5 Core spec: "The command void UniformSubroutinesuiv(enum shadertype, sizei count, const uint *indices); will load all active subroutine uniforms for shader stage shadertype with subroutine indices from indices, storing indices[i] into the uniform at location i. The indices for any locations between zero and the value of ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS minus one which are not used will be ignored." V2: simplify NULL check suggested by Jason. Acked-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Cc: "11.0 11.1" mesa-stable@lists.freedesktop.org https://bugs.freedesktop.org/show_bug.cgi?id=93731
* mesa: print the invalid enum when CreateShader failsTimothy Arceri2016-01-131-1/+2
| | | | Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
* main: Allow compute shaders to be compiled with OpenGLES 3.1Jordan Justen2015-12-161-1/+1
| | | | | | | | | Previous OpenGLES 3.1 testing had been done when ARB_compute_shader was overridden to enabled. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
* main: Add MESA_VERBOSE=api for LinkProgram & UseProgramJordan Justen2015-12-161-0/+5
| | | | | Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
* mesa: fix uniforms calculation in glGetProgramivTapani Pälli2015-11-021-2/+12
| | | | | | | | | | | | | Since introduction of SSBO, UniformStorage contains not just uniforms but also buffer variables, this needs to be taken in to account when calculating active uniforms with GL_ACTIVE_UNIFORMS and GL_ACTIVE_UNIFORM_MAX_LENGTH. No Piglit regressions. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: replace UsesClipDistance with ClipDistanceArraySizeMarek Olšák2015-10-201-3/+3
| | | | | | | This is more practical and needed by gallium. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Brian Paul <brianp@vmware.com>
* main: GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH is about UBOS, not SSBOsIago Toral Quiroga2015-10-191-2/+2
| | | | | Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* main: Use NumUniformBlocks to count UBOsIago Toral Quiroga2015-10-191-5/+1
| | | | | | | | | Now that we have separate index spaces for UBOs and SSBOs we do not need to iterate through BufferInterfaceBlocks any more, we can just take the UBO count directly from NumUniformBlocks. Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* mesa: Rename {Num}UniformBlocks to {Num}BufferInterfaceBlocksIago Toral Quiroga2015-10-141-2/+2
| | | | | | | | | | | | | | Currently, these arrays in gl_shader and gl_shader_program hold both UBOs and SSBOs, so this looks like a better name. We were already using NumBufferInterfaceBlocks in gl_shader_program, so this makes things more consistent as well. In a later patch we will add {Num}UniformBlocks and {Num}ShaderStorageBlocks which will contain only references to UBOs and SSBOs respectively that will provide backends with a separate index space for both types of objects. Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
* glsl: reduce memory footprint of uniform_storage structTimothy Arceri2015-10-051-1/+1
| | | | | | | | The uniform will only be of a single type so store the data for opaque types in a single array. Cc: Francisco Jerez <currojerez@riseup.net> Cc: Ilia Mirkin <imirkin@alum.mit.edu>