diff --git a/src/common/rendering/vulkan/renderer/vk_renderstate.cpp b/src/common/rendering/vulkan/renderer/vk_renderstate.cpp index c8a10d30d..cc6be50a2 100644 --- a/src/common/rendering/vulkan/renderer/vk_renderstate.cpp +++ b/src/common/rendering/vulkan/renderer/vk_renderstate.cpp @@ -198,7 +198,7 @@ void VkRenderState::Apply(int dt) ApplyDepthBias(); ApplyPushConstants(); ApplyVertexBuffers(); - ApplyDynamicSet(); + ApplyHWBufferSet(); ApplyMaterial(); mNeedApply = false; @@ -268,11 +268,6 @@ void VkRenderState::ApplyRenderPass(int dt) mCommandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mPassSetup->GetPipeline(pipelineKey)); mPipelineKey = pipelineKey; } - - if (!inRenderPass) - { - mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, fb->GetRenderPassManager()->GetPipelineLayout(mPipelineKey.NumTextureLayers), 0, fb->GetDescriptorSetManager()->GetFixedDescriptorSet()); - } } void VkRenderState::ApplyStencilRef() @@ -443,12 +438,13 @@ void VkRenderState::ApplyMaterial() VulkanDescriptorSet* descriptorset = mMaterial.mMaterial ? static_cast(mMaterial.mMaterial)->GetDescriptorSet(mMaterial) : descriptors->GetNullTextureDescriptorSet(); + mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, fb->GetRenderPassManager()->GetPipelineLayout(mPipelineKey.NumTextureLayers), 0, fb->GetDescriptorSetManager()->GetFixedDescriptorSet()); mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, passManager->GetPipelineLayout(mPipelineKey.NumTextureLayers), 2, descriptorset); mMaterial.mChanged = false; } } -void VkRenderState::ApplyDynamicSet() +void VkRenderState::ApplyHWBufferSet() { uint32_t matrixOffset = mMatrixBufferWriter.Offset(); uint32_t streamDataOffset = mStreamBufferWriter.StreamDataOffset(); @@ -458,6 +454,7 @@ void VkRenderState::ApplyDynamicSet() auto descriptors = fb->GetDescriptorSetManager(); uint32_t offsets[3] = { mViewpointOffset, matrixOffset, streamDataOffset }; + mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, fb->GetRenderPassManager()->GetPipelineLayout(mPipelineKey.NumTextureLayers), 0, fb->GetDescriptorSetManager()->GetFixedDescriptorSet()); mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, passManager->GetPipelineLayout(mPipelineKey.NumTextureLayers), 1, descriptors->GetHWBufferDescriptorSet(), 3, offsets); mLastViewpointOffset = mViewpointOffset; diff --git a/src/common/rendering/vulkan/renderer/vk_renderstate.h b/src/common/rendering/vulkan/renderer/vk_renderstate.h index d6940393a..5dc463bfb 100644 --- a/src/common/rendering/vulkan/renderer/vk_renderstate.h +++ b/src/common/rendering/vulkan/renderer/vk_renderstate.h @@ -60,7 +60,7 @@ protected: void ApplyStreamData(); void ApplyMatrices(); void ApplyPushConstants(); - void ApplyDynamicSet(); + void ApplyHWBufferSet(); void ApplyVertexBuffers(); void ApplyMaterial(); diff --git a/src/common/rendering/vulkan/shaders/vk_shader.cpp b/src/common/rendering/vulkan/shaders/vk_shader.cpp index 20c536f0d..c5585be0a 100644 --- a/src/common/rendering/vulkan/shaders/vk_shader.cpp +++ b/src/common/rendering/vulkan/shaders/vk_shader.cpp @@ -141,7 +141,8 @@ VkShaderProgram *VkShaderManager::GetEffect(int effect, EPassType passType) VkShaderProgram *VkShaderManager::Get(unsigned int eff, bool alphateston, EPassType passType) { - if (compileIndex != -1) return &mMaterialShaders[0][0]; + if (compileIndex != -1) + return &mMaterialShaders[0][0]; // indices 0-2 match the warping modes, 3 no texture, the following are custom if (!alphateston && eff < SHADER_NoTexture) { @@ -342,7 +343,9 @@ std::unique_ptr VkShaderManager::LoadVertShader(FString shadername ShaderBuilder builder; builder.setVertexShader(code); - return builder.create(shadername.GetChars(), fb->device); + auto shader = builder.create(shadername.GetChars(), fb->device); + shader->SetDebugName(shadername.GetChars()); + return shader; } std::unique_ptr VkShaderManager::LoadFragShader(FString shadername, const char *frag_lump, const char *material_lump, const char *light_lump, const char *defines, bool alphatest, bool gbufferpass) @@ -432,7 +435,9 @@ std::unique_ptr VkShaderManager::LoadFragShader(FString shadername ShaderBuilder builder; builder.setFragmentShader(code); - return builder.create(shadername.GetChars(), fb->device); + auto shader = builder.create(shadername.GetChars(), fb->device); + shader->SetDebugName(shadername.GetChars()); + return shader; } FString VkShaderManager::GetTargetGlslVersion()