summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2020-09-08 19:20:39 +0000
committerazhirnov <zh1dron@gmail.com>2020-09-08 19:20:39 +0000
commit33f1e79c50bb75f496dc3cad0bebbebacd390ab3 (patch)
treea3f8d779580fb1e47f3b2457c152ed73c2a2e088 /Graphics/GraphicsEngineVulkan
parentremoved DILIGENT_HAS_SPIRV_DXCOMPILER, it not needed because used dynamic loa... (diff)
downloadDiligentCore-33f1e79c50bb75f496dc3cad0bebbebacd390ab3.tar.gz
DiligentCore-33f1e79c50bb75f496dc3cad0bebbebacd390ab3.zip
removed StripReflectInfoPass2 - changes will be added to spirv-tools
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
index 6ca51b1e..65150c48 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
@@ -39,7 +39,7 @@
#if !DILIGENT_NO_HLSL
-# include "SPIRVUtils.hpp"
+# include "spirv-tools/optimizer.hpp"
#endif
namespace Diligent
@@ -129,12 +129,25 @@ RenderPassDesc PipelineStateVkImpl::GetImplicitRenderPassDesc(
return RPDesc;
}
-#if DILIGENT_NO_HLSL
static std::vector<uint32_t> StripReflection(const std::vector<uint32_t>& OriginalSPIRV)
{
+#if DILIGENT_NO_HLSL
return OriginalSPIRV;
-}
+#else
+ std::vector<uint32_t> StrippedSPIRV;
+ spvtools::Optimizer SpirvOptimizer(SPV_ENV_VULKAN_1_0);
+ // Decorations defined in SPV_GOOGLE_hlsl_functionality1 are the only instructions
+ // removed by strip-reflect-info pass. SPIRV offsets become INVALID after this operation.
+ SpirvOptimizer.RegisterPass(spvtools::CreateStripReflectInfoPass());
+ auto res = SpirvOptimizer.Run(OriginalSPIRV.data(), OriginalSPIRV.size(), &StrippedSPIRV);
+ if (!res)
+ {
+ // Optimized SPIRV may be invalid
+ StrippedSPIRV.clear();
+ }
+ return StrippedSPIRV;
#endif
+}
PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCounters,
RenderDeviceVkImpl* pDeviceVk,