shader: pass images[] as function arg

Refactor vrend_shader.c by reducing the number of dump_ctx members
that are modified in function calls that take dump_ctx as an argument.

Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Ryan Neph 4 years ago
parent 43b01bb25b
commit b9a78c61da
  1. 6
      src/vrend_shader.c

@ -3131,6 +3131,7 @@ static void
translate_load(struct dump_ctx *ctx, translate_load(struct dump_ctx *ctx,
struct vrend_glsl_strbufs *glsl_strbufs, struct vrend_glsl_strbufs *glsl_strbufs,
uint8_t ssbo_memory_qualifier[], uint8_t ssbo_memory_qualifier[],
struct vrend_shader_image images[],
struct tgsi_full_instruction *inst, struct tgsi_full_instruction *inst,
struct source_info *sinfo, struct source_info *sinfo,
struct dest_info *dinfo, struct dest_info *dinfo,
@ -3172,7 +3173,7 @@ translate_load(struct dump_ctx *ctx,
(ctx->images[sinfo->sreg_index].decl.Format != PIPE_FORMAT_R32_FLOAT) && (ctx->images[sinfo->sreg_index].decl.Format != PIPE_FORMAT_R32_FLOAT) &&
(ctx->images[sinfo->sreg_index].decl.Format != PIPE_FORMAT_R32_SINT) && (ctx->images[sinfo->sreg_index].decl.Format != PIPE_FORMAT_R32_SINT) &&
(ctx->images[sinfo->sreg_index].decl.Format != PIPE_FORMAT_R32_UINT)) (ctx->images[sinfo->sreg_index].decl.Format != PIPE_FORMAT_R32_UINT))
ctx->images[sinfo->sreg_index].decl.Writable = 0; images[sinfo->sreg_index].decl.Writable = 0;
if (!ctx->cfg->use_gles || !inst->Src[0].Register.Indirect) { if (!ctx->cfg->use_gles || !inst->Src[0].Register.Indirect) {
emit_buff(glsl_strbufs, "%s = %s(imageLoad(%s, %s(%s(%s))%s)%s);\n", emit_buff(glsl_strbufs, "%s = %s(imageLoad(%s, %s(%s(%s))%s)%s);\n",
@ -5321,7 +5322,8 @@ iter_instruction(struct tgsi_iterate_context *iter,
return false; return false;
srcs[1] = ctx->src_bufs[1].buf; srcs[1] = ctx->src_bufs[1].buf;
} }
translate_load(ctx, &ctx->glsl_strbufs, ctx->ssbo_memory_qualifier, inst, &sinfo, &dinfo, srcs, dsts[0], writemask); translate_load(ctx, &ctx->glsl_strbufs, ctx->ssbo_memory_qualifier, ctx->images,
inst, &sinfo, &dinfo, srcs, dsts[0], writemask);
break; break;
case TGSI_OPCODE_ATOMUADD: case TGSI_OPCODE_ATOMUADD:
case TGSI_OPCODE_ATOMXCHG: case TGSI_OPCODE_ATOMXCHG:

Loading…
Cancel
Save