@@ -637,9 +637,13 @@ void EpipolarLightScattering::PrecomputeScatteringLUT(IRenderDevice* pDevice, IR
637
637
ShaderMacroHelper Macros;
638
638
DefineMacros (Macros);
639
639
Macros.AddShaderMacro (" THREAD_GROUP_SIZE" , ThreadGroupSize);
640
+ // Vulkan requires image format to be specified in the shader, but glslang does not support
641
+ // the [[vk::image_format]] attribute (https://github.com/KhronosGroup/glslang/issues/3790).
642
+ // So we have to convert HLSL to GLSL so that the converter can add the attribute from the
643
+ // /*format=...*/ comment.
640
644
RefCntAutoPtr<IShader> pPrecomputeSingleSctrCS =
641
645
CreateShader (pDevice, pStateCache, " PrecomputeSingleScattering.fx" , " PrecomputeSingleScatteringCS" ,
642
- SHADER_TYPE_COMPUTE, m_ShaderFlags, Macros);
646
+ SHADER_TYPE_COMPUTE, m_ShaderFlags | SHADER_COMPILE_FLAG_HLSL_TO_SPIRV_VIA_GLSL , Macros);
643
647
PipelineResourceLayoutDesc ResourceLayout;
644
648
ResourceLayout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC;
645
649
PrecomputeSingleSctrTech.InitializeComputeTechnique (pDevice, pStateCache, " PrecomputeSingleScattering" , pPrecomputeSingleSctrCS, ResourceLayout);
@@ -683,9 +687,13 @@ void EpipolarLightScattering::PrecomputeScatteringLUT(IRenderDevice* pDevice, IR
683
687
ShaderMacroHelper Macros;
684
688
DefineMacros (Macros);
685
689
Macros.AddShaderMacro (" THREAD_GROUP_SIZE" , ThreadGroupSize);
690
+ // Vulkan requires image format to be specified in the shader, but glslang does not support
691
+ // the [[vk::image_format]] attribute (https://github.com/KhronosGroup/glslang/issues/3790).
692
+ // So we have to convert HLSL to GLSL so that the converter can add the attribute from the
693
+ // /*format=...*/ comment.
686
694
RefCntAutoPtr<IShader> pInitHighOrderScatteringCS =
687
695
CreateShader (pDevice, pStateCache, " InitHighOrderScattering.fx" , " InitHighOrderScatteringCS" ,
688
- SHADER_TYPE_COMPUTE, m_ShaderFlags, Macros);
696
+ SHADER_TYPE_COMPUTE, m_ShaderFlags | SHADER_COMPILE_FLAG_HLSL_TO_SPIRV_VIA_GLSL , Macros);
689
697
PipelineResourceLayoutDesc ResourceLayout;
690
698
ResourceLayout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC;
691
699
InitHighOrderScatteringTech.InitializeComputeTechnique (pDevice, pStateCache, " InitHighOrderScattering" , pInitHighOrderScatteringCS, ResourceLayout);
@@ -698,9 +706,13 @@ void EpipolarLightScattering::PrecomputeScatteringLUT(IRenderDevice* pDevice, IR
698
706
ShaderMacroHelper Macros;
699
707
DefineMacros (Macros);
700
708
Macros.AddShaderMacro (" THREAD_GROUP_SIZE" , ThreadGroupSize);
709
+ // Vulkan requires image format to be specified in the shader, but glslang does not support
710
+ // the [[vk::image_format]] attribute (https://github.com/KhronosGroup/glslang/issues/3790).
711
+ // So we have to convert HLSL to GLSL so that the converter can add the attribute from the
712
+ // /*format=...*/ comment.
701
713
RefCntAutoPtr<IShader> pUpdateHighOrderScatteringCS =
702
714
CreateShader (pDevice, pStateCache, " UpdateHighOrderScattering.fx" , " UpdateHighOrderScatteringCS" ,
703
- SHADER_TYPE_COMPUTE, m_ShaderFlags, Macros);
715
+ SHADER_TYPE_COMPUTE, m_ShaderFlags | SHADER_COMPILE_FLAG_HLSL_TO_SPIRV_VIA_GLSL , Macros);
704
716
PipelineResourceLayoutDesc ResourceLayout;
705
717
ResourceLayout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC;
706
718
UpdateHighOrderScatteringTech.InitializeComputeTechnique (pDevice, pStateCache, " UpdateHighOrderScattering" , pUpdateHighOrderScatteringCS, ResourceLayout);
@@ -713,9 +725,13 @@ void EpipolarLightScattering::PrecomputeScatteringLUT(IRenderDevice* pDevice, IR
713
725
ShaderMacroHelper Macros;
714
726
DefineMacros (Macros);
715
727
Macros.AddShaderMacro (" THREAD_GROUP_SIZE" , ThreadGroupSize);
728
+ // Vulkan requires image format to be specified in the shader, but glslang does not support
729
+ // the [[vk::image_format]] attribute (https://github.com/KhronosGroup/glslang/issues/3790).
730
+ // So we have to convert HLSL to GLSL so that the converter can add the attribute from the
731
+ // /*format=...*/ comment.
716
732
RefCntAutoPtr<IShader> pCombineScatteringOrdersCS =
717
733
CreateShader (pDevice, pStateCache, " CombineScatteringOrders.fx" , " CombineScatteringOrdersCS" ,
718
- SHADER_TYPE_COMPUTE, m_ShaderFlags, Macros);
734
+ SHADER_TYPE_COMPUTE, m_ShaderFlags | SHADER_COMPILE_FLAG_HLSL_TO_SPIRV_VIA_GLSL , Macros);
719
735
PipelineResourceLayoutDesc ResourceLayout;
720
736
ResourceLayout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC;
721
737
CombineScatteringOrdersTech.InitializeComputeTechnique (pDevice, pStateCache, " CombineScatteringOrders" , pCombineScatteringOrdersCS, ResourceLayout);
0 commit comments