Commit f8acec9f authored by Chad Versace's avatar Chad Versace

glsl-1.xx: Check that global inputs cannot be written to

In GLSL 1.00, 1.10, and 1.20, check that vertex shader attributes and
fragment shader varyings cannot be written to.

In GLSL 1.30, check that global variables declared 'in' cannot be written
to.
parent 0a1148ff
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// From section 4.3.3 of the GLSL 1.00 spec:
// Attribute variables are read-only as far as the vertex shader is
// concerned.
#version 100
attribute float x;
float f() {
x = 0.0;
return x;
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// From section 4.3.3 of the GLSL 1.00 spec:
// Attribute variables are read-only as far as the vertex shader is
// concerned.
#version 100
attribute float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// From section 4.3.5 of the GLSL 1.00 spec:
// A fragment shader can not write to a varying variable.
#version 100
varying float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// From section 4.3.5 of the GLSL 1.00 spec:
// A fragment shader can not write to a varying variable.
#version 100
varying float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
//
// From section 4.3.4 of the GLSL 1.10 spec:
// Attribute variables are read-only as far as the vertex shader is
// concerned.
#version 110
attribute float x;
float f() {
x = 0.0;
return x;
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
//
// From section 4.3.4 of the GLSL 1.10 spec:
// Attribute variables are read-only as far as the vertex shader is
// concerned.
#version 110
attribute float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
//
// From section 4.3.6 of the GLSL 1.10 spec:
// A fragment shader can not write to a varying variable.
#version 110
varying float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.10
// [end config]
//
// From section 4.3.6 of the GLSL 1.10 spec:
// A fragment shader can not write to a varying variable.
#version 110
varying float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.20
// [end config]
//
// From section 4.3.4 of the GLSL 1.20 spec:
// Attribute variables are read-only as far as the vertex shader is
// concerned.
#version 120
attribute float x;
float f() {
x = 0.0;
return x;
}
// [config]
// expect_result: fail
// glsl_version: 1.20
// [end config]
//
// From section 4.3.4 of the GLSL 1.20 spec:
// Attribute variables are read-only as far as the vertex shader is
// concerned.
#version 120
attribute float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.20
// [end config]
//
// From section 4.3.6 of the GLSL 1.20 spec:
// A fragment shader can not write to a varying variable.
#version 120
varying float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.20
// [end config]
//
// From section 4.3.6 of the GLSL 1.20 spec:
// A fragment shader can not write to a varying variable.
#version 120
varying float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
// [config]
// expect_result: fail
// glsl_version: 1.30
// [end config]
//
// From page 31 (37 of pdf) of the GLSL 1.30 spec:
// Variables declared as in or centroid in may not be written
// to during shader execution.
#version 130
in float x;
float f() {
x = 0.0;
return x;
}
// [config]
// expect_result: fail
// glsl_version: 1.30
// [end config]
//
// From page 31 (37 of pdf) of the GLSL 1.30 spec:
// Variables declared as in or centroid in may not be written
// to during shader execution.
#version 130
in float x;
void f(out float y) {
y = 0.0;
}
void g() {
f(x);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment