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
8de7e7bf
Commit
8de7e7bf
authored
Jun 04, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL: Error when using location on an arrayed block.
This implements a recent change to the GLSL specification to enforce this ill-defined situation.
parent
99f289d4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
4 deletions
+55
-4
450.frag
Test/450.frag
+9
-0
450.tesc
Test/450.tesc
+9
-0
450.frag.out
Test/baseResults/450.frag.out
+9
-2
450.tesc.out
Test/baseResults/450.tesc.out
+9
-2
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+18
-0
ParseHelper.h
glslang/MachineIndependent/ParseHelper.h
+1
-0
No files found.
Test/450.frag
View file @
8de7e7bf
...
@@ -54,3 +54,12 @@ float cull(int i)
...
@@ -54,3 +54,12 @@ float cull(int i)
{
{
return
(
i
>=
6
)
?
gl_CullDistance
[
5
]
:
gl_CullDistance
[
i
];
return
(
i
>=
6
)
?
gl_CullDistance
[
5
]
:
gl_CullDistance
[
i
];
}
}
layout
(
location
=
6
)
in
bName1
{
float
f
;
layout
(
location
=
7
)
float
g
;
}
bInst1
;
layout
(
location
=
8
)
in
bName2
{
float
f
;
layout
(
location
=
9
)
float
g
;
// ERROR, location on array
}
bInst2
[
3
];
Test/450.tesc
View file @
8de7e7bf
...
@@ -12,3 +12,12 @@ void main()
...
@@ -12,3 +12,12 @@ void main()
{
{
gl_out[gl_InvocationID].gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
gl_out[gl_InvocationID].gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}
}
layout(location = 4) out bName1 {
float f;
layout(location = 5) float g;
} bInst1[2];
layout(location = 6) out bName2 {
float f;
layout(location = 7) float g; // ERROR, location on array
} bInst2[2][3];
Test/baseResults/450.frag.out
View file @
8de7e7bf
450.frag
450.frag
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:62: 'location' : cannot use in a block array where new locations are needed for each block element
ERROR: 1 compilation errors. No code generated.
Shader version: 450
Shader version: 450
0:? Sequence
ERROR: node is still EOpNull!
0:8 Function Definition: main( ( global void)
0:8 Function Definition: main( ( global void)
0:8 Function Parameters:
0:8 Function Parameters:
0:10 Sequence
0:10 Sequence
...
@@ -160,13 +163,15 @@ Shader version: 450
...
@@ -160,13 +163,15 @@ Shader version: 450
0:? 'us2dmsa' ( uniform usampler2DMSArray)
0:? 'us2dmsa' ( uniform usampler2DMSArray)
0:? 'ii2dms' (layout( rgba32i) uniform iimage2DMS)
0:? 'ii2dms' (layout( rgba32i) uniform iimage2DMS)
0:? 'i2dmsa' (layout( rgba32f) uniform image2DMSArray)
0:? 'i2dmsa' (layout( rgba32f) uniform image2DMSArray)
0:? 'bInst1' ( in block{layout( location=6 component=0) in float f, layout( location=7) in float g})
0:? 'bInst2' ( in 3-element array of block{layout( location=8 component=0) in float f, layout( location=9) in float g})
Linked fragment stage:
Linked fragment stage:
Shader version: 450
Shader version: 450
0:? Sequence
ERROR: node is still EOpNull!
0:8 Function Definition: main( ( global void)
0:8 Function Definition: main( ( global void)
0:8 Function Parameters:
0:8 Function Parameters:
0:10 Sequence
0:10 Sequence
...
@@ -273,4 +278,6 @@ Shader version: 450
...
@@ -273,4 +278,6 @@ Shader version: 450
0:? 'us2dmsa' ( uniform usampler2DMSArray)
0:? 'us2dmsa' ( uniform usampler2DMSArray)
0:? 'ii2dms' (layout( rgba32i) uniform iimage2DMS)
0:? 'ii2dms' (layout( rgba32i) uniform iimage2DMS)
0:? 'i2dmsa' (layout( rgba32f) uniform image2DMSArray)
0:? 'i2dmsa' (layout( rgba32f) uniform image2DMSArray)
0:? 'bInst1' ( in block{layout( location=6 component=0) in float f, layout( location=7) in float g})
0:? 'bInst2' ( in 3-element array of block{layout( location=8 component=0) in float f, layout( location=9) in float g})
Test/baseResults/450.tesc.out
View file @
8de7e7bf
450.tesc
450.tesc
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:20: 'location' : cannot use in a block array where new locations are needed for each block element
ERROR: 1 compilation errors. No code generated.
Shader version: 450
Shader version: 450
vertices = -1
vertices = -1
0:? Sequence
ERROR: node is still EOpNull!
0:11 Function Definition: main( ( global void)
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:11 Function Parameters:
0:13 Sequence
0:13 Sequence
...
@@ -30,6 +33,8 @@ vertices = -1
...
@@ -30,6 +33,8 @@ vertices = -1
0:? Linker Objects
0:? Linker Objects
0:? 'gl_in' ( in 32-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_in' ( in 32-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_out' ( out 4-element array of block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_out' ( out 4-element array of block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'bInst1' ( out 2-element array of block{layout( location=4 component=0) out float f, layout( location=5) out float g})
0:? 'bInst2' ( out 2-element array of 3-element array of block{layout( location=6 component=0) out float f, layout( location=7) out float g})
Linked tessellation control stage:
Linked tessellation control stage:
...
@@ -38,7 +43,7 @@ ERROR: Linking tessellation control stage: At least one shader must specify an o
...
@@ -38,7 +43,7 @@ ERROR: Linking tessellation control stage: At least one shader must specify an o
Shader version: 450
Shader version: 450
vertices = -1
vertices = -1
0:? Sequence
ERROR: node is still EOpNull!
0:11 Function Definition: main( ( global void)
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:11 Function Parameters:
0:13 Sequence
0:13 Sequence
...
@@ -65,4 +70,6 @@ vertices = -1
...
@@ -65,4 +70,6 @@ vertices = -1
0:? Linker Objects
0:? Linker Objects
0:? 'gl_in' ( in 32-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_in' ( in 32-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_out' ( out 4-element array of block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_out' ( out 4-element array of block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'bInst1' ( out 2-element array of block{layout( location=4 component=0) out float f, layout( location=5) out float g})
0:? 'bInst2' ( out 2-element array of 3-element array of block{layout( location=6 component=0) out float f, layout( location=7) out float g})
glslang/MachineIndependent/ParseHelper.cpp
View file @
8de7e7bf
...
@@ -4391,6 +4391,22 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb
...
@@ -4391,6 +4391,22 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb
}
}
}
}
// "For some blocks declared as arrays, the location can only be applied at the block level:
// When a block is declared as an array where additional locations are needed for each member
// for each block array element, it is a compile-time error to specify locations on the block
// members. That is, when locations would be under specified by applying them on block members,
// they are not allowed on block members. For arrayed interfaces (those generally having an
// extra level of arrayness due to interface expansion), the outer array is stripped before
// applying this rule."
void
TParseContext
::
layoutMemberLocationArrayCheck
(
const
TSourceLoc
&
loc
,
bool
memberWithLocation
,
TArraySizes
*
arraySizes
)
{
if
(
memberWithLocation
&&
arraySizes
!=
nullptr
)
{
if
(
arraySizes
->
getNumDims
()
>
(
currentBlockQualifier
.
isArrayedIo
(
language
)
?
1
:
0
))
error
(
loc
,
"cannot use in a block array where new locations are needed for each block element"
,
"location"
,
""
);
}
}
// Do layout error checking with respect to a type.
// Do layout error checking with respect to a type.
void
TParseContext
::
layoutTypeCheck
(
const
TSourceLoc
&
loc
,
const
TType
&
type
)
void
TParseContext
::
layoutTypeCheck
(
const
TSourceLoc
&
loc
,
const
TType
&
type
)
{
{
...
@@ -5693,6 +5709,8 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
...
@@ -5693,6 +5709,8 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
memberQualifier
=
newMemberQualification
;
memberQualifier
=
newMemberQualification
;
}
}
layoutMemberLocationArrayCheck
(
loc
,
memberWithLocation
,
arraySizes
);
// Process the members
// Process the members
fixBlockLocations
(
loc
,
currentBlockQualifier
,
typeList
,
memberWithLocation
,
memberWithoutLocation
);
fixBlockLocations
(
loc
,
currentBlockQualifier
,
typeList
,
memberWithLocation
,
memberWithoutLocation
);
fixBlockXfbOffsets
(
currentBlockQualifier
,
typeList
);
fixBlockXfbOffsets
(
currentBlockQualifier
,
typeList
);
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
8de7e7bf
...
@@ -338,6 +338,7 @@ public:
...
@@ -338,6 +338,7 @@ public:
void
setLayoutQualifier
(
const
TSourceLoc
&
,
TPublicType
&
,
TString
&
,
const
TIntermTyped
*
);
void
setLayoutQualifier
(
const
TSourceLoc
&
,
TPublicType
&
,
TString
&
,
const
TIntermTyped
*
);
void
mergeObjectLayoutQualifiers
(
TQualifier
&
dest
,
const
TQualifier
&
src
,
bool
inheritOnly
);
void
mergeObjectLayoutQualifiers
(
TQualifier
&
dest
,
const
TQualifier
&
src
,
bool
inheritOnly
);
void
layoutObjectCheck
(
const
TSourceLoc
&
,
const
TSymbol
&
);
void
layoutObjectCheck
(
const
TSourceLoc
&
,
const
TSymbol
&
);
void
layoutMemberLocationArrayCheck
(
const
TSourceLoc
&
,
bool
memberWithLocation
,
TArraySizes
*
arraySizes
);
void
layoutTypeCheck
(
const
TSourceLoc
&
,
const
TType
&
);
void
layoutTypeCheck
(
const
TSourceLoc
&
,
const
TType
&
);
void
layoutQualifierCheck
(
const
TSourceLoc
&
,
const
TQualifier
&
);
void
layoutQualifierCheck
(
const
TSourceLoc
&
,
const
TQualifier
&
);
void
checkNoShaderLayouts
(
const
TSourceLoc
&
,
const
TShaderQualifiers
&
);
void
checkNoShaderLayouts
(
const
TSourceLoc
&
,
const
TShaderQualifiers
&
);
...
...
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