Draft Vulkan DescriptorHeap

A utility class from a personal project for managing a heap of
descriptors of a particular layout.

Allows the display graphics pipeline to be successfully created,
satisfying its descriptor layout issues.
This commit is contained in:
Wunkolo
2023-08-20 21:29:37 -07:00
parent 6ebbd80286
commit 72c77e41b4
5 changed files with 189 additions and 5 deletions

View File

@@ -1093,6 +1093,17 @@ void RendererVK::initGraphicsContext(SDL_Window* window) {
}
}
static vk::DescriptorSetLayoutBinding displayShaderLayout[] = {
{// Just a singular texture slot
0, vk::DescriptorType::eCombinedImageSampler, 1, vk::ShaderStageFlagBits::eFragment},
};
if (auto createResult = Vulkan::DescriptorHeap::create(device.get(), displayShaderLayout); createResult.has_value()) {
displayDescriptorHeap = std::make_unique<Vulkan::DescriptorHeap>(std::move(createResult.value()));
} else {
Helpers::panic("Error creating descriptor heap\n");
}
auto vk_resources = cmrc::RendererVK::get_filesystem();
auto displayVertexShader = vk_resources.open("vulkan_display.vert.spv");
auto displayFragmentShader = vk_resources.open("vulkan_display.frag.spv");
@@ -1103,7 +1114,8 @@ void RendererVK::initGraphicsContext(SDL_Window* window) {
vk::RenderPass screenTextureRenderPass = getRenderPass(screenTextureInfo.format, {});
std::tie(displayPipeline, displayPipelineLayout) = createGraphicsPipeline(
device.get(), {}, {}, displayVertexShaderModule.get(), displayFragmentShaderModule.get(), {}, {}, screenTextureRenderPass
device.get(), {}, {{displayDescriptorHeap.get()->getDescriptorSetLayout()}}, displayVertexShaderModule.get(),
displayFragmentShaderModule.get(), {}, {}, screenTextureRenderPass
);
}