summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-04-19 15:57:56 +0200
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-04-26 16:04:56 +0200
commitc54fb916353b47c854379a921c6310e3fde1896f (patch)
tree285d626e0b6e33142a12650aa00fa60e9d284e0c /src
parentba934475fce7268c04f3728f6280d30b238e1fac (diff)
st/glsl_to_tgsi: add support for bindless samplers
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 01cfc589c4..a79acc427c 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -289,6 +289,7 @@ public:
st_dst_reg dst[2];
st_src_reg src[4];
st_src_reg resource; /**< sampler or buffer register */
+ st_src_reg sampler;
st_src_reg *tex_offsets;
/** Pointer to the ir source this tree came from for debugging */
@@ -4137,6 +4138,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
unsigned sampler_array_size = 1, sampler_base = 0;
uint16_t sampler_index = 0;
bool is_cube_array = false, is_cube_shadow = false;
+ ir_variable *var;
unsigned i;
/* if we are a cube array sampler or a cube shadow */
@@ -4400,9 +4402,17 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
if (ir->shadow_comparator)
inst->tex_shadow = GL_TRUE;
- inst->resource.index = sampler_index;
- inst->sampler_array_size = sampler_array_size;
- inst->sampler_base = sampler_base;
+ var = ir->sampler->variable_referenced();
+ if (var->data.bindless) {
+ ir->sampler->accept(this);
+ inst->sampler = this->result;
+ inst->sampler.swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
+ SWIZZLE_X, SWIZZLE_Y);
+ } else {
+ inst->resource.index = sampler_index;
+ inst->sampler_array_size = sampler_array_size;
+ inst->sampler_base = sampler_base;
+ }
if (reladdr.file != PROGRAM_UNDEFINED) {
inst->resource.reladdr = ralloc(mem_ctx, st_src_reg);
@@ -5815,7 +5825,12 @@ compile_tgsi_instruction(struct st_translate *t,
case TGSI_OPCODE_TXL2:
case TGSI_OPCODE_TG4:
case TGSI_OPCODE_LODQ:
- src[num_src] = t->samplers[inst->resource.index];
+ if (inst->sampler.file == PROGRAM_UNIFORM ||
+ inst->sampler.file == PROGRAM_TEMPORARY) {
+ src[num_src] = translate_src(t, &inst->sampler);
+ } else {
+ src[num_src] = t->samplers[inst->resource.index];
+ }
assert(src[num_src].File != TGSI_FILE_NULL);
if (inst->resource.reladdr)
src[num_src] =