[Piglit] [PATCH 09/23] tex-miplevel-selection: test all variants of textureProjOffset
Marek Olšák
maraeo at gmail.com
Fri Jul 4 07:09:56 PDT 2014
From: Marek Olšák <marek.olsak at amd.com>
---
tests/all.py | 8 +++++++
tests/texturing/tex-miplevel-selection.c | 39 +++++++++++++++++++++++++++++---
2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/tests/all.py b/tests/all.py
index a1969e8..3bb29fd 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1251,6 +1251,14 @@ add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection text
add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProj(bias) 1DShadow')
add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProj(bias) 2DShadow')
+add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProjOffset 1D')
+add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProjOffset 1D_ProjVec4')
+add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProjOffset 2D')
+add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProjOffset 2D_ProjVec4')
+add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProjOffset 3D')
+add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProjOffset 1DShadow')
+add_concurrent_test(spec['glsl-1.30']['execution'], 'tex-miplevel-selection textureProjOffset 2DShadow')
+
# Group spec/glsl-1.40
spec['glsl-1.40'] = {}
import_glsl_parser_tests(spec['glsl-1.40'],
diff --git a/tests/texturing/tex-miplevel-selection.c b/tests/texturing/tex-miplevel-selection.c
index 3cb2ad5..d92a5e9 100644
--- a/tests/texturing/tex-miplevel-selection.c
+++ b/tests/texturing/tex-miplevel-selection.c
@@ -120,6 +120,7 @@ enum shader_type {
GL3_TEXTURE_OFFSET_BIAS,
GL3_TEXTURE_PROJ,
GL3_TEXTURE_PROJ_BIAS,
+ GL3_TEXTURE_PROJ_OFFSET,
};
#define NEED_GL3(t) ((t) >= GL3_TEXTURE_LOD)
@@ -269,6 +270,19 @@ static const char *fscode_gl3_proj_bias_shadow =
" textureProj(tex2, TYPE(gl_TexCoord[0]) + 0.05 * MASK, bias)); \n"
"} \n";
+static const char *fscode_gl3_proj_offset =
+ GL3_FS_PREAMBLE
+ "void main() { \n"
+ " gl_FragColor = textureProjOffset(tex, TYPE(gl_TexCoord[0]), OFFSET); \n"
+ "} \n";
+
+static const char *fscode_gl3_proj_offset_shadow =
+ GL3_FS_SHADOW_PREAMBLE
+ "void main() { \n"
+ " gl_FragColor = vec4(textureProjOffset(tex, TYPE(gl_TexCoord[0]) - 0.05 * MASK, OFFSET) * \n"
+ " textureProjOffset(tex2, TYPE(gl_TexCoord[0]) + 0.05 * MASK, OFFSET)); \n"
+ "} \n";
+
static void set_sampler_parameter(GLenum pname, GLint value)
{
glSamplerParameteri(samp[0], pname, value);
@@ -309,6 +323,8 @@ piglit_init(int argc, char **argv)
test = GL3_TEXTURE_PROJ;
else if (strcmp(argv[i], "textureProj(bias)") == 0)
test = GL3_TEXTURE_PROJ_BIAS;
+ else if (strcmp(argv[i], "textureProjOffset") == 0)
+ test = GL3_TEXTURE_PROJ_OFFSET;
else if (strcmp(argv[i], "1D") == 0)
target = TEX_1D;
else if (strcmp(argv[i], "1D_ProjVec4") == 0)
@@ -460,7 +476,8 @@ piglit_init(int argc, char **argv)
}
if (test == GL3_TEXTURE_PROJ ||
- test == GL3_TEXTURE_PROJ_BIAS) {
+ test == GL3_TEXTURE_PROJ_BIAS ||
+ test == GL3_TEXTURE_PROJ_OFFSET) {
if (!strcmp(type_str, "float"))
type_str = "vec2";
else if (!strcmp(type_str, "vec2"))
@@ -572,6 +589,19 @@ piglit_init(int argc, char **argv)
prog = piglit_build_simple_program(NULL, fscode);
loc_bias = glGetUniformLocation(prog, "bias");
break;
+ case GL3_TEXTURE_PROJ_OFFSET:
+ if (IS_SHADOW(target))
+ sprintf(fscode, fscode_gl3_proj_offset_shadow, version, target_str,
+ type_str, compare_value_mask, offset_type_str);
+ else
+ sprintf(fscode, fscode_gl3_proj_offset, version, target_str, type_str,
+ offset_type_str);
+
+ prog = piglit_build_simple_program(NULL, fscode);
+
+ has_offset = GL_TRUE;
+ no_lod_clamp = GL_TRUE;
+ break;
default:
assert(0);
}
@@ -798,7 +828,9 @@ draw_quad(int x, int y, int w, int h, int expected_level, int fetch_level,
/* set a bias */
glUniform1f(loc_bias, bias);
/* fall through */
- case GL3_TEXTURE_OFFSET: {
+ case GL3_TEXTURE_OFFSET:
+ case GL3_TEXTURE_PROJ_OFFSET:
+ {
/* Things get quite complicated with offsets.
*
* The single pixel which is not black has the same integer
@@ -839,7 +871,8 @@ draw_quad(int x, int y, int w, int h, int expected_level, int fetch_level,
}
if (test == GL3_TEXTURE_PROJ ||
- test == GL3_TEXTURE_PROJ_BIAS)
+ test == GL3_TEXTURE_PROJ_BIAS ||
+ test == GL3_TEXTURE_PROJ_OFFSET)
p = 7;
switch (target) {
--
1.9.1
More information about the Piglit
mailing list