Reviewed-by: Samuel Pitoiset <[email protected]>

On 08/02/2017 01:13 PM, Nicolai Hähnle wrote:
From: Nicolai Hähnle <[email protected]>

Use pipe_shader_type_from_mesa instead.
---
  src/mesa/state_tracker/st_atom_constbuf.c  |  2 +-
  src/mesa/state_tracker/st_context.h        | 24 ------------------------
  src/mesa/state_tracker/st_glsl_to_nir.cpp  |  2 +-
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  6 +++---
  src/mesa/state_tracker/st_texture.c        |  5 +++--
  5 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_constbuf.c 
b/src/mesa/state_tracker/st_atom_constbuf.c
index e4b5851..8c6d61a 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -56,7 +56,7 @@ void st_upload_constants(struct st_context *st, struct 
gl_program *prog)
  {
     gl_shader_stage stage = prog->info.stage;
     struct gl_program_parameter_list *params = prog->Parameters;
-   enum pipe_shader_type shader_type = st_shader_stage_to_ptarget(stage);
+   enum pipe_shader_type shader_type = pipe_shader_type_from_mesa(stage);
assert(shader_type == PIPE_SHADER_VERTEX ||
            shader_type == PIPE_SHADER_FRAGMENT ||
diff --git a/src/mesa/state_tracker/st_context.h 
b/src/mesa/state_tracker/st_context.h
index 4c742ca..ced915e 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -358,30 +358,6 @@ st_fb_orientation(const struct gl_framebuffer *fb)
  }
-static inline enum pipe_shader_type
-st_shader_stage_to_ptarget(gl_shader_stage stage)
-{
-   switch (stage) {
-   case MESA_SHADER_VERTEX:
-      return PIPE_SHADER_VERTEX;
-   case MESA_SHADER_FRAGMENT:
-      return PIPE_SHADER_FRAGMENT;
-   case MESA_SHADER_GEOMETRY:
-      return PIPE_SHADER_GEOMETRY;
-   case MESA_SHADER_TESS_CTRL:
-      return PIPE_SHADER_TESS_CTRL;
-   case MESA_SHADER_TESS_EVAL:
-      return PIPE_SHADER_TESS_EVAL;
-   case MESA_SHADER_COMPUTE:
-      return PIPE_SHADER_COMPUTE;
-   default:
-      break;
-   }
-
-   assert(!"should not be reached");
-   return PIPE_SHADER_VERTEX;
-}
-
  static inline bool
  st_user_clip_planes_enabled(struct gl_context *ctx)
  {
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 7f5a9af..a252207 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -227,7 +227,7 @@ st_glsl_to_nir(struct st_context *st, struct gl_program 
*prog,
                 gl_shader_stage stage)
  {
     struct pipe_screen *pscreen = st->pipe->screen;
-   enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(stage);
+   enum pipe_shader_type ptarget = pipe_shader_type_from_mesa(stage);
     const nir_shader_compiler_options *options;
     nir_shader *nir;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 4d66a32..9bc745c 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6801,7 +6801,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
     struct gl_shader_compiler_options *options =
           &ctx->Const.ShaderCompilerOptions[shader->Stage];
     struct pipe_screen *pscreen = ctx->st->pipe->screen;
-   enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(shader->Stage);
+   enum pipe_shader_type ptarget = pipe_shader_type_from_mesa(shader->Stage);
     unsigned skip_merge_registers;
validate_ir_tree(shader->ir);
@@ -7052,7 +7052,7 @@ st_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
        gl_shader_stage stage = shader->Stage;
        const struct gl_shader_compiler_options *options =
              &ctx->Const.ShaderCompilerOptions[stage];
-      enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(stage);
+      enum pipe_shader_type ptarget = pipe_shader_type_from_mesa(stage);
        bool have_dround = pscreen->get_shader_param(pscreen, ptarget,
                                                     
PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED);
        bool have_dfrexp = pscreen->get_shader_param(pscreen, ptarget,
@@ -7169,7 +7169,7 @@ st_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
           continue;
enum pipe_shader_type ptarget =
-         st_shader_stage_to_ptarget(shader->Stage);
+         pipe_shader_type_from_mesa(shader->Stage);
        enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir)
           pscreen->get_shader_param(pscreen, ptarget,
                                     PIPE_SHADER_CAP_PREFERRED_IR);
diff --git a/src/mesa/state_tracker/st_texture.c 
b/src/mesa/state_tracker/st_texture.c
index 2cd783e..f749fb0 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -41,6 +41,7 @@
  #include "util/u_rect.h"
  #include "util/u_math.h"
  #include "util/u_memory.h"
+#include "tgsi/tgsi_from_mesa.h"
#define DBG if(0) printf
@@ -550,7 +551,7 @@ void
  st_make_bound_samplers_resident(struct st_context *st,
                                  struct gl_program *prog)
  {
-   enum pipe_shader_type shader = st_shader_stage_to_ptarget(prog->info.stage);
+   enum pipe_shader_type shader = pipe_shader_type_from_mesa(prog->info.stage);
     struct st_bound_handles *bound_handles = 
&st->bound_texture_handles[shader];
     struct pipe_context *pipe = st->pipe;
     GLuint64 handle;
@@ -597,7 +598,7 @@ void
  st_make_bound_images_resident(struct st_context *st,
                                struct gl_program *prog)
  {
-   enum pipe_shader_type shader = st_shader_stage_to_ptarget(prog->info.stage);
+   enum pipe_shader_type shader = pipe_shader_type_from_mesa(prog->info.stage);
     struct st_bound_handles *bound_handles = &st->bound_image_handles[shader];
     struct pipe_context *pipe = st->pipe;
     GLuint64 handle;

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to