[Piglit] [PATCH 1/5] util: Add support for multisample array textures to the FBO framework
Ian Romanick
idr at freedesktop.org
Mon Sep 21 08:57:48 PDT 2015
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
tests/util/piglit-fbo.cpp | 43 ++++++++++++++++++++++++++++++-------------
tests/util/piglit-fbo.h | 18 ++++++++++++++++++
2 files changed, 48 insertions(+), 13 deletions(-)
diff --git a/tests/util/piglit-fbo.cpp b/tests/util/piglit-fbo.cpp
index 49e9b26..bc705aa 100644
--- a/tests/util/piglit-fbo.cpp
+++ b/tests/util/piglit-fbo.cpp
@@ -37,6 +37,8 @@ FboConfig::FboConfig(int num_samples, int width, int height)
num_tex_attachments(0),
width(width),
height(height),
+ layers(0),
+ attachment_layer(0),
combine_depth_stencil(true),
color_format(GL_RGBA),
color_internalformat(GL_RGBA),
@@ -116,19 +118,34 @@ Fbo::attach_color_texture(const FboConfig &config, int index)
void
Fbo::attach_multisample_color_texture(const FboConfig &config, int index)
{
- glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, color_tex[index]);
- glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
- config.num_samples,
- config.color_internalformat,
- config.width,
- config.height,
- GL_TRUE /* fixed sample locations */);
-
- glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
- config.tex_attachment[index],
- GL_TEXTURE_2D_MULTISAMPLE,
- color_tex[index],
- 0 /* level */);
+ if (config.layers == 0) {
+ glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, color_tex[index]);
+ glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+ config.num_samples,
+ config.color_internalformat,
+ config.width,
+ config.height,
+ GL_TRUE /* fixed sample locations */);
+ glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
+ config.tex_attachment[index],
+ GL_TEXTURE_2D_MULTISAMPLE,
+ color_tex[index],
+ 0 /* level */);
+ } else {
+ glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, color_tex[index]);
+ glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
+ config.num_samples,
+ config.color_internalformat,
+ config.width,
+ config.height,
+ config.layers,
+ GL_TRUE /* fixed sample locations */);
+ glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER,
+ config.tex_attachment[index],
+ color_tex[index],
+ 0 /* level */,
+ config.attachment_layer);
+ }
}
void
diff --git a/tests/util/piglit-fbo.h b/tests/util/piglit-fbo.h
index b8ddaf8..8f956a4 100644
--- a/tests/util/piglit-fbo.h
+++ b/tests/util/piglit-fbo.h
@@ -51,6 +51,24 @@ namespace piglit_util_fbo {
int height;
/**
+ * If non-zero, GL_TEXTURE_2D_MULTISAMPLE_ARRAY is used with
+ * the specified number of layers instead of
+ * GL_TEXTURE_2D_MULTISAMPLE.
+ *
+ * Default value is zero.
+ */
+ unsigned layers;
+
+ /**
+ * 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).
+ *
+ * Default value is zero.
+ */
+ unsigned attachment_layer;
+
+ /**
* True if a single renderbuffer should be used as the backing
* store for both the depth and stencil attachment points.
* Defaults to true.
--
2.1.0
More information about the Piglit
mailing list