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
67eb4970
Commit
67eb4970
authored
Jul 21, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV/OpenGL: Require locations on non-opaque uniform variables.
parent
ab008675
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
13 deletions
+26
-13
glspv.frag.out
Test/baseResults/glspv.frag.out
+4
-3
glspv.frag
Test/glspv.frag
+6
-1
spv.targetOpenGL.vert
Test/spv.targetOpenGL.vert
+3
-2
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+12
-6
ParseHelper.h
glslang/MachineIndependent/ParseHelper.h
+1
-1
No files found.
Test/baseResults/glspv.frag.out
View file @
67eb4970
glspv.frag
glspv.frag
ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error )
ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error )
ERROR: 0:6: '#error' : GL_SPIR is 100
ERROR: 0:6: '#error' : GL_SPIR is 100
ERROR: 0:14: 'input_attachment_index' : only allowed when using GLSL for Vulkan
ERROR: 0:14: 'f' : non-opaque uniform variables need a layout(location=L)
ERROR: 0:14: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 0:19: 'input_attachment_index' : only allowed when using GLSL for Vulkan
ERROR: 4 compilation errors. No code generated.
ERROR: 0:19: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 5 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
SPIR-V is not generated for failed compile or link
Test/glspv.frag
View file @
67eb4970
#version
33
0
#version
45
0
#ifdef GL_SPIRV
#ifdef GL_SPIRV
#error GL_SPIRV is set ( correct, not an error )
#error GL_SPIRV is set ( correct, not an error )
...
@@ -11,4 +11,9 @@ void main()
...
@@ -11,4 +11,9 @@ void main()
{
{
}
}
uniform
float
f
;
// ERROR, no location
layout
(
location
=
2
)
uniform
float
g
;
uniform
sampler2D
s1
;
layout
(
location
=
3
)
uniform
sampler2D
s2
;
layout
(
input_attachment_index
=
1
)
uniform
subpassInput
sub
;
// ERROR, no inputs
layout
(
input_attachment_index
=
1
)
uniform
subpassInput
sub
;
// ERROR, no inputs
Test/spv.targetOpenGL.vert
View file @
67eb4970
#version 450
#version 450
layout
(
constant_id
=
3
)
const
int
a
=
2
;
layout
(
constant_id
=
3
)
const
int
a
=
2
;
layout
(
location
=
2
)
uniform
float
f
;
uniform
float
f
;
layout
(
location
=
4
)
uniform
sampler2D
s1
;
uniform
sampler2D
s2
;
void
main
()
void
main
()
{
{
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
67eb4970
...
@@ -2472,16 +2472,22 @@ void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, co
...
@@ -2472,16 +2472,22 @@ void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, co
error
(
loc
,
"atomic_uints can only be used in uniform variables or function parameters:"
,
type
.
getBasicTypeString
().
c_str
(),
identifier
.
c_str
());
error
(
loc
,
"atomic_uints can only be used in uniform variables or function parameters:"
,
type
.
getBasicTypeString
().
c_str
(),
identifier
.
c_str
());
}
}
void
TParseContext
::
transparent
Check
(
const
TSourceLoc
&
loc
,
const
TType
&
type
,
const
TString
&
/*identifier*/
)
void
TParseContext
::
transparent
OpaqueCheck
(
const
TSourceLoc
&
loc
,
const
TType
&
type
,
const
TString
&
identifier
)
{
{
if
(
parsingBuiltins
)
if
(
parsingBuiltins
)
return
;
return
;
// Vulkan doesn't allow transparent uniforms outside of blocks
if
(
type
.
getQualifier
().
storage
!=
EvqUniform
)
if
(
spvVersion
.
vulkan
==
0
||
type
.
getQualifier
().
storage
!=
EvqUniform
)
return
;
return
;
if
(
type
.
containsNonOpaque
())
vulkanRemoved
(
loc
,
"non-opaque uniforms outside a block"
);
if
(
type
.
containsNonOpaque
())
{
// Vulkan doesn't allow transparent uniforms outside of blocks
if
(
spvVersion
.
vulkan
>
0
)
vulkanRemoved
(
loc
,
"non-opaque uniforms outside a block"
);
// OpenGL wants locations on these
if
(
spvVersion
.
openGl
>
0
&&
!
type
.
getQualifier
().
hasLocation
())
error
(
loc
,
"non-opaque uniform variables need a layout(location=L)"
,
identifier
.
c_str
(),
""
);
}
}
}
//
//
...
@@ -5107,7 +5113,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
...
@@ -5107,7 +5113,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
samplerCheck
(
loc
,
type
,
identifier
,
initializer
);
samplerCheck
(
loc
,
type
,
identifier
,
initializer
);
atomicUintCheck
(
loc
,
type
,
identifier
);
atomicUintCheck
(
loc
,
type
,
identifier
);
transparentCheck
(
loc
,
type
,
identifier
);
transparent
Opaque
Check
(
loc
,
type
,
identifier
);
if
(
identifier
!=
"gl_FragCoord"
&&
(
publicType
.
shaderQualifiers
.
originUpperLeft
||
publicType
.
shaderQualifiers
.
pixelCenterInteger
))
if
(
identifier
!=
"gl_FragCoord"
&&
(
publicType
.
shaderQualifiers
.
originUpperLeft
||
publicType
.
shaderQualifiers
.
pixelCenterInteger
))
error
(
loc
,
"can only apply origin_upper_left and pixel_center_origin to gl_FragCoord"
,
"layout qualifier"
,
""
);
error
(
loc
,
"can only apply origin_upper_left and pixel_center_origin to gl_FragCoord"
,
"layout qualifier"
,
""
);
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
67eb4970
...
@@ -327,7 +327,7 @@ public:
...
@@ -327,7 +327,7 @@ public:
void
boolCheck
(
const
TSourceLoc
&
,
const
TPublicType
&
);
void
boolCheck
(
const
TSourceLoc
&
,
const
TPublicType
&
);
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
transparentCheck
(
const
TSourceLoc
&
,
const
TType
&
,
const
TString
&
identifier
);
void
transparent
Opaque
Check
(
const
TSourceLoc
&
,
const
TType
&
,
const
TString
&
identifier
);
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
);
...
...
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