gallium: split depth_clip into depth_clip_near & depth_clip_far
[mesa.git] / src / gallium / tests / trivial / quad-tex.c
index c019c7bb0a3c590b9579db22b2d0965c4686b3fd..9a9d7012249cc5e69e779149533faa0c602a8a5b 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 */
@@ -50,7 +50,7 @@
 /* u_sampler_view_default_template */
 #include "util/u_sampler.h"
 /* debug_dump_surface_bmp */
-#include "util/u_debug.h"
+#include "util/u_debug_image.h"
 /* util_draw_vertex_buffer helper */
 #include "util/u_draw_quad.h"
 /* FREE & CALLOC_STRUCT */
@@ -96,12 +96,12 @@ static void init_prog(struct program *p)
        assert(ret);
 
        /* init a pipe screen */
-       p->screen = pipe_loader_create_screen(p->dev, PIPE_SEARCH_DIR);
+       p->screen = pipe_loader_create_screen(p->dev);
        assert(p->screen);
 
        /* create the pipe driver context and cso context */
-       p->pipe = p->screen->context_create(p->screen, NULL);
-       p->cso = cso_create_context(p->pipe);
+       p->pipe = p->screen->context_create(p->screen, NULL, 0);
+       p->cso = cso_create_context(p->pipe, 0);
 
        /* set clear color */
        p->clear_color.f[0] = 0.3;
@@ -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;
@@ -199,7 +200,8 @@ static void init_prog(struct program *p)
        p->rasterizer.cull_face = PIPE_FACE_NONE;
        p->rasterizer.half_pixel_center = 1;
        p->rasterizer.bottom_edge_rule = 1;
-       p->rasterizer.depth_clip = 1;
+       p->rasterizer.depth_clip_near = 1;
+       p->rasterizer.depth_clip_far = 1;
 
        /* sampler */
        memset(&p->sampler, 0, sizeof(p->sampler));
@@ -226,7 +228,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;
@@ -263,8 +265,8 @@ static void init_prog(struct program *p)
 
        /* vertex shader */
        {
-               const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
-                                               TGSI_SEMANTIC_GENERIC };
+               const enum tgsi_semantic semantic_names[] =
+                   { TGSI_SEMANTIC_POSITION, TGSI_SEMANTIC_GENERIC };
                const uint semantic_indexes[] = { 0, 0 };
                p->vs = util_make_vertex_passthrough_shader(p->pipe, 2, semantic_names, semantic_indexes, FALSE);
        }
@@ -272,7 +274,9 @@ static void init_prog(struct program *p)
        /* fragment shader */
        p->fs = util_make_fragment_tex_shader(p->pipe, TGSI_TEXTURE_2D,
                                              TGSI_INTERPOLATE_LINEAR,
-                                             TGSI_RETURN_TYPE_FLOAT);
+                                             TGSI_RETURN_TYPE_FLOAT,
+                                             TGSI_RETURN_TYPE_FLOAT, false,
+                                              false);
 }
 
 static void close_prog(struct program *p)