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
fd556e32
Commit
fd556e32
authored
Jun 07, 2019
by
Jeff Bolz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use spvValidatorOptionsSetBeforeHlslLegalization for pre-legalized HLSL
parent
d3692c70
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
5 deletions
+8
-5
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+5
-2
SpvTools.cpp
SPIRV/SpvTools.cpp
+2
-1
SpvTools.h
SPIRV/SpvTools.h
+1
-1
hlsl.structbuffer.fn2.comp.out
Test/baseResults/hlsl.structbuffer.fn2.comp.out
+0
-1
No files found.
SPIRV/GlslangToSpv.cpp
View file @
fd556e32
...
@@ -8090,11 +8090,14 @@ void GlslangToSpv(const TIntermediate& intermediate, std::vector<unsigned int>&
...
@@ -8090,11 +8090,14 @@ void GlslangToSpv(const TIntermediate& intermediate, std::vector<unsigned int>&
#if ENABLE_OPT
#if ENABLE_OPT
// If from HLSL, run spirv-opt to "legalize" the SPIR-V for Vulkan
// If from HLSL, run spirv-opt to "legalize" the SPIR-V for Vulkan
// eg. forward and remove memory writes of opaque types.
// eg. forward and remove memory writes of opaque types.
if
((
intermediate
.
getSource
()
==
EShSourceHlsl
||
options
->
optimizeSize
)
&&
!
options
->
disableOptimizer
)
bool
prelegalization
=
intermediate
.
getSource
()
==
EShSourceHlsl
;
if
((
intermediate
.
getSource
()
==
EShSourceHlsl
||
options
->
optimizeSize
)
&&
!
options
->
disableOptimizer
)
{
SpirvToolsLegalize
(
intermediate
,
spirv
,
logger
,
options
);
SpirvToolsLegalize
(
intermediate
,
spirv
,
logger
,
options
);
prelegalization
=
false
;
}
if
(
options
->
validate
)
if
(
options
->
validate
)
SpirvToolsValidate
(
intermediate
,
spirv
,
logger
);
SpirvToolsValidate
(
intermediate
,
spirv
,
logger
,
prelegalization
);
if
(
options
->
disassemble
)
if
(
options
->
disassemble
)
SpirvToolsDisassemble
(
std
::
cout
,
spirv
);
SpirvToolsDisassemble
(
std
::
cout
,
spirv
);
...
...
SPIRV/SpvTools.cpp
View file @
fd556e32
...
@@ -103,7 +103,7 @@ void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& s
...
@@ -103,7 +103,7 @@ void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& s
// Apply the SPIRV-Tools validator to generated SPIR-V.
// Apply the SPIRV-Tools validator to generated SPIR-V.
void
SpirvToolsValidate
(
const
glslang
::
TIntermediate
&
intermediate
,
std
::
vector
<
unsigned
int
>&
spirv
,
void
SpirvToolsValidate
(
const
glslang
::
TIntermediate
&
intermediate
,
std
::
vector
<
unsigned
int
>&
spirv
,
spv
::
SpvBuildLogger
*
logger
)
spv
::
SpvBuildLogger
*
logger
,
bool
prelegalization
)
{
{
// validate
// validate
spv_context
context
=
spvContextCreate
(
MapToSpirvToolsEnv
(
intermediate
.
getSpv
(),
logger
));
spv_context
context
=
spvContextCreate
(
MapToSpirvToolsEnv
(
intermediate
.
getSpv
(),
logger
));
...
@@ -111,6 +111,7 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
...
@@ -111,6 +111,7 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
spv_diagnostic
diagnostic
=
nullptr
;
spv_diagnostic
diagnostic
=
nullptr
;
spv_validator_options
options
=
spvValidatorOptionsCreate
();
spv_validator_options
options
=
spvValidatorOptionsCreate
();
spvValidatorOptionsSetRelaxBlockLayout
(
options
,
intermediate
.
usingHlslOffsets
());
spvValidatorOptionsSetRelaxBlockLayout
(
options
,
intermediate
.
usingHlslOffsets
());
spvValidatorOptionsSetBeforeHlslLegalization
(
options
,
prelegalization
);
spvValidateWithOptions
(
context
,
options
,
&
binary
,
&
diagnostic
);
spvValidateWithOptions
(
context
,
options
,
&
binary
,
&
diagnostic
);
// report
// report
...
...
SPIRV/SpvTools.h
View file @
fd556e32
...
@@ -66,7 +66,7 @@ void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& s
...
@@ -66,7 +66,7 @@ void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& s
// Apply the SPIRV-Tools validator to generated SPIR-V.
// Apply the SPIRV-Tools validator to generated SPIR-V.
void
SpirvToolsValidate
(
const
glslang
::
TIntermediate
&
intermediate
,
std
::
vector
<
unsigned
int
>&
spirv
,
void
SpirvToolsValidate
(
const
glslang
::
TIntermediate
&
intermediate
,
std
::
vector
<
unsigned
int
>&
spirv
,
spv
::
SpvBuildLogger
*
);
spv
::
SpvBuildLogger
*
,
bool
prelegalization
);
// Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of
// Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of
// legalizing HLSL SPIR-V.
// legalizing HLSL SPIR-V.
...
...
Test/baseResults/hlsl.structbuffer.fn2.comp.out
View file @
fd556e32
...
@@ -135,7 +135,6 @@ local_size = (256, 1, 1)
...
@@ -135,7 +135,6 @@ local_size = (256, 1, 1)
0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID)
0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID)
Validation failed
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80007
// Generated by (magic number): 80007
// Id's are bound by 63
// Id's are bound by 63
...
...
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