Commit 7fb7c9a7 authored by Eric Anholt's avatar Eric Anholt

Add a set of GLSL tests for optimizations I plan to do in glsl2.

parent 64706fe5
......@@ -238,6 +238,33 @@ add_vpfpgeneric('vp-sge-alias')
add_vpfpgeneric('vp-two-constants')
shaders['vpfp-generic'] = vpfpgeneric
glslgeneric = Group()
def add_glslgeneric(name):
glslgeneric[name] = PlainExecTest(['shader_runner', testBinDir + '../tests/shaders/generic/' + name + '.shader_test', '-auto'])
add_glslgeneric('glsl-algebraic-add-zero')
add_glslgeneric('glsl-algebraic-div-one')
add_glslgeneric('glsl-algebraic-logicand-false-2')
add_glslgeneric('glsl-algebraic-logicand-false')
add_glslgeneric('glsl-algebraic-logicand-true-2')
add_glslgeneric('glsl-algebraic-logicand-true')
add_glslgeneric('glsl-algebraic-logicor-false-2')
add_glslgeneric('glsl-algebraic-logicor-false')
add_glslgeneric('glsl-algebraic-logicor-true-2')
add_glslgeneric('glsl-algebraic-logicor-true')
add_glslgeneric('glsl-algebraic-logicxor-false')
add_glslgeneric('glsl-algebraic-logicxor-true')
add_glslgeneric('glsl-algebraic-mul-one')
add_glslgeneric('glsl-algebraic-mul-zero')
add_glslgeneric('glsl-algebraic-not-equals')
add_glslgeneric('glsl-algebraic-not-notequals')
add_glslgeneric('glsl-algebraic-pow-two')
add_glslgeneric('glsl-algebraic-rcp-rcp')
add_glslgeneric('glsl-algebraic-rcp-rsq')
add_glslgeneric('glsl-algebraic-rcp-sqrt')
add_glslgeneric('glsl-algebraic-sub-zero-2')
add_glslgeneric('glsl-algebraic-sub-zero')
shaders['glsl-generic'] = glslgeneric
bugs = Group()
add_plain_test(bugs, 'crash-cubemap-order')
add_plain_test(bugs, 'crash-texparameter-before-teximage')
......
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = color + vec4(0.0);
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = color / vec4(1.0);
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (color.b != 0.0 && false)
gl_FragColor = red;
else
gl_FragColor = green;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (false && color.b != 0.0)
gl_FragColor = red;
else
gl_FragColor = green;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (color.b != 0.0 && true)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (true && color.b != 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (color.b != 0.0 || false)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (false || color.b != 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (true || color.b == 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (color.b == 0.0 || true)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (false ^^ color.b != 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (true ^^ color.b == 0.0)
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = color * 1.0;
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0) - (color * 0.0);
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = -(-color);
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (!(color.b == 0.0))
gl_FragColor = green;
else
gl_FragColor = red;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
const vec4 red = vec4(1.0, 0.0, 0.0, 0.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 0.0);
if (!(color.b != 0.0))
gl_FragColor = red;
else
gl_FragColor = green;
}
[test]
uniform color vec4 0.0 0.0 1.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, pow(color.b, 2), 0.0, 0.0);
}
[test]
uniform color vec4 0.0 0.0 0.5 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 0.25 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, 2.0, 0.0, 0.0) / (1.0 / color);
}
[test]
uniform color vec4 0.0 0.5 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, 0.5 / inversesqrt(color.g), 0.0, 0.0);
}
[test]
uniform color vec4 0.0 2.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 0.7071 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = vec4(0.0, 1.0 / sqrt(color.g), 0.0, 0.0);
}
[test]
uniform color vec4 0.0 2.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 0.7071 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = 0.0 - color;
}
[test]
uniform color vec4 0.0 -1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.0
[require]
GL >= 2.0
GLSL >= 1.10
[vertex shader]
void main()
{
gl_Position = gl_Vertex;
}
[fragment shader]
uniform vec4 color;
void main()
{
gl_FragColor = color - 0.0;
}
[test]
uniform color vec4 0.0 1.0 0.0 0.0
draw rect -1 -1 2 2
probe rgb 1 1 0.0 1.0 0.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