Vulkan: Remove unnecessary index buffer for backbuffer drawcall

This commit is contained in:
Exzap 2024-02-27 00:15:43 +01:00
parent 8f1cd4f925
commit b8d81283e8
2 changed files with 1 additions and 24 deletions

View File

@ -540,7 +540,6 @@ VulkanRenderer::VulkanRenderer()
QueryMemoryInfo();
QueryAvailableFormats();
CreateBackbufferIndexBuffer();
CreateCommandPool();
CreateCommandBuffers();
CreateDescriptorPool();
@ -624,7 +623,6 @@ VulkanRenderer::~VulkanRenderer()
DeleteNullObjects();
// delete buffers
memoryManager->DeleteBuffer(m_indexBuffer, m_indexBufferMemory);
memoryManager->DeleteBuffer(m_uniformVarBuffer, m_uniformVarBufferMemory);
memoryManager->DeleteBuffer(m_textureReadbackBuffer, m_textureReadbackBufferMemory);
memoryManager->DeleteBuffer(m_xfbRingBuffer, m_xfbRingBufferMemory);
@ -2836,18 +2834,6 @@ void VulkanRenderer::ClearColorImage(LatteTextureVk* vkTexture, uint32 sliceInde
vkTexture->SetImageLayout(subresourceRange, outputLayout);
}
void VulkanRenderer::CreateBackbufferIndexBuffer()
{
const VkDeviceSize bufferSize = sizeof(uint16) * 6;
memoryManager->CreateBuffer(bufferSize, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, m_indexBuffer, m_indexBufferMemory);
uint16* data;
vkMapMemory(m_logicalDevice, m_indexBufferMemory, 0, bufferSize, 0, (void**)&data);
const uint16 tmp[] = { 0, 1, 2, 3, 4, 5 };
std::copy(std::begin(tmp), std::end(tmp), data);
vkUnmapMemory(m_logicalDevice, m_indexBufferMemory);
}
void VulkanRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutputShader* shader, bool useLinearTexFilter, sint32 imageX, sint32 imageY, sint32 imageWidth, sint32 imageHeight, bool padView, bool clearBackground)
{
if(!AcquireNextSwapchainImage(!padView))
@ -2906,11 +2892,9 @@ void VulkanRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
vkCmdBindPipeline(m_state.currentCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
m_state.currentPipeline = pipeline;
vkCmdBindIndexBuffer(m_state.currentCommandBuffer, m_indexBuffer, 0, VK_INDEX_TYPE_UINT16);
vkCmdBindDescriptorSets(m_state.currentCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &descriptSet, 0, nullptr);
vkCmdDrawIndexed(m_state.currentCommandBuffer, 6, 1, 0, 0, 0);
vkCmdDraw(m_state.currentCommandBuffer, 6, 1, 0, 0);
vkCmdEndRenderPass(m_state.currentCommandBuffer);

View File

@ -548,15 +548,11 @@ private:
void sync_RenderPassStoreTextures(CachedFBOVk* fboVk);
// command buffer
VkCommandBuffer getCurrentCommandBuffer() const { return m_state.currentCommandBuffer; }
// uniform
void uniformData_updateUniformVars(uint32 shaderStageIndex, LatteDecompilerShader* shader);
// indices
void CreateBackbufferIndexBuffer();
// misc
void CreatePipelineCache();
VkPipelineShaderStageCreateInfo CreatePipelineShaderStageCreateInfo(VkShaderStageFlagBits stage, VkShaderModule& module, const char* entryName) const;
@ -580,9 +576,6 @@ private:
void occlusionQuery_notifyBeginCommandBuffer();
private:
VkBuffer m_indexBuffer = VK_NULL_HANDLE;
VkDeviceMemory m_indexBufferMemory = VK_NULL_HANDLE;
std::vector<const char*> m_layerNames;
VkInstance m_instance = VK_NULL_HANDLE;
VkPhysicalDevice m_physicalDevice = VK_NULL_HANDLE;