From aa228eb1a69b2b367583878f440423229d4d1ac3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 19 Aug 2016 13:44:01 +0100 Subject: [PATCH] mesa: Remove redundant _mesa_has_shader_subroutine 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 Reviewed-by: Nanley Chery --- 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 187138897be..9a609dd61ff 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -338,16 +338,6 @@ _mesa_has_compute_shaders(const struct gl_context *ctx) (ctx->API == API_OPENGLES2 && ctx->Version >= 31); } -/** - * 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. */ diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c index 5726ce10a16..19aaf48f984 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; } @@ -514,20 +514,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 d9699555497..4ebc39febbb 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; } @@ -2584,7 +2584,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; } @@ -2667,7 +2667,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; } @@ -2709,7 +2709,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.30.2