Commit 2b7b52f5 authored by Marek Olšák's avatar Marek Olšák

Add sampler2DRect GLSL tests

parent 394ad6ee
......@@ -906,6 +906,9 @@ arb_texture_rectangle = Group()
spec['ARB_texture_rectangle'] = arb_texture_rectangle
add_texwrap_test1(arb_texture_rectangle, 'RECT')
add_texwrap_test2(arb_texture_rectangle, 'RECT', 'proj')
add_shader_test_dir(arb_texture_rectangle,
os.path.dirname(__file__) + '/spec/arb_texture_rectangle',
recursive=True)
tdfx_texture_compression_fxt1 = Group()
spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
......
......@@ -1024,6 +1024,21 @@ piglit_display(void)
GL_INTENSITY);
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line,
"texture shadowRect %d ( %d , %d )",
&tex, &w, &h) == 3) {
glActiveTexture(GL_TEXTURE0 + tex);
piglit_depth_texture(GL_TEXTURE_RECTANGLE, GL_DEPTH_COMPONENT,
w, h, 1, GL_FALSE);
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_MODE_ARB,
GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_GREATER);
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_DEPTH_TEXTURE_MODE_ARB,
GL_INTENSITY);
} else if (sscanf(line,
"texture shadow1D %d ( %d )",
&tex, &w) == 2) {
......@@ -1142,6 +1157,79 @@ piglit_display(void)
glTexParameteri(GL_TEXTURE_2D,
GL_DEPTH_TEXTURE_MODE_ARB,
GL_ALPHA);
} else if (!strncmp(line,
"texparameterRect compare_func greater\n",
38)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_GREATER);
} else if (!strncmp(line,
"texparameterRect compare_func gequal\n",
37)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_GEQUAL);
} else if (!strncmp(line,
"texparameterRect compare_func less\n",
35)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_LESS);
} else if (!strncmp(line,
"texparameterRect compare_func lequal\n",
37)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_LEQUAL);
} else if (!strncmp(line,
"texparameterRect compare_func equal\n",
36)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_EQUAL);
} else if (!strncmp(line,
"texparameterRect compare_func notequal\n",
39)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_NOTEQUAL);
} else if (!strncmp(line,
"texparameterRect compare_func always\n",
37)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_ALWAYS);
} else if (!strncmp(line,
"texparameterRect compare_func never\n",
36)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_TEXTURE_COMPARE_FUNC_ARB,
GL_NEVER);
} else if (!strncmp(line,
"texparameterRect depth_mode red\n",
32)) {
/* Requires GL 3.0 or GL_ARB_texture_rg */
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_DEPTH_TEXTURE_MODE_ARB,
GL_RED);
} else if (!strncmp(line,
"texparameterRect depth_mode luminance\n",
38)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_DEPTH_TEXTURE_MODE_ARB,
GL_LUMINANCE);
} else if (!strncmp(line,
"texparameterRect depth_mode intensity\n",
38)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_DEPTH_TEXTURE_MODE_ARB,
GL_INTENSITY);
} else if (!strncmp(line,
"texparameterRect depth_mode alpha\n",
33)) {
glTexParameteri(GL_TEXTURE_RECTANGLE,
GL_DEPTH_TEXTURE_MODE_ARB,
GL_ALPHA);
} else if (!strncmp(line,
"texparameter1D compare_func greater\n",
36)) {
......
#version 110
varying vec4 texcoords;
void main() {
gl_Position = gl_Vertex;
texcoords = (gl_Vertex + 1.0) / 2.0;
}
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = luminance
# - texture compare func = greater
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode luminance
texparameterRect compare_func greater
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.9, 1.0) (1.0, 1.0, 1.0, 1.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 1.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 1.0)
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = luminance
# - texture compare func = always
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode luminance
texparameterRect compare_func always
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.9, 1.0) (1.0, 1.0, 1.0, 1.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (1.0, 0.9) (1.0, 1.0, 1.0, 1.0)
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = luminance
# - texture compare func = never
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode luminance
texparameterRect compare_func never
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (0.0, 0.0, 0.0, 1.0)
relative probe rgba (0.9, 1.0) (0.0, 0.0, 0.0, 1.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 1.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 1.0)
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = intensity
# - texture compare func = greater
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode intensity
texparameterRect compare_func greater
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.9, 1.0) (1.0, 1.0, 1.0, 1.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 0.0)
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = intensity
# - texture compare func = always
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode intensity
texparameterRect compare_func always
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.9, 1.0) (1.0, 1.0, 1.0, 1.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (1.0, 0.9) (1.0, 1.0, 1.0, 1.0)
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = intensity
# - texture compare func = never
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode intensity
texparameterRect compare_func never
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (0.9, 1.0) (0.0, 0.0, 0.0, 0.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 0.0)
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = alpha
# - texture compare func = greater
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode alpha
texparameterRect compare_func greater
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (0.0, 0.0, 0.0, 1.0)
relative probe rgba (0.9, 1.0) (0.0, 0.0, 0.0, 1.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 0.0)
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = alpha
# - texture compare func = always
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode alpha
texparameterRect compare_func always
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (0.0, 0.0, 0.0, 1.0)
relative probe rgba (0.9, 1.0) (0.0, 0.0, 0.0, 1.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 1.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 1.0)
# [description]
# Test shadow2DRect(sampler2DRectShadow, vec3) with
# - depth texture mode = alpha
# - texture compare func = never
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader file]
glsl-fs-shadow2DRect.frag
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
texparameterRect depth_mode alpha
texparameterRect compare_func never
draw rect -1 -1 2 2
# depth comparison pass
relative probe rgba (0.0, 0.1) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (0.9, 1.0) (0.0, 0.0, 0.0, 0.0)
# depth comparison fail
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 0.0)
#version 110
uniform sampler2DRectShadow tex;
varying vec4 texcoords;
void main() {
gl_FragColor = shadow2DRect(tex, texcoords.xyy * vec3(31.0, 31.0, 1.0));
}
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader file]
glsl-fs-shadow.vert
[fragment shader]
varying vec4 texcoords;
uniform sampler2DRectShadow tex;
void main()
{
gl_FragColor = shadow2DRect(tex, texcoords.xyy * vec3(31.0, 31.0, 1.0));
}
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
draw rect -1 -1 2 2
relative probe rgba (0.0, 0.1) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.0, 1.0) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.9, 1.0) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (1.0, 0.0) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 0.0)
[require]
GLSL >= 1.10
GL_ARB_texture_rectangle
[vertex shader]
varying vec4 texcoords;
void main()
{
gl_Position = gl_Vertex;
texcoords = gl_Vertex + 1.0;
}
[fragment shader]
varying vec4 texcoords;
uniform sampler2DRectShadow tex;
void main()
{
gl_FragColor = shadow2DRectProj(tex, vec4(texcoords.xyy * vec3(31.0, 31.0, 1.0), 2.0));
}
[test]
uniform int tex 0
texture shadowRect 0 (32, 32)
draw rect -1 -1 2 2
relative probe rgba (0.0, 0.1) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.0, 1.0) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.9, 1.0) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.1, 0.0) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (1.0, 0.0) (0.0, 0.0, 0.0, 0.0)
relative probe rgba (1.0, 0.9) (0.0, 0.0, 0.0, 0.0)
......@@ -1040,6 +1040,7 @@ piglit_depth_texture(GLenum target, GLenum internalformat, int w, int h, int d,
case GL_TEXTURE_1D_ARRAY:
case GL_TEXTURE_2D:
case GL_TEXTURE_RECTANGLE:
glTexImage2D(target, level,
internalformat,
w, h, 0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment