[Piglit] [PATCH 21/23] tex-miplevel-selection: test all functions from ARB_shader_texture_lod

Marek Olšák maraeo at gmail.com
Fri Jul 4 07:10:08 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

Except for textureCubeGradARB, which the test doesn't support yet.
---
 tests/all.py                             |  39 +++++++-
 tests/texturing/tex-miplevel-selection.c | 153 ++++++++++++++++++++++++++++---
 2 files changed, 177 insertions(+), 15 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index c818437..503cbcd 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2021,9 +2021,42 @@ add_shader_test_dir(arb_shader_texture_lod['execution'],
                     recursive=True)
 add_plain_test(arb_shader_texture_lod['execution'], 'arb_shader_texture_lod-texgrad')
 add_plain_test(arb_shader_texture_lod['execution'], 'arb_shader_texture_lod-texgradcube')
-arb_shader_texture_lod['execution']['tex-miplevel-selection-texture2DLod'] = concurrent_test('tex-miplevel-selection -nobias -nolod -GL_ARB_shader_texture_lod')
-arb_shader_texture_lod['execution']['tex-miplevel-selection-texture2DLod-lod'] = concurrent_test('tex-miplevel-selection -nobias -GL_ARB_shader_texture_lod')
-arb_shader_texture_lod['execution']['tex-miplevel-selection-texture2DLod-lod-bias'] = concurrent_test('tex-miplevel-selection -GL_ARB_shader_texture_lod')
+
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *Lod 1D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *Lod 2D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *Lod 3D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *Lod Cube')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *Lod 1DShadow')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *Lod 2DShadow')
+
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjLod 1D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjLod 1D_ProjVec4')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjLod 2D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjLod 2D_ProjVec4')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjLod 3D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjLod 1DShadow')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjLod 2DShadow')
+
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *GradARB 1D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *GradARB 2D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *GradARB 3D')
+#add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *GradARB Cube')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *GradARB 1DShadow')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *GradARB 2DShadow')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *GradARB 2DRect')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *GradARB 2DRectShadow')
+
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 1D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 1D_ProjVec4')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 2D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 2D_ProjVec4')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 3D')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 1DShadow')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 2DShadow')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 2DRect')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 2DRect_ProjVec4')
+add_concurrent_test(arb_shader_texture_lod['execution'], 'tex-miplevel-selection *ProjGradARB 2DRectShadow')
+
 
 # Group ARB_shader_objects
 arb_shader_objects = {}
