Use the stencil and depth buffer settings from RenderState when drawing the level mesh
This commit is contained in:
parent
6b0e4345a2
commit
4a95eafc06
4 changed files with 21 additions and 19 deletions
|
|
@ -631,15 +631,7 @@ int VulkanRenderDevice::GetLevelMeshPipelineID(const MeshApplyData& applyData, c
|
|||
pipelineKey.DrawType = DT_Triangles;
|
||||
pipelineKey.VertexFormat = levelVertexFormatIndex;
|
||||
pipelineKey.RenderStyle = applyData.RenderStyle;
|
||||
pipelineKey.DepthTest = true; // mDepthTest;
|
||||
pipelineKey.DepthWrite = true; // mDepthTest && mDepthWrite;
|
||||
pipelineKey.DepthFunc = applyData.DepthFunc;
|
||||
pipelineKey.DepthClamp = false; // mDepthClamp;
|
||||
pipelineKey.DepthBias = false; // !(mBias.mFactor == 0 && mBias.mUnits == 0);
|
||||
pipelineKey.StencilTest = false; // mStencilTest;
|
||||
pipelineKey.StencilPassOp = 0; // mStencilOp;
|
||||
pipelineKey.ColorMask = 15; // mColorMask;
|
||||
pipelineKey.CullMode = Cull_CW; // mCullMode;
|
||||
pipelineKey.NumTextureLayers = material.mMaterial ? material.mMaterial->NumLayers() : 0;
|
||||
pipelineKey.NumTextureLayers = max(pipelineKey.NumTextureLayers, SHADER_MIN_REQUIRED_TEXTURE_LAYERS);// Always force minimum 8 textures as the shader requires it
|
||||
if (applyData.SpecialEffect > EFF_NONE)
|
||||
|
|
|
|||
|
|
@ -858,17 +858,12 @@ void VkRenderState::DrawLevelMeshDepthPass()
|
|||
auto submesh = fb->GetRaytrace()->GetMesh()->StaticMesh.get();
|
||||
for (LevelSubmeshDrawRange& range : submesh->DrawList)
|
||||
{
|
||||
VkPipelineKey pipelineKey = fb->GetLevelMeshPipelineKey(range.PipelineID);
|
||||
if (pipelineKey.ShaderKey.AlphaTest) continue;
|
||||
pipelineKey.ShaderKey.NoFragmentShader = true;
|
||||
DrawLevelMeshRange(mCommandBuffer, pipelineKey, range.Start, range.Count);
|
||||
DrawLevelMeshRange(mCommandBuffer, fb->GetLevelMeshPipelineKey(range.PipelineID), range.Start, range.Count, true);
|
||||
}
|
||||
/*
|
||||
for (LevelSubmeshDrawRange& range : submesh->PortalList)
|
||||
{
|
||||
VkPipelineKey pipelineKey = fb->GetLevelMeshPipelineKey(range.PipelineID);
|
||||
pipelineKey.ShaderKey.NoFragmentShader = true;
|
||||
DrawLevelMeshRange(mCommandBuffer, pipelineKey, range.Start, range.Count);
|
||||
DrawLevelMeshRange(mCommandBuffer, fb->GetLevelMeshPipelineKey(range.PipelineID), range.Start, range.Count, true);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -880,7 +875,7 @@ void VkRenderState::DrawLevelMeshOpaquePass()
|
|||
auto submesh = fb->GetRaytrace()->GetMesh()->StaticMesh.get();
|
||||
for (LevelSubmeshDrawRange& range : submesh->DrawList)
|
||||
{
|
||||
DrawLevelMeshRange(mCommandBuffer, fb->GetLevelMeshPipelineKey(range.PipelineID), range.Start, range.Count);
|
||||
DrawLevelMeshRange(mCommandBuffer, fb->GetLevelMeshPipelineKey(range.PipelineID), range.Start, range.Count, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -916,8 +911,21 @@ void VkRenderState::GetQueryResults(int queryStart, int queryCount, TArray<bool>
|
|||
}
|
||||
}
|
||||
|
||||
void VkRenderState::DrawLevelMeshRange(VulkanCommandBuffer* cmdbuffer, const VkPipelineKey& pipelineKey, int start, int count)
|
||||
void VkRenderState::DrawLevelMeshRange(VulkanCommandBuffer* cmdbuffer, VkPipelineKey pipelineKey, int start, int count, bool noFragmentShader)
|
||||
{
|
||||
if (noFragmentShader && pipelineKey.ShaderKey.AlphaTest)
|
||||
return;
|
||||
|
||||
pipelineKey.ShaderKey.NoFragmentShader = noFragmentShader;
|
||||
pipelineKey.DepthTest = mDepthTest;
|
||||
pipelineKey.DepthWrite = mDepthTest && mDepthWrite;
|
||||
pipelineKey.DepthClamp = mDepthClamp;
|
||||
pipelineKey.DepthBias = !(mBias.mFactor == 0 && mBias.mUnits == 0);
|
||||
pipelineKey.StencilTest = mStencilTest;
|
||||
pipelineKey.StencilPassOp = mStencilOp;
|
||||
pipelineKey.ColorMask = mColorMask;
|
||||
pipelineKey.CullMode = mCullMode;
|
||||
|
||||
PushConstants pushConstants = {};
|
||||
pushConstants.uDataIndex = 0;
|
||||
pushConstants.uLightIndex = -1;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ protected:
|
|||
void WaitForStreamBuffers();
|
||||
|
||||
void ApplyLevelMesh();
|
||||
void DrawLevelMeshRange(VulkanCommandBuffer* cmdbuffer, const VkPipelineKey& pipelineKey, int start, int count);
|
||||
void DrawLevelMeshRange(VulkanCommandBuffer* cmdbuffer, VkPipelineKey pipelineKey, int start, int count, bool noFragmentShader);
|
||||
|
||||
VulkanRenderDevice* fb = nullptr;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue