summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-07-18 12:20:12 +0200
committerSamuel Pitoiset <[email protected]>2017-07-31 13:53:39 +0200
commitc95bf616a8924c7d38603ea7f81ac8a051c38f23 (patch)
treed28d4f1822a7ba9017a42e7baf48a7a977270b78 /src/mesa
parent667a6e812283fa3f2db84ca06197cdf6f58f0c6d (diff)
mesa: add program_parameteri() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/shaderapi.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 924423ee692..63aec08d0c6 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2141,17 +2141,10 @@ _mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
}
-void GLAPIENTRY
-_mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
+static ALWAYS_INLINE void
+program_parameteri(struct gl_context *ctx, struct gl_shader_program *shProg,
+ GLuint pname, GLint value, bool no_error)
{
- struct gl_shader_program *shProg;
- GET_CURRENT_CONTEXT(ctx);
-
- shProg = _mesa_lookup_shader_program_err(ctx, program,
- "glProgramParameteri");
- if (!shProg)
- return;
-
switch (pname) {
case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
/* This enum isn't part of the OES extension for OpenGL ES 2.0, but it
@@ -2167,7 +2160,7 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
* "An INVALID_VALUE error is generated if the <value> argument to
* ProgramParameteri is not TRUE or FALSE."
*/
- if (value != GL_TRUE && value != GL_FALSE) {
+ if (!no_error && value != GL_TRUE && value != GL_FALSE) {
goto invalid_value;
}
@@ -2198,15 +2191,17 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
/* Spec imply that the behavior is the same as ARB_get_program_binary
* Chapter 7.3 Program Objects
*/
- if (value != GL_TRUE && value != GL_FALSE) {
+ if (!no_error && value != GL_TRUE && value != GL_FALSE) {
goto invalid_value;
}
shProg->SeparateShader = value;
return;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)",
- _mesa_enum_to_string(pname));
+ if (!no_error) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)",
+ _mesa_enum_to_string(pname));
+ }
return;
}
@@ -2219,6 +2214,21 @@ invalid_value:
}
+void GLAPIENTRY
+_mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+ struct gl_shader_program *shProg;
+ GET_CURRENT_CONTEXT(ctx);
+
+ shProg = _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramParameteri");
+ if (!shProg)
+ return;
+
+ program_parameteri(ctx, shProg, pname, value, false);
+}
+
+
void
_mesa_use_program(struct gl_context *ctx, gl_shader_stage stage,
struct gl_shader_program *shProg, struct gl_program *prog,