mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-15 00:51:24 +00:00
- add depth clamp support
This commit is contained in:
parent
56afcd210b
commit
cf49e1ec21
5 changed files with 12 additions and 3 deletions
|
@ -295,6 +295,7 @@ void VkRenderPassSetup::CreatePipeline(const VkRenderPassKey &key)
|
|||
builder.setTopology(vktopology[key.DrawType]);
|
||||
builder.setDepthStencilEnable(key.DepthTest, key.DepthWrite, key.StencilTest);
|
||||
builder.setDepthFunc(depthfunc2vk[key.DepthFunc]);
|
||||
builder.setDepthClampEnable(key.DepthClamp);
|
||||
builder.setCull(key.CullMode == Cull_None ? VK_CULL_MODE_NONE : VK_CULL_MODE_FRONT_AND_BACK, key.CullMode == Cull_CW ? VK_FRONT_FACE_CLOCKWISE : VK_FRONT_FACE_COUNTER_CLOCKWISE);
|
||||
builder.setColorWriteMask((VkColorComponentFlagBits)key.ColorMask);
|
||||
builder.setStencil(VK_STENCIL_OP_KEEP, op2vk[key.StencilPassOp], VK_STENCIL_OP_KEEP, VK_COMPARE_OP_EQUAL, 0xffffffff, 0xffffffff, 0);
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
int DepthWrite;
|
||||
int DepthTest;
|
||||
int DepthFunc;
|
||||
int DepthClamp;
|
||||
int StencilTest;
|
||||
int StencilPassOp;
|
||||
int ColorMask;
|
||||
|
|
|
@ -52,8 +52,8 @@ void VkRenderState::DrawIndexed(int dt, int index, int count, bool apply)
|
|||
|
||||
bool VkRenderState::SetDepthClamp(bool on)
|
||||
{
|
||||
bool lastValue = mLastDepthClamp;
|
||||
mLastDepthClamp = on;
|
||||
bool lastValue = mDepthClamp;
|
||||
mDepthClamp = on;
|
||||
mNeedApply = true;
|
||||
return lastValue;
|
||||
}
|
||||
|
@ -244,6 +244,7 @@ void VkRenderState::ApplyRenderPass(int dt)
|
|||
passKey.DepthTest = mDepthTest;
|
||||
passKey.DepthWrite = mDepthTest && mDepthWrite;
|
||||
passKey.DepthFunc = mDepthFunc;
|
||||
passKey.DepthClamp = mDepthClamp;
|
||||
passKey.StencilTest = mStencilTest;
|
||||
passKey.StencilPassOp = mStencilOp;
|
||||
passKey.ColorMask = mColorMask;
|
||||
|
|
|
@ -57,7 +57,7 @@ private:
|
|||
void ApplyVertexBuffers();
|
||||
void ApplyMaterial();
|
||||
|
||||
bool mLastDepthClamp = true;
|
||||
bool mDepthClamp = true;
|
||||
VulkanCommandBuffer *mCommandBuffer = nullptr;
|
||||
VkRenderPassKey mRenderPassKey = {};
|
||||
bool mNeedApply = true;
|
||||
|
|
|
@ -188,6 +188,7 @@ public:
|
|||
void setCull(VkCullModeFlags cullMode, VkFrontFace frontFace);
|
||||
void setDepthStencilEnable(bool test, bool write, bool stencil);
|
||||
void setDepthFunc(VkCompareOp func);
|
||||
void setDepthClampEnable(bool value);
|
||||
void setColorWriteMask(VkColorComponentFlags mask);
|
||||
void setStencil(VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp, uint32_t compareMask, uint32_t writeMask, uint32_t reference);
|
||||
|
||||
|
@ -800,6 +801,11 @@ inline void GraphicsPipelineBuilder::setDepthFunc(VkCompareOp func)
|
|||
depthStencil.depthCompareOp = func;
|
||||
}
|
||||
|
||||
inline void GraphicsPipelineBuilder::setDepthClampEnable(bool value)
|
||||
{
|
||||
rasterizer.depthClampEnable = value ? VK_TRUE : VK_FALSE;
|
||||
}
|
||||
|
||||
inline void GraphicsPipelineBuilder::setColorWriteMask(VkColorComponentFlags mask)
|
||||
{
|
||||
colorBlendAttachment.colorWriteMask = mask;
|
||||
|
|
Loading…
Reference in a new issue