Commit b25c375e authored by Chad Versace's avatar Chad Versace
Browse files

glsl-1.00: Add tests for precision qualifiers

parent 440038ab
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// Type bool cannot have default precision.
//
// From section 4.5.3 of the GLSL 1.00 spec:
// The precision statement
// precision precision-qualifier type;
// can be used to establish a default precision qualifier. The type field
// can be either int or float. [...] Any other types or qualifiers will
// result in an error.
#version 100
highp bool;
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Type float can have default precision.
//
// From section 4.5.3 of the GLSL 1.00 spec:
// The precision statement
// precision precision-qualifier type;
// can be used to establish a default precision qualifier. The type field
// can be either int or float,
#version 100
lowp float;
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Type int can have default precision.
//
// From section 4.5.3 of the GLSL 1.00 spec:
// The precision statement
// precision precision-qualifier type;
// can be used to establish a default precision qualifier. The type field
// can be either int or float,
#version 100
mediump int;
float f() {
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// Vector types cannot have default precision.
//
// From section 4.5.3 of the GLSL 1.00 spec:
// The precision statement
// precision precision-qualifier type;
// can be used to establish a default precision qualifier. The type field
// can be either int or float. [...] Any other types or qualifiers will
// result in an error.
#version 100
mediump vec2;
float f() {
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers cannot be applied to bool variables.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Literal constants do not have precision qualifiers. Neither do Boolean
// variables.
#version 100
float f() {
highp bool b;
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers can be applied to floats.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
float f() {
highp float x;
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers can be applied to float vectors.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
float f() {
lowp vec2 v;
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers can be applied to float arrays.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
highp float a[4];
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers can be applied to float matrices.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
float f() {
lowp mat4 m;
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Function parameters and return types can have precision qualifiers.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
highp float f(lowp int x) {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Global variables can have precision qualifiers.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
uniform lowp float x;
in highp float y;
float f() {
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers can be applied to ints.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
float f() {
highp int x;
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers can be applied to integer vectors.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
float f() {
lowp ivec2 v;
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers can be applied to int arrays.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
highp int a[4];
float f() {
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers cannot be applied to integer literals.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Literal constants do not have precision qualifiers.
#version 100
float f() {
highp int x = highp 1;
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers cannot be applied to float literals.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Literal constants do not have precision qualifiers.
#version 100
float f() {
highp float x = highp 0.0;
return 0.0;
}
// [config]
// expect_result: pass
// glsl_version: 1.00
// [end config]
//
// Local variables can have precision qualifiers.
//
// From section 4.5.2 of the GLSL 1.00 spec:
// Any floating point or any integer declaration can have the type
// preceded by one of these precision qualifiers
#version 100
float f() {
highp float x = 0.0;
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers cannot be applied to structs.
//
// This test declares the struct and its sole member with matching
// precision qualifier.
//
// See section 4.5.2 of the GLSL 1.00 spec.
#version 100
highp struct s {
highp float a;
};
float f() {
return 0.0;
}
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// Precision qualifiers cannot be applied to structs.
//
// This test declares the struct, but none of its members, with a precision
// qualifier.
//
// See section 4.5.2 of the GLSL 1.00 spec.
#version 100
highp struct s {
float a;
};
float f() {
return 0.0;
}
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