diff options
author | Francisco Jerez <[email protected]> | 2013-11-25 10:11:59 -0800 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2014-01-15 16:42:08 +0100 |
commit | 902f9df36bec7d67a2d8bc4c24d89d9d57964903 (patch) | |
tree | 7253736f117490eac978569d56544e9ae1eae35b | |
parent | eb0de7c4321cf3424b5e50e130151100c8ec20b3 (diff) |
mesa: Add image parameter queries for ARB_shader_image_load_store.
v2: Fix off-by-one error in index parameter bound checking.
Reviewed-by: Chris Forbes <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
-rw-r--r-- | src/mesa/main/get.c | 70 | ||||
-rw-r--r-- | src/mesa/main/get_hash_params.py | 9 | ||||
-rw-r--r-- | src/mesa/main/texparam.c | 6 |
3 files changed, 85 insertions, 0 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 6e55e995650..b13f9a3dba6 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -145,6 +145,7 @@ enum value_extra { EXTRA_GLSL_130, EXTRA_EXT_UBO_GS4, EXTRA_EXT_ATOMICS_GS4, + EXTRA_EXT_SHADER_IMAGE_GS4, }; #define NO_EXTRA NULL @@ -344,6 +345,11 @@ static const int extra_ARB_shader_atomic_counters_and_geometry_shader[] = { EXTRA_END }; +static const int extra_ARB_shader_image_load_store_and_geometry_shader[] = { + EXTRA_EXT_SHADER_IMAGE_GS4, + EXTRA_END +}; + EXTRA_EXT(ARB_texture_cube_map); EXTRA_EXT(EXT_texture_array); EXTRA_EXT(NV_fog_distance); @@ -382,6 +388,7 @@ EXTRA_EXT(ARB_texture_multisample); EXTRA_EXT(ARB_texture_gather); EXTRA_EXT(ARB_shader_atomic_counters); EXTRA_EXT(ARB_draw_indirect); +EXTRA_EXT(ARB_shader_image_load_store); static const int extra_ARB_color_buffer_float_or_glcore[] = { @@ -1071,6 +1078,11 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d api_found = (ctx->Extensions.ARB_shader_atomic_counters && _mesa_has_geometry_shaders(ctx)); break; + case EXTRA_EXT_SHADER_IMAGE_GS4: + api_check = GL_TRUE; + api_found = (ctx->Extensions.ARB_shader_image_load_store && + _mesa_has_geometry_shaders(ctx)); + break; case EXTRA_END: break; default: /* *e is a offset into the extension struct */ @@ -1811,6 +1823,64 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) goto invalid_value; v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride; + + /* ARB_shader_image_load_store */ + case GL_IMAGE_BINDING_NAME: { + struct gl_texture_object *t; + + if (!ctx->Extensions.ARB_shader_image_load_store) + goto invalid_enum; + if (index >= ctx->Const.MaxImageUnits) + goto invalid_value; + + t = ctx->ImageUnits[index].TexObj; + v->value_int = (t ? t->Name : 0); + return TYPE_INT; + } + + case GL_IMAGE_BINDING_LEVEL: + if (!ctx->Extensions.ARB_shader_image_load_store) + goto invalid_enum; + if (index >= ctx->Const.MaxImageUnits) + goto invalid_value; + + v->value_int = ctx->ImageUnits[index].Level; + return TYPE_INT; + + case GL_IMAGE_BINDING_LAYERED: + if (!ctx->Extensions.ARB_shader_image_load_store) + goto invalid_enum; + if (index >= ctx->Const.MaxImageUnits) + goto invalid_value; + + v->value_int = ctx->ImageUnits[index].Layered; + return TYPE_INT; + + case GL_IMAGE_BINDING_LAYER: + if (!ctx->Extensions.ARB_shader_image_load_store) + goto invalid_enum; + if (index >= ctx->Const.MaxImageUnits) + goto invalid_value; + + v->value_int = ctx->ImageUnits[index].Layer; + return TYPE_INT; + + case GL_IMAGE_BINDING_ACCESS: + if (!ctx->Extensions.ARB_shader_image_load_store) + goto invalid_enum; + if (index >= ctx->Const.MaxImageUnits) + goto invalid_value; + + v->value_int = ctx->ImageUnits[index].Access; + return TYPE_INT; + + case GL_IMAGE_BINDING_FORMAT: + if (!ctx->Extensions.ARB_shader_image_load_store) + goto invalid_enum; + if (index >= ctx->Const.MaxImageUnits) + goto invalid_value; + + v->value_int = ctx->ImageUnits[index].Format; return TYPE_INT; } diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 7f025a98093..6195d630d1e 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -742,6 +742,15 @@ descriptor=[ # GL_ARB_vertex_attrib_binding [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", "CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ], [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ], + +# GL_ARB_shader_image_load_store + [ "MAX_IMAGE_UNITS", "CONTEXT_INT(Const.MaxImageUnits), extra_ARB_shader_image_load_store"], + [ "MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS", "CONTEXT_INT(Const.MaxCombinedImageUnitsAndFragmentOutputs), extra_ARB_shader_image_load_store"], + [ "MAX_IMAGE_SAMPLES", "CONTEXT_INT(Const.MaxImageSamples), extra_ARB_shader_image_load_store"], + [ "MAX_VERTEX_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxImageUniforms), extra_ARB_shader_image_load_store"], + [ "MAX_GEOMETRY_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms), extra_ARB_shader_image_load_store_and_geometry_shader"], + [ "MAX_FRAGMENT_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms), extra_ARB_shader_image_load_store"], + [ "MAX_COMBINED_IMAGE_UNIFORMS", "CONTEXT_INT(Const.MaxCombinedImageUniforms), extra_ARB_shader_image_load_store"], ]}, # Enums restricted to OpenGL Core profile diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 94e498d2071..7c59d119ffd 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -1808,6 +1808,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) *params = obj->Sampler.sRGBDecode; break; + case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE: + if (!ctx->Extensions.ARB_shader_image_load_store) + goto invalid_pname; + *params = obj->ImageFormatCompatibilityType; + break; + default: goto invalid_pname; } |