From: Gregory Hainaut Date: Fri, 3 May 2013 17:44:05 +0000 (+0200) Subject: mesa/sso: Add extension entry points for GL_ARB_separate_shader_objects X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=73b78f9c9f86dd38fb165f4730aeac9519635b07;p=mesa.git mesa/sso: Add extension entry points for GL_ARB_separate_shader_objects 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 Reviewed-by: Jordan Justen --- diff --git a/src/mapi/glapi/gen/ARB_separate_shader_objects.xml b/src/mapi/glapi/gen/ARB_separate_shader_objects.xml new file mode 100644 index 00000000000..f996456ef31 --- /dev/null +++ b/src/mapi/glapi/gen/ARB_separate_shader_objects.xml @@ -0,0 +1,401 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am index 9e6fe52612f..7b3c118f043 100644 --- a/src/mapi/glapi/gen/Makefile.am +++ b/src/mapi/glapi/gen/Makefile.am @@ -113,6 +113,7 @@ API_XML = \ ARB_sample_shading.xml \ ARB_sampler_objects.xml \ ARB_seamless_cube_map.xml \ + ARB_separate_shader_objects.xml \ ARB_shader_atomic_counters.xml \ ARB_shader_image_load_store.xml \ ARB_sync.xml \ diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 4ef754d5c9d..c710ea8c81f 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8275,7 +8275,11 @@ - + + + + + diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index 1765a51ad26..4609193977d 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -86,6 +86,7 @@ header = """/** #include "main/multisample.h" #include "main/objectlabel.h" #include "main/performance_monitor.h" +#include "main/pipelineobj.h" #include "main/pixel.h" #include "main/pixelstore.h" #include "main/points.h" diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 1ce94deaa07..f6f4062a491 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -69,6 +69,7 @@ MAIN_FILES = \ $(SRCDIR)main/pack.c \ $(SRCDIR)main/pbo.c \ $(SRCDIR)main/performance_monitor.c \ + $(SRCDIR)main/pipelineobj.c \ $(SRCDIR)main/pixel.c \ $(SRCDIR)main/pixelstore.c \ $(SRCDIR)main/pixeltransfer.c \ diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c new file mode 100644 index 00000000000..74546197ae8 --- /dev/null +++ b/src/mesa/main/pipelineobj.c @@ -0,0 +1,133 @@ +/* + * Mesa 3-D graphics library + * + * Copyright © 2013 Gregory Hainaut + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * \file pipelineobj.c + * \author Hainaut Gregory + * + * Implementation of pipeline object related API functions. Based on + * GL_ARB_separate_shader_objects extension. + * + */ + +#include "main/glheader.h" +#include "main/context.h" +#include "main/dispatch.h" +#include "main/enums.h" +#include "main/hash.h" +#include "main/mtypes.h" +#include "main/pipelineobj.h" +#include "main/shaderapi.h" +#include "main/shaderobj.h" +#include "main/transformfeedback.h" +#include "main/uniforms.h" +#include "program/program.h" +#include "program/prog_parameter.h" +#include "ralloc.h" +#include +#include "../glsl/glsl_parser_extras.h" +#include "../glsl/ir_uniform.h" + + +/** + * Bound program to severals stages of the pipeline + */ +void GLAPIENTRY +_mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) +{ +} + +/** + * Use the named shader program for subsequent glUniform calls (if pipeline + * bound) + */ +void GLAPIENTRY +_mesa_ActiveShaderProgram(GLuint pipeline, GLuint program) +{ +} + +/** + * Make program of the pipeline current + */ +void GLAPIENTRY +_mesa_BindProgramPipeline(GLuint pipeline) +{ +} + +/** + * Delete a set of pipeline objects. + * + * \param n Number of pipeline objects to delete. + * \param ids pipeline of \c n pipeline object IDs. + */ +void GLAPIENTRY +_mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines) +{ +} + +/** + * Generate a set of unique pipeline object IDs and store them in \c pipelines. + * \param n Number of IDs to generate. + * \param pipelines pipeline of \c n locations to store the IDs. + */ +void GLAPIENTRY +_mesa_GenProgramPipelines(GLsizei n, GLuint *pipelines) +{ +} + +/** + * Determine if ID is the name of an pipeline object. + * + * \param id ID of the potential pipeline object. + * \return \c GL_TRUE if \c id is the name of a pipeline object, + * \c GL_FALSE otherwise. + */ +GLboolean GLAPIENTRY +_mesa_IsProgramPipeline(GLuint pipeline) +{ + return GL_FALSE; +} + +/** + * glGetProgramPipelineiv() - get pipeline shader state. + */ +void GLAPIENTRY +_mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params) +{ +} + +/** + * Check compatibility of pipeline's program + */ +void GLAPIENTRY +_mesa_ValidateProgramPipeline(GLuint pipeline) +{ +} + +void GLAPIENTRY +_mesa_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, + GLsizei *length, GLchar *infoLog) +{ +} diff --git a/src/mesa/main/pipelineobj.h b/src/mesa/main/pipelineobj.h new file mode 100644 index 00000000000..56d32ccef74 --- /dev/null +++ b/src/mesa/main/pipelineobj.h @@ -0,0 +1,70 @@ +/* + * Mesa 3-D graphics library + * + * Copyright © 2013 Gregory Hainaut + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef PIPELINEOBJ_H +#define PIPELINEOBJ_H + +#include "glheader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _glapi_table; +struct gl_context; + +extern void GLAPIENTRY +_mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program); + +extern void GLAPIENTRY +_mesa_ActiveShaderProgram(GLuint pipeline, GLuint program); + +extern void GLAPIENTRY +_mesa_BindProgramPipeline(GLuint pipeline); + +extern void GLAPIENTRY +_mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines); + +extern void GLAPIENTRY +_mesa_GenProgramPipelines(GLsizei n, GLuint *pipelines); + +extern GLboolean GLAPIENTRY +_mesa_IsProgramPipeline(GLuint pipeline); + +extern void GLAPIENTRY +_mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_ValidateProgramPipeline(GLuint pipeline); + +extern void GLAPIENTRY +_mesa_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, + GLsizei *length, GLchar *infoLog); + +#ifdef __cplusplus +} +#endif + +#endif /* PIPELINEOBJ_H */ diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index bf138149087..3c946fe028c 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1883,3 +1883,14 @@ _mesa_copy_linked_program_data(gl_shader_stage type, break; } } + + +/** + * ARB_separate_shader_objects: Compile & Link Program + */ +GLuint GLAPIENTRY +_mesa_CreateShaderProgramv(GLenum type, GLsizei count, + const GLchar* const *strings) +{ + return 0; +} diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h index 10f810caf5e..109a802d104 100644 --- a/src/mesa/main/shaderapi.h +++ b/src/mesa/main/shaderapi.h @@ -219,6 +219,11 @@ extern bool _mesa_validate_shader_target(const struct gl_context *ctx, GLenum type); +/* GL_ARB_separate_shader_objects */ +extern GLuint GLAPIENTRY +_mesa_CreateShaderProgramv(GLenum type, GLsizei count, + const GLchar* const *strings); + #ifdef __cplusplus } #endif diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index d8969e268b9..117a57096a9 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -716,66 +716,66 @@ const struct function gl_core_functions_possible[] = { { "glGetProgramBinary", 43, -1 }, { "glProgramBinary", 43, -1 }, { "glProgramParameteri", 43, -1 }, -// { "glUseProgramStages", 43, -1 }, // XXX: Add to xml -// { "glActiveShaderProgram", 43, -1 }, // XXX: Add to xml -// { "glCreateShaderProgramv", 43, -1 }, // XXX: Add to xml -// { "glBindProgramPipeline", 43, -1 }, // XXX: Add to xml -// { "glDeleteProgramPipelines", 43, -1 }, // XXX: Add to xml -// { "glGenProgramPipelines", 43, -1 }, // XXX: Add to xml -// { "glIsProgramPipeline", 43, -1 }, // XXX: Add to xml -// { "glGetProgramPipelineiv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform1i", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform1iv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform1f", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform1fv", 43, -1 }, // XXX: Add to xml + { "glUseProgramStages", 43, -1 }, + { "glActiveShaderProgram", 43, -1 }, + { "glCreateShaderProgramv", 43, -1 }, + { "glBindProgramPipeline", 43, -1 }, + { "glDeleteProgramPipelines", 43, -1 }, + { "glGenProgramPipelines", 43, -1 }, + { "glIsProgramPipeline", 43, -1 }, + { "glGetProgramPipelineiv", 43, -1 }, + { "glProgramUniform1i", 43, -1 }, + { "glProgramUniform1iv", 43, -1 }, + { "glProgramUniform1f", 43, -1 }, + { "glProgramUniform1fv", 43, -1 }, // { "glProgramUniform1d", 43, -1 }, // XXX: Add to xml // { "glProgramUniform1dv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform1ui", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform1uiv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform2i", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform2iv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform2f", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform2fv", 43, -1 }, // XXX: Add to xml + { "glProgramUniform1ui", 43, -1 }, + { "glProgramUniform1uiv", 43, -1 }, + { "glProgramUniform2i", 43, -1 }, + { "glProgramUniform2iv", 43, -1 }, + { "glProgramUniform2f", 43, -1 }, + { "glProgramUniform2fv", 43, -1 }, // { "glProgramUniform2d", 43, -1 }, // XXX: Add to xml // { "glProgramUniform2dv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform2ui", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform2uiv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform3i", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform3iv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform3f", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform3fv", 43, -1 }, // XXX: Add to xml + { "glProgramUniform2ui", 43, -1 }, + { "glProgramUniform2uiv", 43, -1 }, + { "glProgramUniform3i", 43, -1 }, + { "glProgramUniform3iv", 43, -1 }, + { "glProgramUniform3f", 43, -1 }, + { "glProgramUniform3fv", 43, -1 }, // { "glProgramUniform3d", 43, -1 }, // XXX: Add to xml // { "glProgramUniform3dv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform3ui", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform3uiv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform4i", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform4iv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform4f", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform4fv", 43, -1 }, // XXX: Add to xml + { "glProgramUniform3ui", 43, -1 }, + { "glProgramUniform3uiv", 43, -1 }, + { "glProgramUniform4i", 43, -1 }, + { "glProgramUniform4iv", 43, -1 }, + { "glProgramUniform4f", 43, -1 }, + { "glProgramUniform4fv", 43, -1 }, // { "glProgramUniform4d", 43, -1 }, // XXX: Add to xml // { "glProgramUniform4dv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform4ui", 43, -1 }, // XXX: Add to xml -// { "glProgramUniform4uiv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix2fv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix3fv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix4fv", 43, -1 }, // XXX: Add to xml + { "glProgramUniform4ui", 43, -1 }, + { "glProgramUniform4uiv", 43, -1 }, + { "glProgramUniformMatrix2fv", 43, -1 }, + { "glProgramUniformMatrix3fv", 43, -1 }, + { "glProgramUniformMatrix4fv", 43, -1 }, // { "glProgramUniformMatrix2dv", 43, -1 }, // XXX: Add to xml // { "glProgramUniformMatrix3dv", 43, -1 }, // XXX: Add to xml // { "glProgramUniformMatrix4dv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix2x3fv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix3x2fv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix2x4fv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix4x2fv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix3x4fv", 43, -1 }, // XXX: Add to xml -// { "glProgramUniformMatrix4x3fv", 43, -1 }, // XXX: Add to xml + { "glProgramUniformMatrix2x3fv", 43, -1 }, + { "glProgramUniformMatrix3x2fv", 43, -1 }, + { "glProgramUniformMatrix2x4fv", 43, -1 }, + { "glProgramUniformMatrix4x2fv", 43, -1 }, + { "glProgramUniformMatrix3x4fv", 43, -1 }, + { "glProgramUniformMatrix4x3fv", 43, -1 }, // { "glProgramUniformMatrix2x3dv", 43, -1 }, // XXX: Add to xml // { "glProgramUniformMatrix3x2dv", 43, -1 }, // XXX: Add to xml // { "glProgramUniformMatrix2x4dv", 43, -1 }, // XXX: Add to xml // { "glProgramUniformMatrix4x2dv", 43, -1 }, // XXX: Add to xml // { "glProgramUniformMatrix3x4dv", 43, -1 }, // XXX: Add to xml // { "glProgramUniformMatrix4x3dv", 43, -1 }, // XXX: Add to xml -// { "glValidateProgramPipeline", 43, -1 }, // XXX: Add to xml -// { "glGetProgramPipelineInfoLog", 43, -1 }, // XXX: Add to xml + { "glValidateProgramPipeline", 43, -1 }, + { "glGetProgramPipelineInfoLog", 43, -1 }, // { "glVertexAttribL1d", 43, -1 }, // XXX: Add to xml // { "glVertexAttribL2d", 43, -1 }, // XXX: Add to xml // { "glVertexAttribL3d", 43, -1 }, // XXX: Add to xml diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 071d668f3bd..4c123660f59 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -270,6 +270,203 @@ _mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value) _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_INT_VEC4); } +/** Same as above with direct state access **/ +void GLAPIENTRY +_mesa_ProgramUniform1f(GLuint program, GLint location, GLfloat v0) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform1f"); + _mesa_uniform(ctx, shProg, location, 1, &v0, GL_FLOAT); +} + +void GLAPIENTRY +_mesa_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat v[2]; + v[0] = v0; + v[1] = v1; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform2f"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC2); +} + +void GLAPIENTRY +_mesa_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, + GLfloat v2) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat v[3]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform3f"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC3); +} + +void GLAPIENTRY +_mesa_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, + GLfloat v2, GLfloat v3) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat v[4]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + v[3] = v3; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform4f"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC4); +} + +void GLAPIENTRY +_mesa_ProgramUniform1i(GLuint program, GLint location, GLint v0) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform1i"); + _mesa_uniform(ctx, shProg, location, 1, &v0, GL_INT); +} + +void GLAPIENTRY +_mesa_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) +{ + GET_CURRENT_CONTEXT(ctx); + GLint v[2]; + v[0] = v0; + v[1] = v1; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform2i"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC2); +} + +void GLAPIENTRY +_mesa_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, + GLint v2) +{ + GET_CURRENT_CONTEXT(ctx); + GLint v[3]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform3i"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC3); +} + +void GLAPIENTRY +_mesa_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, + GLint v2, GLint v3) +{ + GET_CURRENT_CONTEXT(ctx); + GLint v[4]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + v[3] = v3; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform4i"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC4); +} + +void GLAPIENTRY +_mesa_ProgramUniform1fv(GLuint program, GLint location, GLsizei count, + const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform1fv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT); +} + +void GLAPIENTRY +_mesa_ProgramUniform2fv(GLuint program, GLint location, GLsizei count, + const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform2fv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC2); +} + +void GLAPIENTRY +_mesa_ProgramUniform3fv(GLuint program, GLint location, GLsizei count, + const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform3fv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC3); +} + +void GLAPIENTRY +_mesa_ProgramUniform4fv(GLuint program, GLint location, GLsizei count, + const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform4fv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC4); +} + +void GLAPIENTRY +_mesa_ProgramUniform1iv(GLuint program, GLint location, GLsizei count, + const GLint * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform1iv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_INT); +} + +void GLAPIENTRY +_mesa_ProgramUniform2iv(GLuint program, GLint location, GLsizei count, + const GLint * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform2iv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC2); +} + +void GLAPIENTRY +_mesa_ProgramUniform3iv(GLuint program, GLint location, GLsizei count, + const GLint * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform3iv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC3); +} + +void GLAPIENTRY +_mesa_ProgramUniform4iv(GLuint program, GLint location, GLsizei count, + const GLint * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform4iv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC4); +} + /** OpenGL 3.0 GLuint-valued functions **/ void GLAPIENTRY @@ -369,6 +566,141 @@ _mesa_UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, 4, 4, location, count, transpose, value); } +/** Same as above with direct state access **/ + +void GLAPIENTRY +_mesa_ProgramUniform1ui(GLuint program, GLint location, GLuint v0) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform1ui"); + _mesa_uniform(ctx, shProg, location, 1, &v0, GL_UNSIGNED_INT); +} + +void GLAPIENTRY +_mesa_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint v[2]; + v[0] = v0; + v[1] = v1; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform2ui"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC2); +} + +void GLAPIENTRY +_mesa_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, + GLuint v2) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint v[3]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform3ui"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC3); +} + +void GLAPIENTRY +_mesa_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, + GLuint v2, GLuint v3) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint v[4]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + v[3] = v3; + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform4ui"); + _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC4); +} + +void GLAPIENTRY +_mesa_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count, + const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform1uiv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT); +} + +void GLAPIENTRY +_mesa_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count, + const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform2uiv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC2); +} + +void GLAPIENTRY +_mesa_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count, + const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform3uiv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC3); +} + +void GLAPIENTRY +_mesa_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count, + const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniform4uiv"); + _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC4); +} + + + +void GLAPIENTRY +_mesa_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix2fv"); + _mesa_uniform_matrix(ctx, shProg, 2, 2, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix3fv"); + _mesa_uniform_matrix(ctx, shProg, 3, 3, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix4fv"); + _mesa_uniform_matrix(ctx, shProg, 4, 4, location, count, transpose, value); +} + /** * Non-square UniformMatrix are OpenGL 2.1 @@ -427,6 +759,74 @@ _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, 4, 3, location, count, transpose, value); } +/** Same as above with direct state access **/ + +void GLAPIENTRY +_mesa_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix2x3fv"); + _mesa_uniform_matrix(ctx, shProg, 2, 3, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix3x2fv"); + _mesa_uniform_matrix(ctx, shProg, 3, 2, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix2x4fv"); + _mesa_uniform_matrix(ctx, shProg, 2, 4, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix4x2fv"); + _mesa_uniform_matrix(ctx, shProg, 4, 2, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix3x4fv"); + _mesa_uniform_matrix(ctx, shProg, 3, 4, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, + "glProgramUniformMatrix4x3fv"); + _mesa_uniform_matrix(ctx, shProg, 4, 3, location, count, transpose, value); +} + void GLAPIENTRY _mesa_GetnUniformfvARB(GLhandleARB program, GLint location, diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h index f7cac63286b..bd50fd9b84d 100644 --- a/src/mesa/main/uniforms.h +++ b/src/mesa/main/uniforms.h @@ -111,6 +111,89 @@ _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, void GLAPIENTRY _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + +void GLAPIENTRY +_mesa_ProgramUniform1f(GLuint program, GLint, GLfloat); +void GLAPIENTRY +_mesa_ProgramUniform2f(GLuint program, GLint, GLfloat, GLfloat); +void GLAPIENTRY +_mesa_ProgramUniform3f(GLuint program, GLint, GLfloat, GLfloat, GLfloat); +void GLAPIENTRY +_mesa_ProgramUniform4f(GLuint program, GLint, GLfloat, GLfloat, GLfloat, GLfloat); +void GLAPIENTRY +_mesa_ProgramUniform1i(GLuint program, GLint, GLint); +void GLAPIENTRY +_mesa_ProgramUniform2i(GLuint program, GLint, GLint, GLint); +void GLAPIENTRY +_mesa_ProgramUniform3i(GLuint program, GLint, GLint, GLint, GLint); +void GLAPIENTRY +_mesa_ProgramUniform4i(GLuint program, GLint, GLint, GLint, GLint, GLint); +void GLAPIENTRY +_mesa_ProgramUniform1fv(GLuint program, GLint, GLsizei, const GLfloat *); +void GLAPIENTRY +_mesa_ProgramUniform2fv(GLuint program, GLint, GLsizei, const GLfloat *); +void GLAPIENTRY +_mesa_ProgramUniform3fv(GLuint program, GLint, GLsizei, const GLfloat *); +void GLAPIENTRY +_mesa_ProgramUniform4fv(GLuint program, GLint, GLsizei, const GLfloat *); +void GLAPIENTRY +_mesa_ProgramUniform1iv(GLuint program, GLint, GLsizei, const GLint *); +void GLAPIENTRY +_mesa_ProgramUniform2iv(GLuint program, GLint, GLsizei, const GLint *); +void GLAPIENTRY +_mesa_ProgramUniform3iv(GLuint program, GLint, GLsizei, const GLint *); +void GLAPIENTRY +_mesa_ProgramUniform4iv(GLuint program, GLint, GLsizei, const GLint *); +void GLAPIENTRY +_mesa_ProgramUniform1ui(GLuint program, GLint location, GLuint v0); +void GLAPIENTRY +_mesa_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1); +void GLAPIENTRY +_mesa_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, + GLuint v2); +void GLAPIENTRY +_mesa_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, + GLuint v2, GLuint v3); +void GLAPIENTRY +_mesa_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count, + const GLuint *value); +void GLAPIENTRY +_mesa_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count, + const GLuint *value); +void GLAPIENTRY +_mesa_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count, + const GLuint *value); +void GLAPIENTRY +_mesa_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count, + const GLuint *value); +void GLAPIENTRY +_mesa_ProgramUniformMatrix2fv(GLuint program, GLint, GLsizei, GLboolean, + const GLfloat *); +void GLAPIENTRY +_mesa_ProgramUniformMatrix3fv(GLuint program, GLint, GLsizei, GLboolean, + const GLfloat *); +void GLAPIENTRY +_mesa_ProgramUniformMatrix4fv(GLuint program, GLint, GLsizei, GLboolean, + const GLfloat *); +void GLAPIENTRY +_mesa_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat *value); +void GLAPIENTRY +_mesa_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat *value); +void GLAPIENTRY +_mesa_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat *value); +void GLAPIENTRY +_mesa_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat *value); +void GLAPIENTRY +_mesa_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat *value); +void GLAPIENTRY +_mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, + GLboolean transpose, const GLfloat *value); + void GLAPIENTRY _mesa_GetnUniformfvARB(GLhandleARB, GLint, GLsizei, GLfloat *); void GLAPIENTRY