diff --git a/vulkan.d b/vulkan.d index 10b9af8..221fa93 100644 --- a/vulkan.d +++ b/vulkan.d @@ -435,6 +435,9 @@ struct Vulkan BufferView a_buffer_view; ImageView aux_image; + f32[4] color_clear; + f32[4] depth_clear; + alias queues this; } @@ -770,6 +773,13 @@ BeginFrame(Vulkan* vk) VkCheckA("BeginFrame failure: vkBeginCommandBuffer error", result); } +void +SetClearColors(Vulkan* vk, f32[4] color_clear, f32[4] depth_clear) +{ + vk.color_clear = color_clear; + vk.depth_clear = depth_clear; +} + void BeginRendering(Vulkan* vk) { @@ -782,12 +792,12 @@ BeginRendering(Vulkan* vk) VkClearValue[2] clear_color = [ { color: { - float32: [0.0, 0.0, 0.0, 1.0], + float32: vk.color_clear, }, }, { color: { - float32: [0.0, 0.0, 0.0, 0.0], + float32: vk.depth_clear, }, }, ]; @@ -806,8 +816,8 @@ BeginRendering(Vulkan* vk) height: vk.swapchain_extent.height, }, }, - //clearValueCount: cast(u32)clear_color.length, - //pClearValues: clear_color.ptr, + clearValueCount: cast(u32)clear_color.length, + pClearValues: clear_color.ptr, }; vkCmdBeginRenderPass(vk.cmds[vk.frame_index], &pass_info, VK_SUBPASS_CONTENTS_INLINE);