glsl: add support for texture functions with offset arrays
authorChris Forbes <chrisf@ijw.co.nz>
Thu, 10 Oct 2013 08:34:03 +0000 (21:34 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Sat, 26 Oct 2013 09:27:37 +0000 (22:27 +1300)
This is needed for textureGatherOffsets()

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/builtin_functions.cpp

index deedddbea5ceb2f7717897c5acb19cbdf3896076..1b23677293aa574b570054414d59947d06d5e08e 100644 (file)
@@ -507,6 +507,7 @@ private:
 #define TEX_OFFSET  2
 #define TEX_COMPONENT 4
 #define TEX_OFFSET_NONCONST 8
+#define TEX_OFFSET_ARRAY 16
 
    ir_function_signature *_texture(ir_texture_opcode opcode,
                                    builtin_available_predicate avail,
@@ -3432,6 +3433,14 @@ builtin_builder::_texture(ir_texture_opcode opcode,
       tex->offset = var_ref(offset);
    }
 
+   if (flags & TEX_OFFSET_ARRAY) {
+      ir_variable *offsets =
+         new(mem_ctx) ir_variable(glsl_type::get_array_instance(glsl_type::ivec2_type, 4),
+                                  "offsets", ir_var_const_in);
+      sig->parameters.push_tail(offsets);
+      tex->offset = var_ref(offsets);
+   }
+
    if (opcode == ir_tg4) {
       if (flags & TEX_COMPONENT) {
          ir_variable *component =