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
b901ade0
Commit
b901ade0
authored
Jun 16, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Non-functional: Condense SPV-related versioning, and rationalize all uses.
parent
65336488
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
75 additions
and
75 deletions
+75
-75
spv.atomic.comp.out
Test/baseResults/spv.atomic.comp.out
+0
-2
vulkan.vert.out
Test/baseResults/vulkan.vert.out
+2
-2
spv.atomic.comp
Test/spv.atomic.comp
+1
-1
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+0
-0
Initialize.h
glslang/MachineIndependent/Initialize.h
+9
-9
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+10
-10
ParseHelper.h
glslang/MachineIndependent/ParseHelper.h
+3
-3
Scan.cpp
glslang/MachineIndependent/Scan.cpp
+2
-2
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+0
-0
Versions.cpp
glslang/MachineIndependent/Versions.cpp
+13
-9
Versions.h
glslang/MachineIndependent/Versions.h
+11
-0
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+4
-4
parseVersions.h
glslang/MachineIndependent/parseVersions.h
+3
-4
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+5
-17
hlslParseHelper.h
hlsl/hlslParseHelper.h
+1
-1
hlslParseables.cpp
hlsl/hlslParseables.cpp
+7
-7
hlslParseables.h
hlsl/hlslParseables.h
+4
-4
No files found.
Test/baseResults/spv.atomic.comp.out
View file @
b901ade0
...
...
@@ -2,7 +2,6 @@ spv.atomic.comp
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
Shader version: 310
Requested GL_ARB_gl_spirv
local_size = (1, 1, 1)
0:? Sequence
0:14 Function Definition: func(au1; (global highp uint)
...
...
@@ -105,7 +104,6 @@ Linked compute stage:
Shader version: 310
Requested GL_ARB_gl_spirv
local_size = (1, 1, 1)
0:? Sequence
0:14 Function Definition: func(au1; (global highp uint)
...
...
Test/baseResults/vulkan.vert.out
View file @
b901ade0
...
...
@@ -17,8 +17,8 @@ ERROR: 0:16: 'constant_id' : cannot declare a default, can only be used on a sca
ERROR: 0:20: 'subpassLoad' : no matching overloaded function found
ERROR: 0:20: 'assign' : cannot convert from 'const float' to 'smooth out 4-component vector of float'
ERROR: 0:23: 'atomic counter types' : not allowed when using GLSL for Vulkan
ERROR: 0:24: 'shared' : not allowed when
using GLSL for Vulkan
ERROR: 0:25: 'packed' : not allowed when
using GLSL for Vulkan
ERROR: 0:24: 'shared' : not allowed when
generating SPIR-V
ERROR: 0:25: 'packed' : not allowed when
generating SPIR-V
ERROR: 0:32: 'initializer' : can't use with types containing arrays sized with a specialization constant
ERROR: 0:34: '=' : can't use with types containing arrays sized with a specialization constant
ERROR: 0:35: '==' : can't use with types containing arrays sized with a specialization constant
...
...
Test/spv.atomic.comp
View file @
b901ade0
#version 310 es
#extension GL_ARB_gl_spirv : enable
layout(binding = 0) uniform atomic_uint counter;
...
...
glslang/MachineIndependent/Initialize.cpp
View file @
b901ade0
This diff is collapsed.
Click to expand it.
glslang/MachineIndependent/Initialize.h
View file @
b901ade0
...
...
@@ -61,14 +61,14 @@ public:
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
TBuiltInParseables
();
virtual
~
TBuiltInParseables
();
virtual
void
initialize
(
int
version
,
EProfile
,
int
spv
,
int
vulka
n
)
=
0
;
virtual
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
int
spv
,
int
vulka
n
,
EShLanguage
)
=
0
;
virtual
void
initialize
(
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
)
=
0
;
virtual
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
)
=
0
;
virtual
const
TString
&
getCommonString
()
const
{
return
commonBuiltins
;
}
virtual
const
TString
&
getStageString
(
EShLanguage
language
)
const
{
return
stageBuiltins
[
language
];
}
virtual
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
)
=
0
;
virtual
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
)
=
0
;
virtual
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
/*vulkan*/
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
)
=
0
;
virtual
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersion
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
)
=
0
;
protected
:
TString
commonBuiltins
;
...
...
@@ -85,15 +85,15 @@ public:
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
TBuiltIns
();
virtual
~
TBuiltIns
();
void
initialize
(
int
version
,
EProfile
,
int
spv
,
int
vulka
n
);
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
int
spv
,
int
vulka
n
,
EShLanguage
);
void
initialize
(
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
);
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
);
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
);
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
);
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
/*vulkan*/
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
);
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersion
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
);
protected
:
void
add2ndGenerationSamplingImaging
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
);
void
add2ndGenerationSamplingImaging
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
);
void
addSubpassSampling
(
TSampler
,
TString
&
typeName
,
int
version
,
EProfile
profile
);
void
addQueryFunctions
(
TSampler
,
TString
&
typeName
,
int
version
,
EProfile
profile
);
void
addImageFunctions
(
TSampler
,
TString
&
typeName
,
int
version
,
EProfile
profile
);
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
b901ade0
...
...
@@ -49,9 +49,9 @@ extern int yyparse(glslang::TParseContext*);
namespace
glslang
{
TParseContext
::
TParseContext
(
TSymbolTable
&
symbolTable
,
TIntermediate
&
interm
,
bool
parsingBuiltins
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
bool
forwardCompatible
,
EShMessages
messages
)
:
TParseContextBase
(
symbolTable
,
interm
,
version
,
profile
,
spv
,
vulka
n
,
language
,
infoSink
,
forwardCompatible
,
messages
),
TParseContextBase
(
symbolTable
,
interm
,
version
,
profile
,
spv
Versio
n
,
language
,
infoSink
,
forwardCompatible
,
messages
),
contextPragma
(
true
,
false
),
loopNestingLevel
(
0
),
structNestingLevel
(
0
),
controlFlowNestingLevel
(
0
),
statementNestingLevel
(
0
),
inMain
(
false
),
postMainReturn
(
false
),
currentFunctionType
(
nullptr
),
blockName
(
nullptr
),
limits
(
resources
.
limits
),
parsingBuiltins
(
parsingBuiltins
),
...
...
@@ -104,11 +104,11 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
globalUniformDefaults
.
clear
();
globalUniformDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalUniformDefaults
.
layoutPacking
=
vulkan
>
0
?
ElpStd140
:
ElpShared
;
globalUniformDefaults
.
layoutPacking
=
spvVersion
.
spv
!=
0
?
ElpStd140
:
ElpShared
;
globalBufferDefaults
.
clear
();
globalBufferDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalBufferDefaults
.
layoutPacking
=
vulkan
>
0
?
ElpStd430
:
ElpShared
;
globalBufferDefaults
.
layoutPacking
=
spvVersion
.
spv
!=
0
?
ElpStd430
:
ElpShared
;
globalInputDefaults
.
clear
();
globalOutputDefaults
.
clear
();
...
...
@@ -2565,7 +2565,7 @@ void TParseContext::transparentCheck(const TSourceLoc& loc, const TType& type, c
return
;
// Vulkan doesn't allow transparent uniforms outside of blocks
if
(
vulkan
==
0
||
type
.
getQualifier
().
storage
!=
EvqUniform
)
if
(
spvVersion
.
vulkan
==
0
||
type
.
getQualifier
().
storage
!=
EvqUniform
)
return
;
if
(
type
.
containsNonOpaque
())
vulkanRemoved
(
loc
,
"non-opaque uniforms outside a block"
);
...
...
@@ -3890,14 +3890,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
return
;
}
if
(
id
==
TQualifier
::
getLayoutPackingString
(
ElpPacked
))
{
if
(
vulkan
>
0
)
vulkan
Removed
(
loc
,
"packed"
);
if
(
spvVersion
.
spv
!=
0
)
spv
Removed
(
loc
,
"packed"
);
publicType
.
qualifier
.
layoutPacking
=
ElpPacked
;
return
;
}
if
(
id
==
TQualifier
::
getLayoutPackingString
(
ElpShared
))
{
if
(
vulkan
>
0
)
vulkan
Removed
(
loc
,
"shared"
);
if
(
spvVersion
.
spv
!=
0
)
spv
Removed
(
loc
,
"shared"
);
publicType
.
qualifier
.
layoutPacking
=
ElpShared
;
return
;
}
...
...
@@ -4263,7 +4263,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
publicType
.
shaderQualifiers
.
localSize
[
2
]
=
value
;
return
;
}
if
(
spv
>
0
)
{
if
(
spv
Version
.
spv
!=
0
)
{
if
(
id
==
"local_size_x_id"
)
{
publicType
.
shaderQualifiers
.
localSizeSpecId
[
0
]
=
value
;
return
;
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
b901ade0
...
...
@@ -74,9 +74,9 @@ typedef std::set<int> TIdSetType;
class
TParseContextBase
:
public
TParseVersions
{
public
:
TParseContextBase
(
TSymbolTable
&
symbolTable
,
TIntermediate
&
interm
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
bool
forwardCompatible
,
EShMessages
messages
)
:
TParseVersions
(
interm
,
version
,
profile
,
spv
,
vulka
n
,
language
,
infoSink
,
forwardCompatible
,
messages
),
:
TParseVersions
(
interm
,
version
,
profile
,
spv
Versio
n
,
language
,
infoSink
,
forwardCompatible
,
messages
),
symbolTable
(
symbolTable
),
tokensBeforeEOF
(
false
),
linkage
(
nullptr
),
scanContext
(
nullptr
),
ppContext
(
nullptr
)
{
}
virtual
~
TParseContextBase
()
{
}
...
...
@@ -151,7 +151,7 @@ protected:
//
class
TParseContext
:
public
TParseContextBase
{
public
:
TParseContext
(
TSymbolTable
&
,
TIntermediate
&
,
bool
parsingBuiltins
,
int
version
,
EProfile
,
int
spv
,
int
vulka
n
,
EShLanguage
,
TInfoSink
&
,
TParseContext
(
TSymbolTable
&
,
TIntermediate
&
,
bool
parsingBuiltins
,
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
,
TInfoSink
&
,
bool
forwardCompatible
=
false
,
EShMessages
messages
=
EShMsgDefault
);
virtual
~
TParseContext
();
...
...
glslang/MachineIndependent/Scan.cpp
View file @
b901ade0
...
...
@@ -1092,7 +1092,7 @@ int TScanContext::tokenizeIdentifier()
case
TEXTURE1DARRAY
:
case
SAMPLER
:
case
SAMPLERSHADOW
:
if
(
parseContext
.
spv
>
0
)
if
(
parseContext
.
spv
Version
.
vulkan
>=
10
0
)
return
keyword
;
else
return
identifierOrType
();
...
...
@@ -1103,7 +1103,7 @@ int TScanContext::tokenizeIdentifier()
case
ISUBPASSINPUTMS
:
case
USUBPASSINPUT
:
case
USUBPASSINPUTMS
:
if
(
parseContext
.
spv
>
0
)
if
(
parseContext
.
spv
Version
.
vulkan
>=
10
0
)
return
keyword
;
else
return
identifierOrType
();
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
b901ade0
This diff is collapsed.
Click to expand it.
glslang/MachineIndependent/Versions.cpp
View file @
b901ade0
...
...
@@ -293,8 +293,15 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_GOOGLE_include_directive 1
\n
"
;
if
(
vulkan
>
0
)
preamble
+=
"#define VULKAN 100
\n
"
;
// #define VULKAN XXXX
if
(
spvVersion
.
vulkan
>
0
)
{
preamble
+=
"#define VULKAN "
;
char
number
[
12
];
snprintf
(
number
,
12
,
"%d"
,
spvVersion
.
vulkan
);
preamble
+=
number
;
preamble
+=
"
\n
"
;
}
// gl_spirv TODO
}
//
...
...
@@ -575,9 +582,6 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
updateExtensionBehavior
(
line
,
"GL_OES_shader_io_blocks"
,
behaviorString
);
else
if
(
strcmp
(
extension
,
"GL_GOOGLE_include_directive"
)
==
0
)
updateExtensionBehavior
(
line
,
"GL_GOOGLE_cpp_style_line_directive"
,
behaviorString
);
// SPIR-V
else
if
(
strcmp
(
extension
,
"GL_ARB_gl_spirv"
)
==
0
)
spv
=
100
;
}
void
TParseVersions
::
updateExtensionBehavior
(
const
char
*
extension
,
TExtensionBehavior
behavior
)
...
...
@@ -649,28 +653,28 @@ void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool buil
// Call for any operation removed because SPIR-V is in use.
void
TParseVersions
::
spvRemoved
(
const
TSourceLoc
&
loc
,
const
char
*
op
)
{
if
(
spv
>
0
)
if
(
spv
Version
.
spv
!=
0
)
error
(
loc
,
"not allowed when generating SPIR-V"
,
op
,
""
);
}
// Call for any operation removed because Vulkan SPIR-V is being generated.
void
TParseVersions
::
vulkanRemoved
(
const
TSourceLoc
&
loc
,
const
char
*
op
)
{
if
(
vulkan
>
0
)
if
(
spvVersion
.
vulkan
>=
10
0
)
error
(
loc
,
"not allowed when using GLSL for Vulkan"
,
op
,
""
);
}
// Call for any operation that requires Vulkan.
void
TParseVersions
::
requireVulkan
(
const
TSourceLoc
&
loc
,
const
char
*
op
)
{
if
(
vulkan
==
0
)
if
(
spvVersion
.
vulkan
==
0
)
error
(
loc
,
"only allowed when using GLSL for Vulkan"
,
op
,
""
);
}
// Call for any operation that requires SPIR-V.
void
TParseVersions
::
requireSpv
(
const
TSourceLoc
&
loc
,
const
char
*
op
)
{
if
(
spv
==
0
)
if
(
spv
Version
.
spv
==
0
)
error
(
loc
,
"only allowed when generating SPIR-V"
,
op
,
""
);
}
...
...
glslang/MachineIndependent/Versions.h
View file @
b901ade0
...
...
@@ -72,6 +72,17 @@ inline const char* ProfileName(EProfile profile)
}
//
// SPIR-V has versions for multiple things; tie them together.
// 0 means a target or rule set is not enabled.
//
struct
SpvVersion
{
SpvVersion
()
:
spv
(
0
),
vulkan
(
0
),
openGl
(
0
)
{}
unsigned
int
spv
;
// the version of the targeted SPIR-V, as defined by SPIR-V in word 1 of the SPIR-V binary header
int
vulkan
;
// the version of semantics for Vulkan; e.g., for GLSL from KHR_vulkan_glsl "#define VULKAN"
int
openGl
;
// the version of semantics for OpenGL; gl_spirv TODO
};
//
// The behaviors from the GLSL "#extension extension_name : behavior"
//
typedef
enum
{
...
...
glslang/MachineIndependent/localintermediate.h
View file @
b901ade0
...
...
@@ -125,7 +125,7 @@ class TVariable;
class
TIntermediate
{
public
:
explicit
TIntermediate
(
EShLanguage
l
,
int
v
=
0
,
EProfile
p
=
ENoProfile
)
:
source
(
EShSourceNone
),
language
(
l
),
profile
(
p
),
version
(
v
),
spv
(
0
),
treeRoot
(
0
),
source
(
EShSourceNone
),
language
(
l
),
profile
(
p
),
version
(
v
),
treeRoot
(
0
),
numMains
(
0
),
numErrors
(
0
),
numPushConstants
(
0
),
recursive
(
false
),
invocations
(
TQualifier
::
layoutNotSet
),
vertices
(
TQualifier
::
layoutNotSet
),
inputPrimitive
(
ElgNone
),
outputPrimitive
(
ElgNone
),
pixelCenterInteger
(
false
),
originUpperLeft
(
false
),
...
...
@@ -154,8 +154,8 @@ public:
int
getVersion
()
const
{
return
version
;
}
void
setProfile
(
EProfile
p
)
{
profile
=
p
;
}
EProfile
getProfile
()
const
{
return
profile
;
}
void
setSpv
(
int
s
)
{
spv
=
s
;
}
int
getSpv
()
const
{
return
spv
;
}
void
setSpv
(
const
SpvVersion
&
s
)
{
spvVersion
=
s
;
}
const
SpvVersion
&
getSpv
()
const
{
return
spvVersion
;
}
EShLanguage
getStage
()
const
{
return
language
;
}
void
addRequestedExtension
(
const
char
*
extension
)
{
requestedExtensions
.
insert
(
extension
);
}
const
std
::
set
<
std
::
string
>&
getRequestedExtensions
()
const
{
return
requestedExtensions
;
}
...
...
@@ -352,7 +352,7 @@ protected:
std
::
string
entryPoint
;
EProfile
profile
;
int
version
;
int
spv
;
SpvVersion
spvVersion
;
TIntermNode
*
treeRoot
;
std
::
set
<
std
::
string
>
requestedExtensions
;
// cumulation of all enabled or required extensions; not connected to what subset of the shader used them
TBuiltInResource
resources
;
...
...
glslang/MachineIndependent/parseVersions.h
View file @
b901ade0
...
...
@@ -54,10 +54,10 @@ namespace glslang {
class
TParseVersions
{
public
:
TParseVersions
(
TIntermediate
&
interm
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
bool
forwardCompatible
,
EShMessages
messages
)
:
infoSink
(
infoSink
),
version
(
version
),
profile
(
profile
),
language
(
language
),
spv
(
spv
),
vulkan
(
vulka
n
),
forwardCompatible
(
forwardCompatible
),
spv
Version
(
spvVersio
n
),
forwardCompatible
(
forwardCompatible
),
intermediate
(
interm
),
messages
(
messages
),
numErrors
(
0
),
currentScanner
(
0
)
{
}
virtual
~
TParseVersions
()
{
}
virtual
void
initializeExtensionBehavior
();
...
...
@@ -114,8 +114,7 @@ public:
int
version
;
// version, updated by #version in the shader
EProfile
profile
;
// the declared profile in the shader (core by default)
EShLanguage
language
;
// really the stage
int
spv
;
// SPIR-V version; 0 means not SPIR-V
int
vulkan
;
// Vulkan version; 0 means not vulkan
SpvVersion
spvVersion
;
bool
forwardCompatible
;
// true if errors are to be given for use of deprecated features
TIntermediate
&
intermediate
;
// helper for making and hooking up pieces of the parse tree
...
...
hlsl/hlslParseHelper.cpp
View file @
b901ade0
...
...
@@ -49,9 +49,9 @@
namespace
glslang
{
HlslParseContext
::
HlslParseContext
(
TSymbolTable
&
symbolTable
,
TIntermediate
&
interm
,
bool
/*parsingBuiltins*/
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
bool
forwardCompatible
,
EShMessages
messages
)
:
TParseContextBase
(
symbolTable
,
interm
,
version
,
profile
,
spv
,
vulka
n
,
language
,
infoSink
,
forwardCompatible
,
messages
),
TParseContextBase
(
symbolTable
,
interm
,
version
,
profile
,
spv
Versio
n
,
language
,
infoSink
,
forwardCompatible
,
messages
),
contextPragma
(
true
,
false
),
loopNestingLevel
(
0
),
structNestingLevel
(
0
),
controlFlowNestingLevel
(
0
),
postMainReturn
(
false
),
limits
(
resources
.
limits
),
...
...
@@ -62,11 +62,11 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
globalUniformDefaults
.
clear
();
globalUniformDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalUniformDefaults
.
layoutPacking
=
vulkan
>
0
?
ElpStd140
:
ElpShared
;
globalUniformDefaults
.
layoutPacking
=
ElpStd140
;
globalBufferDefaults
.
clear
();
globalBufferDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalBufferDefaults
.
layoutPacking
=
vulkan
>
0
?
ElpStd430
:
ElpShared
;
globalBufferDefaults
.
layoutPacking
=
ElpStd430
;
globalInputDefaults
.
clear
();
globalOutputDefaults
.
clear
();
...
...
@@ -2416,18 +2416,6 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& pu
publicType
.
qualifier
.
layoutMatrix
=
ElmRowMajor
;
return
;
}
if
(
id
==
TQualifier
::
getLayoutPackingString
(
ElpPacked
))
{
if
(
vulkan
>
0
)
vulkanRemoved
(
loc
,
"packed"
);
publicType
.
qualifier
.
layoutPacking
=
ElpPacked
;
return
;
}
if
(
id
==
TQualifier
::
getLayoutPackingString
(
ElpShared
))
{
if
(
vulkan
>
0
)
vulkanRemoved
(
loc
,
"shared"
);
publicType
.
qualifier
.
layoutPacking
=
ElpShared
;
return
;
}
if
(
id
==
"push_constant"
)
{
requireVulkan
(
loc
,
"push_constant"
);
publicType
.
qualifier
.
layoutPushConstant
=
true
;
...
...
@@ -2714,7 +2702,7 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& pu
publicType
.
shaderQualifiers
.
localSize
[
2
]
=
value
;
return
;
}
if
(
spv
>
0
)
{
if
(
spv
Version
.
spv
!=
0
)
{
if
(
id
==
"local_size_x_id"
)
{
publicType
.
shaderQualifiers
.
localSizeSpecId
[
0
]
=
value
;
return
;
...
...
hlsl/hlslParseHelper.h
View file @
b901ade0
...
...
@@ -44,7 +44,7 @@ namespace glslang {
class
HlslParseContext
:
public
TParseContextBase
{
public
:
HlslParseContext
(
TSymbolTable
&
,
TIntermediate
&
,
bool
parsingBuiltins
,
int
version
,
EProfile
,
int
spv
,
int
vulka
n
,
EShLanguage
,
TInfoSink
&
,
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
,
TInfoSink
&
,
bool
forwardCompatible
=
false
,
EShMessages
messages
=
EShMsgDefault
);
virtual
~
HlslParseContext
();
void
setLimits
(
const
TBuiltInResource
&
);
...
...
hlsl/hlslParseables.cpp
View file @
b901ade0
...
...
@@ -218,7 +218,7 @@ TBuiltInParseablesHlsl::TBuiltInParseablesHlsl()
// Most built-ins variables can be added as simple text strings. Some need to
// be added programmatically, which is done later in IdentifyBuiltIns() below.
//
void
TBuiltInParseablesHlsl
::
initialize
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
)
void
TBuiltInParseablesHlsl
::
initialize
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
)
{
static
const
EShLanguageMask
EShLangAll
=
EShLanguageMask
(
EShLangCount
-
1
);
...
...
@@ -229,8 +229,8 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, int spv,
// typekey can be:
// D = double, F = float, U = uint, I = int, B = bool, S = sampler, - = void
// An empty order or type key repeats the first one. E.g: SVM,, means 3 args each of SVM.
// '>' as first letter of order creates an output par
e
meter
// '<' as first letter of order creates an input par
e
meter
// '>' as first letter of order creates an output par
a
meter
// '<' as first letter of order creates an input par
a
meter
// '^' as first letter of order takes transpose dimensions
static
const
struct
{
...
...
@@ -498,8 +498,8 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, int spv,
// add stage-specific entries to the commonBuiltins, and only if that stage
// was requested.
//
void
TBuiltInParseablesHlsl
::
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
)
void
TBuiltInParseablesHlsl
::
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
)
{
}
...
...
@@ -512,7 +512,7 @@ void TBuiltInParseablesHlsl::initialize(const TBuiltInResource &resources, int v
// 3) Tag extension-related symbols added to their base version with their extensions, so
// that if an early version has the extension turned off, there is an error reported on use.
//
void
TBuiltInParseablesHlsl
::
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
void
TBuiltInParseablesHlsl
::
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
)
{
// symbolTable.relateToOperator("abort", EOpAbort);
...
...
@@ -660,7 +660,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, int
// 2) Tag extension-related symbols added to their base version with their extensions, so
// that if an early version has the extension turned off, there is an error reported on use.
//
void
TBuiltInParseablesHlsl
::
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
/*vulkan*/
,
EShLanguage
language
,
void
TBuiltInParseablesHlsl
::
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersion
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
)
{
}
...
...
hlsl/hlslParseables.h
View file @
b901ade0
...
...
@@ -48,12 +48,12 @@ class TBuiltInParseablesHlsl : public TBuiltInParseables {
public
:
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
TBuiltInParseablesHlsl
();
void
initialize
(
int
version
,
EProfile
,
int
spv
,
int
vulka
n
);
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
int
spv
,
int
vulka
n
,
EShLanguage
);
void
initialize
(
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
);
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
);
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
);
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
);
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
/*vulkan*/
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
);
void
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersion
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
);
};
}
// end namespace glslang
...
...
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