From 528c5a7ef9e3e7cadf9a2caefa3ca115b382df75 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 2 Mar 2025 17:28:07 +1100 Subject: シ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- video.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'video.cpp') diff --git a/video.cpp b/video.cpp index 28df58b..3e960be 100644 --- a/video.cpp +++ b/video.cpp @@ -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 = -- cgit v1.2.3-54-g00ecf