Tell the debug layer what the name of the shader is

Always bind both buffer descriptor sets
This commit is contained in:
Magnus Norddahl 2022-06-12 07:44:04 +02:00 committed by Christoph Oelckers
parent 821bd3b460
commit 32d059e432
3 changed files with 13 additions and 11 deletions

View file

@ -198,7 +198,7 @@ void VkRenderState::Apply(int dt)
ApplyDepthBias(); ApplyDepthBias();
ApplyPushConstants(); ApplyPushConstants();
ApplyVertexBuffers(); ApplyVertexBuffers();
ApplyDynamicSet(); ApplyHWBufferSet();
ApplyMaterial(); ApplyMaterial();
mNeedApply = false; mNeedApply = false;
@ -268,11 +268,6 @@ void VkRenderState::ApplyRenderPass(int dt)
mCommandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mPassSetup->GetPipeline(pipelineKey)); mCommandBuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, mPassSetup->GetPipeline(pipelineKey));
mPipelineKey = pipelineKey; mPipelineKey = pipelineKey;
} }
if (!inRenderPass)
{
mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, fb->GetRenderPassManager()->GetPipelineLayout(mPipelineKey.NumTextureLayers), 0, fb->GetDescriptorSetManager()->GetFixedDescriptorSet());
}
} }
void VkRenderState::ApplyStencilRef() void VkRenderState::ApplyStencilRef()
@ -443,12 +438,13 @@ void VkRenderState::ApplyMaterial()
VulkanDescriptorSet* descriptorset = mMaterial.mMaterial ? static_cast<VkMaterial*>(mMaterial.mMaterial)->GetDescriptorSet(mMaterial) : descriptors->GetNullTextureDescriptorSet(); VulkanDescriptorSet* descriptorset = mMaterial.mMaterial ? static_cast<VkMaterial*>(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); mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, passManager->GetPipelineLayout(mPipelineKey.NumTextureLayers), 2, descriptorset);
mMaterial.mChanged = false; mMaterial.mChanged = false;
} }
} }
void VkRenderState::ApplyDynamicSet() void VkRenderState::ApplyHWBufferSet()
{ {
uint32_t matrixOffset = mMatrixBufferWriter.Offset(); uint32_t matrixOffset = mMatrixBufferWriter.Offset();
uint32_t streamDataOffset = mStreamBufferWriter.StreamDataOffset(); uint32_t streamDataOffset = mStreamBufferWriter.StreamDataOffset();
@ -458,6 +454,7 @@ void VkRenderState::ApplyDynamicSet()
auto descriptors = fb->GetDescriptorSetManager(); auto descriptors = fb->GetDescriptorSetManager();
uint32_t offsets[3] = { mViewpointOffset, matrixOffset, streamDataOffset }; 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); mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, passManager->GetPipelineLayout(mPipelineKey.NumTextureLayers), 1, descriptors->GetHWBufferDescriptorSet(), 3, offsets);
mLastViewpointOffset = mViewpointOffset; mLastViewpointOffset = mViewpointOffset;

View file

@ -60,7 +60,7 @@ protected:
void ApplyStreamData(); void ApplyStreamData();
void ApplyMatrices(); void ApplyMatrices();
void ApplyPushConstants(); void ApplyPushConstants();
void ApplyDynamicSet(); void ApplyHWBufferSet();
void ApplyVertexBuffers(); void ApplyVertexBuffers();
void ApplyMaterial(); void ApplyMaterial();

View file

@ -141,7 +141,8 @@ VkShaderProgram *VkShaderManager::GetEffect(int effect, EPassType passType)
VkShaderProgram *VkShaderManager::Get(unsigned int eff, bool alphateston, 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 // indices 0-2 match the warping modes, 3 no texture, the following are custom
if (!alphateston && eff < SHADER_NoTexture) if (!alphateston && eff < SHADER_NoTexture)
{ {
@ -342,7 +343,9 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadVertShader(FString shadername
ShaderBuilder builder; ShaderBuilder builder;
builder.setVertexShader(code); 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<VulkanShader> VkShaderManager::LoadFragShader(FString shadername, const char *frag_lump, const char *material_lump, const char *light_lump, const char *defines, bool alphatest, bool gbufferpass) std::unique_ptr<VulkanShader> 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<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
ShaderBuilder builder; ShaderBuilder builder;
builder.setFragmentShader(code); 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() FString VkShaderManager::GetTargetGlslVersion()