summaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.h
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2015-08-30 12:49:46 +1000
committerTimothy Arceri <[email protected]>2015-09-17 11:26:39 +1000
commit874a0217fd8bba83b0bc2448f5156fdb82f77d7c (patch)
treea2f7c783f8aeef08299eb516939bf93022244a04 /src/glsl/linker.h
parentb5df52b1128049bf688cace6e581a16d5f1ad5bb (diff)
glsl: order indices for samplers inside a struct array
This allows the correct offset to be easily calculated for indirect indexing when a struct array contains multiple samplers, or any crazy nesting. The indices for the folling struct will now look like this: Sampler index: 0 Name: s[0].tex Sampler index: 1 Name: s[1].tex Sampler index: 2 Name: s[0].si.tex Sampler index: 3 Name: s[1].si.tex Sampler index: 4 Name: s[0].si.tex2 Sampler index: 5 Name: s[1].si.tex2 Before this change it looked like this: Sampler index: 0 Name: s[0].tex Sampler index: 3 Name: s[1].tex Sampler index: 1 Name: s[0].si.tex Sampler index: 4 Name: s[1].si.tex Sampler index: 2 Name: s[0].si.tex2 Sampler index: 5 Name: s[1].si.tex2 struct S_inner { sampler2D tex; sampler2D tex2; }; struct S { sampler2D tex; S_inner si; }; uniform S s[2]; V3: Update comments with suggestions from Jason V2: rename struct array counter to have better name Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/linker.h')
-rw-r--r--src/glsl/linker.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/glsl/linker.h b/src/glsl/linker.h
index 0999878c65a..b31052e767e 100644
--- a/src/glsl/linker.h
+++ b/src/glsl/linker.h
@@ -178,6 +178,8 @@ protected:
virtual void leave_record(const glsl_type *type, const char *name,
bool row_major);
+ virtual void set_record_array_count(unsigned record_array_count);
+
private:
/**
* \param name_length Length of the current name \b not including the
@@ -188,7 +190,7 @@ private:
*/
void recursion(const glsl_type *t, char **name, size_t name_length,
bool row_major, const glsl_type *record_type,
- bool last_field);
+ bool last_field, unsigned record_array_count);
};
void