Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
3933dc51
Commit
3933dc51
authored
Mar 12, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nonuniform: prevent use of struct/block members.
parent
bd4603e0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
42 deletions
+26
-42
nonuniform.frag.out
Test/baseResults/nonuniform.frag.out
+7
-5
spv.nonuniform.frag.out
Test/baseResults/spv.nonuniform.frag.out
+2
-29
nonuniform.frag
Test/nonuniform.frag
+2
-2
spv.nonuniform.frag
Test/spv.nonuniform.frag
+0
-4
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+13
-0
ParseHelper.h
glslang/MachineIndependent/ParseHelper.h
+1
-0
glslang.y
glslang/MachineIndependent/glslang.y
+1
-2
glslang_tab.cpp
glslang/MachineIndependent/glslang_tab.cpp
+0
-0
No files found.
Test/baseResults/nonuniform.frag.out
View file @
3933dc51
...
@@ -7,7 +7,9 @@ ERROR: 0:24: 'constructor' : too many arguments
...
@@ -7,7 +7,9 @@ ERROR: 0:24: 'constructor' : too many arguments
ERROR: 0:24: 'assign' : cannot convert from ' const float' to ' nonuniform temp int'
ERROR: 0:24: 'assign' : cannot convert from ' const float' to ' nonuniform temp int'
ERROR: 0:25: 'constructor' : not enough data provided for construction
ERROR: 0:25: 'constructor' : not enough data provided for construction
ERROR: 0:25: 'assign' : cannot convert from ' const float' to ' nonuniform temp int'
ERROR: 0:25: 'assign' : cannot convert from ' const float' to ' nonuniform temp int'
ERROR: 8 compilation errors. No code generated.
ERROR: 0:28: 'nonuniformEXT' : not allowed on block or structure members
ERROR: 0:29: 'nonuniformEXT' : not allowed on block or structure members
ERROR: 10 compilation errors. No code generated.
Shader version: 450
Shader version: 450
...
@@ -42,8 +44,8 @@ ERROR: node is still EOpNull!
...
@@ -42,8 +44,8 @@ ERROR: node is still EOpNull!
0:? 'nu_uv4' ( nonuniform uniform 4-component vector of float)
0:? 'nu_uv4' ( nonuniform uniform 4-component vector of float)
0:? 'nu_constf' ( nonuniform const float)
0:? 'nu_constf' ( nonuniform const float)
0:? 1.000000
0:? 1.000000
0:? 'ins' (layout( location=1) smooth in structure{ global float a,
nonuniform
temp float b})
0:? 'ins' (layout( location=1) smooth in structure{ global float a, temp float b})
0:? 'inb' (layout( location=3) in block{ in float a,
nonuniform
in float b})
0:? 'inb' (layout( location=3) in block{ in float a, in float b})
Linked fragment stage:
Linked fragment stage:
...
@@ -81,6 +83,6 @@ ERROR: node is still EOpNull!
...
@@ -81,6 +83,6 @@ ERROR: node is still EOpNull!
0:? 'nu_uv4' ( nonuniform uniform 4-component vector of float)
0:? 'nu_uv4' ( nonuniform uniform 4-component vector of float)
0:? 'nu_constf' ( nonuniform const float)
0:? 'nu_constf' ( nonuniform const float)
0:? 1.000000
0:? 1.000000
0:? 'ins' (layout( location=1) smooth in structure{ global float a,
nonuniform
temp float b})
0:? 'ins' (layout( location=1) smooth in structure{ global float a, temp float b})
0:? 'inb' (layout( location=3) in block{ in float a,
nonuniform
in float b})
0:? 'inb' (layout( location=3) in block{ in float a, in float b})
Test/baseResults/spv.nonuniform.frag.out
View file @
3933dc51
spv.nonuniform.frag
spv.nonuniform.frag
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80005
// Generated by (magic number): 80005
// Id's are bound by
54
// Id's are bound by
42
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 33
44 50
EntryPoint Fragment 4 "main" 33
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Source GLSL 450
Name 4 "main"
Name 4 "main"
...
@@ -20,14 +20,6 @@ spv.nonuniform.frag
...
@@ -20,14 +20,6 @@ spv.nonuniform.frag
Name 30 "b"
Name 30 "b"
Name 33 "nu_inv4"
Name 33 "nu_inv4"
Name 39 "nu_gf"
Name 39 "nu_gf"
Name 42 "S"
MemberName 42(S) 0 "a"
MemberName 42(S) 1 "b"
Name 44 "ins"
Name 48 "inbName"
MemberName 48(inbName) 0 "a"
MemberName 48(inbName) 1 "b"
Name 50 "inb"
Decorate 13 DecorationNonUniformEXT
Decorate 13 DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT
...
@@ -37,12 +29,6 @@ spv.nonuniform.frag
...
@@ -37,12 +29,6 @@ spv.nonuniform.frag
Decorate 33(nu_inv4) DecorationNonUniformEXT
Decorate 33(nu_inv4) DecorationNonUniformEXT
Decorate 39(nu_gf) DecorationNonUniformEXT
Decorate 39(nu_gf) DecorationNonUniformEXT
Decorate 40 DecorationNonUniformEXT
Decorate 40 DecorationNonUniformEXT
MemberDecorate 42(S) 1 DecorationNonUniformEXT
Decorate 44(ins) Location 1
MemberDecorate 48(inbName) 0 DecorationNonUniformEXT
Decorate 48(inbName) Block
Decorate 50(inb) Location 3
Decorate 52 DecorationNonUniformEXT
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeInt 32 1
6: TypeInt 32 1
...
@@ -57,13 +43,6 @@ spv.nonuniform.frag
...
@@ -57,13 +43,6 @@ spv.nonuniform.frag
34: TypeInt 32 0
34: TypeInt 32 0
35: 34(int) Constant 0
35: 34(int) Constant 0
36: TypePointer Input 28(float)
36: TypePointer Input 28(float)
42(S): TypeStruct 28(float) 28(float)
43: TypePointer Input 42(S)
44(ins): 43(ptr) Variable Input
45: 6(int) Constant 0
48(inbName): TypeStruct 28(float) 28(float)
49: TypePointer Input 48(inbName)
50(inb): 49(ptr) Variable Input
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
16(a): 7(ptr) Variable Function
16(a): 7(ptr) Variable Function
...
@@ -88,12 +67,6 @@ spv.nonuniform.frag
...
@@ -88,12 +67,6 @@ spv.nonuniform.frag
40: 28(float) Load 39(nu_gf)
40: 28(float) Load 39(nu_gf)
41: 28(float) FMul 38 40
41: 28(float) FMul 38 40
Store 30(b) 41
Store 30(b) 41
46: 36(ptr) AccessChain 44(ins) 45
47: 28(float) Load 46
51: 36(ptr) AccessChain 50(inb) 45
52: 28(float) Load 51
53: 28(float) FAdd 47 52
Store 30(b) 53
Return
Return
FunctionEnd
FunctionEnd
11(foo(i1;i1;): 6(int) Function None 8
11(foo(i1;i1;): 6(int) Function None 8
...
...
Test/nonuniform.frag
View file @
3933dc51
...
@@ -25,5 +25,5 @@ void main()
...
@@ -25,5 +25,5 @@ void main()
nu_li
=
nonuniformEXT
();
// ERROR, no arguments
nu_li
=
nonuniformEXT
();
// ERROR, no arguments
}
}
layout
(
location
=
1
)
in
struct
S
{
float
a
;
nonuniformEXT
float
b
;
}
ins
;
layout
(
location
=
1
)
in
struct
S
{
float
a
;
nonuniformEXT
float
b
;
}
ins
;
// ERROR, not on member
layout
(
location
=
3
)
in
inbName
{
float
a
;
nonuniformEXT
float
b
;
}
inb
;
layout
(
location
=
3
)
in
inbName
{
float
a
;
nonuniformEXT
float
b
;
}
inb
;
// ERROR, not on member
Test/spv.nonuniform.frag
View file @
3933dc51
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
layout
(
location
=
0
)
nonuniformEXT
in
vec4
nu_inv4
;
layout
(
location
=
0
)
nonuniformEXT
in
vec4
nu_inv4
;
nonuniformEXT
float
nu_gf
;
nonuniformEXT
float
nu_gf
;
layout
(
location
=
1
)
in
struct
S
{
float
a
;
nonuniformEXT
float
b
;
}
ins
;
layout
(
location
=
3
)
in
inbName
{
nonuniformEXT
float
a
;
float
b
;
}
inb
;
nonuniformEXT
int
foo
(
nonuniformEXT
int
nupi
,
nonuniformEXT
out
int
f
)
nonuniformEXT
int
foo
(
nonuniformEXT
int
nupi
,
nonuniformEXT
out
int
f
)
{
{
...
@@ -19,5 +17,4 @@ void main()
...
@@ -19,5 +17,4 @@ void main()
float
b
;
float
b
;
b
=
nu_inv4
.
x
*
nu_gf
;
b
=
nu_inv4
.
x
*
nu_gf
;
b
=
ins
.
a
+
inb
.
a
;
}
}
\ No newline at end of file
glslang/MachineIndependent/ParseHelper.cpp
View file @
3933dc51
...
@@ -2575,6 +2575,19 @@ void TParseContext::transparentOpaqueCheck(const TSourceLoc& loc, const TType& t
...
@@ -2575,6 +2575,19 @@ void TParseContext::transparentOpaqueCheck(const TSourceLoc& loc, const TType& t
}
}
//
//
// Qualifier checks knowing the qualifier and that it is a member of a struct/block.
//
void
TParseContext
::
memberQualifierCheck
(
glslang
::
TPublicType
&
publicType
)
{
globalQualifierFixCheck
(
publicType
.
loc
,
publicType
.
qualifier
);
checkNoShaderLayouts
(
publicType
.
loc
,
publicType
.
shaderQualifiers
);
if
(
publicType
.
qualifier
.
isNonUniform
())
{
error
(
publicType
.
loc
,
"not allowed on block or structure members"
,
"nonuniformEXT"
,
""
);
publicType
.
qualifier
.
nonUniform
=
false
;
}
}
//
// Check/fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
// Check/fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
//
//
void
TParseContext
::
globalQualifierFixCheck
(
const
TSourceLoc
&
loc
,
TQualifier
&
qualifier
)
void
TParseContext
::
globalQualifierFixCheck
(
const
TSourceLoc
&
loc
,
TQualifier
&
qualifier
)
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
3933dc51
...
@@ -351,6 +351,7 @@ public:
...
@@ -351,6 +351,7 @@ public:
void
samplerCheck
(
const
TSourceLoc
&
,
const
TType
&
,
const
TString
&
identifier
,
TIntermTyped
*
initializer
);
void
samplerCheck
(
const
TSourceLoc
&
,
const
TType
&
,
const
TString
&
identifier
,
TIntermTyped
*
initializer
);
void
atomicUintCheck
(
const
TSourceLoc
&
,
const
TType
&
,
const
TString
&
identifier
);
void
atomicUintCheck
(
const
TSourceLoc
&
,
const
TType
&
,
const
TString
&
identifier
);
void
transparentOpaqueCheck
(
const
TSourceLoc
&
,
const
TType
&
,
const
TString
&
identifier
);
void
transparentOpaqueCheck
(
const
TSourceLoc
&
,
const
TType
&
,
const
TString
&
identifier
);
void
memberQualifierCheck
(
glslang
::
TPublicType
&
);
void
globalQualifierFixCheck
(
const
TSourceLoc
&
,
TQualifier
&
);
void
globalQualifierFixCheck
(
const
TSourceLoc
&
,
TQualifier
&
);
void
globalQualifierTypeCheck
(
const
TSourceLoc
&
,
const
TQualifier
&
,
const
TPublicType
&
);
void
globalQualifierTypeCheck
(
const
TSourceLoc
&
,
const
TQualifier
&
,
const
TPublicType
&
);
bool
structQualifierErrorCheck
(
const
TSourceLoc
&
,
const
TPublicType
&
pType
);
bool
structQualifierErrorCheck
(
const
TSourceLoc
&
,
const
TPublicType
&
pType
);
...
...
glslang/MachineIndependent/glslang.y
View file @
3933dc51
...
@@ -3127,7 +3127,6 @@ struct_declaration
...
@@ -3127,7 +3127,6 @@ struct_declaration
}
}
}
}
| type_qualifier type_specifier struct_declarator_list SEMICOLON {
| type_qualifier type_specifier struct_declarator_list SEMICOLON {
parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
if ($2.arraySizes) {
if ($2.arraySizes) {
parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
...
@@ -3137,7 +3136,7 @@ struct_declaration
...
@@ -3137,7 +3136,7 @@ struct_declaration
$$ = $3;
$$ = $3;
parseContext.
checkNoShaderLayouts($1.loc, $1.shaderQualifiers
);
parseContext.
memberQualifierCheck($1
);
parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType);
parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType);
parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
...
...
glslang/MachineIndependent/glslang_tab.cpp
View file @
3933dc51
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment