Create shadow framebuffer
This commit is contained in:
1 parent
da10aaab41
commit
8725f3082c
2 files changed
+15
No files matched your search
@@ -768,6 +768,19 @@ void gpu_init(gpu_ctx_t *ctx, GLFWwindow *window, const char *name)
|
||||
assert(result == VK_SUCCESS);
|
||||
|
||||
// Create framebuffers
|
||||
const VkFramebufferCreateInfo shadow_framebuffer_config = {
|
||||
.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
|
||||
.renderPass = ctx->shadow_pass,
|
||||
.attachmentCount = 1,
|
||||
.pAttachments = &ctx->shadow_view,
|
||||
.width = SHADOW_IMG_SIZE,
|
||||
.height = SHADOW_IMG_SIZE,
|
||||
.layers = 1,
|
||||
};
|
||||
result = vkCreateFramebuffer(
|
||||
ctx->dev, &shadow_framebuffer_config, nullptr,
|
||||
&ctx->shadow_framebuf);
|
||||
assert(result == VK_SUCCESS);
|
||||
for (unsigned i = 0; i < ctx->swapchain_img_count; ++i) {
|
||||
VkImageView attachments[] = {
|
||||
ctx->swapchain_img_views[i],
|
||||
@@ -885,6 +898,7 @@ void gpu_cleanup(const gpu_ctx_t *ctx)
|
||||
vkDestroyImage(ctx->dev, ctx->depth_img, nullptr);
|
||||
vkFreeMemory(ctx->dev, ctx->depth_mem, nullptr);
|
||||
|
||||
vkDestroyFramebuffer(ctx->dev, ctx->shadow_framebuf, nullptr);
|
||||
for (unsigned i = 0; i < ctx->swapchain_img_count; ++i) {
|
||||
vkDestroyFramebuffer(ctx->dev, ctx->framebuffers[i], nullptr);
|
||||
vkDestroyImageView(ctx->dev, ctx->swapchain_img_views[i], nullptr);
|
||||
|
||||
Reference in new issue
Block a user