We used to always use GL_TEXTURE_RECTANGLE which we may not actually want.

Signed-off-by: Jason Ekstrand <[email protected]>
---
 tests/util/piglit-fbo.cpp | 14 +++++++-------
 tests/util/piglit-fbo.h   |  8 ++++++++
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/tests/util/piglit-fbo.cpp b/tests/util/piglit-fbo.cpp
index 1c4cd6c..df403d7 100644
--- a/tests/util/piglit-fbo.cpp
+++ b/tests/util/piglit-fbo.cpp
@@ -38,6 +38,7 @@ FboConfig::FboConfig(int num_samples, int width, int height)
          width(width),
          height(height),
          layers(0),
+         use_rect(num_samples == 0),
          attachment_layer(0),
          combine_depth_stencil(true),
          color_format(GL_RGBA),
@@ -94,12 +95,11 @@ Fbo::attach_color_renderbuffer(const FboConfig &config, int 
index)
 void
 Fbo::attach_color_texture(const FboConfig &config, int index)
 {
-       glBindTexture(GL_TEXTURE_RECTANGLE, color_tex[index]);
-       glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER,
-                       GL_NEAREST);
-       glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER,
-                       GL_NEAREST);
-       glTexImage2D(GL_TEXTURE_RECTANGLE,
+       GLenum target = config.use_rect ? GL_TEXTURE_RECTANGLE : GL_TEXTURE_2D;
+       glBindTexture(target, color_tex[index]);
+       glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+       glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+       glTexImage2D(target,
                     0 /* level */,
                     config.color_internalformat,
                     config.width,
@@ -110,7 +110,7 @@ Fbo::attach_color_texture(const FboConfig &config, int 
index)
                     NULL /* data */);
        glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
                               config.tex_attachment[index],
-                              GL_TEXTURE_RECTANGLE,
+                              target,
                               color_tex[index],
                               0 /* level */);
 }
diff --git a/tests/util/piglit-fbo.h b/tests/util/piglit-fbo.h
index 8f956a4..e7e45a8 100644
--- a/tests/util/piglit-fbo.h
+++ b/tests/util/piglit-fbo.h
@@ -60,6 +60,14 @@ namespace piglit_util_fbo {
                unsigned layers;
 
                /**
+                * If true, GL_TEXTURE_RECTANGLE is used when creating and
+                * binding textures
+                *
+                * Default value is true if num_samples == 0.
+                */
+               bool use_rect;
+
+               /**
                 * Specifies the layer of the texture that should be attached
                 * to the framebuffer.  This must be less than the value of
                 * ::layers (unless ::layers is zero).
-- 
2.5.0.400.gff86faf

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

Reply via email to