Hello Community.
Here is my question:
My fragment shader looks like this:
layout(binding = 0) uniform sampler2D texture1;
layout(binding = 1) uniform sampler2D texture2;
if (condition1)
{
only use texture1
}
else
{
use texture1 and texture2
}
In condition1, only texture1’s vk::ImageView is provided from program, and I don’t have another vk::ImageView to bind to texture2. I tried to update my descriptor set with only one vk::WriteDescriptorSet and caused a validation error.
So What should I do to solve my problem in condition1? I’ve come up with some ideas, should I use one of them?
1.update descriptor set with two vk::WriteDescriptorSet, but both vk::WriteDescriptorSet use texutre1’s ImageView.
2.create a new vk::DescriptorSetLayout by only one vk::DescriptorSetLayoutbinding, and then create a new pipeline and a new descriptor set.
3.split this shader to two seperate shaders.
Thanks!