Mesa (master): main: check texture target when validating layered framebuffers.

Paul Berry stereotype441 at kemper.freedesktop.org
Fri Jan 10 14:07:11 UTC 2014


Module: Mesa
Branch: master
Commit: 28af1dc21772d0b7819dff6080484c67114dc0d1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=28af1dc21772d0b7819dff6080484c67114dc0d1

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Tue Nov 19 19:01:37 2013 -0800

main: check texture target when validating layered framebuffers.

>From section 4.4.4 (Framebuffer Completeness) of the GL 3.2 spec:

    If any framebuffer attachment is layered, all populated
    attachments must be layered. Additionally, all populated color
    attachments must be from textures of the same target.

We weren't checking that the attachments were from textures of the
same target.

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

---

 src/mesa/main/fbobject.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index d846808..7ecc48e 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -877,8 +877,9 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
    GLint fixedSampleLocations = -1;
    GLint i;
    GLuint j;
-   bool layer_count_valid = false;
+   bool layer_info_valid = false; /* Covers layer_count and layer_tex_target */
    GLuint layer_count = 0, att_layer_count;
+   GLenum layer_tex_target = 0;
 
    assert(_mesa_is_user_fbo(fb));
 
@@ -1062,9 +1063,14 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
       } else {
          att_layer_count = 0;
       }
-      if (!layer_count_valid) {
+      if (!layer_info_valid) {
          layer_count = att_layer_count;
-         layer_count_valid = true;
+         layer_tex_target = att_tex_target;
+         layer_info_valid = true;
+      } else if (layer_count > 0 && layer_tex_target != att_tex_target) {
+         fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS;
+         fbo_incomplete(ctx, "layered framebuffer has mismatched targets", i);
+         return;
       } else if (layer_count != att_layer_count) {
          if (layer_count == 0 || att_layer_count == 0) {
             fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS;




More information about the mesa-commit mailing list