[virglrenderer-devel] [PATCH 1/3] shader: rename some shader info and key vars.

Dave Airlie airlied at gmail.com
Mon Mar 26 21:20:58 UTC 2018


From: Dave Airlie <airlied at redhat.com>

These names reflect more of the meaning, and allow for tuning
some stuff.
---
 src/vrend_renderer.c | 4 ++--
 src/vrend_shader.c   | 9 +++++----
 src/vrend_shader.h   | 7 ++++---
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 4a0e61c..d1be721 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -2128,8 +2128,8 @@ static inline void vrend_fill_shader_key(struct vrend_context *ctx,
       key->gs_present = true;
 
    if (type == PIPE_SHADER_GEOMETRY && ctx->sub->shaders[PIPE_SHADER_VERTEX]) {
-      key->vs_has_pervertex = ctx->sub->shaders[PIPE_SHADER_VERTEX]->sinfo.num_pervertex_clip > 0;
-      key->vs_pervertex_num_clip = ctx->sub->shaders[PIPE_SHADER_VERTEX]->sinfo.num_pervertex_clip;
+      key->prev_stage_pervertex_out = ctx->sub->shaders[PIPE_SHADER_VERTEX]->sinfo.has_pervertex_out;
+      key->prev_stage_num_clip_out = ctx->sub->shaders[PIPE_SHADER_VERTEX]->sinfo.num_clip_out;
    }
 }
 
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 13db18e..21717f1 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -2545,11 +2545,11 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
    if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY) {
       snprintf(buf, 255, "uniform float winsys_adjust_y;\n");
       STRCAT_WITH_RET(glsl_hdr, buf);
-      if (ctx->num_in_clip_dist || ctx->key->clip_plane_enable || ctx->key->vs_has_pervertex) {
+      if (ctx->num_in_clip_dist || ctx->key->clip_plane_enable || ctx->key->prev_stage_pervertex_out) {
          int clip_dist;
 
-         if (ctx->key->vs_has_pervertex)
-            clip_dist = ctx->key->vs_pervertex_num_clip;
+         if (ctx->key->prev_stage_pervertex_out)
+            clip_dist = ctx->key->prev_stage_num_clip_out;
          else if (ctx->num_in_clip_dist)
             clip_dist = ctx->num_in_clip_dist;
          else
@@ -2772,7 +2772,8 @@ char *vrend_convert_shader(struct vrend_shader_cfg *cfg,
    free(ctx.glsl_main);
    free(glsl_hdr);
    sinfo->num_ucp = ctx.key->clip_plane_enable ? 8 : 0;
-   sinfo->num_pervertex_clip = (ctx.vs_has_pervertex ? (ctx.num_clip_dist ? ctx.num_clip_dist : 8) : 0);
+   sinfo->has_pervertex_out = ctx.vs_has_pervertex;
+   sinfo->num_clip_out = (ctx.num_clip_dist ? ctx.num_clip_dist : 8);
    sinfo->samplers_used_mask = ctx.samplers_used;
    sinfo->num_consts = ctx.num_consts;
    sinfo->num_ubos = ctx.num_ubo;
diff --git a/src/vrend_shader.h b/src/vrend_shader.h
index 646dddc..098a23e 100644
--- a/src/vrend_shader.h
+++ b/src/vrend_shader.h
@@ -43,7 +43,8 @@ struct vrend_shader_info {
    int num_ubos;
    int num_ucp;
    int glsl_ver;
-   uint8_t num_pervertex_clip;
+   bool has_pervertex_out;
+   uint8_t num_clip_out;
    uint32_t shadow_samp_mask;
    int gs_out_prim;
    uint32_t attrib_input_mask;
@@ -63,8 +64,8 @@ struct vrend_shader_key {
    uint8_t clip_plane_enable;
    bool gs_present;
    bool flatshade;
-   bool vs_has_pervertex;
-   uint8_t vs_pervertex_num_clip;
+   bool prev_stage_pervertex_out;
+   uint8_t prev_stage_num_clip_out;
    float alpha_ref_val;
    uint32_t cbufs_are_a8_bitmask;
 };
-- 
2.14.3



More information about the virglrenderer-devel mailing list