mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 15:22:08 +00:00
- don't search for a renderpass if the current one matches
This commit is contained in:
parent
1d003ca3fc
commit
fd752dec54
3 changed files with 11 additions and 9 deletions
|
@ -20,10 +20,9 @@ public:
|
||||||
int VertexFormat;
|
int VertexFormat;
|
||||||
int DrawType;
|
int DrawType;
|
||||||
|
|
||||||
bool operator<(const VkRenderPassKey &other) const
|
bool operator<(const VkRenderPassKey &other) const { return memcmp(this, &other, sizeof(VkRenderPassKey)) < 0; }
|
||||||
{
|
bool operator==(const VkRenderPassKey &other) const { return memcmp(this, &other, sizeof(VkRenderPassKey)) == 0; }
|
||||||
return memcmp(this, &other, sizeof(VkRenderPassKey)) < 0;
|
bool operator!=(const VkRenderPassKey &other) const { return memcmp(this, &other, sizeof(VkRenderPassKey)) != 0; }
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VkRenderPassSetup
|
class VkRenderPassSetup
|
||||||
|
|
|
@ -231,10 +231,9 @@ void VkRenderState::ApplyRenderPass(int dt)
|
||||||
passKey.EffectState = mTextureEnabled ? effectState : SHADER_NoTexture;
|
passKey.EffectState = mTextureEnabled ? effectState : SHADER_NoTexture;
|
||||||
passKey.AlphaTest = mAlphaThreshold >= 0.f;
|
passKey.AlphaTest = mAlphaThreshold >= 0.f;
|
||||||
}
|
}
|
||||||
VkRenderPassSetup *passSetup = passManager->GetRenderPass(passKey);
|
|
||||||
|
|
||||||
// Is this the one we already have or do we need to change render pass?
|
// Is this the one we already have or do we need to change render pass?
|
||||||
bool changingRenderPass = (passSetup != mRenderPassSetup);
|
bool changingRenderPass = (passKey != mRenderPassKey);
|
||||||
|
|
||||||
if (!mCommandBuffer)
|
if (!mCommandBuffer)
|
||||||
{
|
{
|
||||||
|
@ -250,13 +249,16 @@ void VkRenderState::ApplyRenderPass(int dt)
|
||||||
|
|
||||||
if (changingRenderPass)
|
if (changingRenderPass)
|
||||||
{
|
{
|
||||||
|
VkRenderPassSetup *passSetup = passManager->GetRenderPass(passKey);
|
||||||
|
|
||||||
RenderPassBegin beginInfo;
|
RenderPassBegin beginInfo;
|
||||||
beginInfo.setRenderPass(passSetup->RenderPass.get());
|
beginInfo.setRenderPass(passSetup->RenderPass.get());
|
||||||
beginInfo.setRenderArea(0, 0, SCREENWIDTH, SCREENHEIGHT);
|
beginInfo.setRenderArea(0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||||
beginInfo.setFramebuffer(passSetup->Framebuffer.get());
|
beginInfo.setFramebuffer(passSetup->Framebuffer.get());
|
||||||
mCommandBuffer->beginRenderPass(beginInfo);
|
mCommandBuffer->beginRenderPass(beginInfo);
|
||||||
mCommandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, passSetup->Pipeline.get());
|
mCommandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, passSetup->Pipeline.get());
|
||||||
mRenderPassSetup = passSetup;
|
|
||||||
|
mRenderPassKey = passKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +553,7 @@ void VkRenderState::EndRenderPass()
|
||||||
{
|
{
|
||||||
mCommandBuffer->endRenderPass();
|
mCommandBuffer->endRenderPass();
|
||||||
mCommandBuffer = nullptr;
|
mCommandBuffer = nullptr;
|
||||||
mRenderPassSetup = nullptr;
|
mRenderPassKey = {};
|
||||||
|
|
||||||
// To do: move this elsewhere or rename this function to make it clear this can only happen at the end of a frame
|
// To do: move this elsewhere or rename this function to make it clear this can only happen at the end of a frame
|
||||||
mMatricesOffset = 0;
|
mMatricesOffset = 0;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "vulkan/system/vk_buffers.h"
|
#include "vulkan/system/vk_buffers.h"
|
||||||
#include "vulkan/shaders/vk_shader.h"
|
#include "vulkan/shaders/vk_shader.h"
|
||||||
|
#include "vulkan/renderer/vk_renderpass.h"
|
||||||
|
|
||||||
#include "name.h"
|
#include "name.h"
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ private:
|
||||||
|
|
||||||
bool mLastDepthClamp = true;
|
bool mLastDepthClamp = true;
|
||||||
VulkanCommandBuffer *mCommandBuffer = nullptr;
|
VulkanCommandBuffer *mCommandBuffer = nullptr;
|
||||||
VkRenderPassSetup *mRenderPassSetup = nullptr;
|
VkRenderPassKey mRenderPassKey = {};
|
||||||
bool mDynamicSetChanged = true;
|
bool mDynamicSetChanged = true;
|
||||||
|
|
||||||
int mScissorX = 0, mScissorY = 0, mScissorWidth = -1, mScissorHeight = -1;
|
int mScissorX = 0, mScissorY = 0, mScissorWidth = -1, mScissorHeight = -1;
|
||||||
|
|
Loading…
Reference in a new issue