Browse Source

tests: Fix coordinate system issues in GLSL shader input tests

rdb 2 months ago
parent
commit
a1f8759290
2 changed files with 15 additions and 10 deletions
  1. 5 0
      tests/display/conftest.py
  2. 10 10
      tests/display/test_glsl_shader.py

+ 5 - 0
tests/display/conftest.py

@@ -530,6 +530,11 @@ def env(request):
 
     words = request.param.split("-")
     if words[0] == "gl" or words[0] == "gles":
+        # Set the coordinate system to z-up-right, so that we get the same
+        # results with compute shaders (which always have an identity CS
+        # transform) and regular shaders.
+        config["gl-coordinate-system"] = "zup-right"
+
         if words[0] == "gles":
             # Necessary for image load/store support
             config["gl-immutable-texture-storage"] = "true"

+ 10 - 10
tests/display/test_glsl_shader.py

@@ -1066,16 +1066,16 @@ def test_glsl_state_light_source(env):
     assert(p3d_LightSource[0].shadowViewMatrix[0][1] == 0);
     assert(p3d_LightSource[0].shadowViewMatrix[0][2] == 0);
     assert(p3d_LightSource[0].shadowViewMatrix[0][3] == 0);
-    assert(p3d_LightSource[0].shadowViewMatrix[1][0] == 0);
-    assert(p3d_LightSource[0].shadowViewMatrix[1][1] > 0.2886);
-    assert(p3d_LightSource[0].shadowViewMatrix[1][1] < 0.2887);
-    assert(p3d_LightSource[0].shadowViewMatrix[1][2] == 0);
-    assert(p3d_LightSource[0].shadowViewMatrix[1][3] == 0);
-    //assert(p3d_LightSource[0].shadowViewMatrix[2][0] == -0.5);
-    //assert(p3d_LightSource[0].shadowViewMatrix[2][1] == -0.5);
-    assert(p3d_LightSource[0].shadowViewMatrix[2][2] > -1.00002);
-    //assert(p3d_LightSource[0].shadowViewMatrix[2][2] < -1.0);
-    //assert(p3d_LightSource[0].shadowViewMatrix[2][3] == -1);
+    assert(p3d_LightSource[0].shadowViewMatrix[1][0] == 0.5);
+    assert(p3d_LightSource[0].shadowViewMatrix[1][1] == 0.5);
+    assert(p3d_LightSource[0].shadowViewMatrix[1][2] > 1.0);
+    assert(p3d_LightSource[0].shadowViewMatrix[1][2] < 1.00002);
+    assert(p3d_LightSource[0].shadowViewMatrix[1][3] == 1);
+    assert(p3d_LightSource[0].shadowViewMatrix[2][0] == 0);
+    assert(p3d_LightSource[0].shadowViewMatrix[2][1] > 0.2886);
+    assert(p3d_LightSource[0].shadowViewMatrix[2][1] < 0.2887);
+    assert(p3d_LightSource[0].shadowViewMatrix[2][2] == 0);
+    assert(p3d_LightSource[0].shadowViewMatrix[2][3] == 0);
     assert(p3d_LightSource[0].shadowViewMatrix[3][0] > -16.2736);
     assert(p3d_LightSource[0].shadowViewMatrix[3][0] < -16.2734);
     assert(p3d_LightSource[0].shadowViewMatrix[3][1] > -16.8510);