Update defaults for variability of pointed-to types.

Now, if rate qualifiers aren't used to specify otherwise, varying
pointers point to uniform types by default.  As before, uniform
pointers point to varying types by default.

   float *foo;  // varying pointer to uniform float
   float * uniform foo;  // uniform pointer to varying float

These defaults seem to require the least amount of explicit
uniform/varying qualifiers for most common cases, though TBD if it
would be easier to have a single rule that e.g. the pointed-to type
is always uniform by default.
This commit is contained in:
Matt Pharr
2012-02-17 16:52:03 -08:00
parent ad429db7e8
commit 6d7ff7eba2
54 changed files with 187 additions and 131 deletions

View File

@@ -1,4 +1,4 @@
// Illegal to assign to array type "float[5]"
// Illegal to assign to array type "varying float[5]"
void foo(float *x) {
float a[5] = { 1,2,3,4,5};

View File

@@ -1,4 +1,4 @@
// Illegal to assign to array type "float[5]"
// Illegal to assign to array type "varying float[5]"
void foo(float *x) {
float a[5] = { 1,2,3,4,5};

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 int32"
// Illegal to assign to type "uniform struct Bar" in type "uniform 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 int32"
// Illegal to assign to type "uniform struct Foo" due to element "a" with type "const varying int32"
struct Foo {
const int a;

View File

@@ -1,4 +1,4 @@
// Can't assign to type "const int32" on left-hand
// Can't assign to type "const varying int32" on left-hand
int func() {
const int x = 2;

View File

@@ -1,4 +1,4 @@
// Can't assign to type "const int32" on left-hand side
// Can't assign to type "const varying int32" on left-hand side
const int x = 0;

View File

@@ -1,4 +1,4 @@
// operator "." can't be used with expression of "int32" type
// operator "." can't be used with expression of "uniform int32" type
int func(int *a) {
a.x = 0;

View File

@@ -1,4 +1,4 @@
// Illegal to dereference non-pointer or reference type "float"
// Illegal to dereference non-pointer or reference type "varying float"
float func(float a) {
*a = 0;

View File

@@ -1,4 +1,4 @@
// Member operator "->" can't be used with expression of "int32" type
// Member operator "->" can't be used with expression of "uniform int32" type
int func(int *a) {
a->x = 0;

View File

@@ -1,4 +1,4 @@
// Can't assign to type "const int32"
// Can't assign to type "const varying int32"
int foo() {
foreach (i = 0 ... 10) {

View File

@@ -1,4 +1,4 @@
// Can't convert argument of type "void * uniform" to type "float" for function call argument.
// Can't convert argument of type "void * uniform" to type "varying float" for function call argument.
float bar(float a, float b);

View File

@@ -1,3 +1,3 @@
// Initializer list for array "int32[2][4]" must have no more than 2 elements (has 3)
// Initializer list for array "varying int32[2][4]" must have no more than 2 elements (has 3)
int a[2][4] = { { 1, 2, 3 }, { 1, 2, 3, 4 }, 1 };

View File

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

View File

@@ -1,4 +1,4 @@
// Can't convert from varying type "float" to uniform type "uniform float" for initializer
// Can't convert from type "varying float" to type "uniform float" for initializer
struct Point {
uniform float x, y, z;

View File

@@ -1,4 +1,4 @@
// Can't assign to type "const int32 * const"
// Can't assign to type "const uniform int32 * const varying"
void foo(const int * const p) {
++p;

View File

@@ -1,4 +1,4 @@
// Can't assign to type "const int32" on left-hand side
// Can't assign to type "const varying int32" on left-hand side
void foo(const int * p) {
*p = 0;

View File

@@ -1,4 +1,4 @@
// Pointer type cast of type "int32 * uniform" to integer type "uniform int32" may lose information.
// Pointer type cast of type "varying int32 * uniform" to integer type "uniform int32" may lose information.
int32 foo(int * uniform x) {
return (int32) x;

View File

@@ -1,4 +1,4 @@
// Can't assign to type "const int32" on left-hand side of expression
// Can't assign to type "const varying int32" on left-hand side of expression
const int x[20];

View File

@@ -1,4 +1,4 @@
// Can't assign to type "const int32" on left-hand side of expression
// Can't assign to type "const varying int32" on left-hand side of expression
struct Foo {
int x;

View File

@@ -1,4 +1,4 @@
// Can't assign to type "const int32" on left-hand side of expression
// Can't assign to type "const varying int32" on left-hand side of expression
struct Foo {
int x;

View File

@@ -1,4 +1,4 @@
// Can't apply "signed" qualifier to "float" type
// Can't apply "signed" qualifier to "varying float" type
struct Foo {
signed float x;

View File

@@ -1,4 +1,4 @@
// "signed" qualifier is illegal with non-integer type "float"
// "signed" qualifier is illegal with non-integer type "varying float"
int foo() {
signed float x;

View File

@@ -1,4 +1,4 @@
// Can't apply "unsigned" qualifier to "float" type
// Can't apply "unsigned" qualifier to "varying float" type
struct Foo {
unsigned float x;

View File

@@ -1,3 +1,3 @@
// "unsigned" qualifier is illegal with "float" type
// "unsigned" qualifier is illegal with "varying float" type
unsigned float foo = 1;

View File

@@ -1,4 +1,4 @@
// Can't type cast from varying type "int32" to uniform type "uniform int32"
// Can't type cast from type "varying int32" to type "uniform int32"
uniform int foo(int x) {
return (uniform int) x;