Never clear the RenderPassSetup map as that will force pipelines to rebuild
This commit is contained in:
parent
3823196765
commit
8f180e3a3f
4 changed files with 18 additions and 6 deletions
|
|
@ -228,7 +228,6 @@ void VkRenderPassManager::WorkerThreadMain()
|
|||
|
||||
void VkRenderPassManager::RenderBuffersReset()
|
||||
{
|
||||
RenderPassSetup.clear();
|
||||
PPRenderPassSetup.clear();
|
||||
}
|
||||
|
||||
|
|
@ -396,7 +395,7 @@ VkRenderPassSetup::VkRenderPassSetup(VulkanRenderDevice* fb, const VkRenderPassK
|
|||
skip[SHADER_BasicFuzz] = true;
|
||||
skip[SHADER_SmoothFuzz] = true;
|
||||
skip[SHADER_SwirlyFuzz] = true;
|
||||
skip[SHADER_TranslucentFuzz] = true;
|
||||
//skip[SHADER_TranslucentFuzz] = true;
|
||||
skip[SHADER_JaggedFuzz] = true;
|
||||
skip[SHADER_NoiseFuzz] = true;
|
||||
skip[SHADER_SmoothNoiseFuzz] = true;
|
||||
|
|
@ -404,6 +403,9 @@ VkRenderPassSetup::VkRenderPassSetup(VulkanRenderDevice* fb, const VkRenderPassK
|
|||
int count = NUM_BUILTIN_SHADERS + usershaders.Size();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (i < NUM_BUILTIN_SHADERS && skip[i])
|
||||
continue;
|
||||
|
||||
fkey.ShaderKey.SpecialEffect = EFF_NONE;
|
||||
fkey.ShaderKey.EffectState = i;
|
||||
for (int j = 0; j < 16; j++)
|
||||
|
|
@ -420,9 +422,7 @@ VkRenderPassSetup::VkRenderPassSetup(VulkanRenderDevice* fb, const VkRenderPassK
|
|||
|
||||
std::unique_ptr<VulkanRenderPass> VkRenderPassSetup::CreateRenderPass(int clearTargets)
|
||||
{
|
||||
auto buffers = fb->GetBuffers();
|
||||
|
||||
VkFormat drawBufferFormats[] = { VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM, buffers->SceneNormalFormat };
|
||||
VkFormat drawBufferFormats[] = { VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM, PassKey.NormalFormat };
|
||||
|
||||
RenderPassBuilder builder;
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ std::unique_ptr<VulkanRenderPass> VkRenderPassSetup::CreateRenderPass(int clearT
|
|||
if (PassKey.DepthStencil)
|
||||
{
|
||||
builder.AddDepthStencilAttachment(
|
||||
buffers->SceneDepthStencilFormat, (VkSampleCountFlagBits)PassKey.Samples,
|
||||
PassKey.DepthStencilFormat, (VkSampleCountFlagBits)PassKey.Samples,
|
||||
(clearTargets & CT_Depth) ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE,
|
||||
(clearTargets & CT_Stencil) ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE,
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ public:
|
|||
int Samples = 0;
|
||||
int DrawBuffers = 0;
|
||||
VkFormat DrawBufferFormat = VK_FORMAT_UNDEFINED;
|
||||
VkFormat NormalFormat = VK_FORMAT_UNDEFINED;
|
||||
VkFormat DepthStencilFormat = VK_FORMAT_UNDEFINED;
|
||||
|
||||
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; }
|
||||
|
|
|
|||
|
|
@ -818,12 +818,16 @@ void VkRenderState::SetRenderTarget(VkTextureImage *image, VulkanImageView *dept
|
|||
{
|
||||
EndRenderPass();
|
||||
|
||||
auto buffers = fb->GetBuffers();
|
||||
|
||||
mRenderTarget.Image = image;
|
||||
mRenderTarget.DepthStencil = depthStencilView;
|
||||
mRenderTarget.Width = width;
|
||||
mRenderTarget.Height = height;
|
||||
mRenderTarget.Format = format;
|
||||
mRenderTarget.Samples = samples;
|
||||
mRenderTarget.NormalFormat = buffers->SceneNormalFormat;
|
||||
mRenderTarget.DepthStencilFormat = buffers->SceneDepthStencilFormat;
|
||||
}
|
||||
|
||||
void VkRenderState::BeginRenderPass(VulkanCommandBuffer *cmdbuffer)
|
||||
|
|
@ -833,6 +837,8 @@ void VkRenderState::BeginRenderPass(VulkanCommandBuffer *cmdbuffer)
|
|||
key.Samples = mRenderTarget.Samples;
|
||||
key.DrawBuffers = mRenderTarget.DrawBuffers;
|
||||
key.DepthStencil = !!mRenderTarget.DepthStencil;
|
||||
key.NormalFormat = mRenderTarget.NormalFormat;
|
||||
key.DepthStencilFormat = mRenderTarget.DepthStencilFormat;
|
||||
|
||||
mPassSetup = fb->GetRenderPassManager()->GetRenderPass(key);
|
||||
|
||||
|
|
@ -889,6 +895,8 @@ void VkRenderState::RaytraceScene(const FVector3& cameraPos, const VSMatrix& vie
|
|||
key.Samples = mRenderTarget.Samples;
|
||||
key.DrawBuffers = mRenderTarget.DrawBuffers;
|
||||
key.DepthStencil = !!mRenderTarget.DepthStencil;
|
||||
key.NormalFormat = mRenderTarget.NormalFormat;
|
||||
key.DepthStencilFormat = mRenderTarget.DepthStencilFormat;
|
||||
fb->GetLevelMesh()->RaytraceScene(key, mCommandBuffer, cameraPos, viewToWorld, fovy, aspect);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ protected:
|
|||
VkFormat Format = VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||
VkSampleCountFlagBits Samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
int DrawBuffers = 1;
|
||||
VkFormat NormalFormat = VK_FORMAT_UNDEFINED;
|
||||
VkFormat DepthStencilFormat = VK_FORMAT_UNDEFINED;
|
||||
} mRenderTarget;
|
||||
|
||||
TArray<uint32_t> mQueryResultsBuffer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue