diff options
Diffstat (limited to 'video.cpp')
-rw-r--r-- | video.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -1386,7 +1386,7 @@ void Device_Vk::create_depth(int w, int h) { destroy_texture(depth); depth = create_texture( "default depth", - texture_format_d32, + texture_format_d24s8, Texture_Flags::sampleable | Texture_Flags::depth_stencil_target, w, h, @@ -1628,8 +1628,8 @@ void Renderpass_Vk::init( const Rpo_Key& rpk ) { VkRenderPassCreateInfo ri{}; - VkAttachmentDescription ads[max_colour_attachments + 1]; - VkAttachmentReference cars[max_colour_attachments], dar; + VkAttachmentDescription ads[2]; + VkAttachmentReference car, dar; VkSubpassDescription sd{}; VkResult r; auto& rp = rpk.rpo; @@ -1637,12 +1637,10 @@ 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); @@ -1679,7 +1677,7 @@ void Renderpass_Vk::init( sd.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; sd.colorAttachmentCount = rp.colour_count; - sd.pColorAttachments = cars; + sd.pColorAttachments = &car; sd.pDepthStencilAttachment = has_depth? &dar: 0; ri.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; @@ -1706,7 +1704,7 @@ void Framebuffer_Vk::init( ) { bool has_depth = rp.depth.id; int i, count = 0; - VkImageView atts[max_colour_attachments + 1]; + VkImageView atts[2]; VkResult r; VkFramebufferCreateInfo fbi{}; for (i = 0; i < rp.colour_count; i++) { @@ -2882,11 +2880,12 @@ 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 * c); + zero(abs, sizeof *abs); for (i = 0; i < c; i++) { auto& ab = abs[i]; ab.colorWriteMask = |