Patches 25, 26, and 28 - 32:

Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com>


On 30.05.2017 22:36, Samuel Pitoiset wrote:
v2: - rebased (is_bindless() -> contains_bindless())
     - removed dead inst->bindless assignment

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> (v1)
Reviewed-by: Marek Olšák <marek.ol...@amd.com> (v1)
---
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 24 +++++++++++++++++++-----
  1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 7571e7d495..d637dd803a 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4154,6 +4154,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
     const glsl_type *sampler_type = ir->sampler->type;
     unsigned sampler_array_size = 1, sampler_base = 0;
     bool is_cube_array = false, is_cube_shadow = false;
+   ir_variable *var = ir->sampler->variable_referenced();
     unsigned i;
/* if we are a cube array sampler or a cube shadow */
@@ -4386,7 +4387,8 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
     st_src_reg sampler(PROGRAM_SAMPLER, 0, GLSL_TYPE_UINT);
get_deref_offsets(ir->sampler, &sampler_array_size, &sampler_base,
-                     (uint16_t *)&sampler.index, &reladdr, true);
+                     (uint16_t *)&sampler.index, &reladdr,
+                     !var->contains_bindless());
if (reladdr.file != PROGRAM_UNDEFINED) {
        sampler.reladdr = ralloc(mem_ctx, st_src_reg);
@@ -4423,9 +4425,16 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
     if (ir->shadow_comparator)
        inst->tex_shadow = GL_TRUE;
- inst->resource = sampler;
-   inst->sampler_array_size = sampler_array_size;
-   inst->sampler_base = sampler_base;
+   if (var->contains_bindless()) {
+      ir->sampler->accept(this);
+      inst->resource = this->result;
+      inst->resource.swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y,
+                                             SWIZZLE_X, SWIZZLE_Y);
+   } else {
+      inst->resource = sampler;
+      inst->sampler_array_size = sampler_array_size;
+      inst->sampler_base = sampler_base;
+   }
if (ir->offset) {
        if (!inst->tex_offsets)
@@ -5856,7 +5865,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->resource.file == PROGRAM_SAMPLER) {
+         src[num_src] = t->samplers[inst->resource.index];
+      } else {
+         /* Bindless samplers. */
+         src[num_src] = translate_src(t, &inst->resource);
+      }
        assert(src[num_src].File != TGSI_FILE_NULL);
        if (inst->resource.reladdr)
           src[num_src] =



--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to