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
2076acf6
Commit
2076acf6
authored
Mar 02, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Versioning: Move to symbolic version numbers for SPV 1.0 vs 1.3 and Vulkan 1.0 vs. 1.1.
parent
96e77c11
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
36 deletions
+44
-36
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+4
-4
StandAlone.cpp
StandAlone/StandAlone.cpp
+9
-9
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+1
-1
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+2
-2
ShaderLang.h
glslang/Public/ShaderLang.h
+6
-0
AST.FromFile.cpp
gtests/AST.FromFile.cpp
+1
-1
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+6
-6
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+9
-9
TestFixture.h
gtests/TestFixture.h
+6
-4
No files found.
SPIRV/GlslangToSpv.cpp
View file @
2076acf6
...
...
@@ -196,7 +196,7 @@ protected:
#endif
void
addPre13Extension
(
const
char
*
ext
)
{
if
(
builder
.
getSpvVersion
()
<
0x00010300
)
if
(
builder
.
getSpvVersion
()
<
glslang
::
Spv_1_3
)
builder
.
addExtension
(
ext
);
}
...
...
@@ -2463,7 +2463,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case
glslang
:
:
EbtFloat16
:
builder
.
addCapability
(
spv
::
CapabilityFloat16
);
#if AMD_EXTENSIONS
if
(
builder
.
getSpvVersion
()
<
0x00010300
)
if
(
builder
.
getSpvVersion
()
<
glslang
::
Spv_1_3
)
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_half_float
);
#endif
spvType
=
builder
.
makeFloatType
(
16
);
...
...
@@ -2487,7 +2487,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case
glslang
:
:
EbtInt16
:
builder
.
addCapability
(
spv
::
CapabilityInt16
);
#ifdef AMD_EXTENSIONS
if
(
builder
.
getSpvVersion
()
<
0x00010300
)
if
(
builder
.
getSpvVersion
()
<
glslang
::
Spv_1_3
)
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_int16
);
#endif
spvType
=
builder
.
makeIntType
(
16
);
...
...
@@ -2495,7 +2495,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case
glslang
:
:
EbtUint16
:
builder
.
addCapability
(
spv
::
CapabilityInt16
);
#ifdef AMD_EXTENSIONS
if
(
builder
.
getSpvVersion
()
<
0x00010300
)
if
(
builder
.
getSpvVersion
()
<
glslang
::
Spv_1_3
)
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_int16
);
#endif
spvType
=
builder
.
makeUintType
(
16
);
...
...
StandAlone/StandAlone.cpp
View file @
2076acf6
...
...
@@ -156,11 +156,11 @@ const char* sourceEntryPointName = nullptr;
const
char
*
shaderStageName
=
nullptr
;
const
char
*
variableName
=
nullptr
;
std
::
vector
<
std
::
string
>
IncludeDirectoryList
;
int
ClientInputSemanticsVersion
=
100
;
// maps to, say, #define VULKAN 100
int
VulkanClientVersion
=
100
;
// would map to, say, Vulkan 1.0
int
OpenGLClientVersion
=
450
;
// doesn't influence anything yet, but maps to OpenGL 4.50
unsigned
int
TargetVersion
=
0x0001000
0
;
// maps to, say, SPIR-V 1.0
std
::
vector
<
std
::
string
>
Processes
;
// what should be recorded by OpModuleProcessed, or equivalent
int
ClientInputSemanticsVersion
=
100
;
// maps to, say, #define VULKAN 100
int
VulkanClientVersion
=
glslang
::
Vulkan_1_0
;
// would map to, say, Vulkan 1.0
int
OpenGLClientVersion
=
450
;
// doesn't influence anything yet, but maps to OpenGL 4.50
unsigned
int
TargetVersion
=
glslang
::
Spv_1_
0
;
// maps to, say, SPIR-V 1.0
std
::
vector
<
std
::
string
>
Processes
;
// what should be recorded by OpModuleProcessed, or equivalent
// Per descriptor-set binding base data
typedef
std
::
map
<
unsigned
int
,
unsigned
int
>
TPerSetBaseBinding
;
...
...
@@ -504,11 +504,11 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
if
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"vulkan1.0"
)
==
0
)
{
setVulkanSpv
();
VulkanClientVersion
=
10
0
;
VulkanClientVersion
=
glslang
::
Vulkan_1_
0
;
}
else
if
(
strcmp
(
argv
[
1
],
"vulkan1.1"
)
==
0
)
{
setVulkanSpv
();
TargetVersion
=
0x00010300
;
VulkanClientVersion
=
110
;
TargetVersion
=
glslang
::
Spv_1_3
;
VulkanClientVersion
=
glslang
::
Vulkan_1_1
;
}
else
if
(
strcmp
(
argv
[
1
],
"opengl"
)
==
0
)
{
setOpenGlSpv
();
OpenGLClientVersion
=
450
;
...
...
@@ -517,7 +517,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
}
bumpArg
();
}
else
if
(
lowerword
==
"variable-name"
||
// synonyms
lowerword
==
"vn"
)
{
lowerword
==
"vn"
)
{
Options
|=
EOptionOutputHexadecimal
;
if
(
argc
<=
1
)
Error
(
"no <C-variable-name> provided for --variable-name"
);
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
2076acf6
...
...
@@ -1640,7 +1640,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
if
(
callNode
.
getOp
()
>
EOpSubgroupGuardStart
&&
callNode
.
getOp
()
<
EOpSubgroupGuardStop
)
{
// these require SPIR-V 1.3
if
(
spvVersion
.
spv
>
0
&&
spvVersion
.
spv
<
0x00010300
)
if
(
spvVersion
.
spv
>
0
&&
spvVersion
.
spv
<
Spv_1_3
)
error
(
loc
,
"requires SPIR-V 1.3"
,
"subgroup op"
,
""
);
}
}
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
2076acf6
...
...
@@ -619,9 +619,9 @@ void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages
{
// Set up environmental defaults, first ignoring 'environment'.
if
(
messages
&
EShMsgSpvRules
)
spvVersion
.
spv
=
0x0001000
0
;
spvVersion
.
spv
=
Spv_1_
0
;
if
(
messages
&
EShMsgVulkanRules
)
{
spvVersion
.
vulkan
=
10
0
;
spvVersion
.
vulkan
=
Vulkan_1_
0
;
spvVersion
.
vulkanGlsl
=
100
;
}
else
if
(
spvVersion
.
spv
!=
0
)
spvVersion
.
openGl
=
100
;
...
...
glslang/Public/ShaderLang.h
View file @
2076acf6
...
...
@@ -135,11 +135,17 @@ struct TClient {
int
version
;
// version of client itself (not the client's input dialect)
};
static
const
int
Vulkan_1_0
=
(
1
<<
22
);
static
const
int
Vulkan_1_1
=
(
1
<<
22
)
|
(
1
<<
12
);
struct
TTarget
{
EShTargetLanguage
language
;
unsigned
int
version
;
// the version to target, if SPIR-V, defined by "word 1" of the SPIR-V binary header
};
static
const
int
Spv_1_0
=
(
1
<<
16
);
static
const
int
Spv_1_3
=
(
1
<<
16
)
|
(
3
<<
8
);
// All source/client/target versions and settings.
// Can override previous methods of setting, when items are set here.
// Expected to grow, as more are added, rather than growing parameter lists.
...
...
gtests/AST.FromFile.cpp
View file @
2076acf6
...
...
@@ -44,7 +44,7 @@ using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>;
TEST_P
(
CompileToAstTest
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
OpenGL
,
10
0
,
Source
::
GLSL
,
Semantics
::
OpenGL
,
glslang
::
Vulkan_1_
0
,
Target
::
AST
);
}
...
...
gtests/Hlsl.FromFile.cpp
View file @
2076acf6
...
...
@@ -58,7 +58,7 @@ std::string FileNameAsCustomTestSuffix(
}
using
HlslCompileTest
=
GlslangTest
<::
testing
::
TestWithParam
<
FileNameEntryPointPair
>>
;
using
HlslVulkan1
10
CompileTest
=
GlslangTest
<::
testing
::
TestWithParam
<
FileNameEntryPointPair
>>
;
using
HlslVulkan1
_1
CompileTest
=
GlslangTest
<::
testing
::
TestWithParam
<
FileNameEntryPointPair
>>
;
using
HlslCompileAndFlattenTest
=
GlslangTest
<::
testing
::
TestWithParam
<
FileNameEntryPointPair
>>
;
using
HlslLegalizeTest
=
GlslangTest
<::
testing
::
TestWithParam
<
FileNameEntryPointPair
>>
;
...
...
@@ -67,14 +67,14 @@ using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPoint
TEST_P
(
HlslCompileTest
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
10
0
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_
0
,
Target
::
BothASTAndSpv
,
true
,
GetParam
().
entryPoint
);
}
TEST_P
(
HlslVulkan1
10
CompileTest
,
FromFile
)
TEST_P
(
HlslVulkan1
_1
CompileTest
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
110
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_1
,
Target
::
BothASTAndSpv
,
true
,
GetParam
().
entryPoint
);
}
...
...
@@ -90,7 +90,7 @@ TEST_P(HlslCompileAndFlattenTest, FromFile)
TEST_P
(
HlslLegalizeTest
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
10
0
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_
0
,
Target
::
Spv
,
true
,
GetParam
().
entryPoint
,
"/baseLegalResults/"
,
false
);
}
...
...
@@ -385,7 +385,7 @@ INSTANTIATE_TEST_CASE_P(
// clang-format off
INSTANTIATE_TEST_CASE_P
(
ToSpirv
,
HlslVulkan1
10
CompileTest
,
ToSpirv
,
HlslVulkan1
_1
CompileTest
,
::
testing
::
ValuesIn
(
std
::
vector
<
FileNameEntryPointPair
>
{
{
"hlsl.wavebroadcast.comp"
,
"CSMain"
},
{
"hlsl.waveprefix.comp"
,
"CSMain"
},
...
...
gtests/Spv.FromFile.cpp
View file @
2076acf6
...
...
@@ -63,7 +63,7 @@ std::string FileNameAsCustomTestSuffixIoMap(
}
using
CompileVulkanToSpirvTest
=
GlslangTest
<::
testing
::
TestWithParam
<
std
::
string
>>
;
using
CompileVulkan1
10
ToSpirvTest
=
GlslangTest
<::
testing
::
TestWithParam
<
std
::
string
>>
;
using
CompileVulkan1
_1
ToSpirvTest
=
GlslangTest
<::
testing
::
TestWithParam
<
std
::
string
>>
;
using
CompileOpenGLToSpirvTest
=
GlslangTest
<::
testing
::
TestWithParam
<
std
::
string
>>
;
using
VulkanSemantics
=
GlslangTest
<::
testing
::
TestWithParam
<
std
::
string
>>
;
using
OpenGLSemantics
=
GlslangTest
<::
testing
::
TestWithParam
<
std
::
string
>>
;
...
...
@@ -83,14 +83,14 @@ using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::t
TEST_P
(
CompileVulkanToSpirvTest
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
10
0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_
0
,
Target
::
Spv
);
}
TEST_P
(
CompileVulkan1
10
ToSpirvTest
,
FromFile
)
TEST_P
(
CompileVulkan1
_1
ToSpirvTest
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
110
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_1
,
Target
::
Spv
);
}
...
...
@@ -108,7 +108,7 @@ TEST_P(CompileOpenGLToSpirvTest, FromFile)
TEST_P
(
VulkanSemantics
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
10
0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_
0
,
Target
::
Spv
,
false
);
}
...
...
@@ -125,7 +125,7 @@ TEST_P(OpenGLSemantics, FromFile)
TEST_P
(
VulkanAstSemantics
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
10
0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_
0
,
Target
::
AST
);
}
...
...
@@ -165,7 +165,7 @@ TEST_P(GlslIoMap, FromFile)
TEST_P
(
CompileVulkanToSpirvTestAMD
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
10
0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_
0
,
Target
::
Spv
);
}
#endif
...
...
@@ -176,7 +176,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
TEST_P
(
CompileVulkanToSpirvTestNV
,
FromFile
)
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
10
0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_
0
,
Target
::
Spv
);
}
#endif
...
...
@@ -347,7 +347,7 @@ INSTANTIATE_TEST_CASE_P(
// clang-format off
INSTANTIATE_TEST_CASE_P
(
Glsl
,
CompileVulkan1
10
ToSpirvTest
,
Glsl
,
CompileVulkan1
_1
ToSpirvTest
,
::
testing
::
ValuesIn
(
std
::
vector
<
std
::
string
>
({
"spv.deviceGroup.frag"
,
"spv.drawParams.vert"
,
...
...
gtests/TestFixture.h
View file @
2076acf6
...
...
@@ -218,13 +218,15 @@ public:
:
glslang
::
EShSourceGlsl
,
stage
,
glslang
::
EShClientVulkan
,
100
);
shader
.
setEnvClient
(
glslang
::
EShClientVulkan
,
clientTargetVersion
);
shader
.
setEnvTarget
(
glslang
::
EShTargetSpv
,
clientTargetVersion
==
110
?
0x00010300
:
0x00010000
);
shader
.
setEnvTarget
(
glslang
::
EShTargetSpv
,
clientTargetVersion
==
glslang
::
Vulkan_1_1
?
glslang
::
Spv_1_3
:
glslang
::
Spv_1_0
);
}
else
{
shader
.
setEnvInput
((
controls
&
EShMsgReadHlsl
)
?
glslang
::
EShSourceHlsl
:
glslang
::
EShSourceGlsl
,
stage
,
glslang
::
EShClientOpenGL
,
100
);
shader
.
setEnvClient
(
glslang
::
EShClientOpenGL
,
clientTargetVersion
);
shader
.
setEnvTarget
(
glslang
::
EshTargetSpv
,
0x0001000
0
);
shader
.
setEnvTarget
(
glslang
::
EshTargetSpv
,
glslang
::
Spv_1_
0
);
}
}
...
...
@@ -447,7 +449,7 @@ public:
tryLoadFile
(
expectedOutputFname
,
"expected output"
,
&
expectedOutput
);
const
EShMessages
controls
=
DeriveOptions
(
source
,
semantics
,
target
);
GlslangResult
result
=
compileAndLink
(
testName
,
input
,
entryPointName
,
controls
,
10
0
,
true
);
GlslangResult
result
=
compileAndLink
(
testName
,
input
,
entryPointName
,
controls
,
glslang
::
Vulkan_1_
0
,
true
);
// Generate the hybrid output in the way of glslangValidator.
std
::
ostringstream
stream
;
...
...
@@ -616,7 +618,7 @@ public:
tryLoadFile
(
expectedOutputFname
,
"expected output"
,
&
expectedOutput
);
const
EShMessages
controls
=
DeriveOptions
(
source
,
semantics
,
target
);
GlslangResult
result
=
compileAndLink
(
testName
,
input
,
entryPointName
,
controls
,
10
0
,
false
,
GlslangResult
result
=
compileAndLink
(
testName
,
input
,
entryPointName
,
controls
,
glslang
::
Vulkan_1_
0
,
false
,
EShTexSampTransUpgradeTextureRemoveSampler
);
// Generate the hybrid output in the way of glslangValidator.
...
...
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