aboutsummaryrefslogtreecommitdiff
path: root/tests/glean/tglsl1.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-12-09 13:44:55 -0800
committerEric Anholt <eric@anholt.net>2009-12-09 13:44:55 -0800
commit1059cb6712faee4f5d59459ed937cbefaf57125b (patch)
treef868e1ff7081f27994186d2adc7f48de4961e10f /tests/glean/tglsl1.cpp
parent9a6cb4b2ac1e50a957dadbda3233216d4ab0cd87 (diff)
Update glean tests to 19f0f8e67a62d879216e75c756bed905019453c3
Diffstat (limited to 'tests/glean/tglsl1.cpp')
-rw-r--r--tests/glean/tglsl1.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/glean/tglsl1.cpp b/tests/glean/tglsl1.cpp
index 79ac78e6..9eca6bf9 100644
--- a/tests/glean/tglsl1.cpp
+++ b/tests/glean/tglsl1.cpp
@@ -606,6 +606,39 @@ static const ShaderProgram Programs[] = {
},
{
+ // This test is interesting for sqrt(0) which may be
+ // implemented as 1/rsqrt(x) which would generate Inf values
+ "sqrt(vec4) function",
+ NO_VERTEX_SHADER,
+ "uniform vec4 uniform1; \n"
+ "void main() { \n"
+ " vec4 u = vec4(0.0, 0.09, 0.25, 1.0); \n"
+ " u = u * uniform1.xxxx; // mul by 1.0 \n"
+ " u = sqrt(u); \n"
+ " gl_FragColor = u; \n"
+ "} \n",
+ { 0.0, 0.3, 0.5, 1.0 },
+ DONT_CARE_Z,
+ FLAG_NONE
+ },
+
+ {
+ "sqrt(vec2) function",
+ NO_VERTEX_SHADER,
+ "uniform vec4 uniform1; \n"
+ "void main() { \n"
+ " vec2 u = vec2(0.0, 0.04); \n"
+ " u = u * uniform1.xx; // mul by 1.0 \n"
+ " u = sqrt(u); \n"
+ " u = u * uniform1.xx; // mul by 1.0 \n"
+ " gl_FragColor = vec4(u.x, u.y, 0.0, 0.0); \n"
+ "} \n",
+ { 0.0, 0.2, 0.0, 0.0 },
+ DONT_CARE_Z,
+ FLAG_NONE
+ },
+
+ {
"clamp() function",
NO_VERTEX_SHADER,
"uniform vec4 uniform1; \n"
@@ -960,6 +993,41 @@ static const ShaderProgram Programs[] = {
FLAG_NONE
},
+ // Floating Point Precision ==========================================
+ {
+ "precision exp2",
+ NO_VERTEX_SHADER,
+ "uniform vec4 uniform1; \n"
+ "void main() { \n"
+ " vec4 vals = vec4(-0.999992, -0.988281, -0.535149, -0.496090); \n"
+ " vals *= uniform1.xxxx; // multply by one \n"
+ " vec4 actual = exp2(vals); \n"
+ " vec4 expected = vec4(0.500003, 0.504078, 0.690087, 0.709026); \n"
+ " vec4 error = abs((actual - expected) / expected); \n"
+ " gl_FragColor = vec4(lessThan(error, vec4(1e-04))); \n"
+ "} \n",
+ { 1.0, 1.0, 1.0, 1.0 },
+ DONT_CARE_Z,
+ FLAG_NONE
+ },
+
+ {
+ "precision log2",
+ NO_VERTEX_SHADER,
+ "uniform vec4 uniform1; \n"
+ "void main() { \n"
+ " vec4 vals = vec4(0.125096, 0.250265, 0.500301, 2.001205); \n"
+ " vals *= uniform1.xxxx; // multiply by one \n"
+ " vec4 actual = log2(vals); \n"
+ " vec4 expected = vec4(-2.998889, -1.998471, -0.999131, 1.000869); \n"
+ " vec4 error = abs(actual - expected); \n"
+ " gl_FragColor = vec4(lessThan(error, vec4(1e-05))); \n"
+ "} \n",
+ { 1.0, 1.0, 1.0, 1.0 },
+ DONT_CARE_Z,
+ FLAG_NONE
+ },
+
// Flow Control ======================================================
{
"simple if statement, fragment shader",