summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2015-05-06 09:36:15 +0300
committerTapani Pälli <[email protected]>2015-05-06 11:12:01 +0300
commit818cc90535404d76b69b22145f203106491d86a2 (patch)
tree520b13f251339d647e51160ade5cbd3cd3ce8f84 /src/mesa/main/shader_query.cpp
parent3706e5dbc96aa9cc29c58dad661aa10f20574503 (diff)
mesa: support compute stage in _mesa_program_resource_prop
Increases pass rate of ES31-CTS.*program_interface_query* tests when run with MESA_EXTENSION_OVERRIDE='GL_ARB_compute_shader'. Many of the negative tests that happen to use compute stage in queries start passing. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Martin Peres <[email protected]>
Diffstat (limited to 'src/mesa/main/shader_query.cpp')
-rw-r--r--src/mesa/main/shader_query.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index d2ca49b43a7..6e46553724b 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -809,6 +809,8 @@ stage_from_enum(GLenum ref)
return MESA_SHADER_GEOMETRY;
case GL_REFERENCED_BY_FRAGMENT_SHADER:
return MESA_SHADER_FRAGMENT;
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+ return MESA_SHADER_COMPUTE;
default:
assert(!"shader stage not supported");
return MESA_SHADER_STAGES;
@@ -824,6 +826,10 @@ is_resource_referenced(struct gl_shader_program *shProg,
struct gl_program_resource *res,
GLuint index, uint8_t stage)
{
+ /* First, check if we even have such a stage active. */
+ if (!shProg->_LinkedShaders[stage])
+ return false;
+
if (res->Type == GL_ATOMIC_COUNTER_BUFFER)
return RESOURCE_ATC(res)->StageReferences[stage];
@@ -979,6 +985,9 @@ _mesa_program_resource_prop(struct gl_shader_program *shProg,
case GL_NUM_ACTIVE_VARIABLES:
case GL_ACTIVE_VARIABLES:
return get_buffer_property(shProg, res, prop, val, caller);
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+ if (!ctx->Extensions.ARB_compute_shader)
+ goto invalid_enum;
case GL_REFERENCED_BY_VERTEX_SHADER:
case GL_REFERENCED_BY_GEOMETRY_SHADER:
case GL_REFERENCED_BY_FRAGMENT_SHADER:
@@ -1015,17 +1024,18 @@ _mesa_program_resource_prop(struct gl_shader_program *shProg,
case GL_IS_PER_PATCH:
case GL_REFERENCED_BY_TESS_CONTROL_SHADER:
case GL_REFERENCED_BY_TESS_EVALUATION_SHADER:
- /* GL_ARB_compute_shader */
- case GL_REFERENCED_BY_COMPUTE_SHADER:
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(%s prop %s)", caller,
- _mesa_lookup_enum_by_nr(res->Type),
- _mesa_lookup_enum_by_nr(prop));
- return 0;
+ goto invalid_enum;
}
#undef VALIDATE_TYPE
+invalid_enum:
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(%s prop %s)", caller,
+ _mesa_lookup_enum_by_nr(res->Type),
+ _mesa_lookup_enum_by_nr(prop));
+ return 0;
+
invalid_operation:
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(%s prop %s)", caller,
_mesa_lookup_enum_by_nr(res->Type),