#Is it possible to only render to a depth stencil without a pipeline with fragment shader

14 messages · Page 1 of 1 (latest)

royal kite
#

I want to render a to a depth buffer without ever attaching a color attachment but I've been getting these validation warnings

Validation Warning: [ Undefined-Value-ShaderOutputNotConsumed ] | MessageID = 0x9805298c
vkCreateGraphicsPipelines(): pCreateInfos[0] Inside the fragment shader, it writes to output Location 0 but there is no VkSubpassDescription::pColorAttachments[0] and this write is unused.
Spec information at https://docs.vulkan.org/spec/latest/chapters/interfaces.html#interfaces-fragmentoutput
Objects: 1
[0] VkShaderModule 0x2f000000002f

Validation Warning: [ Undefined-Value-ShaderOutputNotConsumed ] | MessageID = 0x9805298c
vkCreateGraphicsPipelines(): pCreateInfos[0] Inside the fragment shader, it writes to output Location 0 but there is no VkSubpassDescription::pColorAttachments[0] and this write is unused.
Spec information at https://docs.vulkan.org/spec/latest/chapters/interfaces.html#interfaces-fragmentoutput
Objects: 1
[0] VkShaderModule 0x320000000032

I want to leave out the color attachment and fragment shading while simply retaining the depth information?
Is it even worth attempting this?

warm parrot
#

So what is your fragment shader, you seem to be writing to Location 0 which is tied to a color attachment

remember, you can have multiple color attachments, but only ever a single depth/stencil attachment

This Validation message is a warning, not an error and is there to help people who are trying to figure out what their color attachment is blank

https://docs.vulkan.org/guide/latest/depth.html

#

If you remove the Fragment shader from the pipeline, it will not hit this validation warning

#

or you can also just have an empty fragment shader as well

royal kite
#

I think the warning is abit to scary.
I want 1 depth attachment and zero color attachments.
I dont have a black screen , everything looks correct I just though I was doing something wrong when this two messages showed up.

warm parrot
#

What does your fragment shader look like?

#

Or are you getting this warning without a frag shader?

royal kite
#

I'm using a library that uses wgsl and converts that to spirv

#

but my shader was just outputing a vec4(0)

warm parrot
#

So apparently it has an extra right to a color attachment... Nothing is wrong and the write will be discarded

#

What if you actually wanted to write that value to a color attachment and you forgot to attach the color attachment? This is why it's a warning

royal kite
#

I guess it makes sense.

#

thanks