[Mesa-dev] [PATCH 4/5] st/mesa: use the new subroutine index upload API.

Dave Airlie airlied at gmail.com
Tue Jun 7 05:25:58 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This plugs the new API into the gallium state tracker.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa/state_tracker/st_atom_constbuf.c | 19 +++++++++++--------
 src/mesa/state_tracker/st_cb_bitmap.c     |  2 +-
 src/mesa/state_tracker/st_cb_drawpixels.c |  4 ++--
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index a980dbe..2646c00 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -34,7 +34,7 @@
 #include "main/imports.h"
 #include "program/prog_parameter.h"
 #include "program/prog_print.h"
-
+#include "main/shaderapi.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
@@ -55,8 +55,10 @@
  */
 void st_upload_constants( struct st_context *st,
                           struct gl_program_parameter_list *params,
-                          unsigned shader_type)
+                          gl_shader_stage stage)
 {
+   unsigned shader_type = st_shader_stage_to_ptarget(stage);
+
    assert(shader_type == PIPE_SHADER_VERTEX ||
           shader_type == PIPE_SHADER_FRAGMENT ||
           shader_type == PIPE_SHADER_GEOMETRY ||
@@ -92,6 +94,7 @@ void st_upload_constants( struct st_context *st,
       if (params->StateFlags)
          _mesa_load_state_parameters(st->ctx, params);
 
+      _mesa_shader_write_subroutine_indicies(st->ctx, stage);
       /* We always need to get a new buffer, to keep the drivers simple and
        * avoid gratuitous rendering synchronization.
        * Let's use a user buffer to avoid an unnecessary copy.
@@ -140,7 +143,7 @@ static void update_vs_constants(struct st_context *st )
    struct st_vertex_program *vp = st->vp;
    struct gl_program_parameter_list *params = vp->Base.Base.Parameters;
 
-   st_upload_constants( st, params, PIPE_SHADER_VERTEX );
+   st_upload_constants( st, params, MESA_SHADER_VERTEX );
 }
 
 
@@ -163,7 +166,7 @@ static void update_fs_constants(struct st_context *st )
    struct st_fragment_program *fp = st->fp;
    struct gl_program_parameter_list *params = fp->Base.Base.Parameters;
 
-   st_upload_constants( st, params, PIPE_SHADER_FRAGMENT );
+   st_upload_constants( st, params, MESA_SHADER_FRAGMENT );
 }
 
 
@@ -185,7 +188,7 @@ static void update_gs_constants(struct st_context *st )
 
    if (gp) {
       params = gp->Base.Base.Parameters;
-      st_upload_constants( st, params, PIPE_SHADER_GEOMETRY );
+      st_upload_constants( st, params, MESA_SHADER_GEOMETRY );
    }
 }
 
@@ -207,7 +210,7 @@ static void update_tcs_constants(struct st_context *st )
 
    if (tcp) {
       params = tcp->Base.Base.Parameters;
-      st_upload_constants( st, params, PIPE_SHADER_TESS_CTRL );
+      st_upload_constants( st, params, MESA_SHADER_TESS_CTRL );
    }
 }
 
@@ -229,7 +232,7 @@ static void update_tes_constants(struct st_context *st )
 
    if (tep) {
       params = tep->Base.Base.Parameters;
-      st_upload_constants( st, params, PIPE_SHADER_TESS_EVAL );
+      st_upload_constants( st, params, MESA_SHADER_TESS_EVAL );
    }
 }
 
@@ -251,7 +254,7 @@ static void update_cs_constants(struct st_context *st )
 
    if (cp) {
       params = cp->Base.Base.Parameters;
-      st_upload_constants( st, params, PIPE_SHADER_COMPUTE );
+      st_upload_constants( st, params, MESA_SHADER_COMPUTE );
    }
 }
 
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index b4d04b4..d062907 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -212,7 +212,7 @@ setup_render_state(struct gl_context *ctx,
       COPY_4V(colorSave, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
       COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color);
       st_upload_constants(st, st->fp->Base.Base.Parameters,
-                          PIPE_SHADER_FRAGMENT);
+                          MESA_SHADER_FRAGMENT);
       COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], colorSave);
    }
 
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 311ba25..0411156 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1121,7 +1121,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
        * into the constant buffer, we need to update them
        */
       st_upload_constants(st, st->fp->Base.Base.Parameters,
-                          PIPE_SHADER_FRAGMENT);
+                          MESA_SHADER_FRAGMENT);
    }
 
    /* Put glDrawPixels image into a texture */
@@ -1481,7 +1481,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
        * into the constant buffer, we need to update them
        */
       st_upload_constants(st, st->fp->Base.Base.Parameters,
-                          PIPE_SHADER_FRAGMENT);
+                          MESA_SHADER_FRAGMENT);
    }
    else {
       assert(type == GL_DEPTH);
-- 
2.5.5



More information about the mesa-dev mailing list