Can I create an Immutable Sampler in Vulkan without binding an image to that bind point?
<p>I've been reading over the Vulkan spec and some examples from Khronos but I can't find a lot of information on Immutable Samplers in general. </p>

<p>What I'm trying to do is have a descriptor set full of immutable samplers (of type VK_DESCRIPTOR_TYPE_SAMPLER, not ...COMBINED_IMAGE_SAMPLER) and when I want to sample a texture, I access the sampler like this in my shader:</p>

<pre><code>layout (location = 0) out vec4 out_color;

layout (set = 0, binding = 0) uniform sampler immutableSampler;
layout (set = 3, binding = 0) uniform texture2D color;

void main()
{
    vec4 textureColor = texture(sampler2D(color, immutableSampler), in_uv);
    out_color = textureColor;
}
</code></pre>

<p>With this shader the idea is:</p>

<ul>
<li>In the pipeline layout I have an immutable sampler at binding point 0 in set 0</li>
<li>I also have a descriptor set (3) with an image described at binding point 0 which I bind as part of my command buffer</li>
<li>I apply the immutable sampler to the image in the shader</li>
<li>Then actually access the image as a <code>sampler2D</code></li>
</ul>

<p>However, the way I've seen it done in the Khronos sample is:</p>

<ul>
<li>Describe an immutable sampler of VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER at a bind point in the pipeline layout (providing only the sampler)</li>
<li>Create an image and bind it to the same binding point (without a sampler)</li>
<li>Access the image as a <code>sampler2D</code> in the shader; the image you've bound is paired with the immutable sampler at that binding</li>
</ul>

<p>In the Vulkan spec it does not say which way is "correct" only noting that:</p>

<blockquote>
  <p>If <code>descriptorType</code> specifies a <code>VK_DESCRIPTOR_TYPE_SAMPLER</code> or <code>VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER</code> type descriptor, then <code>pImmutableSamplers</code> can be used to initialize a set of immutable samplers.</p>
</blockquote>

<p>Now if my shader just worked the way I expected I wouldn't be asking this question. The problem I'm running into is that upon validation the Vulkan layers complain that my VkPipeline is using a descriptor set (set 0, binding 0 where the sampler lives) which has never been bound! Even if I bind garbage data there I'm still going to have to (at least once) update the descriptor set with garbage just to suppress another validation error. However at the same time the Vulkan spec says: </p>

<blockquote>
  <p>Immutable samplers are permanently bound into the set layout; later binding a sampler into an immutable sampler slot in a descriptor set is not allowed</p>
</blockquote>

<p>So binding data to that bind point wouldn't even be allowed!</p>

<p>I'm very unsure right now whether my approach to immutable samplers is even supposed to be valid as it's sort of ambiguous. The spec says I can bind a Sampler without an image but complains when I do and the few examples I've found are binding a Combined Image Sampler. Am I just doing this wrong?</p>

<p>If my approach is <em>supposed</em> to be valid and could work I'd really like that as I'm trying to architect a system for both DirectX 12 and Vulkan. DX12 has a place in its "root layout" (pipeline layout) where ALL immutable samplers are bound without images associated with them. I'd like to emulate this behavior to keep parity between the renderers but I'm very unsure if that's really possible with Vulkan and it's very ambiguous in the spec. </p>