Skip to content

Always write float output from the shader debug sampling shader - #3900

Open
jeremyg-lunarg wants to merge 1 commit into
baldurk:v1.xfrom
jeremyg-lunarg:jeremyg-output-mismatch
Open

Always write float output from the shader debug sampling shader#3900
jeremyg-lunarg wants to merge 1 commit into
baldurk:v1.xfrom
jeremyg-lunarg:jeremyg-output-mismatch

Conversation

@jeremyg-lunarg

Copy link
Copy Markdown
Contributor

The debug sampling shader renders into an R32G32B32A32_SFLOAT target but for integer textures, the output variable is declared to be integer. This is undefined behavior and it causes VK_Shader_Debug_Zoo, Section GLSL1, Test 180 to fail when running with KosmicKrisp. There is not a VUID about this, but the Validation layer reports
Undefined-Value-ShaderFragmentOutputMismatch, which is a warning.

The full validation error, which is only reported if you enable warnings (export VK_LAYER_REPORT_FLAGS=error,warn):

Validation Warning: [ Undefined-Value-ShaderFragmentOutputMismatch ] | MessageID = 0xe5642923
vkCreateGraphicsPipelines(): pCreateInfos[0] Inside [VK_SHADER_STAGE_FRAGMENT_BIT], it writes to
  [Output variable, Location 0, "output"] with a numeric type of UINT but VkSubpassDescription::pColorAttachments[0] 
  pointing at VkRenderPassCreateInfo::pAttachments[0] is created with VK_FORMAT_R32G32B32A32_SFLOAT
  (numeric type of FLOAT) which does not match and the resulting values written will be undefined.
Spec information at https://docs.vulkan.org/spec/latest/chapters/interfaces.html#interfaces-fragmentoutput
Objects: 1
    [0] VkShaderModule 0x5b000000005b0

The debug sampling shader renders into an R32G32B32A32_SFLOAT target but for
integer textures, the output variable is declared to be integer. This is
undefined behavior and it causes VK_Shader_Debug_Zoo, Section GLSL1, Test 180
to fail when running with KosmicKrisp. There is not a VUID about this, but
the Validation layer reports Undefined-Value-ShaderFragmentOutputMismatch,
which is a warning.

@baldurk baldurk left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be fixed with a bitcast on the shader side. Instead we should create one render path per format (SFLOAT/UINT/SINT) so that the native format is respected.

This can keep just the one image & readback path, and do the format cast in the image views. It'll need one image view+framebuffer+renderpass each.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants