New variables added here stay unused. They'll be used by the
following patches in this series.

Signed-off-by: Anuj Phogat <[email protected]>
---
 tests/util/piglit-fbo.cpp | 21 +++++++++++++++++++++
 tests/util/piglit-fbo.h   | 11 +++++++++++
 2 files changed, 32 insertions(+)

diff --git a/tests/util/piglit-fbo.cpp b/tests/util/piglit-fbo.cpp
index 906fa55..484c23f 100644
--- a/tests/util/piglit-fbo.cpp
+++ b/tests/util/piglit-fbo.cpp
@@ -33,6 +33,8 @@ using namespace piglit_util_fbo;
 
 FboConfig::FboConfig(int num_samples, int width, int height)
        : num_samples(num_samples),
+         num_rb_attachments(1),
+         num_tex_attachments(0),
          width(width),
          height(height),
          combine_depth_stencil(true),
@@ -42,6 +44,12 @@ FboConfig::FboConfig(int num_samples, int width, int height)
          depth_internalformat(GL_DEPTH_COMPONENT24),
          stencil_internalformat(GL_STENCIL_INDEX8)
 {
+       memset(rb_attachment, 0, PIGLIT_MAX_COLOR_ATTACHMENTS * sizeof(GLuint));
+       memset(tex_attachment, 0, PIGLIT_MAX_COLOR_ATTACHMENTS * 
sizeof(GLuint));
+
+       /* Set default values for single renderbuffer and texture attachment. */
+       rb_attachment[0] = GL_COLOR_ATTACHMENT0;
+       tex_attachment[0] = GL_COLOR_ATTACHMENT0;
 }
 
 Fbo::Fbo()
@@ -138,6 +146,19 @@ Fbo::set_samples(int num_samples)
 void
 Fbo::setup(const FboConfig &new_config)
 {
+       GLint max_attachments;
+       GLint requested_attachments = new_config.num_rb_attachments +
+               new_config.num_tex_attachments;
+       glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, &max_attachments);
+
+       if (requested_attachments > max_attachments) {
+               printf("Number of color attachments are not supported by the"
+                      " implementation.\nattachments requested = %d,"
+                      " max attachments supported = %d\n",
+                      requested_attachments, max_attachments);
+               piglit_report_result(PIGLIT_SKIP);
+       }
+
        if (!try_setup(new_config)) {
                printf("Framebuffer not complete\n");
                piglit_report_result(PIGLIT_SKIP);
diff --git a/tests/util/piglit-fbo.h b/tests/util/piglit-fbo.h
index e225149..3be4f99 100644
--- a/tests/util/piglit-fbo.h
+++ b/tests/util/piglit-fbo.h
@@ -30,6 +30,11 @@
 #include "math.h"
 
 namespace piglit_util_fbo {
+/* I think 16 is the sufficient number of color attachments which tests would
+ * want to use in near future.
+ */
+#define PIGLIT_MAX_COLOR_ATTACHMENTS 16
+
        /**
         * Information needed to configure a framebuffer object for MSAA
         * testing.
@@ -40,6 +45,8 @@ namespace piglit_util_fbo {
                FboConfig(int num_samples, int width, int height);
 
                int num_samples;
+               int num_rb_attachments; /* Default value is 1 */
+               int num_tex_attachments; /* Default value is 0 */
                int width;
                int height;
 
@@ -57,6 +64,10 @@ namespace piglit_util_fbo {
                 */
                bool attach_texture;
 
+               /* Set color attachments */
+               GLuint rb_attachment[PIGLIT_MAX_COLOR_ATTACHMENTS];
+               GLuint tex_attachment[PIGLIT_MAX_COLOR_ATTACHMENTS];
+
                /**
                 * Useful if attach_texture is true and color buffer is
                 * non-multisample. Specifies the format that should be used
-- 
1.8.3.1

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to