diff options
author | Paul Berry <[email protected]> | 2013-11-19 15:55:51 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2013-11-21 18:16:25 -0800 |
commit | 95140740ad1c6cd8a34002c307556f5c49a34589 (patch) | |
tree | 5a81dc207bad0e94c2b30ac06d20cc4e085ec599 /src/mesa/main/fbobject.c | |
parent | 085ad4821e450349ec1ba8c82d4bd0e7dcfef0af (diff) |
mesa: Track number of layers in layered framebuffers.
In order to properly clear layered framebuffers, we need to know how
many layers they have. The easiest way to do this is to record it in
the gl_framebuffer struct when we check framebuffer completeness.
This patch replaces the gl_framebuffer::Layered boolean with a
gl_framebuffer::NumLayers integer, which is 0 if the framebuffer is
not layered, and equal to the number of layers otherwise.
v2: Remove gl_framebuffer::Layered and make gl_framebuffer::NumLayers
always have a defined value. Fix factor of 6 error in the number of
layers in a cube map array.
Cc: "10.0" <[email protected]>
Reviewed-by: Chris Forbes <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r-- | src/mesa/main/fbobject.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 9dd71612f97..e8cf274e973 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -905,6 +905,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_renderbuffer_attachment *att; GLenum f; gl_format attFormat; + GLenum att_tex_target = GL_NONE; /* * XXX for ARB_fbo, only check color buffers that are named by @@ -945,6 +946,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, */ if (att->Type == GL_TEXTURE) { const struct gl_texture_image *texImg = att->Renderbuffer->TexImage; + att_tex_target = att->Texture->Target; minWidth = MIN2(minWidth, texImg->Width); maxWidth = MAX2(maxWidth, texImg->Width); minHeight = MIN2(minHeight, texImg->Height); @@ -1057,7 +1059,14 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, } /* Check that layered rendering is consistent. */ - att_layer_count = att->Layered ? att->Renderbuffer->Depth : 0; + if (att->Layered) { + if (att_tex_target == GL_TEXTURE_CUBE_MAP) + att_layer_count = 6; + else + att_layer_count = att->Renderbuffer->Depth; + } else { + att_layer_count = 0; + } if (!layer_count_valid) { layer_count = att_layer_count; layer_count_valid = true; @@ -1073,7 +1082,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, } } - fb->Layered = layer_count > 0; + fb->NumLayers = layer_count; if (_mesa_is_desktop_gl(ctx) && !ctx->Extensions.ARB_ES2_compatibility) { /* Check that all DrawBuffers are present */ |