diff --git a/tests/texturing/tex-miplevel-selection.c b/tests/texturing/tex-miplevel-selection.c
index ea3c762..2494556 100644
--- a/tests/texturing/tex-miplevel-selection.c
+++ b/tests/texturing/tex-miplevel-selection.c
@@ -122,7 +122,10 @@ enum target_type {
 
 enum shader_type {
 	FIXED_FUNCTION,
-	ARB_SHADER_TEXTURE_LOD,
+	ARB_TEXTURE_LOD,
+	ARB_TEXTURE_PROJ_LOD,
+	ARB_TEXTURE_GRAD,
+	ARB_TEXTURE_PROJ_GRAD,
 	GL3_TEXTURE_LOD,
 	GL3_TEXTURE_BIAS,
 	GL3_TEXTURE,
@@ -141,7 +144,7 @@ enum shader_type {
 	GL3_TEXTURE_PROJ_GRAD_OFFSET,
 };
 
-#define NEED_ARB_LOD(t) ((t) == ARB_SHADER_TEXTURE_LOD)
+#define NEED_ARB_LOD(t) ((t) >= ARB_TEXTURE_LOD && (t) < GL3_TEXTURE_LOD)
 #define NEED_GL3(t) ((t) >= GL3_TEXTURE_LOD)
 
 static enum shader_type test = FIXED_FUNCTION;
@@ -213,8 +216,14 @@ piglit_init(int argc, char **argv)
 			no_bias = GL_TRUE;
 		else if (strcmp(argv[i], "-nolod") == 0)
 			no_lod_clamp = GL_TRUE;
-		else if (strcmp(argv[i], "-GL_ARB_shader_texture_lod") == 0)
-			test = ARB_SHADER_TEXTURE_LOD;
+		else if (strcmp(argv[i], "*Lod") == 0)
+			test = ARB_TEXTURE_LOD;
+		else if (strcmp(argv[i], "*ProjLod") == 0)
+			test = ARB_TEXTURE_PROJ_LOD;
+		else if (strcmp(argv[i], "*GradARB") == 0)
+			test = ARB_TEXTURE_GRAD;
+		else if (strcmp(argv[i], "*ProjGradARB") == 0)
+			test = ARB_TEXTURE_PROJ_GRAD;
 		else if (strcmp(argv[i], "textureLod") == 0)
 			test = GL3_TEXTURE_LOD;
 		else if (strcmp(argv[i], "texture(bias)") == 0)
@@ -293,7 +302,7 @@ piglit_init(int argc, char **argv)
 	piglit_require_extension("GL_ARB_sampler_objects");
 	piglit_require_extension("GL_ARB_texture_storage");
 	if (NEED_ARB_LOD(test)) {
-		piglit_require_GLSL();
+		piglit_require_GLSL_version(120);
 		piglit_require_extension("GL_ARB_shader_texture_lod");
 	}
 	piglit_require_gl_version(NEED_GL3(test) ? 30 : 14);
@@ -447,7 +456,9 @@ piglit_init(int argc, char **argv)
 		break;
 	}
 
-	if (test == GL3_TEXTURE_PROJ ||
+	if (test == ARB_TEXTURE_PROJ_LOD ||
+	    test == ARB_TEXTURE_PROJ_GRAD ||
+	    test == GL3_TEXTURE_PROJ ||
 	    test == GL3_TEXTURE_PROJ_BIAS ||
 	    test == GL3_TEXTURE_PROJ_OFFSET ||
 	    test == GL3_TEXTURE_PROJ_OFFSET_BIAS ||
@@ -469,11 +480,121 @@ piglit_init(int argc, char **argv)
 	switch (test) {
 	case FIXED_FUNCTION:
 		break;
-	case ARB_SHADER_TEXTURE_LOD:
+	case ARB_TEXTURE_LOD:
 		version = "120";
-		instruction = "texture2DLod";
+		switch (target) {
+		case TEX_1D:
+			instruction = "texture1DLod";
+			break;
+		case TEX_2D:
+			instruction = "texture2DLod";
+			break;
+		case TEX_3D:
+			instruction = "texture3DLod";
+			break;
+		case TEX_CUBE:
+			instruction = "textureCubeLod";
+			break;
+		case TEX_1D_SHADOW:
+			instruction = "shadow1DLod";
+			break;
+		case TEX_2D_SHADOW:
+			instruction = "shadow2DLod";
+			break;
+		default:
+			assert(0);
+		}
+		other_params = ", lod";
+		break;
+	case ARB_TEXTURE_PROJ_LOD:
+		version = "120";
+		switch (target) {
+		case TEX_1D:
+		case TEX_1D_PROJ_VEC4:
+			instruction = "texture1DProjLod";
+			break;
+		case TEX_2D:
+		case TEX_2D_PROJ_VEC4:
+			instruction = "texture2DProjLod";
+			break;
+		case TEX_3D:
+			instruction = "texture3DProjLod";
+			break;
+		case TEX_1D_SHADOW:
+			instruction = "shadow1DProjLod";
+			break;
+		case TEX_2D_SHADOW:
+			instruction = "shadow2DProjLod";
+			break;
+		default:
+			assert(0);
+		}
 		other_params = ", lod";
 		break;
+	case ARB_TEXTURE_GRAD:
+		version = "120";
+		switch (target) {
+		case TEX_1D:
+			instruction = "texture1DGradARB";
+			break;
+		case TEX_2D:
+			instruction = "texture2DGradARB";
+			break;
+		case TEX_3D:
+			instruction = "texture3DGradARB";
+			break;
+		case TEX_CUBE:
+			instruction = "textureCubeGradARB";
+			break;
+		case TEX_1D_SHADOW:
+			instruction = "shadow1DGradARB";
+			break;
+		case TEX_2D_SHADOW:
+			instruction = "shadow2DGradARB";
+			break;
+		case TEX_RECT:
+			instruction = "texture2DRectGradARB";
+			break;
+		case TEX_RECT_SHADOW:
+			instruction = "shadow2DRectGradARB";
+			break;
+		default:
+			assert(0);
+		}
+		other_params = ", DERIV_TYPE(dx), DERIV_TYPE(dy)";
+		break;
+	case ARB_TEXTURE_PROJ_GRAD:
+		version = "120";
+		switch (target) {
+		case TEX_1D:
+		case TEX_1D_PROJ_VEC4:
+			instruction = "texture1DProjGradARB";
+			break;
+		case TEX_2D:
+		case TEX_2D_PROJ_VEC4:
+			instruction = "texture2DProjGradARB";
+			break;
+		case TEX_3D:
+			instruction = "texture3DProjGradARB";
+			break;
+		case TEX_1D_SHADOW:
+			instruction = "shadow1DProjGradARB";
+			break;
+		case TEX_2D_SHADOW:
+			instruction = "shadow2DProjGradARB";
+			break;
+		case TEX_RECT:
+		case TEX_RECT_PROJ_VEC4:
+			instruction = "texture2DRectProjGradARB";
+			break;
+		case TEX_RECT_SHADOW:
+			instruction = "shadow2DRectProjGradARB";
+			break;
+		default:
+			assert(0);
+		}
+		other_params = ", DERIV_TYPE(dx), DERIV_TYPE(dy)";
+		break;
 	case GL3_TEXTURE_LOD:
 		instruction = "textureLod";
 		other_params = ", lod";
@@ -575,7 +696,8 @@ piglit_init(int argc, char **argv)
 		    target == TEX_CUBE_ARRAY_SHADOW)
 			loc_z = glGetUniformLocation(prog, "z");
 
-		if (test == ARB_SHADER_TEXTURE_LOD ||
+		if (test == ARB_TEXTURE_LOD ||
+		    test == ARB_TEXTURE_PROJ_LOD ||
 		    test == GL3_TEXTURE_LOD ||
 		    test == GL3_TEXTURE_LOD_OFFSET ||
 		    test == GL3_TEXTURE_PROJ_LOD ||
@@ -588,7 +710,9 @@ piglit_init(int argc, char **argv)
 		    test == GL3_TEXTURE_PROJ_OFFSET_BIAS)
 			loc_bias = glGetUniformLocation(prog, "bias");
 
-		if (test == GL3_TEXTURE_GRAD ||
+		if (test == ARB_TEXTURE_GRAD ||
+		    test == ARB_TEXTURE_PROJ_GRAD ||
+		    test == GL3_TEXTURE_GRAD ||
 		    test == GL3_TEXTURE_GRAD_OFFSET ||
 		    test == GL3_TEXTURE_PROJ_GRAD ||
 		    test == GL3_TEXTURE_PROJ_GRAD_OFFSET) {
@@ -829,7 +953,8 @@ draw_quad(int x, int y, int w, int h, int expected_level, int fetch_level,
 	float deriv = 1.0 / (TEX_SIZE >> fetch_level);
 
 	switch (test) {
-	case ARB_SHADER_TEXTURE_LOD:
+	case ARB_TEXTURE_LOD:
+	case ARB_TEXTURE_PROJ_LOD:
 	case GL3_TEXTURE_LOD:
 	case GL3_TEXTURE_PROJ_LOD:
 		/* set an explicit LOD */
@@ -855,6 +980,8 @@ draw_quad(int x, int y, int w, int h, int expected_level, int fetch_level,
 	case GL3_TEXTURE_PROJ_GRAD_OFFSET:
 		fix_normalized_coordinates(expected_level, &s0, &t0, &s1, &t1);
 		/* fall through */
+	case ARB_TEXTURE_GRAD:
+	case ARB_TEXTURE_PROJ_GRAD:
 	case GL3_TEXTURE_GRAD:
 	case GL3_TEXTURE_PROJ_GRAD:
 		if (gltarget == GL_TEXTURE_3D) {
@@ -923,7 +1050,9 @@ draw_quad(int x, int y, int w, int h, int expected_level, int fetch_level,
 		assert(0);
 	}
 
-	if (test == GL3_TEXTURE_PROJ ||
+	if (test == ARB_TEXTURE_PROJ_LOD ||
+	    test == ARB_TEXTURE_PROJ_GRAD ||
+	    test == GL3_TEXTURE_PROJ ||
 	    test == GL3_TEXTURE_PROJ_BIAS ||
 	    test == GL3_TEXTURE_PROJ_OFFSET ||
 	    test == GL3_TEXTURE_PROJ_OFFSET_BIAS ||
-- 
1.9.1



More information about the Piglit mailing list