Implement unbound varibility for struct types.

Now, if a struct member has an explicit 'uniform' or 'varying'
qualifier, then that member has that variability, regardless of
the variability of the struct's variability.  Members without
'uniform' or 'varying' have unbound variability, and in turn
inherit the variability of the struct.

As a result of this, now structs can properly be 'varying' by default,
just like all the other types, while still having sensible semantics.
This commit is contained in:
Matt Pharr
2012-02-20 12:20:51 -08:00
parent 6d7ff7eba2
commit f81acbfe80
59 changed files with 744 additions and 322 deletions

View File

@@ -1,4 +1,4 @@
// Illegal to assign to type "uniform struct Bar" in type "uniform struct Foo" due to element "a" with type "const varying int32"
// Illegal to assign to type "varying struct Bar" in type "varying struct Foo" due to element "a" with type "const varying int32"
struct Bar {
const int a;

View File

@@ -1,4 +1,4 @@
// Illegal to assign to type "uniform struct Foo" due to element "a" with type "const varying int32"
// Illegal to assign to type "varying struct Foo" due to element "a" with type "const varying int32"
struct Foo {
const int a;

View File

@@ -1,4 +1,4 @@
// Dereference operator "->" can't be applied to non-pointer type "uniform struct Foo"
// Dereference operator "->" can't be applied to non-pointer type "varying struct Foo"
struct Foo { int x; };

View File

@@ -1,4 +1,4 @@
// Can't convert from type "uniform int32 * varying" to type "uniform int32 * uniform" for return
// Can't convert from type "uniform int32 * varying" to type "varying int32 * uniform" for return
int * uniform func(int x) {
return new int[x];

View File

@@ -1,4 +1,4 @@
// "signed" qualifier is illegal with non-integer type "uniform struct Foo"
// "signed" qualifier is illegal with non-integer type "varying struct Foo"
struct Foo {
float x;

View File

@@ -0,0 +1,7 @@
// Gather operation is impossible due to the presence of struct member "x" with uniform type
struct Foo { uniform int x; };
void a(uniform Foo array[], int index) {
Foo v = array[index];
}

View File

@@ -0,0 +1,7 @@
// Gather operation is impossible due to the presence of struct member "x" with uniform type
struct Foo { uniform int x; };
void a(uniform Foo * uniform array, int index) {
Foo v = array[index];
}

View File

@@ -0,0 +1,7 @@
// Gather operation is impossible due to the presence of struct member "x" with uniform type
struct Foo { uniform int x; };
void a(uniform Foo * varying array, int index) {
Foo v = array[index];
}

View File

@@ -0,0 +1,8 @@
// Gather operation is impossible due to the presence of struct member "x" with uniform type
struct Bar { uniform int x; };
struct Foo { varying Bar b; };
void a(uniform Foo * varying array, int index) {
Foo v = array[index];
}

View File

@@ -0,0 +1,8 @@
// Gather operation is impossible due to the presence of struct member "x" with uniform type
struct Bar { uniform int x; };
struct Foo { Bar b; };
void a(uniform Foo * varying array, int index) {
Foo v = array[index];
}

View File

@@ -1,4 +1,4 @@
// Can't convert between different struct types "uniform struct Foo" and "uniform struct Bar"
// Can't convert between different struct types "varying struct Foo" and "varying struct Bar"
struct Foo {
int a;

View File

@@ -1,4 +1,4 @@
// "unsigned" qualifier is illegal with "uniform struct Foo" typ
// "unsigned" qualifier is illegal with "varying struct Foo" typ
struct Foo {
float x;