[Piglit] [PATCH 11/21] arb_internalformat_query2: Check if the resource is supported in max-dimensions
Alejandro PiƱeiro
apinheiro at igalia.com
Tue Jan 19 09:04:42 PST 2016
From: Antia Puentes <apuentes at igalia.com>
The ARB_internalformat_query2 specification says about
MAX_WIDTH, MAX_HEIGHT, MAX_DEPTH and MAX_COMBINED_DIMENSIONS <pnames>:
"If the resource is unsupported, zero is returned."
>From the same specification:
"In the following descriptions, the term /resource/ is used
to generically refer to an object of the appropriate type that has
been created with <internalformat> and <target>."
We check if the /resource/ is supported by trying to create the object,
if an error is raised, we consider the /resource/ as "unsupported".
Before, we were only checking if the <internalformat> was supported
independently of the <target>.
Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: after this commit,
all the subtests on this test fails.
Now that a stricter check for unsupported resources are in place, the
test fails on NVIDIA because for some unsupported resources it returns
a value different to zero.
---
.../arb_internalformat_query2/max-dimensions.c | 51 +++++++++++++++++++---
1 file changed, 45 insertions(+), 6 deletions(-)
diff --git a/tests/spec/arb_internalformat_query2/max-dimensions.c b/tests/spec/arb_internalformat_query2/max-dimensions.c
index 68945bf..311060c 100644
--- a/tests/spec/arb_internalformat_query2/max-dimensions.c
+++ b/tests/spec/arb_internalformat_query2/max-dimensions.c
@@ -222,6 +222,45 @@ num_dimensions(const GLenum target)
}
static bool
+is_supported_renderbuffer(const GLenum target, const GLenum internalformat)
+{
+ GLuint rb;
+ bool result = true;
+
+ glGenRenderbuffers(1, &rb);
+ glBindRenderbuffer(GL_RENDERBUFFER, rb);
+ glRenderbufferStorage(GL_RENDERBUFFER, internalformat, 16, 16);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ result = false;
+
+ glDeleteRenderbuffers(1, &rb);
+ return result;
+}
+
+static bool
+is_resource_supported(const test_data *data, const GLenum target,
+ const GLenum internalformat)
+{
+ GLuint tex;
+ GLuint buffer;
+
+ if (!test_data_check_supported(data, target, internalformat))
+ return false;
+
+ if (target == GL_RENDERBUFFER)
+ return is_supported_renderbuffer(target, internalformat);
+
+ if (!create_texture(target, internalformat, &tex, &buffer))
+ return false;
+
+ glDeleteTextures(1, &tex);
+ glDeleteBuffers(1, &buffer);
+
+ return true;
+}
+
+static bool
try(const GLenum *targets, unsigned num_targets,
const GLenum *internalformats, unsigned num_internalformats,
const GLenum pname,
@@ -238,8 +277,8 @@ try(const GLenum *targets, unsigned num_targets,
bool value_test = true;
bool supported;
- supported = test_data_check_supported(data, targets[i],
- internalformats[j]);
+ supported = is_resource_supported(data, targets[i],
+ internalformats[j]);
test_data_execute(data, targets[i], internalformats[j],
pname);
@@ -408,8 +447,8 @@ try_max_layers(const GLenum *targets, unsigned num_targets,
bool value_test = true;
bool supported;
- supported = test_data_check_supported(data, targets[i],
- internalformats[j]);
+ supported = is_resource_supported(data, targets[i],
+ internalformats[j]);
test_data_execute(data, targets[i], internalformats[j],
GL_MAX_LAYERS);
@@ -572,8 +611,8 @@ try_max_combined_dimensions(const GLenum *targets, unsigned num_targets,
bool value_test = true;
bool supported;
- supported = test_data_check_supported(data, targets[i],
- internalformats[j]);
+ supported = is_resource_supported(data, targets[i],
+ internalformats[j]);
test_data_execute(data, targets[i], internalformats[j],
GL_MAX_COMBINED_DIMENSIONS);
--
2.1.4
More information about the Piglit
mailing list