summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/spec/arb_internalformat_query2/common.c34
-rw-r--r--tests/spec/arb_internalformat_query2/internalformat-size-checks.c23
-rw-r--r--tests/spec/arb_internalformat_query2/internalformat-type-checks.c21
3 files changed, 37 insertions, 41 deletions
diff --git a/tests/spec/arb_internalformat_query2/common.c b/tests/spec/arb_internalformat_query2/common.c
index 9fa5fa9d1..5fc4c833b 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -496,6 +496,37 @@ create_texture(const GLenum target,
}
return result;
}
+
+
+static GLenum
+translate_pname(const GLenum pname)
+{
+ switch (pname) {
+ case GL_INTERNALFORMAT_RED_TYPE:
+ case GL_INTERNALFORMAT_GREEN_TYPE:
+ case GL_INTERNALFORMAT_BLUE_TYPE:
+ case GL_INTERNALFORMAT_ALPHA_TYPE:
+ return pname - GL_INTERNALFORMAT_RED_TYPE + GL_TEXTURE_RED_TYPE;
+ case GL_INTERNALFORMAT_DEPTH_TYPE:
+ /* case GL_INTERNALFORMAT_STENCIL_TYPE, */
+ return GL_TEXTURE_DEPTH_TYPE;
+ case GL_INTERNALFORMAT_RED_SIZE:
+ case GL_INTERNALFORMAT_GREEN_SIZE:
+ case GL_INTERNALFORMAT_BLUE_SIZE:
+ case GL_INTERNALFORMAT_ALPHA_SIZE:
+ return pname - GL_INTERNALFORMAT_RED_SIZE + GL_TEXTURE_RED_SIZE;
+ case GL_INTERNALFORMAT_DEPTH_SIZE:
+ return GL_TEXTURE_DEPTH_SIZE;
+ case GL_INTERNALFORMAT_STENCIL_SIZE:
+ return GL_TEXTURE_STENCIL_SIZE;
+ case GL_INTERNALFORMAT_SHARED_SIZE:
+ return GL_TEXTURE_SHARED_SIZE;
+ default:
+ assert(!"incorrect pname");
+ return 0;
+ }
+}
+
/*
* Builds a a texture using @target and @internalformat, and compares
* the result of calling GetTexLevelParameter using @pname with the
@@ -520,6 +551,7 @@ test_data_check_against_get_tex_level_parameter(test_data *data,
GLuint tex;
GLuint buffer;
GLenum real_target = target;
+ GLenum pname_equiv = translate_pname(pname);
result = create_texture(target, internalformat, &tex, &buffer);
if (!result)
@@ -530,7 +562,7 @@ test_data_check_against_get_tex_level_parameter(test_data *data,
if (target == GL_TEXTURE_CUBE_MAP) {
real_target = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
}
- glGetTexLevelParameteriv(real_target, 0, pname, &param);
+ glGetTexLevelParameteriv(real_target, 0, pname_equiv, &param);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
result = false;
fprintf(stderr, "\tError calling glGetTexLevelParameter\n");
diff --git a/tests/spec/arb_internalformat_query2/internalformat-size-checks.c b/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
index bbccbd6d1..928133133 100644
--- a/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
+++ b/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
@@ -53,24 +53,6 @@ static const GLenum pnames[] = {
GL_INTERNALFORMAT_SHARED_SIZE,
};
-/* From spec:
- *
- * "For textures this query will return the same information
- * as querying GetTexLevelParameter{if}v for TEXTURE_*_SIZE
- * would return."
- *
- * The following are the pnames we would need to use when
- * calling GetTexLevelParameter (so equivalent to pnames)
- */
-static const GLenum equivalent_pnames[] = {
- GL_TEXTURE_RED_SIZE,
- GL_TEXTURE_GREEN_SIZE,
- GL_TEXTURE_BLUE_SIZE,
- GL_TEXTURE_ALPHA_SIZE,
- GL_TEXTURE_DEPTH_SIZE,
- GL_TEXTURE_STENCIL_SIZE,
- GL_TEXTURE_SHARED_SIZE,
-};
enum piglit_result
piglit_display(void)
@@ -102,7 +84,6 @@ static bool
try_textures_size(const GLenum *targets, unsigned num_targets,
const GLenum *internalformats, unsigned num_internalformats,
const GLenum pname,
- const GLenum equivalent_pname,
test_data *data)
{
bool pass = true;
@@ -128,7 +109,7 @@ try_textures_size(const GLenum *targets, unsigned num_targets,
value_test = supported ?
test_data_check_against_get_tex_level_parameter(data,
targets[i],
- equivalent_pname,
+ pname,
internalformats[j]) :
test_data_is_unsupported_response(data, pname);
@@ -168,7 +149,7 @@ check_textures_size(void)
pass = try_textures_size(texture_targets, ARRAY_SIZE(texture_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
- pnames[i], equivalent_pnames[i],
+ pnames[i],
data)
&& pass;
}
diff --git a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
index e2d739424..c6e46f504 100644
--- a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
+++ b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
@@ -53,22 +53,6 @@ static const GLenum pnames[] = {
/* GL_INTERNALFORMAT_STENCIL_TYPE, */
};
-/* From spec:
- *
- * "For textures this query will return the same information
- * as querying GetTexLevelParameter{if}v for TEXTURE_*_TYPE
- * would return."
- *
- * The following are the pnames we would need to use when
- * calling GetTexLevelParameter (so equivalent to pnames)
- */
-static const GLenum equivalent_pnames[] = {
- GL_TEXTURE_RED_TYPE,
- GL_TEXTURE_GREEN_TYPE,
- GL_TEXTURE_BLUE_TYPE,
- GL_TEXTURE_ALPHA_TYPE,
- GL_TEXTURE_DEPTH_TYPE,
-};
/* From spec:
*
@@ -120,7 +104,6 @@ static bool
try_textures_type(const GLenum *targets, unsigned num_targets,
const GLenum *internalformats, unsigned num_internalformats,
const GLenum pname,
- const GLenum equivalent_pname,
test_data *data)
{
bool pass = true;
@@ -151,7 +134,7 @@ try_textures_type(const GLenum *targets, unsigned num_targets,
value_test = value_test &&
test_data_check_against_get_tex_level_parameter(data,
targets[i],
- equivalent_pname,
+ pname,
internalformats[j]);
}
@@ -184,7 +167,7 @@ check_textures_type(void)
pass = try_textures_type(texture_targets, ARRAY_SIZE(texture_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
- pnames[i], equivalent_pnames[i],
+ pnames[i],
data)
&& pass;
}