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
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
174 additions
and
153 deletions
+174
-153
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
+48
-40
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
+51
-38
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
...
@@ -2,7 +2,6 @@ spv.atomic.comp
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
Shader version: 310
Shader version: 310
Requested GL_ARB_gl_spirv
local_size = (1, 1, 1)
local_size = (1, 1, 1)
0:? Sequence
0:? Sequence
0:14 Function Definition: func(au1; (global highp uint)
0:14 Function Definition: func(au1; (global highp uint)
...
@@ -105,7 +104,6 @@ Linked compute stage:
...
@@ -105,7 +104,6 @@ Linked compute stage:
Shader version: 310
Shader version: 310
Requested GL_ARB_gl_spirv
local_size = (1, 1, 1)
local_size = (1, 1, 1)
0:? Sequence
0:? Sequence
0:14 Function Definition: func(au1; (global highp uint)
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
...
@@ -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: '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: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:23: 'atomic counter types' : not allowed when using GLSL for Vulkan
ERROR: 0:24: 'shared' : not allowed when
using GLSL for Vulkan
ERROR: 0:24: 'shared' : not allowed when
generating SPIR-V
ERROR: 0:25: 'packed' : not allowed when
using GLSL for Vulkan
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: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: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
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
#version 310 es
#extension GL_ARB_gl_spirv : enable
layout(binding = 0) uniform atomic_uint counter;
layout(binding = 0) uniform atomic_uint counter;
...
...
glslang/MachineIndependent/Initialize.cpp
View file @
b901ade0
...
@@ -63,9 +63,9 @@ const bool ForwardCompatibility = false;
...
@@ -63,9 +63,9 @@ const bool ForwardCompatibility = false;
// Using PureOperatorBuiltins=false is deprecated.
// Using PureOperatorBuiltins=false is deprecated.
bool
PureOperatorBuiltins
=
true
;
bool
PureOperatorBuiltins
=
true
;
inline
bool
IncludeLegacy
(
int
version
,
EProfile
profile
,
int
spv
)
inline
bool
IncludeLegacy
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersion
)
{
{
return
profile
!=
EEsProfile
&&
(
version
<=
130
||
(
spv
==
0
&&
ARBCompatibility
)
||
profile
==
ECompatibilityProfile
);
return
profile
!=
EEsProfile
&&
(
version
<=
130
||
(
spv
Version
.
spv
==
0
&&
ARBCompatibility
)
||
profile
==
ECompatibilityProfile
);
}
}
// Construct TBuiltInParseables base class. This can be used for language-common constructs.
// Construct TBuiltInParseables base class. This can be used for language-common constructs.
...
@@ -114,7 +114,7 @@ TBuiltIns::~TBuiltIns()
...
@@ -114,7 +114,7 @@ TBuiltIns::~TBuiltIns()
// Most built-ins variables can be added as simple text strings. Some need to
// Most built-ins variables can be added as simple text strings. Some need to
// be added programmatically, which is done later in IdentifyBuiltIns() below.
// be added programmatically, which is done later in IdentifyBuiltIns() below.
//
//
void
TBuiltIns
::
initialize
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
)
void
TBuiltIns
::
initialize
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
)
{
{
//============================================================================
//============================================================================
//
//
...
@@ -1174,7 +1174,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1174,7 +1174,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
profile
==
ECompatibilityProfile
||
profile
==
ECompatibilityProfile
||
(
profile
==
ECoreProfile
&&
version
<
420
)
||
(
profile
==
ECoreProfile
&&
version
<
420
)
||
profile
==
ENoProfile
)
{
profile
==
ENoProfile
)
{
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"vec4 texture2D(sampler2D, vec2);"
"vec4 texture2D(sampler2D, vec2);"
...
@@ -1193,7 +1193,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1193,7 +1193,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
if
(
profile
==
ECompatibilityProfile
||
if
(
profile
==
ECompatibilityProfile
||
(
profile
==
ECoreProfile
&&
version
<
420
)
||
(
profile
==
ECoreProfile
&&
version
<
420
)
||
profile
==
ENoProfile
)
{
profile
==
ENoProfile
)
{
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"vec4 texture1D(sampler1D, float);"
"vec4 texture1D(sampler1D, float);"
...
@@ -1216,7 +1216,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1216,7 +1216,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
}
}
if
(
profile
==
EEsProfile
)
{
if
(
profile
==
EEsProfile
)
{
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"vec4 texture2D(samplerExternalOES, vec2 coord);"
// GL_OES_EGL_image_external, caught by keyword check
"vec4 texture2D(samplerExternalOES, vec2 coord);"
// GL_OES_EGL_image_external, caught by keyword check
"vec4 texture2DProj(samplerExternalOES, vec3);"
// GL_OES_EGL_image_external, caught by keyword check
"vec4 texture2DProj(samplerExternalOES, vec3);"
// GL_OES_EGL_image_external, caught by keyword check
...
@@ -1258,7 +1258,8 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1258,7 +1258,8 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"
\n
"
);
"
\n
"
);
}
}
if
(
vulkan
==
0
)
{
if
(
spvVersion
.
vulkan
==
0
)
{
// gl_spirv TODO
//
//
// Atomic counter functions.
// Atomic counter functions.
//
//
...
@@ -1479,7 +1480,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1479,7 +1480,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
//
//
// Geometric Functions.
// Geometric Functions.
//
//
if
(
IncludeLegacy
(
version
,
profile
,
spv
))
if
(
IncludeLegacy
(
version
,
profile
,
spv
Version
))
stageBuiltins
[
EShLangVertex
].
append
(
"vec4 ftransform();"
);
stageBuiltins
[
EShLangVertex
].
append
(
"vec4 ftransform();"
);
//
//
...
@@ -1494,7 +1495,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1494,7 +1495,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
profile
==
ECompatibilityProfile
||
profile
==
ECompatibilityProfile
||
(
profile
==
ECoreProfile
&&
version
<
420
)
||
(
profile
==
ECoreProfile
&&
version
<
420
)
||
profile
==
ENoProfile
)
{
profile
==
ENoProfile
)
{
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
s
->
append
(
s
->
append
(
"vec4 texture2DLod(sampler2D, vec2, float);"
// GL_ARB_shader_texture_lod
"vec4 texture2DLod(sampler2D, vec2, float);"
// GL_ARB_shader_texture_lod
"vec4 texture2DProjLod(sampler2D, vec3, float);"
// GL_ARB_shader_texture_lod
"vec4 texture2DProjLod(sampler2D, vec3, float);"
// GL_ARB_shader_texture_lod
...
@@ -1509,7 +1510,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1509,7 +1510,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
if
(
profile
==
ECompatibilityProfile
||
if
(
profile
==
ECompatibilityProfile
||
(
profile
==
ECoreProfile
&&
version
<
420
)
||
(
profile
==
ECoreProfile
&&
version
<
420
)
||
profile
==
ENoProfile
)
{
profile
==
ENoProfile
)
{
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
s
->
append
(
s
->
append
(
"vec4 texture1DLod(sampler1D, float, float);"
// GL_ARB_shader_texture_lod
"vec4 texture1DLod(sampler1D, float, float);"
// GL_ARB_shader_texture_lod
"vec4 texture1DProjLod(sampler1D, vec2, float);"
// GL_ARB_shader_texture_lod
"vec4 texture1DProjLod(sampler1D, vec2, float);"
// GL_ARB_shader_texture_lod
...
@@ -1601,7 +1602,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1601,7 +1602,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
//
//
// Original-style texture Functions with bias.
// Original-style texture Functions with bias.
//
//
if
(
spv
==
0
&&
(
profile
!=
EEsProfile
||
version
==
100
))
{
if
(
spv
Version
.
spv
==
0
&&
(
profile
!=
EEsProfile
||
version
==
100
))
{
stageBuiltins
[
EShLangFragment
].
append
(
stageBuiltins
[
EShLangFragment
].
append
(
"vec4 texture2D(sampler2D, vec2, float);"
"vec4 texture2D(sampler2D, vec2, float);"
"vec4 texture2DProj(sampler2D, vec3, float);"
"vec4 texture2DProj(sampler2D, vec3, float);"
...
@@ -1612,7 +1613,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1612,7 +1613,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"
\n
"
);
"
\n
"
);
}
}
if
(
spv
==
0
&&
(
profile
!=
EEsProfile
&&
version
>
100
))
{
if
(
spv
Version
.
spv
==
0
&&
(
profile
!=
EEsProfile
&&
version
>
100
))
{
stageBuiltins
[
EShLangFragment
].
append
(
stageBuiltins
[
EShLangFragment
].
append
(
"vec4 texture1D(sampler1D, float, float);"
"vec4 texture1D(sampler1D, float, float);"
"vec4 texture1DProj(sampler1D, vec2, float);"
"vec4 texture1DProj(sampler1D, vec2, float);"
...
@@ -1624,7 +1625,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1624,7 +1625,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"
\n
"
);
"
\n
"
);
}
}
if
(
spv
==
0
&&
profile
==
EEsProfile
)
{
if
(
spv
Version
.
spv
==
0
&&
profile
==
EEsProfile
)
{
stageBuiltins
[
EShLangFragment
].
append
(
stageBuiltins
[
EShLangFragment
].
append
(
"vec4 texture2DLodEXT(sampler2D, vec2, float);"
// GL_EXT_shader_texture_lod
"vec4 texture2DLodEXT(sampler2D, vec2, float);"
// GL_EXT_shader_texture_lod
"vec4 texture2DProjLodEXT(sampler2D, vec3, float);"
// GL_EXT_shader_texture_lod
"vec4 texture2DProjLodEXT(sampler2D, vec3, float);"
// GL_EXT_shader_texture_lod
...
@@ -1722,7 +1723,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1722,7 +1723,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
//
//
// Depth range in window coordinates, p. 33
// Depth range in window coordinates, p. 33
//
//
if
(
vulkan
==
0
)
{
if
(
spvVersion
.
spv
==
0
)
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"struct gl_DepthRangeParameters {"
"struct gl_DepthRangeParameters {"
);
);
...
@@ -1746,7 +1747,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1746,7 +1747,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"
\n
"
);
"
\n
"
);
}
}
if
(
vulkan
==
0
&&
IncludeLegacy
(
version
,
profile
,
spv
))
{
if
(
spvVersion
.
spv
==
0
&&
IncludeLegacy
(
version
,
profile
,
spvVersion
))
{
//
//
// Matrix state. p. 31, 32, 37, 39, 40.
// Matrix state. p. 31, 32, 37, 39, 40.
//
//
...
@@ -1909,7 +1910,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1909,7 +1910,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"attribute vec4 gl_MultiTexCoord7;"
"attribute vec4 gl_MultiTexCoord7;"
"attribute float gl_FogCoord;"
"attribute float gl_FogCoord;"
"
\n
"
);
"
\n
"
);
}
else
if
(
IncludeLegacy
(
version
,
profile
,
spv
))
{
}
else
if
(
IncludeLegacy
(
version
,
profile
,
spv
Version
))
{
stageBuiltins
[
EShLangVertex
].
append
(
stageBuiltins
[
EShLangVertex
].
append
(
"in vec4 gl_Color;"
"in vec4 gl_Color;"
"in vec4 gl_SecondaryColor;"
"in vec4 gl_SecondaryColor;"
...
@@ -1938,7 +1939,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1938,7 +1939,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"varying vec4 gl_TexCoord[];"
"varying vec4 gl_TexCoord[];"
"varying float gl_FogFragCoord;"
"varying float gl_FogFragCoord;"
"
\n
"
);
"
\n
"
);
}
else
if
(
IncludeLegacy
(
version
,
profile
,
spv
))
{
}
else
if
(
IncludeLegacy
(
version
,
profile
,
spv
Version
))
{
stageBuiltins
[
EShLangVertex
].
append
(
stageBuiltins
[
EShLangVertex
].
append
(
" vec4 gl_ClipVertex;"
// needs qualifier fixed later
" vec4 gl_ClipVertex;"
// needs qualifier fixed later
"out vec4 gl_FrontColor;"
"out vec4 gl_FrontColor;"
...
@@ -1966,7 +1967,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1966,7 +1967,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"float gl_PointSize;"
// needs qualifier fixed later
"float gl_PointSize;"
// needs qualifier fixed later
"float gl_ClipDistance[];"
"float gl_ClipDistance[];"
);
);
if
(
IncludeLegacy
(
version
,
profile
,
spv
))
if
(
IncludeLegacy
(
version
,
profile
,
spv
Version
))
stageBuiltins
[
EShLangVertex
].
append
(
stageBuiltins
[
EShLangVertex
].
append
(
"vec4 gl_ClipVertex;"
// needs qualifier fixed later
"vec4 gl_ClipVertex;"
// needs qualifier fixed later
"vec4 gl_FrontColor;"
"vec4 gl_FrontColor;"
...
@@ -1984,15 +1985,18 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -1984,15 +1985,18 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"};"
"};"
"
\n
"
);
"
\n
"
);
}
}
if
(
version
>=
130
&&
vulkan
==
0
)
if
(
version
>=
130
&&
spvVersion
.
vulkan
==
0
)
// gl_spirv TODO
stageBuiltins
[
EShLangVertex
].
append
(
stageBuiltins
[
EShLangVertex
].
append
(
"int gl_VertexID;"
// needs qualifier fixed later
"int gl_VertexID;"
// needs qualifier fixed later
);
);
if
(
version
>=
140
&&
vulkan
==
0
)
if
(
version
>=
140
&&
spvVersion
.
vulkan
==
0
)
// gl_spirv TODO
stageBuiltins
[
EShLangVertex
].
append
(
stageBuiltins
[
EShLangVertex
].
append
(
"int gl_InstanceID;"
// needs qualifier fixed later
"int gl_InstanceID;"
// needs qualifier fixed later
);
);
if
(
vulkan
>
0
&&
version
>=
140
)
if
(
spvVersion
.
vulkan
>=
100
&&
version
>=
140
)
// gl_spirv TODO
stageBuiltins
[
EShLangVertex
].
append
(
stageBuiltins
[
EShLangVertex
].
append
(
"in int gl_VertexIndex;"
"in int gl_VertexIndex;"
"in int gl_InstanceIndex;"
"in int gl_InstanceIndex;"
...
@@ -2012,12 +2016,14 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -2012,12 +2016,14 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"mediump float gl_PointSize;"
// needs qualifier fixed later
"mediump float gl_PointSize;"
// needs qualifier fixed later
);
);
}
else
{
}
else
{
if
(
vulkan
==
0
)
if
(
spvVersion
.
vulkan
==
0
)
// gl_spirv TODO
stageBuiltins
[
EShLangVertex
].
append
(
stageBuiltins
[
EShLangVertex
].
append
(
"in highp int gl_VertexID;"
// needs qualifier fixed later
"in highp int gl_VertexID;"
// needs qualifier fixed later
"in highp int gl_InstanceID;"
// needs qualifier fixed later
"in highp int gl_InstanceID;"
// needs qualifier fixed later
);
);
if
(
vulkan
>
0
)
if
(
spvVersion
.
vulkan
>=
100
)
// gl_spirv TODO
stageBuiltins
[
EShLangVertex
].
append
(
stageBuiltins
[
EShLangVertex
].
append
(
"in highp int gl_VertexIndex;"
"in highp int gl_VertexIndex;"
"in highp int gl_InstanceIndex;"
"in highp int gl_InstanceIndex;"
...
@@ -2270,7 +2276,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -2270,7 +2276,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
stageBuiltins
[
EShLangFragment
].
append
(
stageBuiltins
[
EShLangFragment
].
append
(
"vec2 gl_PointCoord;"
// needs qualifier fixed later
"vec2 gl_PointCoord;"
// needs qualifier fixed later
);
);
if
(
IncludeLegacy
(
version
,
profile
,
spv
)
||
(
!
ForwardCompatibility
&&
version
<
420
))
if
(
IncludeLegacy
(
version
,
profile
,
spv
Version
)
||
(
!
ForwardCompatibility
&&
version
<
420
))
stageBuiltins
[
EShLangFragment
].
append
(
stageBuiltins
[
EShLangFragment
].
append
(
"vec4 gl_FragColor;"
// needs qualifier fixed later
"vec4 gl_FragColor;"
// needs qualifier fixed later
);
);
...
@@ -2287,7 +2293,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -2287,7 +2293,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"in float gl_ClipDistance[];"
"in float gl_ClipDistance[];"
);
);
if
(
IncludeLegacy
(
version
,
profile
,
spv
))
{
if
(
IncludeLegacy
(
version
,
profile
,
spv
Version
))
{
if
(
version
<
150
)
if
(
version
<
150
)
stageBuiltins
[
EShLangFragment
].
append
(
stageBuiltins
[
EShLangFragment
].
append
(
"in float gl_FogFragCoord;"
"in float gl_FogFragCoord;"
...
@@ -2373,7 +2379,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -2373,7 +2379,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
stageBuiltins
[
EShLangFragment
].
append
(
"
\n
"
);
stageBuiltins
[
EShLangFragment
].
append
(
"
\n
"
);
if
(
version
>=
130
)
if
(
version
>=
130
)
add2ndGenerationSamplingImaging
(
version
,
profile
,
spv
,
vulka
n
);
add2ndGenerationSamplingImaging
(
version
,
profile
,
spv
Versio
n
);
// GL_ARB_shader_ballot
// GL_ARB_shader_ballot
if
(
profile
!=
EEsProfile
&&
version
>=
450
)
{
if
(
profile
!=
EEsProfile
&&
version
>=
450
)
{
...
@@ -2398,7 +2404,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
...
@@ -2398,7 +2404,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
// Helper function for initialize(), to add the second set of names for texturing,
// Helper function for initialize(), to add the second set of names for texturing,
// when adding context-independent built-in functions.
// when adding context-independent built-in functions.
//
//
void
TBuiltIns
::
add2ndGenerationSamplingImaging
(
int
version
,
EProfile
profile
,
int
/*spv*/
,
int
vulka
n
)
void
TBuiltIns
::
add2ndGenerationSamplingImaging
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
)
{
{
//
//
// In this function proper, enumerate the types, then calls the next set of functions
// In this function proper, enumerate the types, then calls the next set of functions
...
@@ -2425,7 +2431,7 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, i
...
@@ -2425,7 +2431,7 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, i
for
(
int
arrayed
=
0
;
arrayed
<=
1
;
++
arrayed
)
{
// loop over "bool" arrayed or not
for
(
int
arrayed
=
0
;
arrayed
<=
1
;
++
arrayed
)
{
// loop over "bool" arrayed or not
for
(
int
dim
=
Esd1D
;
dim
<
EsdNumDims
;
++
dim
)
{
// 1D, 2D, ..., buffer
for
(
int
dim
=
Esd1D
;
dim
<
EsdNumDims
;
++
dim
)
{
// 1D, 2D, ..., buffer
if
(
dim
==
EsdSubpass
&&
vulkan
==
0
)
if
(
dim
==
EsdSubpass
&&
spvVersion
.
vulkan
==
0
)
continue
;
continue
;
if
(
dim
==
EsdSubpass
&&
(
image
||
shadow
||
arrayed
))
if
(
dim
==
EsdSubpass
&&
(
image
||
shadow
||
arrayed
))
continue
;
continue
;
...
@@ -3029,7 +3035,7 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int vers
...
@@ -3029,7 +3035,7 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int vers
// add stage-specific entries to the commonBuiltins, and only if that stage
// add stage-specific entries to the commonBuiltins, and only if that stage
// was requested.
// was requested.
//
//
void
TBuiltIns
::
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
)
void
TBuiltIns
::
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
)
{
{
//
//
// Initialize the context-dependent (resource-dependent) built-in strings for parsing.
// Initialize the context-dependent (resource-dependent) built-in strings for parsing.
...
@@ -3192,7 +3198,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
...
@@ -3192,7 +3198,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
snprintf
(
builtInConstant
,
maxSize
,
"const int gl_MaxFragmentUniformComponents = %d;"
,
resources
.
maxFragmentUniformComponents
);
snprintf
(
builtInConstant
,
maxSize
,
"const int gl_MaxFragmentUniformComponents = %d;"
,
resources
.
maxFragmentUniformComponents
);
s
.
append
(
builtInConstant
);
s
.
append
(
builtInConstant
);
if
(
vulkan
==
0
&&
IncludeLegacy
(
version
,
profile
,
spv
))
{
if
(
spvVersion
.
spv
==
0
&&
IncludeLegacy
(
version
,
profile
,
spvVersion
))
{
//
//
// OpenGL'uniform' state. Page numbers are in reference to version
// OpenGL'uniform' state. Page numbers are in reference to version
// 1.4 of the OpenGL specification.
// 1.4 of the OpenGL specification.
...
@@ -3536,7 +3542,7 @@ static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVar
...
@@ -3536,7 +3542,7 @@ static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVar
// 3) Tag extension-related symbols added to their base version with their extensions, so
// 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.
// that if an early version has the extension turned off, there is an error reported on use.
//
//
void
TBuiltIns
::
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
)
void
TBuiltIns
::
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
)
{
{
//
//
// Tag built-in variables and functions with additional qualifier and extension information
// Tag built-in variables and functions with additional qualifier and extension information
...
@@ -3589,7 +3595,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -3589,7 +3595,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
}
}
// Compatibility variables, vertex only
// Compatibility variables, vertex only
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
BuiltInVariable
(
"gl_Color"
,
EbvColor
,
symbolTable
);
BuiltInVariable
(
"gl_Color"
,
EbvColor
,
symbolTable
);
BuiltInVariable
(
"gl_SecondaryColor"
,
EbvSecondaryColor
,
symbolTable
);
BuiltInVariable
(
"gl_SecondaryColor"
,
EbvSecondaryColor
,
symbolTable
);
BuiltInVariable
(
"gl_Normal"
,
EbvNormal
,
symbolTable
);
BuiltInVariable
(
"gl_Normal"
,
EbvNormal
,
symbolTable
);
...
@@ -3606,7 +3612,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -3606,7 +3612,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
}
}
if
(
profile
==
EEsProfile
)
{
if
(
profile
==
EEsProfile
)
{
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
symbolTable
.
setFunctionExtensions
(
"texture2DGradEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DGradEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DProjGradEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DProjGradEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"textureCubeGradEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"textureCubeGradEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
...
@@ -3627,7 +3633,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -3627,7 +3633,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
symbolTable
.
setFunctionExtensions
(
"imageAtomicCompSwap"
,
1
,
&
E_GL_OES_shader_image_atomic
);
symbolTable
.
setFunctionExtensions
(
"imageAtomicCompSwap"
,
1
,
&
E_GL_OES_shader_image_atomic
);
}
}
if
(
vulkan
==
0
)
{
if
(
spvVersion
.
vulkan
==
0
)
{
// gl_spirv TODO
SpecialQualifier
(
"gl_VertexID"
,
EvqVertexId
,
EbvVertexId
,
symbolTable
);
SpecialQualifier
(
"gl_VertexID"
,
EvqVertexId
,
EbvVertexId
,
symbolTable
);
SpecialQualifier
(
"gl_InstanceID"
,
EvqInstanceId
,
EbvInstanceId
,
symbolTable
);
SpecialQualifier
(
"gl_InstanceID"
,
EvqInstanceId
,
EbvInstanceId
,
symbolTable
);
}
}
...
@@ -3762,7 +3769,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -3762,7 +3769,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
// built-in functions
// built-in functions
if
(
profile
==
EEsProfile
)
{
if
(
profile
==
EEsProfile
)
{
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
symbolTable
.
setFunctionExtensions
(
"texture2DLodEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DLodEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DProjLodEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DProjLodEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"textureCubeLodEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"textureCubeLodEXT"
,
1
,
&
E_GL_EXT_shader_texture_lod
);
...
@@ -3783,7 +3790,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -3783,7 +3790,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
symbolTable
.
setFunctionExtensions
(
"interpolateAtOffset"
,
1
,
&
E_GL_OES_shader_multisample_interpolation
);
symbolTable
.
setFunctionExtensions
(
"interpolateAtOffset"
,
1
,
&
E_GL_OES_shader_multisample_interpolation
);
}
}
}
else
if
(
version
<
130
)
{
}
else
if
(
version
<
130
)
{
if
(
spv
==
0
)
{
if
(
spv
Version
.
spv
==
0
)
{
symbolTable
.
setFunctionExtensions
(
"texture1DLod"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture1DLod"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DLod"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DLod"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture3DLod"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture3DLod"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
...
@@ -3799,7 +3806,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -3799,7 +3806,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
}
}
// E_GL_ARB_shader_texture_lod functions usable only with the extension enabled
// E_GL_ARB_shader_texture_lod functions usable only with the extension enabled
if
(
profile
!=
EEsProfile
&&
spv
==
0
)
{
if
(
profile
!=
EEsProfile
&&
spv
Version
.
spv
==
0
)
{
symbolTable
.
setFunctionExtensions
(
"texture1DGradARB"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture1DGradARB"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture1DProjGradARB"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture1DProjGradARB"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DGradARB"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
symbolTable
.
setFunctionExtensions
(
"texture2DGradARB"
,
1
,
&
E_GL_ARB_shader_texture_lod
);
...
@@ -4116,7 +4123,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -4116,7 +4123,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
symbolTable
.
relateToOperator
(
"noise3"
,
EOpNoise
);
symbolTable
.
relateToOperator
(
"noise3"
,
EOpNoise
);
symbolTable
.
relateToOperator
(
"noise4"
,
EOpNoise
);
symbolTable
.
relateToOperator
(
"noise4"
,
EOpNoise
);
if
(
spv
==
0
&&
(
IncludeLegacy
(
version
,
profile
,
spv
)
||
(
profile
==
EEsProfile
&&
version
==
100
)))
{
if
(
spvVersion
.
spv
==
0
&&
(
IncludeLegacy
(
version
,
profile
,
spvVersion
)
||
(
profile
==
EEsProfile
&&
version
==
100
)))
{
symbolTable
.
relateToOperator
(
"ftransform"
,
EOpFtransform
);
symbolTable
.
relateToOperator
(
"ftransform"
,
EOpFtransform
);
symbolTable
.
relateToOperator
(
"texture1D"
,
EOpTexture
);
symbolTable
.
relateToOperator
(
"texture1D"
,
EOpTexture
);
...
@@ -4256,7 +4264,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
...
@@ -4256,7 +4264,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
// 2) Tag extension-related symbols added to their base version with their extensions, so
// 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.
// that if an early version has the extension turned off, there is an error reported on use.
//
//
void
TBuiltIns
::
identifyBuiltIns
(
int
version
,
EProfile
profile
,
int
spv
,
int
/*vulkan*/
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
)
void
TBuiltIns
::
identifyBuiltIns
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersion
,
EShLanguage
language
,
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
)
{
{
if
(
profile
!=
EEsProfile
&&
version
>=
430
&&
version
<
440
)
{
if
(
profile
!=
EEsProfile
&&
version
>=
430
&&
version
<
440
)
{
symbolTable
.
setVariableExtensions
(
"gl_MaxTransformFeedbackBuffers"
,
1
,
&
E_GL_ARB_enhanced_layouts
);
symbolTable
.
setVariableExtensions
(
"gl_MaxTransformFeedbackBuffers"
,
1
,
&
E_GL_ARB_enhanced_layouts
);
...
@@ -4272,7 +4280,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int /*v
...
@@ -4272,7 +4280,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int /*v
switch
(
language
)
{
switch
(
language
)
{
case
EShLangFragment
:
case
EShLangFragment
:
// Set up gl_FragData based on current array size.
// Set up gl_FragData based on current array size.
if
(
version
==
100
||
IncludeLegacy
(
version
,
profile
,
spv
)
||
(
!
ForwardCompatibility
&&
profile
!=
EEsProfile
&&
version
<
420
))
{
if
(
version
==
100
||
IncludeLegacy
(
version
,
profile
,
spv
Version
)
||
(
!
ForwardCompatibility
&&
profile
!=
EEsProfile
&&
version
<
420
))
{
TPrecisionQualifier
pq
=
profile
==
EEsProfile
?
EpqMedium
:
EpqNone
;
TPrecisionQualifier
pq
=
profile
==
EEsProfile
?
EpqMedium
:
EpqNone
;
TType
fragData
(
EbtFloat
,
EvqFragColor
,
pq
,
4
);
TType
fragData
(
EbtFloat
,
EvqFragColor
,
pq
,
4
);
TArraySizes
&
arraySizes
=
*
new
TArraySizes
;
TArraySizes
&
arraySizes
=
*
new
TArraySizes
;
...
...
glslang/MachineIndependent/Initialize.h
View file @
b901ade0
...
@@ -61,14 +61,14 @@ public:
...
@@ -61,14 +61,14 @@ public:
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
TBuiltInParseables
();
TBuiltInParseables
();
virtual
~
TBuiltInParseables
();
virtual
~
TBuiltInParseables
();
virtual
void
initialize
(
int
version
,
EProfile
,
int
spv
,
int
vulka
n
)
=
0
;
virtual
void
initialize
(
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
)
=
0
;
virtual
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
int
spv
,
int
vulka
n
,
EShLanguage
)
=
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
&
getCommonString
()
const
{
return
commonBuiltins
;
}
virtual
const
TString
&
getStageString
(
EShLanguage
language
)
const
{
return
stageBuiltins
[
language
];
}
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
:
protected
:
TString
commonBuiltins
;
TString
commonBuiltins
;
...
@@ -85,15 +85,15 @@ public:
...
@@ -85,15 +85,15 @@ public:
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
TBuiltIns
();
TBuiltIns
();
virtual
~
TBuiltIns
();
virtual
~
TBuiltIns
();
void
initialize
(
int
version
,
EProfile
,
int
spv
,
int
vulka
n
);
void
initialize
(
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
);
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
int
spv
,
int
vulka
n
,
EShLanguage
);
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
:
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
addSubpassSampling
(
TSampler
,
TString
&
typeName
,
int
version
,
EProfile
profile
);
void
addQueryFunctions
(
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
);
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*);
...
@@ -49,9 +49,9 @@ extern int yyparse(glslang::TParseContext*);
namespace
glslang
{
namespace
glslang
{
TParseContext
::
TParseContext
(
TSymbolTable
&
symbolTable
,
TIntermediate
&
interm
,
bool
parsingBuiltins
,
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
)
:
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
),
contextPragma
(
true
,
false
),
loopNestingLevel
(
0
),
structNestingLevel
(
0
),
controlFlowNestingLevel
(
0
),
statementNestingLevel
(
0
),
inMain
(
false
),
postMainReturn
(
false
),
currentFunctionType
(
nullptr
),
blockName
(
nullptr
),
inMain
(
false
),
postMainReturn
(
false
),
currentFunctionType
(
nullptr
),
blockName
(
nullptr
),
limits
(
resources
.
limits
),
parsingBuiltins
(
parsingBuiltins
),
limits
(
resources
.
limits
),
parsingBuiltins
(
parsingBuiltins
),
...
@@ -104,11 +104,11 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
...
@@ -104,11 +104,11 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
globalUniformDefaults
.
clear
();
globalUniformDefaults
.
clear
();
globalUniformDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalUniformDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalUniformDefaults
.
layoutPacking
=
vulkan
>
0
?
ElpStd140
:
ElpShared
;
globalUniformDefaults
.
layoutPacking
=
spvVersion
.
spv
!=
0
?
ElpStd140
:
ElpShared
;
globalBufferDefaults
.
clear
();
globalBufferDefaults
.
clear
();
globalBufferDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalBufferDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalBufferDefaults
.
layoutPacking
=
vulkan
>
0
?
ElpStd430
:
ElpShared
;
globalBufferDefaults
.
layoutPacking
=
spvVersion
.
spv
!=
0
?
ElpStd430
:
ElpShared
;
globalInputDefaults
.
clear
();
globalInputDefaults
.
clear
();
globalOutputDefaults
.
clear
();
globalOutputDefaults
.
clear
();
...
@@ -2565,7 +2565,7 @@ void TParseContext::transparentCheck(const TSourceLoc& loc, const TType& type, c
...
@@ -2565,7 +2565,7 @@ void TParseContext::transparentCheck(const TSourceLoc& loc, const TType& type, c
return
;
return
;
// Vulkan doesn't allow transparent uniforms outside of blocks
// 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
;
return
;
if
(
type
.
containsNonOpaque
())
if
(
type
.
containsNonOpaque
())
vulkanRemoved
(
loc
,
"non-opaque uniforms outside a block"
);
vulkanRemoved
(
loc
,
"non-opaque uniforms outside a block"
);
...
@@ -3890,14 +3890,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
...
@@ -3890,14 +3890,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
return
;
return
;
}
}
if
(
id
==
TQualifier
::
getLayoutPackingString
(
ElpPacked
))
{
if
(
id
==
TQualifier
::
getLayoutPackingString
(
ElpPacked
))
{
if
(
vulkan
>
0
)
if
(
spvVersion
.
spv
!=
0
)
vulkan
Removed
(
loc
,
"packed"
);
spv
Removed
(
loc
,
"packed"
);
publicType
.
qualifier
.
layoutPacking
=
ElpPacked
;
publicType
.
qualifier
.
layoutPacking
=
ElpPacked
;
return
;
return
;
}
}
if
(
id
==
TQualifier
::
getLayoutPackingString
(
ElpShared
))
{
if
(
id
==
TQualifier
::
getLayoutPackingString
(
ElpShared
))
{
if
(
vulkan
>
0
)
if
(
spvVersion
.
spv
!=
0
)
vulkan
Removed
(
loc
,
"shared"
);
spv
Removed
(
loc
,
"shared"
);
publicType
.
qualifier
.
layoutPacking
=
ElpShared
;
publicType
.
qualifier
.
layoutPacking
=
ElpShared
;
return
;
return
;
}
}
...
@@ -4263,7 +4263,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
...
@@ -4263,7 +4263,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
publicType
.
shaderQualifiers
.
localSize
[
2
]
=
value
;
publicType
.
shaderQualifiers
.
localSize
[
2
]
=
value
;
return
;
return
;
}
}
if
(
spv
>
0
)
{
if
(
spv
Version
.
spv
!=
0
)
{
if
(
id
==
"local_size_x_id"
)
{
if
(
id
==
"local_size_x_id"
)
{
publicType
.
shaderQualifiers
.
localSizeSpecId
[
0
]
=
value
;
publicType
.
shaderQualifiers
.
localSizeSpecId
[
0
]
=
value
;
return
;
return
;
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
b901ade0
...
@@ -74,9 +74,9 @@ typedef std::set<int> TIdSetType;
...
@@ -74,9 +74,9 @@ typedef std::set<int> TIdSetType;
class
TParseContextBase
:
public
TParseVersions
{
class
TParseContextBase
:
public
TParseVersions
{
public
:
public
:
TParseContextBase
(
TSymbolTable
&
symbolTable
,
TIntermediate
&
interm
,
int
version
,
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
)
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
),
symbolTable
(
symbolTable
),
tokensBeforeEOF
(
false
),
linkage
(
nullptr
),
scanContext
(
nullptr
),
ppContext
(
nullptr
)
{
}
linkage
(
nullptr
),
scanContext
(
nullptr
),
ppContext
(
nullptr
)
{
}
virtual
~
TParseContextBase
()
{
}
virtual
~
TParseContextBase
()
{
}
...
@@ -151,7 +151,7 @@ protected:
...
@@ -151,7 +151,7 @@ protected:
//
//
class
TParseContext
:
public
TParseContextBase
{
class
TParseContext
:
public
TParseContextBase
{
public
:
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
);
bool
forwardCompatible
=
false
,
EShMessages
messages
=
EShMsgDefault
);
virtual
~
TParseContext
();
virtual
~
TParseContext
();
...
...
glslang/MachineIndependent/Scan.cpp
View file @
b901ade0
...
@@ -1092,7 +1092,7 @@ int TScanContext::tokenizeIdentifier()
...
@@ -1092,7 +1092,7 @@ int TScanContext::tokenizeIdentifier()
case
TEXTURE1DARRAY
:
case
TEXTURE1DARRAY
:
case
SAMPLER
:
case
SAMPLER
:
case
SAMPLERSHADOW
:
case
SAMPLERSHADOW
:
if
(
parseContext
.
spv
>
0
)
if
(
parseContext
.
spv
Version
.
vulkan
>=
10
0
)
return
keyword
;
return
keyword
;
else
else
return
identifierOrType
();
return
identifierOrType
();
...
@@ -1103,7 +1103,7 @@ int TScanContext::tokenizeIdentifier()
...
@@ -1103,7 +1103,7 @@ int TScanContext::tokenizeIdentifier()
case
ISUBPASSINPUTMS
:
case
ISUBPASSINPUTMS
:
case
USUBPASSINPUT
:
case
USUBPASSINPUT
:
case
USUBPASSINPUTMS
:
case
USUBPASSINPUTMS
:
if
(
parseContext
.
spv
>
0
)
if
(
parseContext
.
spv
Version
.
vulkan
>=
10
0
)
return
keyword
;
return
keyword
;
else
else
return
identifierOrType
();
return
identifierOrType
();
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
b901ade0
...
@@ -141,12 +141,12 @@ TPoolAllocator* PerProcessGPA = 0;
...
@@ -141,12 +141,12 @@ TPoolAllocator* PerProcessGPA = 0;
//
//
// Parse and add to the given symbol table the content of the given shader string.
// Parse and add to the given symbol table the content of the given shader string.
//
//
bool
InitializeSymbolTable
(
const
TString
&
builtIns
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
bool
InitializeSymbolTable
(
const
TString
&
builtIns
,
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
TSymbolTable
&
symbolTable
)
TSymbolTable
&
symbolTable
)
{
{
TIntermediate
intermediate
(
language
,
version
,
profile
);
TIntermediate
intermediate
(
language
,
version
,
profile
);
TParseContext
parseContext
(
symbolTable
,
intermediate
,
true
,
version
,
profile
,
spv
,
vulka
n
,
language
,
infoSink
);
TParseContext
parseContext
(
symbolTable
,
intermediate
,
true
,
version
,
profile
,
spv
Versio
n
,
language
,
infoSink
);
TShader
::
ForbidInclude
includer
;
TShader
::
ForbidInclude
includer
;
TPpContext
ppContext
(
parseContext
,
""
,
includer
);
TPpContext
ppContext
(
parseContext
,
""
,
includer
);
TScanContext
scanContext
(
parseContext
);
TScanContext
scanContext
(
parseContext
);
...
@@ -189,12 +189,12 @@ int CommonIndex(EProfile profile, EShLanguage language)
...
@@ -189,12 +189,12 @@ int CommonIndex(EProfile profile, EShLanguage language)
//
//
// To initialize per-stage shared tables, with the common table already complete.
// To initialize per-stage shared tables, with the common table already complete.
//
//
void
InitializeStageSymbolTable
(
TBuiltInParseables
&
builtInParseables
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
void
InitializeStageSymbolTable
(
TBuiltInParseables
&
builtInParseables
,
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
TInfoSink
&
infoSink
,
TSymbolTable
**
commonTable
,
TSymbolTable
**
symbolTables
)
EShLanguage
language
,
TInfoSink
&
infoSink
,
TSymbolTable
**
commonTable
,
TSymbolTable
**
symbolTables
)
{
{
(
*
symbolTables
[
language
]).
adoptLevels
(
*
commonTable
[
CommonIndex
(
profile
,
language
)]);
(
*
symbolTables
[
language
]).
adoptLevels
(
*
commonTable
[
CommonIndex
(
profile
,
language
)]);
InitializeSymbolTable
(
builtInParseables
.
getStageString
(
language
),
version
,
profile
,
spv
,
vulka
n
,
language
,
infoSink
,
*
symbolTables
[
language
]);
InitializeSymbolTable
(
builtInParseables
.
getStageString
(
language
),
version
,
profile
,
spv
Versio
n
,
language
,
infoSink
,
*
symbolTables
[
language
]);
builtInParseables
.
identifyBuiltIns
(
version
,
profile
,
spv
,
vulka
n
,
language
,
*
symbolTables
[
language
]);
builtInParseables
.
identifyBuiltIns
(
version
,
profile
,
spv
Versio
n
,
language
,
*
symbolTables
[
language
]);
if
(
profile
==
EEsProfile
&&
version
>=
300
)
if
(
profile
==
EEsProfile
&&
version
>=
300
)
(
*
symbolTables
[
language
]).
setNoBuiltInRedeclarations
();
(
*
symbolTables
[
language
]).
setNoBuiltInRedeclarations
();
if
(
version
==
110
)
if
(
version
==
110
)
...
@@ -205,51 +205,51 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi
...
@@ -205,51 +205,51 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi
// Initialize the full set of shareable symbol tables;
// Initialize the full set of shareable symbol tables;
// The common (cross-stage) and those shareable per-stage.
// The common (cross-stage) and those shareable per-stage.
//
//
bool
InitializeSymbolTables
(
TInfoSink
&
infoSink
,
TSymbolTable
**
commonTable
,
TSymbolTable
**
symbolTables
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShSource
source
)
bool
InitializeSymbolTables
(
TInfoSink
&
infoSink
,
TSymbolTable
**
commonTable
,
TSymbolTable
**
symbolTables
,
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShSource
source
)
{
{
std
::
unique_ptr
<
TBuiltInParseables
>
builtInParseables
(
CreateBuiltInParseables
(
infoSink
,
source
));
std
::
unique_ptr
<
TBuiltInParseables
>
builtInParseables
(
CreateBuiltInParseables
(
infoSink
,
source
));
builtInParseables
->
initialize
(
version
,
profile
,
spv
,
vulka
n
);
builtInParseables
->
initialize
(
version
,
profile
,
spv
Versio
n
);
// do the common tables
// do the common tables
InitializeSymbolTable
(
builtInParseables
->
getCommonString
(),
version
,
profile
,
spv
,
vulka
n
,
EShLangVertex
,
infoSink
,
*
commonTable
[
EPcGeneral
]);
InitializeSymbolTable
(
builtInParseables
->
getCommonString
(),
version
,
profile
,
spv
Versio
n
,
EShLangVertex
,
infoSink
,
*
commonTable
[
EPcGeneral
]);
if
(
profile
==
EEsProfile
)
if
(
profile
==
EEsProfile
)
InitializeSymbolTable
(
builtInParseables
->
getCommonString
(),
version
,
profile
,
spv
,
vulka
n
,
EShLangFragment
,
infoSink
,
*
commonTable
[
EPcFragment
]);
InitializeSymbolTable
(
builtInParseables
->
getCommonString
(),
version
,
profile
,
spv
Versio
n
,
EShLangFragment
,
infoSink
,
*
commonTable
[
EPcFragment
]);
// do the per-stage tables
// do the per-stage tables
// always have vertex and fragment
// always have vertex and fragment
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
,
vulka
n
,
EShLangVertex
,
infoSink
,
commonTable
,
symbolTables
);
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
Versio
n
,
EShLangVertex
,
infoSink
,
commonTable
,
symbolTables
);
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
,
vulka
n
,
EShLangFragment
,
infoSink
,
commonTable
,
symbolTables
);
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
Versio
n
,
EShLangFragment
,
infoSink
,
commonTable
,
symbolTables
);
// check for tessellation
// check for tessellation
if
((
profile
!=
EEsProfile
&&
version
>=
150
)
||
if
((
profile
!=
EEsProfile
&&
version
>=
150
)
||
(
profile
==
EEsProfile
&&
version
>=
310
))
{
(
profile
==
EEsProfile
&&
version
>=
310
))
{
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
,
vulka
n
,
EShLangTessControl
,
infoSink
,
commonTable
,
symbolTables
);
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
Versio
n
,
EShLangTessControl
,
infoSink
,
commonTable
,
symbolTables
);
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
,
vulka
n
,
EShLangTessEvaluation
,
infoSink
,
commonTable
,
symbolTables
);
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
Versio
n
,
EShLangTessEvaluation
,
infoSink
,
commonTable
,
symbolTables
);
}
}
// check for geometry
// check for geometry
if
((
profile
!=
EEsProfile
&&
version
>=
150
)
||
if
((
profile
!=
EEsProfile
&&
version
>=
150
)
||
(
profile
==
EEsProfile
&&
version
>=
310
))
(
profile
==
EEsProfile
&&
version
>=
310
))
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
,
vulka
n
,
EShLangGeometry
,
infoSink
,
commonTable
,
symbolTables
);
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
Versio
n
,
EShLangGeometry
,
infoSink
,
commonTable
,
symbolTables
);
// check for compute
// check for compute
if
((
profile
!=
EEsProfile
&&
version
>=
420
)
||
if
((
profile
!=
EEsProfile
&&
version
>=
420
)
||
(
profile
==
EEsProfile
&&
version
>=
310
))
(
profile
==
EEsProfile
&&
version
>=
310
))
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
,
vulka
n
,
EShLangCompute
,
infoSink
,
commonTable
,
symbolTables
);
InitializeStageSymbolTable
(
*
builtInParseables
,
version
,
profile
,
spv
Versio
n
,
EShLangCompute
,
infoSink
,
commonTable
,
symbolTables
);
return
true
;
return
true
;
}
}
bool
AddContextSpecificSymbols
(
const
TBuiltInResource
*
resources
,
TInfoSink
&
infoSink
,
TSymbolTable
&
symbolTable
,
int
version
,
bool
AddContextSpecificSymbols
(
const
TBuiltInResource
*
resources
,
TInfoSink
&
infoSink
,
TSymbolTable
&
symbolTable
,
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShLanguage
language
,
EShSource
source
)
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
,
EShSource
source
)
{
{
std
::
unique_ptr
<
TBuiltInParseables
>
builtInParseables
(
CreateBuiltInParseables
(
infoSink
,
source
));
std
::
unique_ptr
<
TBuiltInParseables
>
builtInParseables
(
CreateBuiltInParseables
(
infoSink
,
source
));
builtInParseables
->
initialize
(
*
resources
,
version
,
profile
,
spv
,
vulka
n
,
language
);
builtInParseables
->
initialize
(
*
resources
,
version
,
profile
,
spv
Versio
n
,
language
);
InitializeSymbolTable
(
builtInParseables
->
getCommonString
(),
version
,
profile
,
spv
,
vulka
n
,
language
,
infoSink
,
symbolTable
);
InitializeSymbolTable
(
builtInParseables
->
getCommonString
(),
version
,
profile
,
spv
Versio
n
,
language
,
infoSink
,
symbolTable
);
builtInParseables
->
identifyBuiltIns
(
version
,
profile
,
spv
,
vulka
n
,
language
,
symbolTable
,
*
resources
);
builtInParseables
->
identifyBuiltIns
(
version
,
profile
,
spv
Versio
n
,
language
,
symbolTable
,
*
resources
);
return
true
;
return
true
;
}
}
...
@@ -266,7 +266,7 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
...
@@ -266,7 +266,7 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
// This only gets done the first time any thread needs a particular symbol table
// This only gets done the first time any thread needs a particular symbol table
// (lazy evaluation).
// (lazy evaluation).
//
//
void
SetupBuiltinSymbolTable
(
int
version
,
EProfile
profile
,
int
spv
,
int
vulka
n
,
EShSource
source
)
void
SetupBuiltinSymbolTable
(
int
version
,
EProfile
profile
,
const
SpvVersion
&
spvVersio
n
,
EShSource
source
)
{
{
TInfoSink
infoSink
;
TInfoSink
infoSink
;
...
@@ -296,7 +296,7 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, int spv, int vulkan,
...
@@ -296,7 +296,7 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, int spv, int vulkan,
stageTables
[
stage
]
=
new
TSymbolTable
;
stageTables
[
stage
]
=
new
TSymbolTable
;
// Generate the local symbol tables using the new pool
// Generate the local symbol tables using the new pool
InitializeSymbolTables
(
infoSink
,
commonTable
,
stageTables
,
version
,
profile
,
spv
,
vulka
n
,
source
);
InitializeSymbolTables
(
infoSink
,
commonTable
,
stageTables
,
version
,
profile
,
spv
Versio
n
,
source
);
// Switch to the process-global pool
// Switch to the process-global pool
SetThreadPoolAllocator
(
*
PerProcessGPA
);
SetThreadPoolAllocator
(
*
PerProcessGPA
);
...
@@ -332,7 +332,7 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, int spv, int vulkan,
...
@@ -332,7 +332,7 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, int spv, int vulkan,
// Return true if the shader was correctly specified for version/profile/stage.
// Return true if the shader was correctly specified for version/profile/stage.
bool
DeduceVersionProfile
(
TInfoSink
&
infoSink
,
EShLanguage
stage
,
bool
versionNotFirst
,
int
defaultVersion
,
bool
DeduceVersionProfile
(
TInfoSink
&
infoSink
,
EShLanguage
stage
,
bool
versionNotFirst
,
int
defaultVersion
,
EShSource
source
,
int
&
version
,
EProfile
&
profile
,
int
spv
)
EShSource
source
,
int
&
version
,
EProfile
&
profile
,
const
SpvVersion
&
spvVersion
)
{
{
const
int
FirstProfileVersion
=
150
;
const
int
FirstProfileVersion
=
150
;
bool
correct
=
true
;
bool
correct
=
true
;
...
@@ -430,19 +430,27 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
...
@@ -430,19 +430,27 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
}
}
// Check for SPIR-V compatibility
// Check for SPIR-V compatibility
if
(
spv
>
0
)
{
if
(
spvVersion
.
spv
!=
0
)
{
if
(
profile
==
EEsProfile
)
{
switch
(
profile
)
{
if
(
version
<
310
)
{
case
EEsProfile
:
if
(
spvVersion
.
vulkan
>=
100
&&
version
<
310
)
{
correct
=
false
;
correct
=
false
;
infoSink
.
info
.
message
(
EPrefixError
,
"#version: ES shaders for SPIR-V require version 310 or higher"
);
infoSink
.
info
.
message
(
EPrefixError
,
"#version: ES shaders for
Vulkan
SPIR-V require version 310 or higher"
);
version
=
310
;
version
=
310
;
}
}
}
else
{
// gl_spirv TODO: test versions
if
(
version
<
140
)
{
break
;
case
ECompatibilityProfile
:
infoSink
.
info
.
message
(
EPrefixError
,
"#version: compilation for SPIR-V does not support the compatibility profile"
);
break
;
default:
if
(
spvVersion
.
vulkan
>=
100
&&
version
<
140
)
{
correct
=
false
;
correct
=
false
;
infoSink
.
info
.
message
(
EPrefixError
,
"#version: Desktop shaders for SPIR-V require version 140 or higher"
);
infoSink
.
info
.
message
(
EPrefixError
,
"#version: Desktop shaders for
Vulkan
SPIR-V require version 140 or higher"
);
version
=
140
;
version
=
140
;
}
}
// gl_spirv TODO: test versions
break
;
}
}
}
}
...
@@ -581,9 +589,11 @@ bool ProcessDeferred(
...
@@ -581,9 +589,11 @@ bool ProcessDeferred(
version
=
defaultVersion
;
version
=
defaultVersion
;
profile
=
defaultProfile
;
profile
=
defaultProfile
;
}
}
int
spv
=
(
messages
&
EShMsgSpvRules
)
?
100
:
0
;
// TODO find path to get real version number here, for now non-0 is what matters
SpvVersion
spvVersion
;
if
(
messages
&
EShMsgSpvRules
)
spvVersion
.
spv
=
0x00010000
;
// TODO: eventually have this come from the outside
EShSource
source
=
(
messages
&
EShMsgReadHlsl
)
?
EShSourceHlsl
:
EShSourceGlsl
;
EShSource
source
=
(
messages
&
EShMsgReadHlsl
)
?
EShSourceHlsl
:
EShSourceGlsl
;
bool
goodVersion
=
DeduceVersionProfile
(
compiler
->
infoSink
,
compiler
->
getLanguage
(),
versionNotFirst
,
defaultVersion
,
source
,
version
,
profile
,
spv
);
bool
goodVersion
=
DeduceVersionProfile
(
compiler
->
infoSink
,
compiler
->
getLanguage
(),
versionNotFirst
,
defaultVersion
,
source
,
version
,
profile
,
spv
Version
);
bool
versionWillBeError
=
(
versionNotFound
||
(
profile
==
EEsProfile
&&
version
>=
300
&&
versionNotFirst
));
bool
versionWillBeError
=
(
versionNotFound
||
(
profile
==
EEsProfile
&&
version
>=
300
&&
versionNotFirst
));
bool
warnVersionNotFirst
=
false
;
bool
warnVersionNotFirst
=
false
;
if
(
!
versionWillBeError
&&
versionNotFirstToken
)
{
if
(
!
versionWillBeError
&&
versionNotFirstToken
)
{
...
@@ -593,14 +603,17 @@ bool ProcessDeferred(
...
@@ -593,14 +603,17 @@ bool ProcessDeferred(
versionWillBeError
=
true
;
versionWillBeError
=
true
;
}
}
int
vulkan
=
(
messages
&
EShMsgVulkanRules
)
?
100
:
0
;
// TODO find path to get real version number here, for now non-0 is what matters
if
(
messages
&
EShMsgVulkanRules
)
spvVersion
.
vulkan
=
100
;
// TODO: eventually have this come from the outside
else
if
(
spvVersion
.
spv
!=
0
)
spvVersion
.
openGl
=
100
;
intermediate
.
setSource
(
source
);
intermediate
.
setSource
(
source
);
intermediate
.
setVersion
(
version
);
intermediate
.
setVersion
(
version
);
intermediate
.
setProfile
(
profile
);
intermediate
.
setProfile
(
profile
);
intermediate
.
setSpv
(
spv
);
intermediate
.
setSpv
(
spv
Version
);
if
(
vulkan
)
if
(
spvVersion
.
vulkan
>=
100
)
intermediate
.
setOriginUpperLeft
();
intermediate
.
setOriginUpperLeft
();
SetupBuiltinSymbolTable
(
version
,
profile
,
spv
,
vulka
n
,
source
);
SetupBuiltinSymbolTable
(
version
,
profile
,
spv
Versio
n
,
source
);
TSymbolTable
*
cachedTable
=
SharedSymbolTables
[
MapVersionToIndex
(
version
)]
TSymbolTable
*
cachedTable
=
SharedSymbolTables
[
MapVersionToIndex
(
version
)]
[
MapProfileToIndex
(
profile
)]
[
MapProfileToIndex
(
profile
)]
...
@@ -614,7 +627,7 @@ bool ProcessDeferred(
...
@@ -614,7 +627,7 @@ bool ProcessDeferred(
// Add built-in symbols that are potentially context dependent;
// Add built-in symbols that are potentially context dependent;
// they get popped again further down.
// they get popped again further down.
AddContextSpecificSymbols
(
resources
,
compiler
->
infoSink
,
symbolTable
,
version
,
profile
,
spv
,
vulka
n
,
AddContextSpecificSymbols
(
resources
,
compiler
->
infoSink
,
symbolTable
,
version
,
profile
,
spv
Versio
n
,
compiler
->
getLanguage
(),
source
);
compiler
->
getLanguage
(),
source
);
//
//
...
@@ -623,12 +636,12 @@ bool ProcessDeferred(
...
@@ -623,12 +636,12 @@ bool ProcessDeferred(
TParseContextBase
*
parseContext
;
TParseContextBase
*
parseContext
;
if
(
source
==
EShSourceHlsl
)
{
if
(
source
==
EShSourceHlsl
)
{
parseContext
=
new
HlslParseContext
(
symbolTable
,
intermediate
,
false
,
version
,
profile
,
spv
,
vulka
n
,
parseContext
=
new
HlslParseContext
(
symbolTable
,
intermediate
,
false
,
version
,
profile
,
spv
Versio
n
,
compiler
->
getLanguage
(),
compiler
->
infoSink
,
forwardCompatible
,
messages
);
compiler
->
getLanguage
(),
compiler
->
infoSink
,
forwardCompatible
,
messages
);
}
}
else
{
else
{
intermediate
.
setEntryPoint
(
"main"
);
intermediate
.
setEntryPoint
(
"main"
);
parseContext
=
new
TParseContext
(
symbolTable
,
intermediate
,
false
,
version
,
profile
,
spv
,
vulka
n
,
parseContext
=
new
TParseContext
(
symbolTable
,
intermediate
,
false
,
version
,
profile
,
spv
Versio
n
,
compiler
->
getLanguage
(),
compiler
->
infoSink
,
forwardCompatible
,
messages
);
compiler
->
getLanguage
(),
compiler
->
infoSink
,
forwardCompatible
,
messages
);
}
}
TPpContext
ppContext
(
*
parseContext
,
names
[
numPre
]
?
names
[
numPre
]
:
""
,
includer
);
TPpContext
ppContext
(
*
parseContext
,
names
[
numPre
]
?
names
[
numPre
]
:
""
,
includer
);
...
...
glslang/MachineIndependent/Versions.cpp
View file @
b901ade0
...
@@ -293,8 +293,15 @@ void TParseVersions::getPreamble(std::string& preamble)
...
@@ -293,8 +293,15 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_GOOGLE_include_directive 1
\n
"
"#define GL_GOOGLE_include_directive 1
\n
"
;
;
if
(
vulkan
>
0
)
// #define VULKAN XXXX
preamble
+=
"#define VULKAN 100
\n
"
;
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
...
@@ -575,9 +582,6 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
updateExtensionBehavior
(
line
,
"GL_OES_shader_io_blocks"
,
behaviorString
);
updateExtensionBehavior
(
line
,
"GL_OES_shader_io_blocks"
,
behaviorString
);
else
if
(
strcmp
(
extension
,
"GL_GOOGLE_include_directive"
)
==
0
)
else
if
(
strcmp
(
extension
,
"GL_GOOGLE_include_directive"
)
==
0
)
updateExtensionBehavior
(
line
,
"GL_GOOGLE_cpp_style_line_directive"
,
behaviorString
);
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
)
void
TParseVersions
::
updateExtensionBehavior
(
const
char
*
extension
,
TExtensionBehavior
behavior
)
...
@@ -649,28 +653,28 @@ void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool buil
...
@@ -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.
// Call for any operation removed because SPIR-V is in use.
void
TParseVersions
::
spvRemoved
(
const
TSourceLoc
&
loc
,
const
char
*
op
)
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
,
""
);
error
(
loc
,
"not allowed when generating SPIR-V"
,
op
,
""
);
}
}
// Call for any operation removed because Vulkan SPIR-V is being generated.
// Call for any operation removed because Vulkan SPIR-V is being generated.
void
TParseVersions
::
vulkanRemoved
(
const
TSourceLoc
&
loc
,
const
char
*
op
)
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
,
""
);
error
(
loc
,
"not allowed when using GLSL for Vulkan"
,
op
,
""
);
}
}
// Call for any operation that requires Vulkan.
// Call for any operation that requires Vulkan.
void
TParseVersions
::
requireVulkan
(
const
TSourceLoc
&
loc
,
const
char
*
op
)
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
,
""
);
error
(
loc
,
"only allowed when using GLSL for Vulkan"
,
op
,
""
);
}
}
// Call for any operation that requires SPIR-V.
// Call for any operation that requires SPIR-V.
void
TParseVersions
::
requireSpv
(
const
TSourceLoc
&
loc
,
const
char
*
op
)
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
,
""
);
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)
...
@@ -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"
// The behaviors from the GLSL "#extension extension_name : behavior"
//
//
typedef
enum
{
typedef
enum
{
...
...
glslang/MachineIndependent/localintermediate.h
View file @
b901ade0
...
@@ -125,7 +125,7 @@ class TVariable;
...
@@ -125,7 +125,7 @@ class TVariable;
class
TIntermediate
{
class
TIntermediate
{
public
:
public
:
explicit
TIntermediate
(
EShLanguage
l
,
int
v
=
0
,
EProfile
p
=
ENoProfile
)
:
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
),
numMains
(
0
),
numErrors
(
0
),
numPushConstants
(
0
),
recursive
(
false
),
invocations
(
TQualifier
::
layoutNotSet
),
vertices
(
TQualifier
::
layoutNotSet
),
inputPrimitive
(
ElgNone
),
outputPrimitive
(
ElgNone
),
invocations
(
TQualifier
::
layoutNotSet
),
vertices
(
TQualifier
::
layoutNotSet
),
inputPrimitive
(
ElgNone
),
outputPrimitive
(
ElgNone
),
pixelCenterInteger
(
false
),
originUpperLeft
(
false
),
pixelCenterInteger
(
false
),
originUpperLeft
(
false
),
...
@@ -154,8 +154,8 @@ public:
...
@@ -154,8 +154,8 @@ public:
int
getVersion
()
const
{
return
version
;
}
int
getVersion
()
const
{
return
version
;
}
void
setProfile
(
EProfile
p
)
{
profile
=
p
;
}
void
setProfile
(
EProfile
p
)
{
profile
=
p
;
}
EProfile
getProfile
()
const
{
return
profile
;
}
EProfile
getProfile
()
const
{
return
profile
;
}
void
setSpv
(
int
s
)
{
spv
=
s
;
}
void
setSpv
(
const
SpvVersion
&
s
)
{
spvVersion
=
s
;
}
int
getSpv
()
const
{
return
spv
;
}
const
SpvVersion
&
getSpv
()
const
{
return
spvVersion
;
}
EShLanguage
getStage
()
const
{
return
language
;
}
EShLanguage
getStage
()
const
{
return
language
;
}
void
addRequestedExtension
(
const
char
*
extension
)
{
requestedExtensions
.
insert
(
extension
);
}
void
addRequestedExtension
(
const
char
*
extension
)
{
requestedExtensions
.
insert
(
extension
);
}
const
std
::
set
<
std
::
string
>&
getRequestedExtensions
()
const
{
return
requestedExtensions
;
}
const
std
::
set
<
std
::
string
>&
getRequestedExtensions
()
const
{
return
requestedExtensions
;
}
...
@@ -352,7 +352,7 @@ protected:
...
@@ -352,7 +352,7 @@ protected:
std
::
string
entryPoint
;
std
::
string
entryPoint
;
EProfile
profile
;
EProfile
profile
;
int
version
;
int
version
;
int
spv
;
SpvVersion
spvVersion
;
TIntermNode
*
treeRoot
;
TIntermNode
*
treeRoot
;
std
::
set
<
std
::
string
>
requestedExtensions
;
// cumulation of all enabled or required extensions; not connected to what subset of the shader used them
std
::
set
<
std
::
string
>
requestedExtensions
;
// cumulation of all enabled or required extensions; not connected to what subset of the shader used them
TBuiltInResource
resources
;
TBuiltInResource
resources
;
...
...
glslang/MachineIndependent/parseVersions.h
View file @
b901ade0
...
@@ -54,10 +54,10 @@ namespace glslang {
...
@@ -54,10 +54,10 @@ namespace glslang {
class
TParseVersions
{
class
TParseVersions
{
public
:
public
:
TParseVersions
(
TIntermediate
&
interm
,
int
version
,
EProfile
profile
,
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
)
bool
forwardCompatible
,
EShMessages
messages
)
:
infoSink
(
infoSink
),
version
(
version
),
profile
(
profile
),
language
(
language
),
:
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
)
{
}
intermediate
(
interm
),
messages
(
messages
),
numErrors
(
0
),
currentScanner
(
0
)
{
}
virtual
~
TParseVersions
()
{
}
virtual
~
TParseVersions
()
{
}
virtual
void
initializeExtensionBehavior
();
virtual
void
initializeExtensionBehavior
();
...
@@ -114,8 +114,7 @@ public:
...
@@ -114,8 +114,7 @@ public:
int
version
;
// version, updated by #version in the shader
int
version
;
// version, updated by #version in the shader
EProfile
profile
;
// the declared profile in the shader (core by default)
EProfile
profile
;
// the declared profile in the shader (core by default)
EShLanguage
language
;
// really the stage
EShLanguage
language
;
// really the stage
int
spv
;
// SPIR-V version; 0 means not SPIR-V
SpvVersion
spvVersion
;
int
vulkan
;
// Vulkan version; 0 means not vulkan
bool
forwardCompatible
;
// true if errors are to be given for use of deprecated features
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
TIntermediate
&
intermediate
;
// helper for making and hooking up pieces of the parse tree
...
...
hlsl/hlslParseHelper.cpp
View file @
b901ade0
...
@@ -49,9 +49,9 @@
...
@@ -49,9 +49,9 @@
namespace
glslang
{
namespace
glslang
{
HlslParseContext
::
HlslParseContext
(
TSymbolTable
&
symbolTable
,
TIntermediate
&
interm
,
bool
/*parsingBuiltins*/
,
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
)
:
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
),
contextPragma
(
true
,
false
),
loopNestingLevel
(
0
),
structNestingLevel
(
0
),
controlFlowNestingLevel
(
0
),
postMainReturn
(
false
),
postMainReturn
(
false
),
limits
(
resources
.
limits
),
limits
(
resources
.
limits
),
...
@@ -62,11 +62,11 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
...
@@ -62,11 +62,11 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
globalUniformDefaults
.
clear
();
globalUniformDefaults
.
clear
();
globalUniformDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalUniformDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalUniformDefaults
.
layoutPacking
=
vulkan
>
0
?
ElpStd140
:
ElpShared
;
globalUniformDefaults
.
layoutPacking
=
ElpStd140
;
globalBufferDefaults
.
clear
();
globalBufferDefaults
.
clear
();
globalBufferDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalBufferDefaults
.
layoutMatrix
=
ElmColumnMajor
;
globalBufferDefaults
.
layoutPacking
=
vulkan
>
0
?
ElpStd430
:
ElpShared
;
globalBufferDefaults
.
layoutPacking
=
ElpStd430
;
globalInputDefaults
.
clear
();
globalInputDefaults
.
clear
();
globalOutputDefaults
.
clear
();
globalOutputDefaults
.
clear
();
...
@@ -2416,18 +2416,6 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& pu
...
@@ -2416,18 +2416,6 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& pu
publicType
.
qualifier
.
layoutMatrix
=
ElmRowMajor
;
publicType
.
qualifier
.
layoutMatrix
=
ElmRowMajor
;
return
;
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"
)
{
if
(
id
==
"push_constant"
)
{
requireVulkan
(
loc
,
"push_constant"
);
requireVulkan
(
loc
,
"push_constant"
);
publicType
.
qualifier
.
layoutPushConstant
=
true
;
publicType
.
qualifier
.
layoutPushConstant
=
true
;
...
@@ -2714,7 +2702,7 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& pu
...
@@ -2714,7 +2702,7 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& pu
publicType
.
shaderQualifiers
.
localSize
[
2
]
=
value
;
publicType
.
shaderQualifiers
.
localSize
[
2
]
=
value
;
return
;
return
;
}
}
if
(
spv
>
0
)
{
if
(
spv
Version
.
spv
!=
0
)
{
if
(
id
==
"local_size_x_id"
)
{
if
(
id
==
"local_size_x_id"
)
{
publicType
.
shaderQualifiers
.
localSizeSpecId
[
0
]
=
value
;
publicType
.
shaderQualifiers
.
localSizeSpecId
[
0
]
=
value
;
return
;
return
;
...
...
hlsl/hlslParseHelper.h
View file @
b901ade0
...
@@ -44,7 +44,7 @@ namespace glslang {
...
@@ -44,7 +44,7 @@ namespace glslang {
class
HlslParseContext
:
public
TParseContextBase
{
class
HlslParseContext
:
public
TParseContextBase
{
public
:
public
:
HlslParseContext
(
TSymbolTable
&
,
TIntermediate
&
,
bool
parsingBuiltins
,
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
);
bool
forwardCompatible
=
false
,
EShMessages
messages
=
EShMsgDefault
);
virtual
~
HlslParseContext
();
virtual
~
HlslParseContext
();
void
setLimits
(
const
TBuiltInResource
&
);
void
setLimits
(
const
TBuiltInResource
&
);
...
...
hlsl/hlslParseables.cpp
View file @
b901ade0
...
@@ -218,7 +218,7 @@ TBuiltInParseablesHlsl::TBuiltInParseablesHlsl()
...
@@ -218,7 +218,7 @@ TBuiltInParseablesHlsl::TBuiltInParseablesHlsl()
// Most built-ins variables can be added as simple text strings. Some need to
// Most built-ins variables can be added as simple text strings. Some need to
// be added programmatically, which is done later in IdentifyBuiltIns() below.
// 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
);
static
const
EShLanguageMask
EShLangAll
=
EShLanguageMask
(
EShLangCount
-
1
);
...
@@ -229,8 +229,8 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, int spv,
...
@@ -229,8 +229,8 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, int spv,
// typekey can be:
// typekey can be:
// D = double, F = float, U = uint, I = int, B = bool, S = sampler, - = void
// 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.
// 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 output par
a
meter
// '<' as first letter of order creates an input par
e
meter
// '<' as first letter of order creates an input par
a
meter
// '^' as first letter of order takes transpose dimensions
// '^' as first letter of order takes transpose dimensions
static
const
struct
{
static
const
struct
{
...
@@ -498,8 +498,8 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, int spv,
...
@@ -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
// add stage-specific entries to the commonBuiltins, and only if that stage
// was requested.
// was requested.
//
//
void
TBuiltInParseablesHlsl
::
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
profile
,
int
spv
,
void
TBuiltInParseablesHlsl
::
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
profile
,
int
vulka
n
,
EShLanguage
language
)
const
SpvVersion
&
spvVersio
n
,
EShLanguage
language
)
{
{
}
}
...
@@ -512,7 +512,7 @@ void TBuiltInParseablesHlsl::initialize(const TBuiltInResource &resources, int v
...
@@ -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
// 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.
// 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
)
TSymbolTable
&
symbolTable
)
{
{
// symbolTable.relateToOperator("abort", EOpAbort);
// symbolTable.relateToOperator("abort", EOpAbort);
...
@@ -660,7 +660,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, int
...
@@ -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
// 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.
// 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
)
TSymbolTable
&
symbolTable
,
const
TBuiltInResource
&
resources
)
{
{
}
}
...
...
hlsl/hlslParseables.h
View file @
b901ade0
...
@@ -48,12 +48,12 @@ class TBuiltInParseablesHlsl : public TBuiltInParseables {
...
@@ -48,12 +48,12 @@ class TBuiltInParseablesHlsl : public TBuiltInParseables {
public
:
public
:
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
POOL_ALLOCATOR_NEW_DELETE
(
GetThreadPoolAllocator
())
TBuiltInParseablesHlsl
();
TBuiltInParseablesHlsl
();
void
initialize
(
int
version
,
EProfile
,
int
spv
,
int
vulka
n
);
void
initialize
(
int
version
,
EProfile
,
const
SpvVersion
&
spvVersio
n
);
void
initialize
(
const
TBuiltInResource
&
resources
,
int
version
,
EProfile
,
int
spv
,
int
vulka
n
,
EShLanguage
);
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
}
// 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