gallium/tests/trivial: fix viewport depth transform
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 1 Mar 2018 00:40:48 +0000 (19:40 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 22 Apr 2018 03:31:48 +0000 (23:31 -0400)
These were getting mapped off into outer space, which would cause nv50
and nvc0 to clip the primitives (as depth_clip was enabled).

These drivers are configured to clip everything outside the [0, 1]
range, even though the hardware supports other view settings.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/tests/trivial/quad-tex.c
src/gallium/tests/trivial/tri.c

index df0e1301f5ef2a2e10a8743177f24beefe0f3d7c..1f29306ec0453ecf9eabbeb540b758838d1b9784 100644 (file)
@@ -27,8 +27,8 @@
 #define USE_TRACE 0
 #define WIDTH 300
 #define HEIGHT 300
-#define NEAR 30
-#define FAR 1000
+#define NEAR 0
+#define FAR 1
 #define FLIP 0
 
 /* pipe_*_state structs */
@@ -174,6 +174,7 @@ static void init_prog(struct program *p)
                memset(&box, 0, sizeof(box));
                box.width = 2;
                box.height = 2;
+               box.depth = 1;
 
                ptr = p->pipe->transfer_map(p->pipe, p->tex, 0, PIPE_TRANSFER_WRITE, &box, &t);
                ptr[0] = 0xffff0000;
@@ -226,7 +227,7 @@ static void init_prog(struct program *p)
        {
                float x = 0;
                float y = 0;
-               float z = FAR;
+               float z = NEAR;
                float half_width = (float)WIDTH / 2.0f;
                float half_height = (float)HEIGHT / 2.0f;
                float half_depth = ((float)FAR - (float)NEAR) / 2.0f;
index 71e9702275232a7c7c7715bd90366663d76a76a7..87a335fba1e5818bcae4c0f4878af93db0d00ebd 100644 (file)
@@ -27,8 +27,8 @@
 #define USE_TRACE 0
 #define WIDTH 300
 #define HEIGHT 300
-#define NEAR 30
-#define FAR 1000
+#define NEAR 0
+#define FAR 1
 #define FLIP 0
 
 /* pipe_*_state structs */
@@ -171,7 +171,7 @@ static void init_prog(struct program *p)
        {
                float x = 0;
                float y = 0;
-               float z = FAR;
+               float z = NEAR;
                float half_width = (float)WIDTH / 2.0f;
                float half_height = (float)HEIGHT / 2.0f;
                float half_depth = ((float)FAR - (float)NEAR) / 2.0f;