Skip to content

Commit 9e2ceeb

Browse files
Tutorial 23: fixed Vulkan image format mismatch validation warning (close #233)
1 parent d4aa499 commit 9e2ceeb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Tutorials/Tutorial23_CommandQueues/src/Terrain.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ void Terrain::CreatePSO(const ScenePSOCreateAttribs& Attr)
240240
ShaderCI.FilePath = "GenerateTerrain.csh";
241241
ShaderCI.EntryPoint = "CSMain";
242242

243+
// Vulkan requires image format to be specified in the shader, but glslang does not support
244+
// the [[vk::image_format]] attribute (https://github.com/KhronosGroup/glslang/issues/3790).
245+
// So we have to convert HLSL to GLSL so that the converter can add the attribute from the
246+
// /*format=...*/ comment.
247+
ShaderCI.CompileFlags = SHADER_COMPILE_FLAG_HLSL_TO_SPIRV_VIA_GLSL;
248+
243249
RefCntAutoPtr<IShader> pCS;
244250
m_Device->CreateShader(ShaderCI, &pCS);
245251

0 commit comments

Comments
 (0)