[Mesa-dev] [PATCH 2/4] gallium/util: add a window_space option to the passthrough vertex shader

Marek Olšák maraeo at gmail.com
Sun Nov 9 15:08:49 PST 2014


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/auxiliary/postprocess/pp_program.c |  2 +-
 src/gallium/auxiliary/util/u_blit.c            |  2 +-
 src/gallium/auxiliary/util/u_blitter.c         |  5 +++--
 src/gallium/auxiliary/util/u_simple_shaders.c  | 10 ++++++++--
 src/gallium/auxiliary/util/u_simple_shaders.h  |  4 +++-
 src/mesa/state_tracker/st_cb_bitmap.c          |  3 ++-
 src/mesa/state_tracker/st_cb_clear.c           |  3 ++-
 src/mesa/state_tracker/st_cb_drawtex.c         |  2 +-
 8 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c
index 91cc781..811f1fb 100644
--- a/src/gallium/auxiliary/postprocess/pp_program.c
+++ b/src/gallium/auxiliary/postprocess/pp_program.c
@@ -131,7 +131,7 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
       const uint semantic_indexes[] = { 0, 0 };
       p->passvs = util_make_vertex_passthrough_shader(p->pipe, 2,
                                                       semantic_names,
-                                                      semantic_indexes);
+                                                      semantic_indexes, FALSE);
    }
 
    p->framebuffer.nr_cbufs = 1;
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 2573bed..020e5f7 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -188,7 +188,7 @@ set_vertex_shader(struct blit_state *ctx)
       const uint semantic_indexes[] = { 0, 0 };
       ctx->vs = util_make_vertex_passthrough_shader(ctx->pipe, 2,
                                                     semantic_names,
-                                                    semantic_indexes);
+                                                    semantic_indexes, FALSE);
    }
 
    cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 4626c1e..b4598b8 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -331,7 +331,8 @@ static void bind_vs_pos_only(struct blitter_context_priv *ctx)
 
       ctx->vs_pos_only =
          util_make_vertex_passthrough_shader_with_so(pipe, 1, semantic_names,
-                                                     semantic_indices, &so);
+                                                     semantic_indices, FALSE,
+                                                     &so);
    }
 
    pipe->bind_vs_state(pipe, ctx->vs_pos_only);
@@ -347,7 +348,7 @@ static void bind_vs_passthrough(struct blitter_context_priv *ctx)
       const uint semantic_indices[] = { 0, 0 };
       ctx->vs =
          util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
-                                             semantic_indices);
+                                             semantic_indices, FALSE);
    }
 
    pipe->bind_vs_state(pipe, ctx->vs);
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c
index adf4887..280ed8f 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -59,11 +59,13 @@ void *
 util_make_vertex_passthrough_shader(struct pipe_context *pipe,
                                     uint num_attribs,
                                     const uint *semantic_names,
-                                    const uint *semantic_indexes)
+                                    const uint *semantic_indexes,
+                                    bool window_space)
 {
    return util_make_vertex_passthrough_shader_with_so(pipe, num_attribs,
                                                       semantic_names,
-                                                      semantic_indexes, NULL);
+                                                      semantic_indexes,
+                                                      window_space, NULL);
 }
 
 void *
@@ -71,6 +73,7 @@ util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
                                     uint num_attribs,
                                     const uint *semantic_names,
                                     const uint *semantic_indexes,
+                                    bool window_space,
 				    const struct pipe_stream_output_info *so)
 {
    struct ureg_program *ureg;
@@ -80,6 +83,9 @@ util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
    if (ureg == NULL)
       return NULL;
 
+   if (window_space)
+      ureg_property_vs_window_space_position(ureg, TRUE);
+
    for (i = 0; i < num_attribs; i++) {
       struct ureg_src src;
       struct ureg_dst dst;
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.h b/src/gallium/auxiliary/util/u_simple_shaders.h
index c1d14aa..2ba3f2a 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.h
+++ b/src/gallium/auxiliary/util/u_simple_shaders.h
@@ -47,13 +47,15 @@ extern void *
 util_make_vertex_passthrough_shader(struct pipe_context *pipe,
                                     uint num_attribs,
                                     const uint *semantic_names,
-                                    const uint *semantic_indexes);
+                                    const uint *semantic_indexes,
+                                    bool window_space);
 
 extern void *
 util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe,
                                     uint num_attribs,
                                     const uint *semantic_names,
                                     const uint *semantic_indexes,
+                                    bool window_space,
                                     const struct pipe_stream_output_info *so);
 
 extern void *
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index e3ba5a8..25975d0 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -769,7 +769,8 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
       const uint semantic_indexes[] = { 0, 0, 0 };
       st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3,
                                                           semantic_names,
-                                                          semantic_indexes);
+                                                          semantic_indexes,
+                                                          FALSE);
    }
 
    if (UseBitmapCache && accum_bitmap(ctx, x, y, width, height, unpack, bitmap))
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 2c1414e..bb84fd9 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -123,7 +123,8 @@ set_vertex_shader(struct st_context *st)
       const uint semantic_indexes[] = { 0, 0 };
       st->clear.vs = util_make_vertex_passthrough_shader(st->pipe, 2,
                                                          semantic_names,
-                                                         semantic_indexes);
+                                                         semantic_indexes,
+                                                         FALSE);
    }
 
    cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
index f997e6b..168c276 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -91,7 +91,7 @@ lookup_shader(struct pipe_context *pipe,
       util_make_vertex_passthrough_shader(pipe,
                                           num_attribs,
                                           semantic_names,
-                                          semantic_indexes);
+                                          semantic_indexes, FALSE);
    NumCachedShaders++;
 
    return CachedShaders[i].handle;
-- 
2.1.0



More information about the mesa-dev mailing list