diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-05-04 15:46:40 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-05-10 15:31:06 -0700 |
commit | 8f49abc4a9d7bca8d42b5163e7f26173d88467ce (patch) | |
tree | e0958e098b9671329bcb0daa8b2a621f4f6a2cad | |
parent | 59c2dbd5a3ad72ade3d141ee7747f2ccc8a04f56 (diff) |
util/fbo: Add support for textures with target GL_TEXTURE_2D
We used to always use GL_TEXTURE_RECTANGLE which we may not actually want.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
-rw-r--r-- | tests/util/piglit-fbo.cpp | 14 | ||||
-rw-r--r-- | 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 1c4cd6c42..df403d717 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 8f956a4ca..e7e45a884 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). |