These variables can be used to create an fbo with required formats.
Note: These changes don't affect any of the existing test cases in
directory ext_framebuffer_multisample

Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
---
 tests/spec/ext_framebuffer_multisample/common.cpp |   16 ++++++++++------
 tests/spec/ext_framebuffer_multisample/common.h   |    4 ++++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp 
b/tests/spec/ext_framebuffer_multisample/common.cpp
index d1e6bcd..09431a6 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -121,6 +121,10 @@ Fbo::init(int num_samples, int width, int height, bool 
combine_depth_stencil,
        generate();
        this->width = width;
        this->height = height;
+       this->color_format = GL_RGBA;
+       this->depth_format = GL_DEPTH_COMPONENT24;
+       this->stencil_format = GL_STENCIL_INDEX8;
+       this->depth_stencil_format = GL_DEPTH_STENCIL;
        this->combine_depth_stencil = combine_depth_stencil;
        this->attach_texture = attach_texture;
        set_samples(num_samples);
@@ -145,7 +149,7 @@ Fbo::set_samples(int num_samples)
                glGenRenderbuffers(1, &rb);
                glBindRenderbuffer(GL_RENDERBUFFER, rb);
                glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples,
-                                                GL_RGBA, width, height);
+                                                color_format, width, height);
                glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
                                          GL_COLOR_ATTACHMENT0,
                                          GL_RENDERBUFFER, rb);
@@ -158,11 +162,11 @@ Fbo::set_samples(int num_samples)
                                GL_NEAREST);
                glTexImage2D(GL_TEXTURE_2D,
                             0 /* level */,
-                            GL_RGBA /* internalformat */,
+                            color_format /* internalformat */,
                             width,
                             height,
                             0 /* border */,
-                            GL_RGBA /* format */,
+                            color_format /* format */,
                             GL_BYTE /* type */,
                             NULL /* data */);
                glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
@@ -178,7 +182,7 @@ Fbo::set_samples(int num_samples)
                glGenRenderbuffers(1, &depth_stencil);
                glBindRenderbuffer(GL_RENDERBUFFER, depth_stencil);
                glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples,
-                                                GL_DEPTH_STENCIL, width,
+                                                depth_stencil_format, width,
                                                 height);
                glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
                                          GL_DEPTH_STENCIL_ATTACHMENT,
@@ -188,7 +192,7 @@ Fbo::set_samples(int num_samples)
                glGenRenderbuffers(1, &stencil);
                glBindRenderbuffer(GL_RENDERBUFFER, stencil);
                glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples,
-                                                GL_STENCIL_INDEX8,
+                                                stencil_format,
                                                 width, height);
                glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
                                          GL_STENCIL_ATTACHMENT,
@@ -198,7 +202,7 @@ Fbo::set_samples(int num_samples)
                glGenRenderbuffers(1, &depth);
                glBindRenderbuffer(GL_RENDERBUFFER, depth);
                glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples,
-                                                GL_DEPTH_COMPONENT24,
+                                                depth_format,
                                                 width, height);
                glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
                                          GL_DEPTH_ATTACHMENT,
diff --git a/tests/spec/ext_framebuffer_multisample/common.h 
b/tests/spec/ext_framebuffer_multisample/common.h
index d86cb95..f5cb7d1 100644
--- a/tests/spec/ext_framebuffer_multisample/common.h
+++ b/tests/spec/ext_framebuffer_multisample/common.h
@@ -59,6 +59,10 @@ public:
        int height;
        bool combine_depth_stencil;
        bool attach_texture;
+       GLenum color_format;
+       GLenum depth_format;
+       GLenum stencil_format;
+       GLenum depth_stencil_format;
        GLuint handle;
 
        /**
-- 
1.7.7.6

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to