[PATCH 02/11] etnaviv: s/etna_shader/etna_shader_variant

Christian Gmeiner christian.gmeiner at gmail.com
Sun Mar 26 14:13:06 UTC 2017


Prep work to add shader variant support.

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_compiler.c     | 26 +++++++++++-----------
 src/gallium/drivers/etnaviv/etnaviv_compiler.h     | 10 ++++-----
 .../drivers/etnaviv/etnaviv_compiler_cmdline.c     |  2 +-
 src/gallium/drivers/etnaviv/etnaviv_context.h      |  6 ++---
 src/gallium/drivers/etnaviv/etnaviv_shader.c       | 14 ++++++------
 src/gallium/drivers/etnaviv/etnaviv_uniforms.c     |  4 ++--
 src/gallium/drivers/etnaviv/etnaviv_uniforms.h     |  6 ++---
 7 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index af7b64d..be3838d 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -2044,7 +2044,7 @@ permute_ps_inputs(struct etna_compile *c)
 
 /* fill in ps inputs into shader object */
 static void
-fill_in_ps_inputs(struct etna_shader *sobj, struct etna_compile *c)
+fill_in_ps_inputs(struct etna_shader_variant *sobj, struct etna_compile *c)
 {
    struct etna_shader_io_file *sf = &sobj->infile;
 
@@ -2074,7 +2074,7 @@ fill_in_ps_inputs(struct etna_shader *sobj, struct etna_compile *c)
 
 /* fill in output mapping for ps into shader object */
 static void
-fill_in_ps_outputs(struct etna_shader *sobj, struct etna_compile *c)
+fill_in_ps_outputs(struct etna_shader_variant *sobj, struct etna_compile *c)
 {
    sobj->outfile.num_reg = 0;
 
@@ -2096,7 +2096,7 @@ fill_in_ps_outputs(struct etna_shader *sobj, struct etna_compile *c)
 
 /* fill in inputs for vs into shader object */
 static void
-fill_in_vs_inputs(struct etna_shader *sobj, struct etna_compile *c)
+fill_in_vs_inputs(struct etna_shader_variant *sobj, struct etna_compile *c)
 {
    struct etna_shader_io_file *sf = &sobj->infile;
 
@@ -2116,7 +2116,7 @@ fill_in_vs_inputs(struct etna_shader *sobj, struct etna_compile *c)
 
 /* build two-level output index [Semantic][Index] for fast linking */
 static void
-build_output_index(struct etna_shader *sobj)
+build_output_index(struct etna_shader_variant *sobj)
 {
    int total = 0;
    int offset = 0;
@@ -2140,7 +2140,7 @@ build_output_index(struct etna_shader *sobj)
 
 /* fill in outputs for vs into shader object */
 static void
-fill_in_vs_outputs(struct etna_shader *sobj, struct etna_compile *c)
+fill_in_vs_outputs(struct etna_shader_variant *sobj, struct etna_compile *c)
 {
    struct etna_shader_io_file *sf = &sobj->outfile;
 
@@ -2240,7 +2240,7 @@ etna_compile_check_limits(struct etna_compile *c)
 }
 
 static void
-copy_uniform_state_to_shader(struct etna_compile *c, struct etna_shader *sobj)
+copy_uniform_state_to_shader(struct etna_compile *c, struct etna_shader_variant *sobj)
 {
    uint32_t count = c->imm_size;
    struct etna_shader_uniform_info *uinfo = &sobj->uniforms;
@@ -2253,7 +2253,7 @@ copy_uniform_state_to_shader(struct etna_compile *c, struct etna_shader *sobj)
    etna_set_shader_uniforms_dirty_flags(sobj);
 }
 
-struct etna_shader *
+struct etna_shader_variant *
 etna_compile_shader(const struct etna_specs *specs,
                     const struct tgsi_token *tokens)
 {
@@ -2261,7 +2261,7 @@ etna_compile_shader(const struct etna_specs *specs,
     */
    bool ret;
    struct etna_compile *c;
-   struct etna_shader *shader;
+   struct etna_shader_variant *shader;
 
    struct tgsi_lowering_config lconfig = {
       .lower_SCS = specs->has_sin_cos_sqrt,
@@ -2280,7 +2280,7 @@ etna_compile_shader(const struct etna_specs *specs,
    if (!c)
       return NULL;
 
-   shader = CALLOC_STRUCT(etna_shader);
+   shader = CALLOC_STRUCT(etna_shader_variant);
    if (!shader)
       goto out;
 
@@ -2450,7 +2450,7 @@ out:
 
 extern const char *tgsi_swizzle_names[];
 void
-etna_dump_shader(const struct etna_shader *shader)
+etna_dump_shader(const struct etna_shader_variant *shader)
 {
    if (shader->processor == PIPE_SHADER_VERTEX)
       printf("VERT\n");
@@ -2498,7 +2498,7 @@ etna_dump_shader(const struct etna_shader *shader)
 }
 
 void
-etna_destroy_shader(struct etna_shader *shader)
+etna_destroy_shader(struct etna_shader_variant *shader)
 {
    assert(shader);
 
@@ -2510,7 +2510,7 @@ etna_destroy_shader(struct etna_shader *shader)
 }
 
 static const struct etna_shader_inout *
-etna_shader_vs_lookup(const struct etna_shader *sobj,
+etna_shader_vs_lookup(const struct etna_shader_variant *sobj,
                       const struct etna_shader_inout *in)
 {
    if (in->semantic.Index < sobj->output_count_per_semantic[in->semantic.Name])
@@ -2521,7 +2521,7 @@ etna_shader_vs_lookup(const struct etna_shader *sobj,
 
 bool
 etna_link_shader(struct etna_shader_link_info *info,
-                 const struct etna_shader *vs, const struct etna_shader *fs)
+                 const struct etna_shader_variant *vs, const struct etna_shader_variant *fs)
 {
    /* For each fragment input we need to find the associated vertex shader
     * output, which can be found by matching on semantic name and index. A
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.h b/src/gallium/drivers/etnaviv/etnaviv_compiler.h
index de3e20d..2a3b4f4 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.h
@@ -55,7 +55,7 @@ struct etna_shader_io_file {
 };
 
 /* shader object, for linking */
-struct etna_shader {
+struct etna_shader_variant {
    uint32_t id; /* for debug */
 
    uint processor; /* TGSI_PROCESSOR_... */
@@ -107,17 +107,17 @@ struct etna_shader_link_info {
    struct etna_varying varyings[ETNA_NUM_INPUTS];
 };
 
-struct etna_shader *
+struct etna_shader_variant *
 etna_compile_shader(const struct etna_specs *specs, const struct tgsi_token *tokens);
 
 void
-etna_dump_shader(const struct etna_shader *shader);
+etna_dump_shader(const struct etna_shader_variant *shader);
 
 bool
 etna_link_shader(struct etna_shader_link_info *info,
-                 const struct etna_shader *vs, const struct etna_shader *fs);
+                 const struct etna_shader_variant *vs, const struct etna_shader_variant *fs);
 
 void
-etna_destroy_shader(struct etna_shader *shader);
+etna_destroy_shader(struct etna_shader_variant *shader);
 
 #endif
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_cmdline.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_cmdline.c
index 6f241d1..48f74b8 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler_cmdline.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_cmdline.c
@@ -98,7 +98,7 @@ main(int argc, char **argv)
    const char *filename;
    struct tgsi_token toks[65536];
    struct tgsi_parse_context parse;
-   struct etna_shader *shader_obj;
+   struct etna_shader_variant *shader_obj;
    void *ptr;
    size_t size;
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h
index a921403..81acc92 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
@@ -41,7 +41,7 @@
 #include "util/slab.h"
 
 struct pipe_screen;
-struct etna_shader;
+struct etna_shader_variant;
 
 struct etna_index_buffer {
    struct pipe_index_buffer ib;
@@ -157,8 +157,8 @@ struct etna_context {
    struct etna_index_buffer index_buffer;
 
    /* pointers to the bound state. these are mainly kept around for the blitter */
-   struct etna_shader *vs;
-   struct etna_shader *fs;
+   struct etna_shader_variant *vs;
+   struct etna_shader_variant *fs;
 
    /* saved parameter-like state. these are mainly kept around for the blitter */
    struct pipe_framebuffer_state framebuffer_s;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c
index 87edf5b..35084e5 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_shader.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c
@@ -44,7 +44,7 @@
  */
 static bool
 etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs,
-                  const struct etna_shader *vs, const struct etna_shader *fs)
+                  const struct etna_shader_variant *vs, const struct etna_shader_variant *fs)
 {
    struct etna_shader_link_info link = { };
 
@@ -182,7 +182,7 @@ etna_shader_link(struct etna_context *ctx)
 static bool
 etna_shader_update_vs_inputs(struct etna_context *ctx,
                              struct compiled_shader_state *cs,
-                             const struct etna_shader *vs,
+                             const struct etna_shader_variant *vs,
                              const struct compiled_vertex_elements_state *ves)
 {
    unsigned num_temps, cur_temp, num_vs_inputs;
@@ -224,7 +224,7 @@ etna_shader_update_vs_inputs(struct etna_context *ctx,
 }
 
 static inline const char *
-etna_shader_stage(struct etna_shader *shader)
+etna_shader_stage(struct etna_shader_variant *shader)
 {
    switch (shader->processor) {
    case PIPE_SHADER_VERTEX:     return "VERT";
@@ -237,7 +237,7 @@ etna_shader_stage(struct etna_shader *shader)
 }
 
 static void
-dump_shader_info(struct etna_shader *shader, struct pipe_debug_callback *debug)
+dump_shader_info(struct etna_shader_variant *shader, struct pipe_debug_callback *debug)
 {
    if (!unlikely(etna_mesa_debug & ETNA_DBG_SHADERDB))
       return;
@@ -271,7 +271,7 @@ etna_create_shader_state(struct pipe_context *pctx,
                          const struct pipe_shader_state *pss)
 {
    struct etna_context *ctx = etna_context(pctx);
-   struct etna_shader *shader = etna_compile_shader(&ctx->specs, pss->tokens);
+   struct etna_shader_variant *shader = etna_compile_shader(&ctx->specs, pss->tokens);
 
    static uint32_t id;
    shader->id = id++;
@@ -291,7 +291,7 @@ static void
 etna_bind_fs_state(struct pipe_context *pctx, void *fss_)
 {
    struct etna_context *ctx = etna_context(pctx);
-   struct etna_shader *fss = fss_;
+   struct etna_shader_variant *fss = fss_;
 
    if (ctx->fs == fss) /* skip if already bound */
       return;
@@ -305,7 +305,7 @@ static void
 etna_bind_vs_state(struct pipe_context *pctx, void *vss_)
 {
    struct etna_context *ctx = etna_context(pctx);
-   struct etna_shader *vss = vss_;
+   struct etna_shader_variant *vss = vss_;
 
    if (ctx->vs == vss) /* skip if already bound */
       return;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_uniforms.c b/src/gallium/drivers/etnaviv/etnaviv_uniforms.c
index 70e5d58..7487426 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_uniforms.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_uniforms.c
@@ -59,7 +59,7 @@ get_texrect_scale(const struct etna_context *ctx, bool frag,
 
 void
 etna_uniforms_write(const struct etna_context *ctx,
-                    const struct etna_shader *sobj,
+                    const struct etna_shader_variant *sobj,
                     struct pipe_constant_buffer *cb, uint32_t *uniforms,
                     unsigned *size)
 {
@@ -97,7 +97,7 @@ etna_uniforms_write(const struct etna_context *ctx,
 }
 
 void
-etna_set_shader_uniforms_dirty_flags(struct etna_shader *sobj)
+etna_set_shader_uniforms_dirty_flags(struct etna_shader_variant *sobj)
 {
    uint32_t dirty = 0;
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_uniforms.h b/src/gallium/drivers/etnaviv/etnaviv_uniforms.h
index 83a3a49..1dacd2a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_uniforms.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_uniforms.h
@@ -30,16 +30,16 @@
 #include <stdint.h>
 
 struct etna_context;
-struct etna_shader;
+struct etna_shader_variant;
 struct pipe_constant_buffer;
 
 void
 etna_uniforms_write(const struct etna_context *ctx,
-                    const struct etna_shader *sobj,
+                    const struct etna_shader_variant *sobj,
                     struct pipe_constant_buffer *cb, uint32_t *uniforms,
                     unsigned *size);
 
 void
-etna_set_shader_uniforms_dirty_flags(struct etna_shader *sobj);
+etna_set_shader_uniforms_dirty_flags(struct etna_shader_variant *sobj);
 
 #endif /* ETNAVIV_UNIFORMS_H_ */
-- 
2.9.3



More information about the etnaviv mailing list