gallium: Use enum pipe_shader_type in set_sampler_views()
authorKai Wasserbäch <kai@dev.carbon-project.org>
Sat, 27 Aug 2016 10:08:00 +0000 (04:08 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 29 Aug 2016 15:07:25 +0000 (09:07 -0600)
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
34 files changed:
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/cso_cache/cso_context.h
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/auxiliary/draw/draw_pipe_aaline.c
src/gallium/auxiliary/draw/draw_pipe_pstipple.c
src/gallium/drivers/ddebug/dd_context.c
src/gallium/drivers/freedreno/a4xx/fd4_texture.c
src/gallium/drivers/freedreno/freedreno_texture.c
src/gallium/drivers/freedreno/freedreno_texture.h
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/ilo/ilo_state.c
src/gallium/drivers/llvmpipe/lp_state_sampler.c
src/gallium/drivers/noop/noop_state.c
src/gallium/drivers/nouveau/nv30/nv30_fragtex.c
src/gallium/drivers/nouveau/nv50/nv50_state.c
src/gallium/drivers/nouveau/nvc0/nvc0_state.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/radeonsi/si_descriptors.c
src/gallium/drivers/rbug/rbug_context.c
src/gallium/drivers/softpipe/sp_state.h
src/gallium/drivers/softpipe/sp_state_sampler.c
src/gallium/drivers/svga/svga_pipe_sampler.c
src/gallium/drivers/swr/swr_state.cpp
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/vc4/vc4_state.c
src/gallium/drivers/virgl/virgl_context.c
src/gallium/include/pipe/p_context.h
src/mesa/state_tracker/st_atom_constbuf.c
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_context.h
src/mesa/state_tracker/st_glsl_to_nir.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 6ffcce4dc6ec3d4c3fe01c58ae52186d931445dd..5e6b36e9b535ec9883ca5a51d29e4c3088fdb8d1 100644 (file)
@@ -1284,7 +1284,7 @@ cso_restore_fragment_samplers(struct cso_context *ctx)
 
 void
 cso_set_sampler_views(struct cso_context *ctx,
-                      unsigned shader_stage,
+                      enum pipe_shader_type shader_stage,
                       unsigned count,
                       struct pipe_sampler_view **views)
 {
index 5c9cb5a6327a26e5cbe80848eb0799fcee33f8d3..27863f4a642451b211fd51b8727bfe7e39619bee 100644 (file)
@@ -188,7 +188,7 @@ void cso_restore_state(struct cso_context *cso);
 
 void
 cso_set_sampler_views(struct cso_context *cso,
-                      unsigned shader_stage,
+                      enum pipe_shader_type shader_stage,
                       unsigned count,
                       struct pipe_sampler_view **views);
 
index 6305761f2dbd05ce5c250e7c272861ec7d1fd93f..56abcff5a248addaa4f25603ce0df64c1231952d 100644 (file)
@@ -964,7 +964,7 @@ draw_set_mapped_so_targets(struct draw_context *draw,
 
 void
 draw_set_sampler_views(struct draw_context *draw,
-                       unsigned shader_stage,
+                       enum pipe_shader_type shader_stage,
                        struct pipe_sampler_view **views,
                        unsigned num)
 {
@@ -985,7 +985,7 @@ draw_set_sampler_views(struct draw_context *draw,
 
 void
 draw_set_samplers(struct draw_context *draw,
-                  unsigned shader_stage,
+                  enum pipe_shader_type shader_stage,
                   struct pipe_sampler_state **samplers,
                   unsigned num)
 {
index 9167ffde753643888427deff3ba894e4dba74ac4..145fc2ed467bba4de79d98a367972d90e879221b 100644 (file)
@@ -167,12 +167,12 @@ draw_buffer(struct draw_context *draw,
 
 void
 draw_set_sampler_views(struct draw_context *draw,
-                       unsigned shader_stage,
+                       enum pipe_shader_type shader_stage,
                        struct pipe_sampler_view **views,
                        unsigned num);
 void
 draw_set_samplers(struct draw_context *draw,
-                  unsigned shader_stage,
+                  enum pipe_shader_type shader_stage,
                   struct pipe_sampler_state **samplers,
                   unsigned num);
 
index 1ea77da90e13041237757e806886e1b55087dbf3..c236caa3eddde7f516c041247f859808ddfd4bdc 100644 (file)
@@ -910,7 +910,8 @@ aaline_bind_sampler_states(struct pipe_context *pipe,
 
 
 static void
-aaline_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+aaline_set_sampler_views(struct pipe_context *pipe,
+                         enum pipe_shader_type shader,
                          unsigned start, unsigned num,
                          struct pipe_sampler_view **views)
 {
index ed94083f06e4674b09018a23beab2e29a7466ff4..33bd7b6cfd511807391335e0368cdc6aef0eba1d 100644 (file)
@@ -104,8 +104,8 @@ struct pstip_stage
                                       unsigned, unsigned, void **);
 
    void (*driver_set_sampler_views)(struct pipe_context *,
-                                    unsigned shader, unsigned start,
-                                    unsigned count,
+                                    enum pipe_shader_type shader,
+                                    unsigned start, unsigned count,
                                     struct pipe_sampler_view **);
 
    void (*driver_set_polygon_stipple)(struct pipe_context *,
@@ -143,7 +143,7 @@ generate_pstip_fs(struct pstip_stage *pstip)
    assert(pstip->fs->sampler_unit < PIPE_MAX_SAMPLERS);
 
    pstip->fs->pstip_fs = pstip->driver_create_fs_state(pipe, &pstip_fs);
-   
+
    FREE((void *)pstip_fs.tokens);
 
    if (!pstip->fs->pstip_fs)
@@ -399,7 +399,8 @@ pstip_bind_sampler_states(struct pipe_context *pipe,
 
 static void
 pstip_set_sampler_views(struct pipe_context *pipe,
-                        unsigned shader, unsigned start, unsigned num,
+                        enum pipe_shader_type shader,
+                        unsigned start, unsigned num,
                         struct pipe_sampler_view **views)
 {
    struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
index 25c6b5f75a69771f17b76aad6964f8c0e79b1d96..50edfd794e36e0ff9a6756cfa8df0212e719a139 100644 (file)
@@ -507,7 +507,8 @@ dd_context_stream_output_target_destroy(struct pipe_context *_pipe,
  */
 
 static void
-dd_context_set_sampler_views(struct pipe_context *_pipe, unsigned shader,
+dd_context_set_sampler_views(struct pipe_context *_pipe,
+                             enum pipe_shader_type shader,
                              unsigned start, unsigned num,
                              struct pipe_sampler_view **views)
 {
index bad56fec83bbf12f057ae5474e46586e68ad11fa..4faeceee5e61f890ea68a78c59ebcca06e3b09f4 100644 (file)
@@ -308,7 +308,7 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
 }
 
 static void
-fd4_set_sampler_views(struct pipe_context *pctx, unsigned shader,
+fd4_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
                unsigned start, unsigned nr,
                struct pipe_sampler_view **views)
 {
index 884d7b04811af24084e406db0fb36ded2a358143..2d038927a5a6a676d27eaf28ffb9c44d30365ce1 100644 (file)
@@ -102,7 +102,7 @@ fd_sampler_states_bind(struct pipe_context *pctx,
 }
 
 void
-fd_set_sampler_views(struct pipe_context *pctx, unsigned shader,
+fd_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
                unsigned start, unsigned nr,
                struct pipe_sampler_view **views)
 {
index b52e27d07a00fb59dae8687623a113b05f2f4b62..612453299678139b0a37334c09fd398578fa36e6 100644 (file)
@@ -35,7 +35,8 @@ void fd_sampler_states_bind(struct pipe_context *pctx,
                unsigned shader, unsigned start,
                unsigned nr, void **hwcso);
 
-void fd_set_sampler_views(struct pipe_context *pctx, unsigned shader,
+void fd_set_sampler_views(struct pipe_context *pctx,
+                                                 enum pipe_shader_type shader,
                                                  unsigned start, unsigned nr,
                                                  struct pipe_sampler_view **views);
 
index 0290c0fd33e8ec8f13a3d22e9292e039cdf5faf6..950604407e9762a9718bb76e936ee1458dcef711 100644 (file)
@@ -794,7 +794,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe,
 
 
 static void
-i915_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+i915_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
                        unsigned start, unsigned num,
                        struct pipe_sampler_view **views)
 {
index e05d49f7bf453f17a344ff16f1c787aa3300ea19..0ae32c76161c68935c030f413d3450f9246fc366 100644 (file)
@@ -1802,7 +1802,7 @@ ilo_set_viewport_states(struct pipe_context *pipe,
 }
 
 static void
-ilo_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+ilo_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
                       unsigned start, unsigned count,
                       struct pipe_sampler_view **views)
 {
@@ -1846,6 +1846,9 @@ ilo_set_sampler_views(struct pipe_context *pipe, unsigned shader,
    case PIPE_SHADER_COMPUTE:
       vec->dirty |= ILO_DIRTY_VIEW_CS;
       break;
+   default:
+      assert(!"unexpected shader type");
+      break;
    }
 }
 
index 6dd520f65e7e1ba23ee0b16923e87ae9606763a6..01af052114643967404b3a33f441c8448c427761 100644 (file)
@@ -106,7 +106,7 @@ llvmpipe_bind_sampler_states(struct pipe_context *pipe,
 
 static void
 llvmpipe_set_sampler_views(struct pipe_context *pipe,
-                           unsigned shader,
+                           enum pipe_shader_type shader,
                            unsigned start,
                            unsigned num,
                            struct pipe_sampler_view **views)
index ed964ddaf9288dc7e874089261b7ac613d4439cb..4f63e4d8959e0c3feac08d4fbced781cc988fa97 100644 (file)
@@ -124,7 +124,8 @@ static struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
    return surface;
 }
 
-static void noop_set_sampler_views(struct pipe_context *ctx, unsigned shader,
+static void noop_set_sampler_views(struct pipe_context *ctx,
+                                   enum pipe_shader_type shader,
                                    unsigned start, unsigned count,
                                    struct pipe_sampler_view **views)
 {
index 4ab31d1416966bb1d498dafb9ba6f4d453e4e193..a6bfee6f0bba1a00861a7041500581deda5015a8 100644 (file)
@@ -196,7 +196,7 @@ nv30_fragtex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
 
 
 static void
-nv30_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+nv30_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
                        unsigned start, unsigned nr,
                        struct pipe_sampler_view **views)
 {
index 86674673e9237308879ab53ea724946c84fb2058..57b23e6af5cde84804fd61345dbaaaa5503688c1 100644 (file)
@@ -712,7 +712,7 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s,
 }
 
 static void
-nv50_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+nv50_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
                        unsigned start, unsigned nr,
                        struct pipe_sampler_view **views)
 {
index 0d971f3f2e4767161d86b5c29459ab1c098677e8..c9b0e3fcf43a647f495ba04dc5bfa108dffb6512 100644 (file)
@@ -656,7 +656,7 @@ nvc0_stage_set_sampler_views_range(struct nvc0_context *nvc0, const unsigned s,
 }
 
 static void
-nvc0_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+nvc0_set_sampler_views(struct pipe_context *pipe, enum pipe_shader_type shader,
                        unsigned start, unsigned nr,
                        struct pipe_sampler_view **views)
 {
index 7c1aed8ff8089d2d5d65632de1071db9bbcfa0c3..196c0df88644b3ca472c23b62f79a85b1308429f 100644 (file)
@@ -1522,7 +1522,8 @@ static uint32_t r300_assign_texture_cache_region(unsigned index, unsigned num)
         return R300_TX_CACHE(num + index);
 }
 
-static void r300_set_sampler_views(struct pipe_context* pipe, unsigned shader,
+static void r300_set_sampler_views(struct pipe_context* pipe,
+                                   enum pipe_shader_type shader,
                                    unsigned start, unsigned count,
                                    struct pipe_sampler_view** views)
 {
index fd8eb95af3a52585e4d0592596c8bd1cf1440a90..5234c044b673d06dca14eb660f4332d3815a5aa2 100644 (file)
@@ -597,7 +597,8 @@ void r600_sampler_views_dirty(struct r600_context *rctx,
        }
 }
 
-static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader,
+static void r600_set_sampler_views(struct pipe_context *pipe,
+                                  enum pipe_shader_type shader,
                                   unsigned start, unsigned count,
                                   struct pipe_sampler_view **views)
 {
index 075d0823e8da7480431cc17cd2f5675bb1b94526..573c8a858174cd7afd374ffe4db73d3c1e6fad43 100644 (file)
@@ -465,7 +465,7 @@ static bool is_compressed_colortex(struct r600_texture *rtex)
 }
 
 static void si_set_sampler_views(struct pipe_context *ctx,
-                                unsigned shader, unsigned start,
+                                enum pipe_shader_type shader, unsigned start,
                                  unsigned count,
                                 struct pipe_sampler_view **views)
 {
index e87824145301ef5adee3eee292709adcb6e91ba1..b08acfaf8c171fee032e6879945b67ec2624df83 100644 (file)
@@ -727,7 +727,7 @@ rbug_set_viewport_states(struct pipe_context *_pipe,
 
 static void
 rbug_set_sampler_views(struct pipe_context *_pipe,
-                       unsigned shader,
+                       enum pipe_shader_type shader,
                        unsigned start,
                        unsigned num,
                        struct pipe_sampler_view **_views)
index 0ced70c305d8a47abc5dce0caf1c494bb8257fd6..af6b9782afa42111d1c6bb6238fbae463a15b682 100644 (file)
@@ -172,7 +172,7 @@ softpipe_update_derived(struct softpipe_context *softpipe, unsigned prim);
 
 void
 softpipe_set_sampler_views(struct pipe_context *pipe,
-                           unsigned shader,
+                           enum pipe_shader_type shader,
                            unsigned start,
                            unsigned num,
                            struct pipe_sampler_view **views);
index 6454f6bcd1b0dcb9efcb55366ec409336ded2d5b..a4185c2b641acd0611e8445311cbe4011ba36776 100644 (file)
@@ -97,7 +97,7 @@ softpipe_sampler_view_destroy(struct pipe_context *pipe,
 
 void
 softpipe_set_sampler_views(struct pipe_context *pipe,
-                           unsigned shader,
+                           enum pipe_shader_type shader,
                            unsigned start,
                            unsigned num,
                            struct pipe_sampler_view **views)
index db598799ac75677d2fd7d52dc0e24d6c25a1f4a9..4a2b3c3ef72be594babe79d85d6c8cf574c3cf92 100644 (file)
@@ -417,7 +417,7 @@ svga_sampler_view_destroy(struct pipe_context *pipe,
 
 static void
 svga_set_sampler_views(struct pipe_context *pipe,
-                       unsigned shader,
+                       enum pipe_shader_type shader,
                        unsigned start,
                        unsigned num,
                        struct pipe_sampler_view **views)
index f9d8ea84ee300700d1b6e6133f95445cd10f3d8c..7d49ce7b896f5de367c3a940ef7be7cd0d7c6bd8 100644 (file)
@@ -282,7 +282,7 @@ swr_create_sampler_view(struct pipe_context *pipe,
 
 static void
 swr_set_sampler_views(struct pipe_context *pipe,
-                      unsigned shader,
+                      enum pipe_shader_type shader,
                       unsigned start,
                       unsigned num,
                       struct pipe_sampler_view **views)
index 7d3329e768fdf9ca71d64eecff60b3757983e6dc..a648297fa9bb0944d850d923896977f9eabddf5f 100644 (file)
@@ -1016,7 +1016,7 @@ trace_context_surface_destroy(struct pipe_context *_pipe,
 
 static void
 trace_context_set_sampler_views(struct pipe_context *_pipe,
-                                unsigned shader,
+                                enum pipe_shader_type shader,
                                 unsigned start,
                                 unsigned num,
                                 struct pipe_sampler_view **views)
index 5706765c2eb2e4103f526e0a5c64ff3ee7e8ecd1..bf211b1b02ab493ff834d9866c1b35f5b94091de 100644 (file)
@@ -480,7 +480,7 @@ vc4_set_framebuffer_state(struct pipe_context *pctx,
 }
 
 static struct vc4_texture_stateobj *
-vc4_get_stage_tex(struct vc4_context *vc4, unsigned shader)
+vc4_get_stage_tex(struct vc4_context *vc4, enum pipe_shader_type shader)
 {
         switch (shader) {
         case PIPE_SHADER_FRAGMENT:
@@ -660,7 +660,8 @@ vc4_sampler_view_destroy(struct pipe_context *pctx,
 }
 
 static void
-vc4_set_sampler_views(struct pipe_context *pctx, unsigned shader,
+vc4_set_sampler_views(struct pipe_context *pctx,
+                      enum pipe_shader_type shader,
                       unsigned start, unsigned nr,
                       struct pipe_sampler_view **views)
 {
index 625baf99af991d82263e366090af948c9e39e708..1bd7f3b6b52584f53001b26d49e27c2b22b59c08 100644 (file)
@@ -690,7 +690,7 @@ static struct pipe_sampler_view *virgl_create_sampler_view(struct pipe_context *
 }
 
 static void virgl_set_sampler_views(struct pipe_context *ctx,
-                                   unsigned shader_type,
+                                   enum pipe_shader_type shader_type,
                                    unsigned start_slot,
                                    unsigned num_views,
                                    struct pipe_sampler_view **views)
index 9c9a126ad01588797fc3c21c6edfecac3bc2a6df..b74679d1f82e773c6c9986d3544311622d1309e7 100644 (file)
@@ -285,7 +285,8 @@ struct pipe_context {
                                 unsigned num_viewports,
                                 const struct pipe_viewport_state *);
 
-   void (*set_sampler_views)(struct pipe_context *, unsigned shader,
+   void (*set_sampler_views)(struct pipe_context *,
+                             enum pipe_shader_type shader,
                              unsigned start_slot, unsigned num_views,
                              struct pipe_sampler_view **);
 
index a5d60257d0d00b1c8a9cdd4655e47cc8cf89582f..8882582c6012a98757fa0a2b5f3f227fc0d67610 100644 (file)
@@ -57,7 +57,7 @@ void st_upload_constants( struct st_context *st,
                           struct gl_program_parameter_list *params,
                           gl_shader_stage stage)
 {
-   unsigned shader_type = st_shader_stage_to_ptarget(stage);
+   enum pipe_shader_type shader_type = st_shader_stage_to_ptarget(stage);
 
    assert(shader_type == PIPE_SHADER_VERTEX ||
           shader_type == PIPE_SHADER_FRAGMENT ||
index 9ee476de14cfcf585b73b972b8ab2f123dd7877c..b6471178ce426ece3d0c8c174557028547038b0a 100644 (file)
@@ -427,7 +427,7 @@ update_textures(struct st_context *st,
    struct gl_shader_program *shader =
       st->ctx->_Shader->CurrentProgram[mesa_shader];
    unsigned glsl_version = shader ? shader->Version : 0;
-   unsigned shader_stage = st_shader_stage_to_ptarget(mesa_shader);
+   enum pipe_shader_type shader_stage = st_shader_stage_to_ptarget(mesa_shader);
 
    if (samplers_used == 0x0 && old_max == 0)
       return;
index f82cf3a85aac2f27c14c1f0b1f92fe75f441caab..2b783e0028193aa500cf92957b41503b05bde51a 100644 (file)
@@ -317,7 +317,7 @@ st_fb_orientation(const struct gl_framebuffer *fb)
 }
 
 
-static inline unsigned
+static inline enum pipe_shader_type
 st_shader_stage_to_ptarget(gl_shader_stage stage)
 {
    switch (stage) {
index be2d5b2ff0f9f73daad2aca5bd0b7f28cd135f68..307bf3e3a142455df2dac10ef447529bbc737937 100644 (file)
@@ -218,7 +218,7 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
                gl_shader_stage stage)
 {
    struct pipe_screen *pscreen = st->pipe->screen;
-   unsigned ptarget = st_shader_stage_to_ptarget(stage);
+   enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(stage);
    const nir_shader_compiler_options *options;
    nir_shader *nir;
 
index 50ff4231eabc7faf7d88374eb5dce647abf10122..b7e47dbc21bb71c1fce16d77734c1ae9f75ddb2f 100644 (file)
@@ -6465,7 +6465,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;
-   unsigned ptarget = st_shader_stage_to_ptarget(shader->Stage);
+   enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(shader->Stage);
 
    validate_ir_tree(shader->ir);
 
@@ -6701,7 +6701,7 @@ get_mesa_program(struct gl_context *ctx,
                  struct gl_linked_shader *shader)
 {
    struct pipe_screen *pscreen = ctx->st->pipe->screen;
-   unsigned ptarget = st_shader_stage_to_ptarget(shader->Stage);
+   enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(shader->Stage);
    enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir)
       pscreen->get_shader_param(pscreen, ptarget, PIPE_SHADER_CAP_PREFERRED_IR);
    struct gl_program *prog = NULL;
@@ -6855,7 +6855,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       gl_shader_stage stage = prog->_LinkedShaders[i]->Stage;
       const struct gl_shader_compiler_options *options =
             &ctx->Const.ShaderCompilerOptions[stage];
-      unsigned ptarget = st_shader_stage_to_ptarget(stage);
+      enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(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,