gallium: Use enum pipe_shader_type in bind_sampler_states() (v2)
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 14:45:48 +0000 (08:45 -0600)
v1 → v2:
 - Fixed indentation (noted by Brian Paul)
 - Removed second assert from nouveau's switch statements (suggested by
   Brian Paul)

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
28 files changed:
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/cso_cache/cso_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/a2xx/fd2_texture.c
src/gallium/drivers/freedreno/a3xx/fd3_texture.c
src/gallium/drivers/freedreno/a4xx/fd4_texture.c
src/gallium/drivers/freedreno/freedreno_texture.c
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_texture.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_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_sampler.c

index 4a54cff97a11b90f50ccf1d73750ff86ac7c4d5b..6ffcce4dc6ec3d4c3fe01c58ae52186d931445dd 100644 (file)
@@ -316,7 +316,7 @@ void cso_destroy_context( struct cso_context *ctx )
          static struct pipe_sampler_view *views[PIPE_MAX_SHADER_SAMPLER_VIEWS] = { NULL };
          static void *zeros[PIPE_MAX_SAMPLERS] = { NULL };
          struct pipe_screen *scr = ctx->pipe->screen;
-         unsigned sh;
+         enum pipe_shader_type sh;
          for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) {
             int maxsam = scr->get_shader_param(scr, sh,
                                                PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS);
@@ -1207,7 +1207,8 @@ cso_single_sampler(struct cso_context *ctx, unsigned shader_stage,
  * Send staged sampler state to the driver.
  */
 void
-cso_single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
+cso_single_sampler_done(struct cso_context *ctx,
+                        enum pipe_shader_type shader_stage)
 {
    struct sampler_info *info = &ctx->samplers[shader_stage];
    const unsigned old_nr_samplers = info->nr_samplers;
@@ -1233,7 +1234,7 @@ cso_single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
  */
 enum pipe_error
 cso_set_samplers(struct cso_context *ctx,
-                 unsigned shader_stage,
+                 enum pipe_shader_type shader_stage,
                  unsigned nr,
                  const struct pipe_sampler_state **templates)
 {
index a4309c7684ca6a9d99d721ea4af9fdf4ee202acc..5c9cb5a6327a26e5cbe80848eb0799fcee33f8d3 100644 (file)
@@ -60,7 +60,7 @@ enum pipe_error cso_set_rasterizer( struct cso_context *cso,
 
 enum pipe_error
 cso_set_samplers(struct cso_context *cso,
-                 unsigned shader_stage,
+                 enum pipe_shader_type shader_stage,
                  unsigned count,
                  const struct pipe_sampler_state **states);
 
@@ -73,7 +73,8 @@ cso_single_sampler(struct cso_context *cso, unsigned shader_stage,
                    unsigned idx, const struct pipe_sampler_state *states);
 
 void
-cso_single_sampler_done(struct cso_context *cso, unsigned shader_stage);
+cso_single_sampler_done(struct cso_context *cso,
+                        enum pipe_shader_type shader_stage);
 
 
 enum pipe_error cso_set_vertex_elements(struct cso_context *ctx,
index a5f07236e83c7a1ebe21ebe3987bea9c5fd9459e..1ea77da90e13041237757e806886e1b55087dbf3 100644 (file)
@@ -118,10 +118,12 @@ struct aaline_stage
    void (*driver_bind_fs_state)(struct pipe_context *, void *);
    void (*driver_delete_fs_state)(struct pipe_context *, void *);
 
-   void (*driver_bind_sampler_states)(struct pipe_context *, unsigned, unsigned,
+   void (*driver_bind_sampler_states)(struct pipe_context *,
+                                      enum pipe_shader_type, unsigned,
                                       unsigned, void **);
 
-   void (*driver_set_sampler_views)(struct pipe_context *, unsigned shader,
+   void (*driver_set_sampler_views)(struct pipe_context *,
+                                    enum pipe_shader_type shader,
                                     unsigned start, unsigned count,
                                     struct pipe_sampler_view **);
 };
@@ -884,7 +886,8 @@ aaline_delete_fs_state(struct pipe_context *pipe, void *fs)
 
 
 static void
-aaline_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
+aaline_bind_sampler_states(struct pipe_context *pipe,
+                           enum pipe_shader_type shader,
                            unsigned start, unsigned num, void **sampler)
 {
    struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
index 0298334a28f53667a4a5f8a7d8bcec673124b6c4..ed94083f06e4674b09018a23beab2e29a7466ff4 100644 (file)
@@ -99,7 +99,8 @@ struct pstip_stage
    void (*driver_bind_fs_state)(struct pipe_context *, void *);
    void (*driver_delete_fs_state)(struct pipe_context *, void *);
 
-   void (*driver_bind_sampler_states)(struct pipe_context *, unsigned,
+   void (*driver_bind_sampler_states)(struct pipe_context *,
+                                      enum pipe_shader_type,
                                       unsigned, unsigned, void **);
 
    void (*driver_set_sampler_views)(struct pipe_context *,
@@ -195,7 +196,6 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
       stage->tri(stage, header);
       return;
    }
-      
 
    /* how many samplers? */
    /* we'll use sampler/texture[pstip->sampler_unit] for the stipple */
@@ -374,7 +374,8 @@ pstip_delete_fs_state(struct pipe_context *pipe, void *fs)
 
 
 static void
-pstip_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
+pstip_bind_sampler_states(struct pipe_context *pipe,
+                          enum pipe_shader_type shader,
                           unsigned start, unsigned num, void **sampler)
 {
    struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
index 4423e904dc1bf17b91cd89f06679be072dccb2cf..25c6b5f75a69771f17b76aad6964f8c0e79b1d96 100644 (file)
@@ -230,7 +230,8 @@ DD_CSO_CREATE(sampler, sampler)
 DD_CSO_DELETE(sampler)
 
 static void
-dd_context_bind_sampler_states(struct pipe_context *_pipe, unsigned shader,
+dd_context_bind_sampler_states(struct pipe_context *_pipe,
+                               enum pipe_shader_type shader,
                                unsigned start, unsigned count, void **states)
 {
    struct dd_context *dctx = dd_context(_pipe);
index 6e4b5a5e72cf6356e8dc30f3dff29ca0802eaea4..932383a528e75b6f1f03036c8a7c36ecb5c680be 100644 (file)
@@ -103,7 +103,7 @@ fd2_sampler_state_create(struct pipe_context *pctx,
 
 static void
 fd2_sampler_states_bind(struct pipe_context *pctx,
-               unsigned shader, unsigned start,
+               enum pipe_shader_type shader, unsigned start,
                unsigned nr, void **hwcso)
 {
        if (!hwcso)
index ea2d34177a297e8adf1ae4c1615ae72b911c5cd6..94caaedae41819ccf50d219b1591556a72f869ce 100644 (file)
@@ -143,7 +143,7 @@ fd3_sampler_state_create(struct pipe_context *pctx,
 
 static void
 fd3_sampler_states_bind(struct pipe_context *pctx,
-               unsigned shader, unsigned start,
+               enum pipe_shader_type shader, unsigned start,
                unsigned nr, void **hwcso)
 {
        struct fd_context *ctx = fd_context(pctx);
index e62c732313e82a1d1ed0c51bb496655ca7fad88a..bad56fec83bbf12f057ae5474e46586e68ad11fa 100644 (file)
@@ -144,7 +144,7 @@ fd4_sampler_state_create(struct pipe_context *pctx,
 
 static void
 fd4_sampler_states_bind(struct pipe_context *pctx,
-               unsigned shader, unsigned start,
+               enum pipe_shader_type shader, unsigned start,
                unsigned nr, void **hwcso)
 {
        struct fd_context *ctx = fd_context(pctx);
index b506595192dc26ea03cb48d1bf8c20ee457f9752..884d7b04811af24084e406db0fb36ded2a358143 100644 (file)
@@ -86,7 +86,7 @@ static void set_sampler_views(struct fd_texture_stateobj *tex,
 
 void
 fd_sampler_states_bind(struct pipe_context *pctx,
-               unsigned shader, unsigned start,
+               enum pipe_shader_type shader, unsigned start,
                unsigned nr, void **hwcso)
 {
        struct fd_context *ctx = fd_context(pctx);
index 2efa14e3f1b40255ad5917e2578ef4231482ee60..0290c0fd33e8ec8f13a3d22e9292e039cdf5faf6 100644 (file)
@@ -358,7 +358,8 @@ static void i915_bind_fragment_sampler_states(struct pipe_context *pipe,
 
 
 static void
-i915_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
+i915_bind_sampler_states(struct pipe_context *pipe,
+                         enum pipe_shader_type shader,
                          unsigned start, unsigned num_samplers,
                          void **samplers)
 {
index 7693133a1bf4cf43cc76d924f95a8119497de4e3..e05d49f7bf453f17a344ff16f1c787aa3300ea19 100644 (file)
@@ -1052,7 +1052,8 @@ ilo_create_sampler_state(struct pipe_context *pipe,
 }
 
 static void
-ilo_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
+ilo_bind_sampler_states(struct pipe_context *pipe,
+                        enum pipe_shader_type shader,
                         unsigned start, unsigned count, void **samplers)
 {
    struct ilo_state_vector *vec = &ilo_context(pipe)->state_vector;
index 665cd9ed475464de64bbed15564a7bc86cc8b5fb..6dd520f65e7e1ba23ee0b16923e87ae9606763a6 100644 (file)
@@ -66,7 +66,7 @@ llvmpipe_create_sampler_state(struct pipe_context *pipe,
 
 static void
 llvmpipe_bind_sampler_states(struct pipe_context *pipe,
-                             unsigned shader,
+                             enum pipe_shader_type shader,
                              unsigned start,
                              unsigned num,
                              void **samplers)
index 0c0ad9f370e3a325f3c29d63718c2c37d5ef8953..ed964ddaf9288dc7e874089261b7ac613d4439cb 100644 (file)
@@ -130,7 +130,8 @@ static void noop_set_sampler_views(struct pipe_context *ctx, unsigned shader,
 {
 }
 
-static void noop_bind_sampler_states(struct pipe_context *ctx, unsigned shader,
+static void noop_bind_sampler_states(struct pipe_context *ctx,
+                                     enum pipe_shader_type shader,
                                      unsigned start, unsigned count,
                                      void **states)
 {
index 4f4f87e2ce9fe30f34f2a2f46c3dad871761d067..e5d3db39f17e37cc44489068a000b02a438977a6 100644 (file)
@@ -188,7 +188,7 @@ nv30_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
 
 static void
 nv30_bind_sampler_states(struct pipe_context *pipe,
-                         unsigned shader, unsigned start_slot,
+                         enum pipe_shader_type shader, unsigned start_slot,
                          unsigned num_samplers, void **samplers)
 {
    switch (shader) {
@@ -198,6 +198,9 @@ nv30_bind_sampler_states(struct pipe_context *pipe,
    case PIPE_SHADER_FRAGMENT:
       nv30_fragtex_sampler_states_bind(pipe, num_samplers, samplers);
       break;
+   default:
+      assert(!"unexpected shader type");
+      break;
    }
 }
 
index b6741140e50e534575042020de0e1cc3cdbb3d1c..86674673e9237308879ab53ea724946c84fb2058 100644 (file)
@@ -633,7 +633,7 @@ nv50_gp_sampler_states_bind(struct pipe_context *pipe, unsigned nr, void **s)
 
 static void
 nv50_bind_sampler_states(struct pipe_context *pipe,
-                         unsigned shader, unsigned start,
+                         enum pipe_shader_type shader, unsigned start,
                          unsigned num_samplers, void **samplers)
 {
    assert(start == 0);
@@ -647,6 +647,9 @@ nv50_bind_sampler_states(struct pipe_context *pipe,
    case PIPE_SHADER_FRAGMENT:
       nv50_fp_sampler_states_bind(pipe, num_samplers, samplers);
       break;
+   default:
+      assert(!"unexpected shader type");
+      break;
    }
 }
 
index b9ac9f49ad91cae1cd19c3cdbded660438db3336..0d971f3f2e4767161d86b5c29459ab1c098677e8 100644 (file)
@@ -426,7 +426,8 @@ nvc0_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
 }
 
 static inline void
-nvc0_stage_sampler_states_bind(struct nvc0_context *nvc0, int s,
+nvc0_stage_sampler_states_bind(struct nvc0_context *nvc0,
+                               enum pipe_shader_type s,
                                unsigned nr, void **hwcso)
 {
    unsigned i;
@@ -456,7 +457,7 @@ nvc0_stage_sampler_states_bind(struct nvc0_context *nvc0, int s,
 
 static void
 nvc0_stage_sampler_states_bind_range(struct nvc0_context *nvc0,
-                                     const unsigned s,
+                                     const enum pipe_shader_type s,
                                      unsigned start, unsigned nr, void **cso)
 {
    const unsigned end = start + nr;
@@ -497,7 +498,8 @@ nvc0_stage_sampler_states_bind_range(struct nvc0_context *nvc0,
 }
 
 static void
-nvc0_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
+nvc0_bind_sampler_states(struct pipe_context *pipe,
+                         enum pipe_shader_type shader,
                          unsigned start, unsigned nr, void **s)
 {
    switch (shader) {
@@ -526,6 +528,9 @@ nvc0_bind_sampler_states(struct pipe_context *pipe, unsigned shader,
                                            start, nr, s);
       nvc0_context(pipe)->dirty_cp |= NVC0_NEW_CP_SAMPLERS;
       break;
+   default:
+      assert(!"unexpected shader type");
+      break;
    }
 }
 
index 01ccd46f702cafaeebf49cf1603582a1fb217ea5..7c1aed8ff8089d2d5d65632de1071db9bbcfa0c3 100644 (file)
@@ -1469,7 +1469,7 @@ static void*
 }
 
 static void r300_bind_sampler_states(struct pipe_context* pipe,
-                                     unsigned shader,
+                                     enum pipe_shader_type shader,
                                      unsigned start, unsigned count,
                                      void** states)
 {
index a5341c3b420cf8af07200ba5cfb055e395d3d07e..fd8eb95af3a52585e4d0592596c8bd1cf1440a90 100644 (file)
@@ -408,7 +408,7 @@ void r600_sampler_states_dirty(struct r600_context *rctx,
 }
 
 static void r600_bind_sampler_states(struct pipe_context *pipe,
-                               unsigned shader,
+                              enum pipe_shader_type shader,
                               unsigned start,
                               unsigned count, void **states)
 {
index 0e026e957cd2d7cbf2c659fb4fa4283b6bda9691..075d0823e8da7480431cc17cd2f5675bb1b94526 100644 (file)
@@ -750,7 +750,8 @@ si_images_update_compressed_colortex_mask(struct si_images_info *images)
 
 /* SAMPLER STATES */
 
-static void si_bind_sampler_states(struct pipe_context *ctx, unsigned shader,
+static void si_bind_sampler_states(struct pipe_context *ctx,
+                                   enum pipe_shader_type shader,
                                    unsigned start, unsigned count, void **states)
 {
        struct si_context *sctx = (struct si_context *)ctx;
index 3c2dc698e42f606239edc198779171203a3a6d65..e87824145301ef5adee3eee292709adcb6e91ba1 100644 (file)
@@ -284,7 +284,8 @@ rbug_create_sampler_state(struct pipe_context *_pipe,
 }
 
 static void
-rbug_bind_sampler_states(struct pipe_context *_pipe, unsigned shader,
+rbug_bind_sampler_states(struct pipe_context *_pipe,
+                         enum pipe_shader_type shader,
                          unsigned start, unsigned count,
                          void **samplers)
 {
index f82474343566ff7aab70b34a3147d6e82c3c8258..6454f6bcd1b0dcb9efcb55366ec409336ded2d5b 100644 (file)
@@ -49,7 +49,7 @@
  */
 static void
 softpipe_bind_sampler_states(struct pipe_context *pipe,
-                             unsigned shader,
+                             enum pipe_shader_type shader,
                              unsigned start,
                              unsigned num,
                              void **samplers)
index 42e4fa5a69f1c8a71e795955b8c8f18bd3bd39cc..db598799ac75677d2fd7d52dc0e24d6c25a1f4a9 100644 (file)
@@ -286,7 +286,7 @@ svga_create_sampler_state(struct pipe_context *pipe,
 
 static void
 svga_bind_sampler_states(struct pipe_context *pipe,
-                         unsigned shader,
+                         enum pipe_shader_type shader,
                          unsigned start,
                          unsigned num,
                          void **samplers)
index 4c9a4327e29a85ade2e97ad4951d3803b137007f..f9d8ea84ee300700d1b6e6133f95445cd10f3d8c 100644 (file)
@@ -235,7 +235,7 @@ swr_create_sampler_state(struct pipe_context *pipe,
 
 static void
 swr_bind_sampler_states(struct pipe_context *pipe,
-                        unsigned shader,
+                        enum pipe_shader_type shader,
                         unsigned start,
                         unsigned num,
                         void **samplers)
index ef36f5faa472ab808ffd65e9a1cca8ae804476ef..7d3329e768fdf9ca71d64eecff60b3757983e6dc 100644 (file)
@@ -377,7 +377,7 @@ trace_context_create_sampler_state(struct pipe_context *_pipe,
 
 static void
 trace_context_bind_sampler_states(struct pipe_context *_pipe,
-                                  unsigned shader,
+                                  enum pipe_shader_type shader,
                                   unsigned start,
                                   unsigned num_states,
                                   void **states)
index 19aae35c65a37500c0f7d8f8213aa1aca5960450..5706765c2eb2e4103f526e0a5c64ff3ee7e8ecd1 100644 (file)
@@ -559,7 +559,7 @@ vc4_create_sampler_state(struct pipe_context *pctx,
 
 static void
 vc4_sampler_states_bind(struct pipe_context *pctx,
-                        unsigned shader, unsigned start,
+                        enum pipe_shader_type shader, unsigned start,
                         unsigned nr, void **hwcso)
 {
         struct vc4_context *vc4 = vc4_context(pctx);
index 615bb507afb5ae4334363ae2b0d357c8606f71ac..625baf99af991d82263e366090af948c9e39e708 100644 (file)
@@ -765,7 +765,8 @@ static void virgl_delete_sampler_state(struct pipe_context *ctx,
 }
 
 static void virgl_bind_sampler_states(struct pipe_context *ctx,
-                                     unsigned shader, unsigned start_slot,
+                                     enum pipe_shader_type shader,
+                                     unsigned start_slot,
                                      unsigned num_samplers,
                                      void **samplers)
 {
index 5359164ee9aa53e3c3971859de831a6a496e3dc9..9c9a126ad01588797fc3c21c6edfecac3bc2a6df 100644 (file)
@@ -193,8 +193,9 @@ struct pipe_context {
    void * (*create_sampler_state)(struct pipe_context *,
                                   const struct pipe_sampler_state *);
    void   (*bind_sampler_states)(struct pipe_context *,
-                                 unsigned shader, unsigned start_slot,
-                                 unsigned num_samplers, void **samplers);
+                                 enum pipe_shader_type shader,
+                                 unsigned start_slot, unsigned num_samplers,
+                                 void **samplers);
    void   (*delete_sampler_state)(struct pipe_context *, void *);
 
    void * (*create_rasterizer_state)(struct pipe_context *,
index 88ae7a09e464d7525761b05ca4ba3ecd2ba020a2..6b36ac74aad60779c17b1dda82420a5d93aab241 100644 (file)
@@ -237,7 +237,7 @@ convert_sampler(struct st_context *st,
  */
 static void
 update_shader_samplers(struct st_context *st,
-                       unsigned shader_stage,
+                       enum pipe_shader_type shader_stage,
                        const struct gl_program *prog,
                        unsigned max_units,
                        struct pipe_sampler_state *samplers,