mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 17:48:10 +02:00
st/glsl_to_tgsi: make sure resource file for samplers is PROGRAM_SAMPLER
Similar to how image resources are handled. That way we are sure that inst->resource.file is PROGRAM_SAMPLER for "bound" samplers. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
169888b55e
commit
de97e38290
1 changed files with 9 additions and 9 deletions
|
|
@ -4154,7 +4154,6 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
|
||||||
unsigned opcode = TGSI_OPCODE_NOP;
|
unsigned opcode = TGSI_OPCODE_NOP;
|
||||||
const glsl_type *sampler_type = ir->sampler->type;
|
const glsl_type *sampler_type = ir->sampler->type;
|
||||||
unsigned sampler_array_size = 1, sampler_base = 0;
|
unsigned sampler_array_size = 1, sampler_base = 0;
|
||||||
uint16_t sampler_index = 0;
|
|
||||||
bool is_cube_array = false, is_cube_shadow = false;
|
bool is_cube_array = false, is_cube_shadow = false;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
|
@ -4385,10 +4384,16 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
|
||||||
coord_dst.writemask = WRITEMASK_XYZW;
|
coord_dst.writemask = WRITEMASK_XYZW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
st_src_reg sampler(PROGRAM_SAMPLER, 0, GLSL_TYPE_UINT);
|
||||||
|
|
||||||
get_deref_offsets(ir->sampler, &sampler_array_size, &sampler_base,
|
get_deref_offsets(ir->sampler, &sampler_array_size, &sampler_base,
|
||||||
&sampler_index, &reladdr, true);
|
(uint16_t *)&sampler.index, &reladdr, true);
|
||||||
if (reladdr.file != PROGRAM_UNDEFINED)
|
|
||||||
|
if (reladdr.file != PROGRAM_UNDEFINED) {
|
||||||
|
sampler.reladdr = ralloc(mem_ctx, st_src_reg);
|
||||||
|
*sampler.reladdr = reladdr;
|
||||||
emit_arl(ir, sampler_reladdr, reladdr);
|
emit_arl(ir, sampler_reladdr, reladdr);
|
||||||
|
}
|
||||||
|
|
||||||
if (opcode == TGSI_OPCODE_TXD)
|
if (opcode == TGSI_OPCODE_TXD)
|
||||||
inst = emit_asm(ir, opcode, result_dst, coord, dx, dy);
|
inst = emit_asm(ir, opcode, result_dst, coord, dx, dy);
|
||||||
|
|
@ -4419,15 +4424,10 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
|
||||||
if (ir->shadow_comparator)
|
if (ir->shadow_comparator)
|
||||||
inst->tex_shadow = GL_TRUE;
|
inst->tex_shadow = GL_TRUE;
|
||||||
|
|
||||||
inst->resource.index = sampler_index;
|
inst->resource = sampler;
|
||||||
inst->sampler_array_size = sampler_array_size;
|
inst->sampler_array_size = sampler_array_size;
|
||||||
inst->sampler_base = sampler_base;
|
inst->sampler_base = sampler_base;
|
||||||
|
|
||||||
if (reladdr.file != PROGRAM_UNDEFINED) {
|
|
||||||
inst->resource.reladdr = ralloc(mem_ctx, st_src_reg);
|
|
||||||
memcpy(inst->resource.reladdr, &reladdr, sizeof(reladdr));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ir->offset) {
|
if (ir->offset) {
|
||||||
if (!inst->tex_offsets)
|
if (!inst->tex_offsets)
|
||||||
inst->tex_offsets = rzalloc_array(inst, st_src_reg, MAX_GLSL_TEXTURE_OFFSET);
|
inst->tex_offsets = rzalloc_array(inst, st_src_reg, MAX_GLSL_TEXTURE_OFFSET);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue