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
60e774b2
Unverified
Commit
60e774b2
authored
Jun 08, 2019
by
John Kessenich
Committed by
GitHub
Jun 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1794 from jeffbolznv/pre_legalization
Use spvValidatorOptionsSetBeforeHlslLegalization for pre-legalized HLSL
parents
f575f4c8
fd556e32
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 @
60e774b2
...
@@ -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 @
60e774b2
...
@@ -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 @
60e774b2
...
@@ -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 @
60e774b2
...
@@ -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