0

I am working on a deferred renderer. I tried to set up the lighting pass (not an accurate term in the context of dynamic rendering but you get the idea) with dynamic rendering:

VkRenderingAttachmentInfo color_attachment_0 = {};
color_attachment_0.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
color_attachment_0.imageView = _lit_image->vk_view;
color_attachment_0.imageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
color_attachment_0.resolveMode = VK_RESOLVE_MODE_NONE;
color_attachment_0.resolveImageView = VK_NULL_HANDLE;
color_attachment_0.resolveImageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
color_attachment_0.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
color_attachment_0.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
color_attachment_0.clearValue.color.float32[0] = 0.0f;
color_attachment_0.clearValue.color.float32[1] = 0.0f;
color_attachment_0.clearValue.color.float32[2] = 0.0f;
color_attachment_0.clearValue.color.float32[3] = 1.0f;          

VkRenderingInfo pass_begin = {};
pass_begin.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
pass_begin.renderArea = { { 0, 0 }, { window_width, window_height } };
pass_begin.layerCount = 1;
pass_begin.viewMask = 0;
pass_begin.colorAttachmentCount = 1;
pass_begin.pColorAttachments = &color_attachment_0;
pass_begin.pDepthAttachment = VK_NULL_HANDLE;
pass_begin.pStencilAttachment = VK_NULL_HANDLE;

vkCmdBeginRendering(cmd_buf->vk_command_buffer, &pass_begin);
// bind pipeline
// ...
vkCmdEndRendering();

Visual Studio debugger throws exception 0xC0000005: Access violation reading location 0x0000000000000068at vkCmdBeginRendering. Validation layer did not give any error.

I checked _lit_image->vk_view at runtime, the handle was valid. I don't think any pointer, any object in the snippet above accidentally got invalidated either.

What could possibly be the problem?

Before the lighting pass, I had G-pass carried out with dynamic rendering. The G-pass had zero issue because I managed to show every G-buffer on screen. So I don't think the exception was caused by vkCmdBeginRendering() function pointer.

I tried pointing pDepthAttachment to a depth attachment, the exception is gone. This doesn't make much sense to me as why would a null depth attachment pointer cause a crash

2
  • Are you attempting to call directly the prototype defined in the header? If yes, does the answer to this question answser yours? Commented Jun 2 at 18:21
  • where is "cmd_buf" ? Commented Jun 3 at 12:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.