diff options
24 files changed, 582 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests index 478f51bc3..adc47b0d9 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -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') diff --git a/tests/shaders/generic/glsl-algebraic-add-zero.shader_test b/tests/shaders/generic/glsl-algebraic-add-zero.shader_test new file mode 100644 index 000000000..ef5727cf3 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-add-zero.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-div-one.shader_test b/tests/shaders/generic/glsl-algebraic-div-one.shader_test new file mode 100644 index 000000000..ad5f469b2 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-div-one.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicand-false-2.shader_test b/tests/shaders/generic/glsl-algebraic-logicand-false-2.shader_test new file mode 100644 index 000000000..93839d7a8 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicand-false-2.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicand-false.shader_test b/tests/shaders/generic/glsl-algebraic-logicand-false.shader_test new file mode 100644 index 000000000..dc250f6ce --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicand-false.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicand-true-2.shader_test b/tests/shaders/generic/glsl-algebraic-logicand-true-2.shader_test new file mode 100644 index 000000000..3802ad227 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicand-true-2.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicand-true.shader_test b/tests/shaders/generic/glsl-algebraic-logicand-true.shader_test new file mode 100644 index 000000000..0c5e599d9 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicand-true.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicor-false-2.shader_test b/tests/shaders/generic/glsl-algebraic-logicor-false-2.shader_test new file mode 100644 index 000000000..c9d31a212 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicor-false-2.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicor-false.shader_test b/tests/shaders/generic/glsl-algebraic-logicor-false.shader_test new file mode 100644 index 000000000..a0602bdda --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicor-false.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicor-true-2.shader_test b/tests/shaders/generic/glsl-algebraic-logicor-true-2.shader_test new file mode 100644 index 000000000..c37972da2 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicor-true-2.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicor-true.shader_test b/tests/shaders/generic/glsl-algebraic-logicor-true.shader_test new file mode 100644 index 000000000..3ce84131a --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicor-true.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicxor-false.shader_test b/tests/shaders/generic/glsl-algebraic-logicxor-false.shader_test new file mode 100644 index 000000000..6686f7261 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicxor-false.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-logicxor-true.shader_test b/tests/shaders/generic/glsl-algebraic-logicxor-true.shader_test new file mode 100644 index 000000000..602e16165 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-logicxor-true.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-mul-one.shader_test b/tests/shaders/generic/glsl-algebraic-mul-one.shader_test new file mode 100644 index 000000000..6f5a4d71e --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-mul-one.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-mul-zero.shader_test b/tests/shaders/generic/glsl-algebraic-mul-zero.shader_test new file mode 100644 index 000000000..17b4dd6ad --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-mul-zero.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-neg-neg.shader_test b/tests/shaders/generic/glsl-algebraic-neg-neg.shader_test new file mode 100644 index 000000000..5fa68fd9d --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-neg-neg.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-not-equals.shader_test b/tests/shaders/generic/glsl-algebraic-not-equals.shader_test new file mode 100644 index 000000000..3a0109c64 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-not-equals.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-not-notequals.shader_test b/tests/shaders/generic/glsl-algebraic-not-notequals.shader_test new file mode 100644 index 000000000..a84f7dc84 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-not-notequals.shader_test @@ -0,0 +1,27 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-pow-two.shader_test b/tests/shaders/generic/glsl-algebraic-pow-two.shader_test new file mode 100644 index 000000000..e47f6d67a --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-pow-two.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-rcp-rcp.shader_test b/tests/shaders/generic/glsl-algebraic-rcp-rcp.shader_test new file mode 100644 index 000000000..71d2c80de --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-rcp-rcp.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-rcp-rsq.shader_test b/tests/shaders/generic/glsl-algebraic-rcp-rsq.shader_test new file mode 100644 index 000000000..9d2b0eec5 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-rcp-rsq.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-rcp-sqrt.shader_test b/tests/shaders/generic/glsl-algebraic-rcp-sqrt.shader_test new file mode 100644 index 000000000..a85b14fad --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-rcp-sqrt.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-sub-zero-2.shader_test b/tests/shaders/generic/glsl-algebraic-sub-zero-2.shader_test new file mode 100644 index 000000000..fdeab6ff7 --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-sub-zero-2.shader_test @@ -0,0 +1,21 @@ +[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 diff --git a/tests/shaders/generic/glsl-algebraic-sub-zero.shader_test b/tests/shaders/generic/glsl-algebraic-sub-zero.shader_test new file mode 100644 index 000000000..ac83e9eca --- /dev/null +++ b/tests/shaders/generic/glsl-algebraic-sub-zero.shader_test @@ -0,0 +1,21 @@ +[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 |