summaryrefslogtreecommitdiff
path: root/tests/spec/glsl-es-1.00/compiler/precision-qualifiers/default-precision-nested-scope-03.frag
blob: 1cd09e4a69c3acbc5f320c09d48ace11410a737d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// [config]
// expect_result: fail
// glsl_version: 1.00
// [end config]
//
// Section 4.5.3 (Default Precision Qualifiers) of the GLSL ES 1.00 spec says:
//
//     "Non-precision qualified declarations will use the precision qualifier
//     specified in the most recent precision statement that is still in
//     scope. The precision statement has the same scoping rules as variable
//     declarations. If it is declared inside a compound statement, its effect
//     stops at the end of the innermost statement it was declared
//     in. Precision statements in nested scopes override precision statements
//     in outer scopes. Multiple precision statements for the same basic type
//     can appear inside the same scope, with later statements overriding
//     earlier statements within that scope."
//
// The default precision set inside the if-statement in the function is no
// longer in scope when x is declared.

#version 100

uniform bool b;

void f()
{
	if (b) {
		precision mediump float;
	}

	float x;
}

mediump float y;