summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2019-05-20 16:19:56 +0200
committerMarek Olšák <marek.olsak@amd.com>2019-06-03 15:12:50 -0400
commit520a76111a71ca98b097623db033222682928f53 (patch)
tree2ed1cd1cca20fe614573f10855cebb438b15ef73
parent2ed536693bdcae150d86b999835100a134f7a706 (diff)
ext_direct_state_access: test glTextureImage* with GL_PROXY_TEXTURE_* targets
-rw-r--r--tests/spec/ext_direct_state_access/multi-texture.c59
-rw-r--r--tests/spec/ext_direct_state_access/textures.c81
2 files changed, 140 insertions, 0 deletions
diff --git a/tests/spec/ext_direct_state_access/multi-texture.c b/tests/spec/ext_direct_state_access/multi-texture.c
index d689a0bec..a1528a629 100644
--- a/tests/spec/ext_direct_state_access/multi-texture.c
+++ b/tests/spec/ext_direct_state_access/multi-texture.c
@@ -1074,6 +1074,47 @@ test_MultiTexParameterfEXT(void* data)
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
+static enum piglit_result
+test_TextureProxyTarget(void* data)
+{
+ bool pass = true;
+ GLint width;
+ GLfloat height;
+ const int n = (int)(intptr_t) data;
+ const GLenum target = dimension_to_target(n);
+ const GLenum* texunits = n_texunits(2);
+
+ GLenum proxy_target = (target == GL_TEXTURE_1D) ? GL_PROXY_TEXTURE_1D :
+ (target == GL_TEXTURE_2D ? GL_PROXY_TEXTURE_2D : GL_PROXY_TEXTURE_3D);
+
+ glActiveTexture(texunits[1]);
+
+ if (target == GL_TEXTURE_1D) {
+ glMultiTexImage1DEXT(texunits[0], proxy_target, 0, GL_RGBA,
+ piglit_width, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ } else if (target == GL_TEXTURE_2D) {
+ glMultiTexImage2DEXT(texunits[0], proxy_target, 0, GL_RGBA,
+ piglit_width, piglit_height, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ } else {
+ glMultiTexImage3DEXT(texunits[0], proxy_target, 0, GL_RGBA,
+ piglit_width, piglit_height, 1, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ }
+
+ piglit_check_gl_error(GL_NO_ERROR);
+
+ glGetMultiTexLevelParameterivEXT(texunits[0], proxy_target, 0,
+ GL_TEXTURE_WIDTH, &width);
+ glGetMultiTexLevelParameterfvEXT(texunits[0], proxy_target, 0,
+ GL_TEXTURE_HEIGHT, &height);
+ pass = width == piglit_width && pass;
+ pass = (int)height == (n > 1 ? piglit_height : 1) && pass;
+
+ return pass && piglit_check_gl_error(GL_NO_ERROR) ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
enum piglit_result
piglit_display(void)
{
@@ -1178,6 +1219,24 @@ piglit_display(void)
test_MultiTexParameteriEXT
},
{
+ "GL_PROXY_TEXTURE_1D + glTex*",
+ NULL,
+ test_TextureProxyTarget,
+ (void*) 1
+ },
+ {
+ "GL_PROXY_TEXTURE_2D + glTex*",
+ NULL,
+ test_TextureProxyTarget,
+ (void*) 2
+ },
+ {
+ "GL_PROXY_TEXTURE_3D + glTex*",
+ NULL,
+ test_TextureProxyTarget,
+ (void*) 3
+ },
+ {
NULL
}
};
diff --git a/tests/spec/ext_direct_state_access/textures.c b/tests/spec/ext_direct_state_access/textures.c
index 9a4aa9c63..f2421aadf 100644
--- a/tests/spec/ext_direct_state_access/textures.c
+++ b/tests/spec/ext_direct_state_access/textures.c
@@ -696,6 +696,69 @@ test_EnableDisableEXT(void* data)
}
+static enum piglit_result
+test_TextureProxyTarget(void* data)
+{
+ bool pass = true;
+ GLint width;
+ GLfloat height;
+ const int n = (int)(intptr_t) data;
+ const GLenum target = dimension_to_target(n);
+
+ GLenum proxy_target = (target == GL_TEXTURE_1D) ? GL_PROXY_TEXTURE_1D :
+ (target == GL_TEXTURE_2D ? GL_PROXY_TEXTURE_2D : GL_PROXY_TEXTURE_3D);
+
+ GLuint tex;
+ glGenTextures(1, &tex);
+
+ /* The GL_EXT_direct_state_access says:
+ *
+ * Proxy targets work with the glTex* (glTexImage*)
+ * and glGetTex* (glGetTexLevelParameter*) commands that support
+ * proxy textures BUT the texture name must be 0 to avoid a
+ * GL_INVALID_OPERATION error.
+ */
+ if (n == 1) {
+ glTextureImage1DEXT(tex, proxy_target, 0, GL_RGBA,
+ piglit_width, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ } else if (n == 2) {
+ glTextureImage2DEXT(tex, proxy_target, 0, GL_RGBA,
+ piglit_width, piglit_height, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ } else if (n == 3) {
+ glTextureImage3DEXT(tex, proxy_target, 0, GL_RGBA,
+ piglit_width, piglit_height, 1, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ }
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+
+ if (n == 1) {
+ glTextureImage1DEXT(0, proxy_target, 0, GL_RGBA,
+ piglit_width, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ } else if (n == 2) {
+ glTextureImage2DEXT(0, proxy_target, 0, GL_RGBA,
+ piglit_width, piglit_height, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ } else if (n == 3) {
+ glTextureImage3DEXT(0, proxy_target, 0, GL_RGBA,
+ piglit_width, piglit_height, 1, 0,
+ GL_RGBA, GL_FLOAT, NULL);
+ }
+ glGetTextureLevelParameterivEXT(0, proxy_target, 0,
+ GL_TEXTURE_WIDTH, &width);
+ glGetTextureLevelParameterfvEXT(0, proxy_target, 0,
+ GL_TEXTURE_HEIGHT, &height);
+ pass = width == piglit_width && pass;
+ pass = (int)height == (n > 1 ? piglit_height : 1) && pass;
+
+ glDeleteTextures(1, &tex);
+
+ return pass && piglit_check_gl_error(GL_NO_ERROR) ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+
enum piglit_result
piglit_display(void)
{
@@ -785,6 +848,24 @@ piglit_display(void)
test_EnableDisableEXT
},
{
+ "GL_PROXY_TEXTURE_1D + glTex*",
+ NULL,
+ test_TextureProxyTarget,
+ (void*) 1
+ },
+ {
+ "GL_PROXY_TEXTURE_2D + glTex*",
+ NULL,
+ test_TextureProxyTarget,
+ (void*) 2
+ },
+ {
+ "GL_PROXY_TEXTURE_3D + glTex*",
+ NULL,
+ test_TextureProxyTarget,
+ (void*) 3
+ },
+ {
NULL
}
};