Improve support for subpass inputs in order to emit shaders that work when subpass inputs are enabled or disabled. In the case they are disabled, SubpassInputs are transformed to a Texture2D type. This way we can use the same shader on platforms where SubpassInputs are not supported without having to modify the code.
SubpassInputs need to pass the arguments used when doing the Load operation on the Texture2D. Example:
[[input_attachment_index(0)]]
SubpassInput m_frameBuffer;
float4 color = m_frameBuffer.SubpassLoad(int3(1, 2, 0));
When subpass inputs are supported we get the following result:
[[vk::input_attachment_index(0)]]
[[vk::binding(0, 0)]]
SubpassInput m_frameBuffer;
float4 color = m_frameBuffer.SubpassLoad();
When subpass inputs are not supported we get the following result:
Texture2D m_frameBuffer;
float4 color = m_frameBuffer.Load(int3(1, 2, 0));
Details:
Add --no-subpass-input argument to emit a shader without subpass input support
Add SubpassInputToTexture2DCodeMutator to:
Replace SubpassInput type --> Texture2D type if subpass input are not supported
Replace SubpassLoad function --> Load function if subpass input are not supported
Remove arguments from SubpassLoad function when subpass inputs are supported
Improve support for subpass inputs in order to emit shaders that work when subpass inputs are enabled or disabled. In the case they are disabled, SubpassInputs are transformed to a Texture2D type. This way we can use the same shader on platforms where SubpassInputs are not supported without having to modify the code.
SubpassInputs need to pass the arguments used when doing the Load operation on the Texture2D. Example:
When subpass inputs are supported we get the following result:
When subpass inputs are not supported we get the following result:
Details: