[Piglit] [PATCH] depthstencil-render-miplevels: check GL_ARB_depth_texture_extension
Brian Paul
brianp at vmware.com
Thu Jun 28 16:40:01 PDT 2012
The test was trying to create GL_DEPTH_COMPONENT32F and
GL_DEPTH32F_STENCIL8 textures without checking if GL_ARB_depth_buffer_float
is supported. If it's not supported, return PIGLIT_SKIP.
---
tests/texturing/depthstencil-render-miplevels.cpp | 33 +++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/tests/texturing/depthstencil-render-miplevels.cpp b/tests/texturing/depthstencil-render-miplevels.cpp
index 976c3b5..4246fc7 100644
--- a/tests/texturing/depthstencil-render-miplevels.cpp
+++ b/tests/texturing/depthstencil-render-miplevels.cpp
@@ -105,6 +105,27 @@ GLenum depth_format;
int miplevel0_size;
int max_miplevel;
+
+/**
+ * Check if the given depth/stencil/rgba texture internal format is supported.
+ */
+static bool
+supported_format(GLenum internal_format)
+{
+ switch (internal_format) {
+ case GL_DEPTH_COMPONENT32F:
+ case GL_DEPTH32F_STENCIL8:
+ return piglit_is_extension_supported("GL_ARB_depth_buffer_float");
+ case GL_RGBA:
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH24_STENCIL8:
+ default:
+ return true;
+ }
+}
+
+
/**
* Create a mipmapped texture with the given dimensions and internal format.
*/
@@ -112,6 +133,10 @@ GLuint
create_mipmapped_tex(GLenum internal_format)
{
GLenum format;
+
+ if (!supported_format(internal_format))
+ return 0;
+
switch (internal_format) {
case GL_RGBA:
format = GL_RGBA;
@@ -392,6 +417,10 @@ piglit_init(int argc, char **argv)
if (attach_depth) {
depth_tex = create_mipmapped_tex(depth_format);
+ if (!depth_tex) {
+ /* unsupported format */
+ piglit_report_result(PIGLIT_SKIP);
+ }
}
if (attach_stencil) {
@@ -400,6 +429,10 @@ piglit_init(int argc, char **argv)
} else {
stencil_tex = create_mipmapped_tex(GL_DEPTH24_STENCIL8);
}
+ if (!stencil_tex) {
+ /* unsupported format */
+ piglit_report_result(PIGLIT_SKIP);
+ }
}
GLuint fbo;
--
1.7.3.4
More information about the Piglit
mailing list