Skip to content

Commit

Permalink
PipelineStateVk: run legalization pass for HLSL shaders when remappin…
Browse files Browse the repository at this point in the history
…g resources
  • Loading branch information
TheMostDiligent committed Jan 19, 2025
1 parent 315c2ad commit 68e441e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2024 Diligent Graphics LLC
* Copyright 2019-2025 Diligent Graphics LLC
* Copyright 2015-2019 Egor Yusov
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -740,7 +740,12 @@ void PipelineStateVkImpl::RemapOrVerifyShaderResources(
// SPIR-V module not valid: DecorateStringGOOGLE requires one of the following extensions: SPV_GOOGLE_decorate_string
// Optimizer also performs validation and may catch problems with the byte code.
// NB: SPIRV offsets become INVALID after this operation.
auto StrippedSPIRV = OptimizeSPIRV(SPIRV, SPV_ENV_MAX, SPIRV_OPTIMIZATION_FLAG_STRIP_REFLECTION);
SPIRV_OPTIMIZATION_FLAGS OptimizationFlags = SPIRV_OPTIMIZATION_FLAG_STRIP_REFLECTION;
if (pShaderResources->IsHLSLSource())
{
OptimizationFlags |= SPIRV_OPTIMIZATION_FLAG_LEGALIZATION;
}
auto StrippedSPIRV = OptimizeSPIRV(SPIRV, SPV_ENV_MAX, OptimizationFlags);
if (!StrippedSPIRV.empty())
SPIRV = std::move(StrippedSPIRV);
else
Expand Down

0 comments on commit 68e441e

Please sign in to comment.