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:
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
void foo(float * uniform a) {
|
||||
void foo(varying float * uniform a) {
|
||||
*a = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
float * uniform buf = uniform new float[programCount+1];
|
||||
varying float * uniform buf = uniform new varying float[programCount+1];
|
||||
for (uniform int i = 0; i < programCount+1; ++i) {
|
||||
buf[i] = i+a;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ struct Point {
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
Point * varying buf = new Point(0., b, a);
|
||||
uniform Point * buf = new Point(0., b, a);
|
||||
RET[programIndex] = buf->z;
|
||||
delete buf;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ export uniform int width() { return programCount; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
float a = aFOO[programIndex];
|
||||
float * uniform pa = &a;
|
||||
int * uniform pb = (int *)pa;
|
||||
float *uniform pc = (float *)pb;
|
||||
varying float * uniform pa = &a;
|
||||
varying int * uniform pb = (varying int *)pa;
|
||||
varying float *uniform pc = (varying float *)pb;
|
||||
*pc = programIndex;
|
||||
RET[programIndex] = *pc;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
int a = aFOO[programIndex];
|
||||
int * uniform b = &a;
|
||||
varying int * uniform b = &a;
|
||||
RET[programIndex] = *b;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@ struct Foo {
|
||||
uniform float b;
|
||||
};
|
||||
|
||||
void update(Foo * varying fp) {
|
||||
void update(uniform Foo * varying fp) {
|
||||
++fp;
|
||||
fp->a -= 1;
|
||||
fp->b = 1;
|
||||
}
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
Foo f[2] = { { 1234, 4321 }, { aFOO[programIndex], 5 } };
|
||||
uniform Foo f[2] = { { 1234, 4321 }, { aFOO[programIndex], 5 } };
|
||||
update(f);
|
||||
RET[programIndex] = f[1].a;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ struct Foo {
|
||||
uniform float b;
|
||||
};
|
||||
|
||||
void update(float<3> * uniform vp) {
|
||||
void update(varying float<3> * uniform vp) {
|
||||
vp->x = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
void update(float<2> * varying vp) {
|
||||
void update(varying float<2> * vp) {
|
||||
vp->y = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
int a = aFOO[programIndex];
|
||||
int * uniform b = &a;
|
||||
varying int * uniform b = &a;
|
||||
*b = 2;
|
||||
RET[programIndex] = *b;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
int a = aFOO[programIndex];
|
||||
int * uniform b = &a;
|
||||
varying int * uniform b = &a;
|
||||
++*b;
|
||||
RET[programIndex] = *b;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
int a = aFOO[programIndex];
|
||||
int * uniform b = &a;
|
||||
varying int * uniform b = &a;
|
||||
(*b)++;
|
||||
RET[programIndex] = *b;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
void inc(int * uniform v) {
|
||||
void inc(varying int * uniform v) {
|
||||
++*v;
|
||||
}
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
int a = aFOO[programIndex];
|
||||
int * uniform b = &a;
|
||||
varying int * uniform b = &a;
|
||||
if (a <= 2)
|
||||
inc(b);
|
||||
RET[programIndex] = a;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
void inc(int * uniform v) {
|
||||
void inc(varying int * uniform v) {
|
||||
++*v;
|
||||
}
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
int a = aFOO[programIndex];
|
||||
int * uniform b = &a;
|
||||
varying int * uniform b = &a;
|
||||
void * uniform vp = b;
|
||||
int * uniform c = (int * uniform)vp;
|
||||
varying int * uniform c = (varying int * uniform)vp;
|
||||
RET[programIndex] = *c;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
float foo(float * uniform a) {
|
||||
float foo(varying float * uniform a) {
|
||||
*a = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
float foo(float * uniform a) {
|
||||
float foo(varying float * uniform a) {
|
||||
*a = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
void foo(float * uniform a) {
|
||||
void foo(varying float * uniform a) {
|
||||
*a = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
void foo(float * uniform a) {
|
||||
void foo(varying float * uniform a) {
|
||||
*a = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
void foo(float * uniform a) {
|
||||
void foo(varying float * uniform a) {
|
||||
*a = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
void foo(float * uniform x, int y) {
|
||||
void foo(varying float * uniform x, int y) {
|
||||
*x = y;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
void foo(float * uniform x, float y) {
|
||||
void foo(varying float * uniform x, float y) {
|
||||
*x = y;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
void foo(float * uniform x) {
|
||||
void foo(varying float * uniform x) {
|
||||
if ((*x) <= 2)
|
||||
++(*x);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
|
||||
|
||||
|
||||
|
||||
float foo(float * uniform a) {
|
||||
float foo(varying float * uniform a) {
|
||||
*a = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ typedef int<4> int4;
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
void inc(int4 * uniform v) {
|
||||
void inc(varying int4 * uniform v) {
|
||||
int4 delta = { 1, 1, 1, 1 };
|
||||
(*v) += delta;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ typedef int<4> int4;
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
void incXY(int4 * uniform v) {
|
||||
void incXY(varying int4 * uniform v) {
|
||||
++(*v).x;
|
||||
++(*v).y;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user