From 826bb92d569aa12215475faabb2a922cc45da14f Mon Sep 17 00:00:00 2001 From: goeiecool9999 <7033575+goeiecool9999@users.noreply.github.com> Date: Wed, 30 Oct 2024 00:32:03 +0100 Subject: [PATCH] use a single PushConstants command --- .../HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp index c2ff6a6a..37432eeb 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp @@ -2965,24 +2965,23 @@ void VulkanRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu vkCmdBindDescriptorSets(m_state.currentCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &descriptSet, 0, nullptr); // update push constants - Vector2f pushData; + Vector2f pushData[3]; // textureSrcResolution sint32 effectiveWidth, effectiveHeight; texView->baseTexture->GetEffectiveSize(effectiveWidth, effectiveHeight, 0); - pushData = {(float)effectiveWidth, (float)effectiveHeight}; - vkCmdPushConstants(m_state.currentCommandBuffer, m_pipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT, 0*sizeof(float)*2, sizeof(float)*2, &pushData); + pushData[0] = {(float)effectiveWidth, (float)effectiveHeight}; // nativeResolution - pushData = { + pushData[1] = { (float)texViewVk->baseTexture->width, (float)texViewVk->baseTexture->height, }; - vkCmdPushConstants(m_state.currentCommandBuffer, m_pipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT, 1*sizeof(float)*2, sizeof(float)*2, &pushData); // outputResolution - pushData = {(float)imageWidth,(float)imageHeight}; - vkCmdPushConstants(m_state.currentCommandBuffer, m_pipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT, 2*sizeof(float)*2, sizeof(float)*2, &pushData); + pushData[2] = {(float)imageWidth,(float)imageHeight}; + + vkCmdPushConstants(m_state.currentCommandBuffer, m_pipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(float) * 2 * 3, &pushData); vkCmdDraw(m_state.currentCommandBuffer, 6, 1, 0, 0);