unsigned tess_input_info; /* temp with tess input offsets */
unsigned tess_output_info; /* temp with tess input offsets */
unsigned thread_id_gpr; /* temp with thread id calculated for images */
+ bool thread_id_gpr_loaded;
};
struct r600_shader_tgsi_instruction {
struct r600_bytecode_alu alu;
int r;
+ if (ctx->thread_id_gpr_loaded)
+ return 0;
+
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
alu.op = ALU_OP1_MBCNT_32LO_ACCUM_PREV_INT;
alu.dst.sel = ctx->temp_reg;
ctx->temp_reg, 0);
if (r)
return r;
+ ctx->thread_id_gpr_loaded = true;
return 0;
}
ctx.fragcoord_input = -1;
ctx.colors_used = 0;
ctx.clip_vertex_write = 0;
+ ctx.thread_id_gpr_loaded = false;
shader->nr_ps_color_exports = 0;
shader->nr_ps_max_color_exports = 0;
ctx.temp_reg = ctx.bc->ar_reg + 3;
}
- if (shader->uses_images && ctx.type == PIPE_SHADER_FRAGMENT) {
- ctx.thread_id_gpr = ctx.temp_reg;
- ctx.temp_reg++;
- } else
- ctx.thread_id_gpr = 0;
+ if (shader->uses_images) {
+ ctx.thread_id_gpr = ctx.temp_reg++;
+ ctx.thread_id_gpr_loaded = false;
+ }
shader->max_arrays = 0;
shader->num_arrays = 0;
}
}
- if (ctx.thread_id_gpr) {
- load_thread_id_gpr(&ctx);
- }
-
if (ctx.type == PIPE_SHADER_GEOMETRY) {
struct r600_bytecode_alu alu;
int r;
unsigned rat_index_mode;
unsigned immed_base;
+ r = load_thread_id_gpr(ctx);
+ if (r)
+ return r;
+
rat_index_mode = inst->Src[0].Indirect.Index == 2 ? 2 : 0; // CF_INDEX_1 : CF_INDEX_NONE
immed_base = R600_IMAGE_IMMED_RESOURCE_OFFSET;
immed_base = R600_IMAGE_IMMED_RESOURCE_OFFSET;
rat_base = ctx->shader->rat_base;
+ r = load_thread_id_gpr(ctx);
+ if (r)
+ return r;
+
if (inst->Src[0].Register.File == TGSI_FILE_BUFFER) {
immed_base += ctx->info.file_count[TGSI_FILE_IMAGE];
rat_base += ctx->info.file_count[TGSI_FILE_IMAGE];