From c683e0ded8ec9e6f91ac1aa616ffe5257f9fbea9 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Wed, 11 Dec 2019 22:31:35 +0100 Subject: [PATCH] vulkan: push constants when starting render pass to avoid crash (mali) --- core/rend/vulkan/drawer.cpp | 4 ++++ core/rend/vulkan/oit/oit_drawer.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/core/rend/vulkan/drawer.cpp b/core/rend/vulkan/drawer.cpp index 1201ec63d..5cb540086 100644 --- a/core/rend/vulkan/drawer.cpp +++ b/core/rend/vulkan/drawer.cpp @@ -375,6 +375,10 @@ bool Drawer::Draw(const Texture *fogTexture) cmdBuffer.bindVertexBuffers(0, 1, &buffer, zeroOffset); cmdBuffer.bindIndexBuffer(buffer, offsets.indexOffset, vk::IndexType::eUint32); + // Make sure to push constants even if not used + std::array pushConstants = { 0, 0, 0, 0, 0 }; + cmdBuffer.pushConstants(pipelineManager->GetPipelineLayout(), vk::ShaderStageFlagBits::eFragment, 0, pushConstants); + RenderPass previous_pass = {}; for (int render_pass = 0; render_pass < pvrrc.render_passes.used(); render_pass++) { diff --git a/core/rend/vulkan/oit/oit_drawer.cpp b/core/rend/vulkan/oit/oit_drawer.cpp index 0da70a8c5..010486a15 100644 --- a/core/rend/vulkan/oit/oit_drawer.cpp +++ b/core/rend/vulkan/oit/oit_drawer.cpp @@ -284,6 +284,10 @@ bool OITDrawer::Draw(const Texture *fogTexture) cmdBuffer.bindVertexBuffers(0, 1, &mainBuffer, zeroOffset); cmdBuffer.bindIndexBuffer(mainBuffer, offsets.indexOffset, vk::IndexType::eUint32); + // Make sure to push constants even if not used + OITDescriptorSets::PushConstants pushConstants = { }; + cmdBuffer.pushConstants(pipelineManager->GetPipelineLayout(), vk::ShaderStageFlagBits::eFragment, 0, pushConstants); + const std::array clear_colors = { vk::ClearColorValue(std::array{0.f, 0.f, 0.f, 1.f}), vk::ClearColorValue(std::array{0.f, 0.f, 0.f, 1.f}),