cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

tbarbour
Journeyman III

Problem with subpassLoad call?

I'm writing a Vulkan sample that uses an input attachment, calling subpassLoad in the fragment shader to access the attachment. The sample is crashing, deep in the AMD graphics driver on the call to vkCreateGraphicsPipeline. This sample passes validation, runs correctly on Intel and Nvidia graphics, and it runs correctly on AMD graphics if I replace the shader call to subpassLoad with a constant color, making me think there may be a problem with subpassLoad in the AMD Vulkan driver. This is on Windows 10, Radeon HD 7700 graphics, Vulkan driver version 1.3.0. 

0 Likes
1 Solution

The fragment shader used by the application does not specify which set and binding the input attachment should use, which is why you're seeing the crash. The following one-line fix causes a yellow triangle to be rendered on screen:

diff --git a/API-Samples/input_attachment/input_attachment.cpp b/API-Samples/input_attachment/input_attachment.cpp

index 01fc597..05bc9d8 100644

--- a/API-Samples/input_attachment/input_attachment.cpp

+++ b/API-Samples/input_attachment/input_attachment.cpp

@@ -53,7 +53,7 @@ static const char *fragShaderText =

     "#version 400\n"

     "#extension GL_ARB_separate_shader_objects : enable\n"

     "#extension GL_ARB_shading_language_420pack : enable\n"

-    "layout (input_attachment_index = 0) uniform subpassInput "

+    "layout (input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput "

     "myInputAttachment;\n"

     "layout (location = 0) out vec4 outColor;\n"

     "void main() {\n"

View solution in original post

0 Likes
5 Replies
dwitczak
Staff

Thank you for your report. Our internal automated tests do cover input attachments, so I would appreciate if you could either provide a diff based on SDK's cube / tri app, or point me to a simple app which reproduces the issue.

0 Likes

I've created a pull request on LunarG's VulkanSamples repo that contains the mentioned input_attachment sample.  Let me know if you run into problems or have suggestions.  Thanks!

samples: Add sample that uses an input attachment by Tony-LunarG · Pull Request #99 · LunarG/VulkanS...

0 Likes

The fragment shader used by the application does not specify which set and binding the input attachment should use, which is why you're seeing the crash. The following one-line fix causes a yellow triangle to be rendered on screen:

diff --git a/API-Samples/input_attachment/input_attachment.cpp b/API-Samples/input_attachment/input_attachment.cpp

index 01fc597..05bc9d8 100644

--- a/API-Samples/input_attachment/input_attachment.cpp

+++ b/API-Samples/input_attachment/input_attachment.cpp

@@ -53,7 +53,7 @@ static const char *fragShaderText =

     "#version 400\n"

     "#extension GL_ARB_separate_shader_objects : enable\n"

     "#extension GL_ARB_shading_language_420pack : enable\n"

-    "layout (input_attachment_index = 0) uniform subpassInput "

+    "layout (input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput "

     "myInputAttachment;\n"

     "layout (location = 0) out vec4 outColor;\n"

     "void main() {\n"

0 Likes

Got it - thanks for your help.

0 Likes

Glad to be of help. Please consider marking this thread as answered, when you get a free second. Thanks!

0 Likes