I am trying to write the hello world triangle in Vulkan and I got a very weird bug with the renderpass. The render pass has one attachment, that has the load op VK_ATTACHMENT_LOAD_OP_CLEAR. The whole attachment description looks like this:
AttachmentDescription.flags = 0;
AttachmentDescription.format = format;
AttachmentDescription.samples = VK_SAMPLE_COUNT_1_BIT;
AttachmentDescription.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
AttachmentDescription.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
AttachmentDescription.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
AttachmentDescription.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
AttachmentDescription.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
AttachmentDescription.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
The only subpass in the renderpass looks like this:
SubpassDescription.flags = 0;
SubpassDescription.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
SubpassDescription.inputAttachmentCount = 0;
SubpassDescription.pInputAttachments = nullptr;
SubpassDescription.colorAttachmentCount = 1;
SubpassDescription.pColorAttachments = &AttachmentReference;
SubpassDescription.pResolveAttachments = nullptr;
SubpassDescription.pDepthStencilAttachment = nullptr;
SubpassDescription.preserveAttachmentCount = 0;
SubpassDescription.pPreserveAttachments = nullptr;
The clear color looks like this:
VkClearColorValue clearColor = {};
clearColor.float32[0] = 1.0f;
clearColor.float32[1] = 0.0f;
clearColor.float32[2] = 1.0f;
clearColor.float32[3] = 1.0f;
Now, what I expect from this would be a magenta screen if the format is RGBA or something else, but regardless of what values I insert in R(clearColor.float32[0] = 1.0f), G(clearColor.float32[1] = 0.0f) and A(clearColor.float32[3] = 1.0f), the only value that is really aknowledged is B(clearColor.float32[2] = 1.0f). The blue color channel is fully acknowledged, I can slide from 1.0f to 0.0f and the output is correct. But the other 3 channels seem to don’t be used for the output. What am I doing wrong?