[Mesa-dev] [PATCH 12/13] mesa: Remove redundant _mesa_has_shader_subroutine
Ian Romanick
idr at freedesktop.org
Wed Aug 24 18:46:20 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
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 at intel.com>
---
src/mesa/main/context.h | 10 ----------
src/mesa/main/program_resource.c | 16 ++++++++--------
src/mesa/main/shaderapi.c | 16 ++++++++--------
3 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 1871388..9a609dd 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -339,16 +339,6 @@ _mesa_has_compute_shaders(const struct gl_context *ctx)
}
/**
- * Checks if the context supports shader subroutines.
- */
-static inline bool
-_mesa_has_shader_subroutine(const struct gl_context *ctx)
-{
- return ctx->API == API_OPENGL_CORE &&
- (ctx->Version >= 40 || ctx->Extensions.ARB_shader_subroutine);
-}
-
-/**
* Checks if the context supports tessellation.
*/
static inline GLboolean
diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c
index f2a9f00..2b3e14a 100644
--- a/src/mesa/main/program_resource.c
+++ b/src/mesa/main/program_resource.c
@@ -49,18 +49,18 @@ supported_interface_enum(struct gl_context *ctx, GLenum iface)
case GL_FRAGMENT_SUBROUTINE:
case GL_VERTEX_SUBROUTINE_UNIFORM:
case GL_FRAGMENT_SUBROUTINE_UNIFORM:
- return _mesa_has_shader_subroutine(ctx);
+ return _mesa_has_ARB_shader_subroutine(ctx);
case GL_GEOMETRY_SUBROUTINE:
case GL_GEOMETRY_SUBROUTINE_UNIFORM:
- return _mesa_has_geometry_shaders(ctx) && _mesa_has_shader_subroutine(ctx);
+ return _mesa_has_geometry_shaders(ctx) && _mesa_has_ARB_shader_subroutine(ctx);
case GL_COMPUTE_SUBROUTINE:
case GL_COMPUTE_SUBROUTINE_UNIFORM:
- return _mesa_has_compute_shaders(ctx) && _mesa_has_shader_subroutine(ctx);
+ return _mesa_has_compute_shaders(ctx) && _mesa_has_ARB_shader_subroutine(ctx);
case GL_TESS_CONTROL_SUBROUTINE:
case GL_TESS_EVALUATION_SUBROUTINE:
case GL_TESS_CONTROL_SUBROUTINE_UNIFORM:
case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM:
- return _mesa_has_tessellation(ctx) && _mesa_has_shader_subroutine(ctx);
+ return _mesa_has_tessellation(ctx) && _mesa_has_ARB_shader_subroutine(ctx);
default:
return false;
}
@@ -419,20 +419,20 @@ _mesa_GetProgramResourceLocation(GLuint program, GLenum programInterface,
case GL_VERTEX_SUBROUTINE_UNIFORM:
case GL_FRAGMENT_SUBROUTINE_UNIFORM:
- if (!_mesa_has_shader_subroutine(ctx))
+ if (!_mesa_has_ARB_shader_subroutine(ctx))
goto fail;
break;
case GL_GEOMETRY_SUBROUTINE_UNIFORM:
- if (!_mesa_has_geometry_shaders(ctx) || !_mesa_has_shader_subroutine(ctx))
+ if (!_mesa_has_geometry_shaders(ctx) || !_mesa_has_ARB_shader_subroutine(ctx))
goto fail;
break;
case GL_COMPUTE_SUBROUTINE_UNIFORM:
- if (!_mesa_has_compute_shaders(ctx) || !_mesa_has_shader_subroutine(ctx))
+ if (!_mesa_has_compute_shaders(ctx) || !_mesa_has_ARB_shader_subroutine(ctx))
goto fail;
break;
case GL_TESS_CONTROL_SUBROUTINE_UNIFORM:
case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM:
- if (!_mesa_has_tessellation(ctx) || !_mesa_has_shader_subroutine(ctx))
+ if (!_mesa_has_tessellation(ctx) || !_mesa_has_ARB_shader_subroutine(ctx))
goto fail;
break;
default:
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 4f29cd9..de7ae5c 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2344,7 +2344,7 @@ _mesa_GetSubroutineUniformLocation(GLuint program, GLenum shadertype,
GLenum resource_type;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return -1;
}
@@ -2379,7 +2379,7 @@ _mesa_GetSubroutineIndex(GLuint program, GLenum shadertype,
GLenum resource_type;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return -1;
}
@@ -2423,7 +2423,7 @@ _mesa_GetActiveSubroutineUniformiv(GLuint program, GLenum shadertype,
GLenum resource_type;
int count, i, j;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
@@ -2509,7 +2509,7 @@ _mesa_GetActiveSubroutineUniformName(GLuint program, GLenum shadertype,
GLenum resource_type;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
@@ -2548,7 +2548,7 @@ _mesa_GetActiveSubroutineName(GLuint program, GLenum shadertype,
GLenum resource_type;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
@@ -2585,7 +2585,7 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
gl_shader_stage stage;
int i;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
@@ -2682,7 +2682,7 @@ _mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location,
struct gl_linked_shader *sh;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
@@ -2729,7 +2729,7 @@ _mesa_GetProgramStageiv(GLuint program, GLenum shadertype,
struct gl_linked_shader *sh;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
--
2.5.5
More information about the mesa-dev
mailing list