mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 09:09:18 +01:00
Vulkan: Remove unnecessary index buffer for backbuffer drawcall
This commit is contained in:
parent
8f1cd4f925
commit
b8d81283e8
@ -540,7 +540,6 @@ VulkanRenderer::VulkanRenderer()
|
|||||||
|
|
||||||
QueryMemoryInfo();
|
QueryMemoryInfo();
|
||||||
QueryAvailableFormats();
|
QueryAvailableFormats();
|
||||||
CreateBackbufferIndexBuffer();
|
|
||||||
CreateCommandPool();
|
CreateCommandPool();
|
||||||
CreateCommandBuffers();
|
CreateCommandBuffers();
|
||||||
CreateDescriptorPool();
|
CreateDescriptorPool();
|
||||||
@ -624,7 +623,6 @@ VulkanRenderer::~VulkanRenderer()
|
|||||||
DeleteNullObjects();
|
DeleteNullObjects();
|
||||||
|
|
||||||
// delete buffers
|
// delete buffers
|
||||||
memoryManager->DeleteBuffer(m_indexBuffer, m_indexBufferMemory);
|
|
||||||
memoryManager->DeleteBuffer(m_uniformVarBuffer, m_uniformVarBufferMemory);
|
memoryManager->DeleteBuffer(m_uniformVarBuffer, m_uniformVarBufferMemory);
|
||||||
memoryManager->DeleteBuffer(m_textureReadbackBuffer, m_textureReadbackBufferMemory);
|
memoryManager->DeleteBuffer(m_textureReadbackBuffer, m_textureReadbackBufferMemory);
|
||||||
memoryManager->DeleteBuffer(m_xfbRingBuffer, m_xfbRingBufferMemory);
|
memoryManager->DeleteBuffer(m_xfbRingBuffer, m_xfbRingBufferMemory);
|
||||||
@ -2836,18 +2834,6 @@ void VulkanRenderer::ClearColorImage(LatteTextureVk* vkTexture, uint32 sliceInde
|
|||||||
vkTexture->SetImageLayout(subresourceRange, outputLayout);
|
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)
|
void VulkanRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutputShader* shader, bool useLinearTexFilter, sint32 imageX, sint32 imageY, sint32 imageWidth, sint32 imageHeight, bool padView, bool clearBackground)
|
||||||
{
|
{
|
||||||
if(!AcquireNextSwapchainImage(!padView))
|
if(!AcquireNextSwapchainImage(!padView))
|
||||||
@ -2906,11 +2892,9 @@ void VulkanRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
|
|||||||
vkCmdBindPipeline(m_state.currentCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
vkCmdBindPipeline(m_state.currentCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||||
m_state.currentPipeline = 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);
|
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);
|
vkCmdEndRenderPass(m_state.currentCommandBuffer);
|
||||||
|
|
||||||
|
@ -548,15 +548,11 @@ private:
|
|||||||
void sync_RenderPassStoreTextures(CachedFBOVk* fboVk);
|
void sync_RenderPassStoreTextures(CachedFBOVk* fboVk);
|
||||||
|
|
||||||
// command buffer
|
// command buffer
|
||||||
|
|
||||||
VkCommandBuffer getCurrentCommandBuffer() const { return m_state.currentCommandBuffer; }
|
VkCommandBuffer getCurrentCommandBuffer() const { return m_state.currentCommandBuffer; }
|
||||||
|
|
||||||
// uniform
|
// uniform
|
||||||
void uniformData_updateUniformVars(uint32 shaderStageIndex, LatteDecompilerShader* shader);
|
void uniformData_updateUniformVars(uint32 shaderStageIndex, LatteDecompilerShader* shader);
|
||||||
|
|
||||||
// indices
|
|
||||||
void CreateBackbufferIndexBuffer();
|
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
void CreatePipelineCache();
|
void CreatePipelineCache();
|
||||||
VkPipelineShaderStageCreateInfo CreatePipelineShaderStageCreateInfo(VkShaderStageFlagBits stage, VkShaderModule& module, const char* entryName) const;
|
VkPipelineShaderStageCreateInfo CreatePipelineShaderStageCreateInfo(VkShaderStageFlagBits stage, VkShaderModule& module, const char* entryName) const;
|
||||||
@ -580,9 +576,6 @@ private:
|
|||||||
void occlusionQuery_notifyBeginCommandBuffer();
|
void occlusionQuery_notifyBeginCommandBuffer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VkBuffer m_indexBuffer = VK_NULL_HANDLE;
|
|
||||||
VkDeviceMemory m_indexBufferMemory = VK_NULL_HANDLE;
|
|
||||||
|
|
||||||
std::vector<const char*> m_layerNames;
|
std::vector<const char*> m_layerNames;
|
||||||
VkInstance m_instance = VK_NULL_HANDLE;
|
VkInstance m_instance = VK_NULL_HANDLE;
|
||||||
VkPhysicalDevice m_physicalDevice = VK_NULL_HANDLE;
|
VkPhysicalDevice m_physicalDevice = VK_NULL_HANDLE;
|
||||||
|
Loading…
Reference in New Issue
Block a user