diff options
author | Antia Puentes <[email protected]> | 2015-12-19 19:39:53 +0100 |
---|---|---|
committer | Eduardo Lima Mitev <[email protected]> | 2016-03-03 15:14:07 +0100 |
commit | 52c3692324675535105f2d5bbdf2c4cd26e76580 (patch) | |
tree | 5f7db54cc7e3479e1457e371cea3a70bd3e7a6b9 /src/mesa/main/formatquery.c | |
parent | 876f7a7c081dd8261a3d969ec1d76ddac64afcbb (diff) |
mesa/formatquery: Added SHADER_IMAGE_{LOAD,STORE,ATOMIC} <pname> queries
From the ARB_internalformat_query2 specification:
"- SHADER_IMAGE_LOAD: The support for using the resource with image load
operations in shaders is written to <params>.
In this case the <internalformat> is the value of the <format> parameter
that would be passed to BindImageTexture.
- SHADER_IMAGE_STORE: The support for using the resource with image store
operations in shaders is written to <params>.
In this case the <internalformat> is the value of the <format> parameter
that is passed to BindImageTexture.
- SHADER_IMAGE_ATOMIC: The support for using the resource with atomic
memory operations from shaders is written to <params>."
For all of them:
"Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE.
If the resource or operation is not supported, NONE is returned."
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/formatquery.c')
-rw-r--r-- | src/mesa/main/formatquery.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c index b5a072ca42d..f487f32e7f5 100644 --- a/src/mesa/main/formatquery.c +++ b/src/mesa/main/formatquery.c @@ -33,6 +33,7 @@ #include "texobj.h" #include "get.h" #include "genmipmap.h" +#include "shaderimage.h" static bool _is_renderable(struct gl_context *ctx, GLenum internalformat) @@ -607,6 +608,9 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target, case GL_GEOMETRY_TEXTURE: case GL_FRAGMENT_TEXTURE: case GL_COMPUTE_TEXTURE: + case GL_SHADER_IMAGE_LOAD: + case GL_SHADER_IMAGE_STORE: + case GL_SHADER_IMAGE_ATOMIC: params[0] = GL_FULL_SUPPORT; break; @@ -1190,15 +1194,30 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, break; case GL_SHADER_IMAGE_LOAD: - /* @TODO */ - break; - case GL_SHADER_IMAGE_STORE: - /* @TODO */ + if (!_mesa_has_ARB_shader_image_load_store(ctx)) + goto end; + + /* We call to _mesa_is_shader_image_format_supported + * using "internalformat" as parameter, because the + * the ARB_internalformat_query2 spec says: + * "In this case the <internalformat> is the value of the <format> + * parameter that is passed to BindImageTexture." + */ + if (target == GL_RENDERBUFFER || + !_mesa_is_shader_image_format_supported(ctx, internalformat)) + goto end; + + ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_SHADER_IMAGE_ATOMIC: - /* @TODO */ + if (!_mesa_has_ARB_shader_image_load_store(ctx)) + goto end; + + ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_IMAGE_TEXEL_SIZE: |