summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2015-12-21 18:55:56 +0100
committerEduardo Lima Mitev <[email protected]>2016-03-03 15:14:07 +0100
commite8ab7727e1cb359be565b9d3dace1c0490e452ad (patch)
tree7980d02f917150f1fe215f32e264322732622300 /src/mesa/main
parentb4ee9f56fd8e457c91a85bcebb124b088edee76e (diff)
mesa/formatquery: Added framebuffer renderability related queries
From the ARB_internalformat_query2 specification: "- FRAMEBUFFER_RENDERABLE: The support for rendering to the resource via framebuffer attachment is returned in <params>. - FRAMEBUFFER_RENDERABLE_LAYERED: The support for layered rendering to the resource via framebuffer attachment is returned in <params>. - FRAMEBUFFER_BLEND: The support for rendering to the resource via framebuffer attachment when blending is enabled is returned in <params>." For all of them, "Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource is unsupported, NONE is returned." Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/formatquery.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index e4ddb94978c..e7645b161ee 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -573,6 +573,23 @@ _is_internalformat_supported(struct gl_context *ctx, GLenum target,
return (buffer[0] == GL_TRUE);
}
+static bool
+_legal_target_for_framebuffer_texture_layer(struct gl_context *ctx,
+ GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_3D:
+ case GL_TEXTURE_1D_ARRAY:
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ case GL_TEXTURE_CUBE_MAP:
+ return true;
+ default:
+ return false;
+ }
+}
+
/* default implementation of QueryInternalFormat driverfunc, for
* drivers not implementing ARB_internalformat_query2.
*/
@@ -622,6 +639,9 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
case GL_TEXTURE_SHADOW:
case GL_TEXTURE_GATHER:
case GL_TEXTURE_GATHER_SHADOW:
+ case GL_FRAMEBUFFER_RENDERABLE:
+ case GL_FRAMEBUFFER_RENDERABLE_LAYERED:
+ case GL_FRAMEBUFFER_BLEND:
params[0] = GL_FULL_SUPPORT;
break;
@@ -1050,16 +1070,22 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
buffer[0] = GL_TRUE;
break;
+ case GL_FRAMEBUFFER_RENDERABLE_LAYERED:
+ if (!_mesa_has_EXT_texture_array(ctx) ||
+ _legal_target_for_framebuffer_texture_layer(ctx, target))
+ goto end;
+ /* fallthrough */
case GL_FRAMEBUFFER_RENDERABLE:
- /* @TODO */
- break;
+ case GL_FRAMEBUFFER_BLEND:
+ if (!_mesa_has_ARB_framebuffer_object(ctx))
+ goto end;
- case GL_FRAMEBUFFER_RENDERABLE_LAYERED:
- /* @TODO */
- break;
+ if (target == GL_TEXTURE_BUFFER ||
+ !_is_renderable(ctx, internalformat))
+ goto end;
- case GL_FRAMEBUFFER_BLEND:
- /* @TODO */
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
break;
case GL_READ_PIXELS: