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
9ad89bfa
Commit
9ad89bfa
authored
Mar 04, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Versioning: Move to using enums.
parent
9f70f7f2
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
56 additions
and
45 deletions
+56
-45
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+4
-4
StandAlone.cpp
StandAlone/StandAlone.cpp
+12
-9
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+1
-1
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+2
-2
ShaderLang.h
glslang/Public/ShaderLang.h
+15
-10
AST.FromFile.cpp
gtests/AST.FromFile.cpp
+1
-1
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+3
-3
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+8
-8
TestFixture.h
gtests/TestFixture.h
+10
-7
No files found.
SPIRV/GlslangToSpv.cpp
View file @
9ad89bfa
...
@@ -196,7 +196,7 @@ protected:
...
@@ -196,7 +196,7 @@ protected:
#endif
#endif
void
addPre13Extension
(
const
char
*
ext
)
void
addPre13Extension
(
const
char
*
ext
)
{
{
if
(
builder
.
getSpvVersion
()
<
glslang
::
Spv_1_3
)
if
(
builder
.
getSpvVersion
()
<
glslang
::
EShTarget
Spv_1_3
)
builder
.
addExtension
(
ext
);
builder
.
addExtension
(
ext
);
}
}
...
@@ -2463,7 +2463,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
...
@@ -2463,7 +2463,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case
glslang
:
:
EbtFloat16
:
case
glslang
:
:
EbtFloat16
:
builder
.
addCapability
(
spv
::
CapabilityFloat16
);
builder
.
addCapability
(
spv
::
CapabilityFloat16
);
#if AMD_EXTENSIONS
#if AMD_EXTENSIONS
if
(
builder
.
getSpvVersion
()
<
glslang
::
Spv_1_3
)
if
(
builder
.
getSpvVersion
()
<
glslang
::
EShTarget
Spv_1_3
)
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_half_float
);
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_half_float
);
#endif
#endif
spvType
=
builder
.
makeFloatType
(
16
);
spvType
=
builder
.
makeFloatType
(
16
);
...
@@ -2487,7 +2487,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
...
@@ -2487,7 +2487,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case
glslang
:
:
EbtInt16
:
case
glslang
:
:
EbtInt16
:
builder
.
addCapability
(
spv
::
CapabilityInt16
);
builder
.
addCapability
(
spv
::
CapabilityInt16
);
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
if
(
builder
.
getSpvVersion
()
<
glslang
::
Spv_1_3
)
if
(
builder
.
getSpvVersion
()
<
glslang
::
EShTarget
Spv_1_3
)
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_int16
);
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_int16
);
#endif
#endif
spvType
=
builder
.
makeIntType
(
16
);
spvType
=
builder
.
makeIntType
(
16
);
...
@@ -2495,7 +2495,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
...
@@ -2495,7 +2495,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case
glslang
:
:
EbtUint16
:
case
glslang
:
:
EbtUint16
:
builder
.
addCapability
(
spv
::
CapabilityInt16
);
builder
.
addCapability
(
spv
::
CapabilityInt16
);
#ifdef AMD_EXTENSIONS
#ifdef AMD_EXTENSIONS
if
(
builder
.
getSpvVersion
()
<
glslang
::
Spv_1_3
)
if
(
builder
.
getSpvVersion
()
<
glslang
::
EShTarget
Spv_1_3
)
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_int16
);
builder
.
addExtension
(
spv
::
E_SPV_AMD_gpu_shader_int16
);
#endif
#endif
spvType
=
builder
.
makeUintType
(
16
);
spvType
=
builder
.
makeUintType
(
16
);
...
...
StandAlone/StandAlone.cpp
View file @
9ad89bfa
...
@@ -156,11 +156,14 @@ const char* sourceEntryPointName = nullptr;
...
@@ -156,11 +156,14 @@ const char* sourceEntryPointName = nullptr;
const
char
*
shaderStageName
=
nullptr
;
const
char
*
shaderStageName
=
nullptr
;
const
char
*
variableName
=
nullptr
;
const
char
*
variableName
=
nullptr
;
std
::
vector
<
std
::
string
>
IncludeDirectoryList
;
std
::
vector
<
std
::
string
>
IncludeDirectoryList
;
int
ClientInputSemanticsVersion
=
100
;
// maps to, say, #define VULKAN 100
int
ClientInputSemanticsVersion
=
100
;
// maps to, say, #define VULKAN 100
int
VulkanClientVersion
=
glslang
::
Vulkan_1_0
;
// would map to, say, Vulkan 1.0
glslang
::
EshTargetClientVersion
VulkanClientVersion
=
int
OpenGLClientVersion
=
450
;
// doesn't influence anything yet, but maps to OpenGL 4.50
glslang
::
EShTargetVulkan_1_0
;
// would map to, say, Vulkan 1.0
unsigned
int
TargetVersion
=
glslang
::
Spv_1_0
;
// maps to, say, SPIR-V 1.0
glslang
::
EshTargetClientVersion
OpenGLClientVersion
=
std
::
vector
<
std
::
string
>
Processes
;
// what should be recorded by OpModuleProcessed, or equivalent
glslang
::
EShTargetOpenGL_450
;
// doesn't influence anything yet, but maps to OpenGL 4.50
glslang
::
EShTargetLanguageVersion
TargetVersion
=
glslang
::
EShTargetSpv_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
// Per descriptor-set binding base data
typedef
std
::
map
<
unsigned
int
,
unsigned
int
>
TPerSetBaseBinding
;
typedef
std
::
map
<
unsigned
int
,
unsigned
int
>
TPerSetBaseBinding
;
...
@@ -504,14 +507,14 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -504,14 +507,14 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
if
(
argc
>
1
)
{
if
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"vulkan1.0"
)
==
0
)
{
if
(
strcmp
(
argv
[
1
],
"vulkan1.0"
)
==
0
)
{
setVulkanSpv
();
setVulkanSpv
();
VulkanClientVersion
=
glslang
::
Vulkan_1_0
;
VulkanClientVersion
=
glslang
::
EShTarget
Vulkan_1_0
;
}
else
if
(
strcmp
(
argv
[
1
],
"vulkan1.1"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
1
],
"vulkan1.1"
)
==
0
)
{
setVulkanSpv
();
setVulkanSpv
();
TargetVersion
=
glslang
::
Spv_1_3
;
TargetVersion
=
glslang
::
EShTarget
Spv_1_3
;
VulkanClientVersion
=
glslang
::
Vulkan_1_1
;
VulkanClientVersion
=
glslang
::
EShTarget
Vulkan_1_1
;
}
else
if
(
strcmp
(
argv
[
1
],
"opengl"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
1
],
"opengl"
)
==
0
)
{
setOpenGlSpv
();
setOpenGlSpv
();
OpenGLClientVersion
=
450
;
OpenGLClientVersion
=
glslang
::
EShTargetOpenGL_
450
;
}
else
}
else
Error
(
"--target-env expected vulkan1.0 or opengl"
);
Error
(
"--target-env expected vulkan1.0 or opengl"
);
}
}
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
9ad89bfa
...
@@ -1640,7 +1640,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
...
@@ -1640,7 +1640,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
if
(
callNode
.
getOp
()
>
EOpSubgroupGuardStart
&&
callNode
.
getOp
()
<
EOpSubgroupGuardStop
)
{
if
(
callNode
.
getOp
()
>
EOpSubgroupGuardStart
&&
callNode
.
getOp
()
<
EOpSubgroupGuardStop
)
{
// these require SPIR-V 1.3
// these require SPIR-V 1.3
if
(
spvVersion
.
spv
>
0
&&
spvVersion
.
spv
<
Spv_1_3
)
if
(
spvVersion
.
spv
>
0
&&
spvVersion
.
spv
<
EShTarget
Spv_1_3
)
error
(
loc
,
"requires SPIR-V 1.3"
,
"subgroup op"
,
""
);
error
(
loc
,
"requires SPIR-V 1.3"
,
"subgroup op"
,
""
);
}
}
}
}
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
9ad89bfa
...
@@ -619,9 +619,9 @@ void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages
...
@@ -619,9 +619,9 @@ void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages
{
{
// Set up environmental defaults, first ignoring 'environment'.
// Set up environmental defaults, first ignoring 'environment'.
if
(
messages
&
EShMsgSpvRules
)
if
(
messages
&
EShMsgSpvRules
)
spvVersion
.
spv
=
Spv_1_0
;
spvVersion
.
spv
=
EShTarget
Spv_1_0
;
if
(
messages
&
EShMsgVulkanRules
)
{
if
(
messages
&
EShMsgVulkanRules
)
{
spvVersion
.
vulkan
=
Vulkan_1_0
;
spvVersion
.
vulkan
=
EShTarget
Vulkan_1_0
;
spvVersion
.
vulkanGlsl
=
100
;
spvVersion
.
vulkanGlsl
=
100
;
}
else
if
(
spvVersion
.
spv
!=
0
)
}
else
if
(
spvVersion
.
spv
!=
0
)
spvVersion
.
openGl
=
100
;
spvVersion
.
openGl
=
100
;
...
...
glslang/Public/ShaderLang.h
View file @
9ad89bfa
...
@@ -123,6 +123,17 @@ typedef enum {
...
@@ -123,6 +123,17 @@ typedef enum {
EshTargetSpv
=
EShTargetSpv
,
// legacy spelling
EshTargetSpv
=
EShTargetSpv
,
// legacy spelling
}
EShTargetLanguage
;
}
EShTargetLanguage
;
typedef
enum
{
EShTargetVulkan_1_0
=
(
1
<<
22
),
EShTargetVulkan_1_1
=
(
1
<<
22
)
|
(
1
<<
12
),
EShTargetOpenGL_450
=
450
,
}
EshTargetClientVersion
;
typedef
enum
{
EShTargetSpv_1_0
=
(
1
<<
16
),
EShTargetSpv_1_3
=
(
1
<<
16
)
|
(
3
<<
8
),
}
EShTargetLanguageVersion
;
struct
TInputLanguage
{
struct
TInputLanguage
{
EShSource
languageFamily
;
// redundant information with other input, this one overrides when not EShSourceNone
EShSource
languageFamily
;
// redundant information with other input, this one overrides when not EShSourceNone
EShLanguage
stage
;
// redundant information with other input, this one overrides when not EShSourceNone
EShLanguage
stage
;
// redundant information with other input, this one overrides when not EShSourceNone
...
@@ -132,20 +143,14 @@ struct TInputLanguage {
...
@@ -132,20 +143,14 @@ struct TInputLanguage {
struct
TClient
{
struct
TClient
{
EShClient
client
;
EShClient
client
;
int
version
;
// version of client itself (not the client's input dialect)
EshTargetClientVersion
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
{
struct
TTarget
{
EShTargetLanguage
language
;
EShTargetLanguage
language
;
unsigned
int
version
;
// the version to target, if SPIR-V, defined by "word 1" of the SPIR-V binary
header
EShTargetLanguageVersion
version
;
// version to target, if SPIR-V, defined by "word 1" of the SPIR-V
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.
// All source/client/target versions and settings.
// Can override previous methods of setting, when items are set here.
// Can override previous methods of setting, when items are set here.
// Expected to grow, as more are added, rather than growing parameter lists.
// Expected to grow, as more are added, rather than growing parameter lists.
...
@@ -399,12 +404,12 @@ public:
...
@@ -399,12 +404,12 @@ public:
environment
.
input
.
dialect
=
client
;
environment
.
input
.
dialect
=
client
;
environment
.
input
.
dialectVersion
=
version
;
environment
.
input
.
dialectVersion
=
version
;
}
}
void
setEnvClient
(
EShClient
client
,
int
version
)
void
setEnvClient
(
EShClient
client
,
EshTargetClientVersion
version
)
{
{
environment
.
client
.
client
=
client
;
environment
.
client
.
client
=
client
;
environment
.
client
.
version
=
version
;
environment
.
client
.
version
=
version
;
}
}
void
setEnvTarget
(
EShTargetLanguage
lang
,
unsigned
int
version
)
void
setEnvTarget
(
EShTargetLanguage
lang
,
EShTargetLanguageVersion
version
)
{
{
environment
.
target
.
language
=
lang
;
environment
.
target
.
language
=
lang
;
environment
.
target
.
version
=
version
;
environment
.
target
.
version
=
version
;
...
...
gtests/AST.FromFile.cpp
View file @
9ad89bfa
...
@@ -44,7 +44,7 @@ using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>;
...
@@ -44,7 +44,7 @@ using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>;
TEST_P
(
CompileToAstTest
,
FromFile
)
TEST_P
(
CompileToAstTest
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
OpenGL
,
glslang
::
Vulkan_1_0
,
Source
::
GLSL
,
Semantics
::
OpenGL
,
glslang
::
EShTarget
Vulkan_1_0
,
Target
::
AST
);
Target
::
AST
);
}
}
...
...
gtests/Hlsl.FromFile.cpp
View file @
9ad89bfa
...
@@ -67,14 +67,14 @@ using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPoint
...
@@ -67,14 +67,14 @@ using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPoint
TEST_P
(
HlslCompileTest
,
FromFile
)
TEST_P
(
HlslCompileTest
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_0
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_0
,
Target
::
BothASTAndSpv
,
true
,
GetParam
().
entryPoint
);
Target
::
BothASTAndSpv
,
true
,
GetParam
().
entryPoint
);
}
}
TEST_P
(
HlslVulkan1_1CompileTest
,
FromFile
)
TEST_P
(
HlslVulkan1_1CompileTest
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_1
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_1
,
Target
::
BothASTAndSpv
,
true
,
GetParam
().
entryPoint
);
Target
::
BothASTAndSpv
,
true
,
GetParam
().
entryPoint
);
}
}
...
@@ -90,7 +90,7 @@ TEST_P(HlslCompileAndFlattenTest, FromFile)
...
@@ -90,7 +90,7 @@ TEST_P(HlslCompileAndFlattenTest, FromFile)
TEST_P
(
HlslLegalizeTest
,
FromFile
)
TEST_P
(
HlslLegalizeTest
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
().
fileName
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_0
,
Source
::
HLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_0
,
Target
::
Spv
,
true
,
GetParam
().
entryPoint
,
Target
::
Spv
,
true
,
GetParam
().
entryPoint
,
"/baseLegalResults/"
,
false
);
"/baseLegalResults/"
,
false
);
}
}
...
...
gtests/Spv.FromFile.cpp
View file @
9ad89bfa
...
@@ -83,14 +83,14 @@ using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::t
...
@@ -83,14 +83,14 @@ using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::t
TEST_P
(
CompileVulkanToSpirvTest
,
FromFile
)
TEST_P
(
CompileVulkanToSpirvTest
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_0
,
Target
::
Spv
);
Target
::
Spv
);
}
}
TEST_P
(
CompileVulkan1_1ToSpirvTest
,
FromFile
)
TEST_P
(
CompileVulkan1_1ToSpirvTest
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_1
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_1
,
Target
::
Spv
);
Target
::
Spv
);
}
}
...
@@ -99,7 +99,7 @@ TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
...
@@ -99,7 +99,7 @@ TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
TEST_P
(
CompileOpenGLToSpirvTest
,
FromFile
)
TEST_P
(
CompileOpenGLToSpirvTest
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
OpenGL
,
10
0
,
Source
::
GLSL
,
Semantics
::
OpenGL
,
glslang
::
EShTargetVulkan_1_
0
,
Target
::
Spv
);
Target
::
Spv
);
}
}
...
@@ -108,7 +108,7 @@ TEST_P(CompileOpenGLToSpirvTest, FromFile)
...
@@ -108,7 +108,7 @@ TEST_P(CompileOpenGLToSpirvTest, FromFile)
TEST_P
(
VulkanSemantics
,
FromFile
)
TEST_P
(
VulkanSemantics
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_0
,
Target
::
Spv
,
false
);
Target
::
Spv
,
false
);
}
}
...
@@ -117,7 +117,7 @@ TEST_P(VulkanSemantics, FromFile)
...
@@ -117,7 +117,7 @@ TEST_P(VulkanSemantics, FromFile)
TEST_P
(
OpenGLSemantics
,
FromFile
)
TEST_P
(
OpenGLSemantics
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
OpenGL
,
10
0
,
Source
::
GLSL
,
Semantics
::
OpenGL
,
glslang
::
EShTargetVulkan_1_
0
,
Target
::
Spv
,
false
);
Target
::
Spv
,
false
);
}
}
...
@@ -125,7 +125,7 @@ TEST_P(OpenGLSemantics, FromFile)
...
@@ -125,7 +125,7 @@ TEST_P(OpenGLSemantics, FromFile)
TEST_P
(
VulkanAstSemantics
,
FromFile
)
TEST_P
(
VulkanAstSemantics
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_0
,
Target
::
AST
);
Target
::
AST
);
}
}
...
@@ -165,7 +165,7 @@ TEST_P(GlslIoMap, FromFile)
...
@@ -165,7 +165,7 @@ TEST_P(GlslIoMap, FromFile)
TEST_P
(
CompileVulkanToSpirvTestAMD
,
FromFile
)
TEST_P
(
CompileVulkanToSpirvTestAMD
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_0
,
Target
::
Spv
);
Target
::
Spv
);
}
}
#endif
#endif
...
@@ -176,7 +176,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
...
@@ -176,7 +176,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
TEST_P
(
CompileVulkanToSpirvTestNV
,
FromFile
)
TEST_P
(
CompileVulkanToSpirvTestNV
,
FromFile
)
{
{
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
loadFileCompileAndCheck
(
GlobalTestSettings
.
testRoot
,
GetParam
(),
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
Vulkan_1_0
,
Source
::
GLSL
,
Semantics
::
Vulkan
,
glslang
::
EShTarget
Vulkan_1_0
,
Target
::
Spv
);
Target
::
Spv
);
}
}
#endif
#endif
...
...
gtests/TestFixture.h
View file @
9ad89bfa
...
@@ -196,7 +196,8 @@ public:
...
@@ -196,7 +196,8 @@ public:
// the result and returns disassembly text.
// the result and returns disassembly text.
GlslangResult
compileAndLink
(
GlslangResult
compileAndLink
(
const
std
::
string
shaderName
,
const
std
::
string
&
code
,
const
std
::
string
shaderName
,
const
std
::
string
&
code
,
const
std
::
string
&
entryPointName
,
EShMessages
controls
,
int
clientTargetVersion
,
const
std
::
string
&
entryPointName
,
EShMessages
controls
,
glslang
::
EshTargetClientVersion
clientTargetVersion
,
bool
flattenUniformArrays
=
false
,
bool
flattenUniformArrays
=
false
,
EShTextureSamplerTransformMode
texSampTransMode
=
EShTexSampTransKeep
,
EShTextureSamplerTransformMode
texSampTransMode
=
EShTexSampTransKeep
,
bool
disableOptimizer
=
true
,
bool
disableOptimizer
=
true
,
...
@@ -219,14 +220,14 @@ public:
...
@@ -219,14 +220,14 @@ public:
stage
,
glslang
::
EShClientVulkan
,
100
);
stage
,
glslang
::
EShClientVulkan
,
100
);
shader
.
setEnvClient
(
glslang
::
EShClientVulkan
,
clientTargetVersion
);
shader
.
setEnvClient
(
glslang
::
EShClientVulkan
,
clientTargetVersion
);
shader
.
setEnvTarget
(
glslang
::
EShTargetSpv
,
shader
.
setEnvTarget
(
glslang
::
EShTargetSpv
,
clientTargetVersion
==
glslang
::
Vulkan_1_1
?
glslang
::
Spv_1_3
clientTargetVersion
==
glslang
::
EShTargetVulkan_1_1
?
glslang
::
EShTarget
Spv_1_3
:
glslang
::
Spv_1_0
);
:
glslang
::
EShTarget
Spv_1_0
);
}
else
{
}
else
{
shader
.
setEnvInput
((
controls
&
EShMsgReadHlsl
)
?
glslang
::
EShSourceHlsl
shader
.
setEnvInput
((
controls
&
EShMsgReadHlsl
)
?
glslang
::
EShSourceHlsl
:
glslang
::
EShSourceGlsl
,
:
glslang
::
EShSourceGlsl
,
stage
,
glslang
::
EShClientOpenGL
,
100
);
stage
,
glslang
::
EShClientOpenGL
,
100
);
shader
.
setEnvClient
(
glslang
::
EShClientOpenGL
,
clientTargetVersion
);
shader
.
setEnvClient
(
glslang
::
EShClientOpenGL
,
clientTargetVersion
);
shader
.
setEnvTarget
(
glslang
::
EshTargetSpv
,
glslang
::
Spv_1_0
);
shader
.
setEnvTarget
(
glslang
::
EshTargetSpv
,
glslang
::
EShTarget
Spv_1_0
);
}
}
}
}
...
@@ -406,7 +407,7 @@ public:
...
@@ -406,7 +407,7 @@ public:
const
std
::
string
&
testName
,
const
std
::
string
&
testName
,
Source
source
,
Source
source
,
Semantics
semantics
,
Semantics
semantics
,
int
clientTargetVersion
,
glslang
::
EshTargetClientVersion
clientTargetVersion
,
Target
target
,
Target
target
,
bool
automap
=
true
,
bool
automap
=
true
,
const
std
::
string
&
entryPointName
=
""
,
const
std
::
string
&
entryPointName
=
""
,
...
@@ -449,7 +450,8 @@ public:
...
@@ -449,7 +450,8 @@ public:
tryLoadFile
(
expectedOutputFname
,
"expected output"
,
&
expectedOutput
);
tryLoadFile
(
expectedOutputFname
,
"expected output"
,
&
expectedOutput
);
const
EShMessages
controls
=
DeriveOptions
(
source
,
semantics
,
target
);
const
EShMessages
controls
=
DeriveOptions
(
source
,
semantics
,
target
);
GlslangResult
result
=
compileAndLink
(
testName
,
input
,
entryPointName
,
controls
,
glslang
::
Vulkan_1_0
,
true
);
GlslangResult
result
=
compileAndLink
(
testName
,
input
,
entryPointName
,
controls
,
glslang
::
EShTargetVulkan_1_0
,
true
);
// Generate the hybrid output in the way of glslangValidator.
// Generate the hybrid output in the way of glslangValidator.
std
::
ostringstream
stream
;
std
::
ostringstream
stream
;
...
@@ -618,7 +620,8 @@ public:
...
@@ -618,7 +620,8 @@ public:
tryLoadFile
(
expectedOutputFname
,
"expected output"
,
&
expectedOutput
);
tryLoadFile
(
expectedOutputFname
,
"expected output"
,
&
expectedOutput
);
const
EShMessages
controls
=
DeriveOptions
(
source
,
semantics
,
target
);
const
EShMessages
controls
=
DeriveOptions
(
source
,
semantics
,
target
);
GlslangResult
result
=
compileAndLink
(
testName
,
input
,
entryPointName
,
controls
,
glslang
::
Vulkan_1_0
,
false
,
GlslangResult
result
=
compileAndLink
(
testName
,
input
,
entryPointName
,
controls
,
glslang
::
EShTargetVulkan_1_0
,
false
,
EShTexSampTransUpgradeTextureRemoveSampler
);
EShTexSampTransUpgradeTextureRemoveSampler
);
// Generate the hybrid output in the way of glslangValidator.
// 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