diff options
author | quou <quou@disroot.org> | 2025-03-02 17:28:07 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2025-03-02 17:28:07 +1100 |
commit | 528c5a7ef9e3e7cadf9a2caefa3ca115b382df75 (patch) | |
tree | 4557c8cb90d182b4f82bc574d61204ff09b5f72f /video.cpp | |
parent | 3634e53cc68671a576754d6bb668f585f7e2c53d (diff) |
シ
Diffstat (limited to 'video.cpp')
-rw-r--r-- | video.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1628,8 +1628,8 @@ void Renderpass_Vk::init( const Rpo_Key& rpk ) { VkRenderPassCreateInfo ri{}; - VkAttachmentDescription ads[2]; - VkAttachmentReference car, dar; + VkAttachmentDescription ads[max_colour_attachments + 1]; + VkAttachmentReference cars[max_colour_attachments], dar; VkSubpassDescription sd{}; VkResult r; auto& rp = rpk.rpo; @@ -1637,10 +1637,12 @@ void Renderpass_Vk::init( bool has_depth = rp.depth.id; int count = 0, i, c = rp.colour_count; zero(ads, sizeof ads); + zero(cars, sizeof cars); for (i = 0; i < c; i++) { int index = count++; auto& colour = rp.colours[i]; auto& ad = ads[index]; + auto& car = cars[index]; ad.format = get_vk_format(colour.fmt); ad.samples = VK_SAMPLE_COUNT_1_BIT; ad.loadOp = load_op_from_mode(colour.mode); @@ -1677,7 +1679,7 @@ void Renderpass_Vk::init( sd.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; sd.colorAttachmentCount = rp.colour_count; - sd.pColorAttachments = &car; + sd.pColorAttachments = cars; sd.pDepthStencilAttachment = has_depth? &dar: 0; ri.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; @@ -1704,7 +1706,7 @@ void Framebuffer_Vk::init( ) { bool has_depth = rp.depth.id; int i, count = 0; - VkImageView atts[2]; + VkImageView atts[max_colour_attachments + 1]; VkResult r; VkFramebufferCreateInfo fbi{}; for (i = 0; i < rp.colour_count; i++) { @@ -2880,12 +2882,11 @@ void Pipeline_Vk::init_blending( zero(&bi, sizeof bi); if (rp.colour_count) { int i, c = rp.colour_count; - abs = - (VkPipelineColorBlendAttachmentState*)arena_alloc( + abs = (VkPipelineColorBlendAttachmentState*)arena_alloc( &scope, - sizeof abs * c + sizeof *abs * c ); - zero(abs, sizeof *abs); + zero(abs, sizeof *abs * c); for (i = 0; i < c; i++) { auto& ab = abs[i]; ab.colorWriteMask = |