mirror of https://github.com/AxioDL/boo.git
D3D-native depth conventions
This commit is contained in:
parent
01649d42f6
commit
4c8e36f3e3
|
@ -500,7 +500,7 @@ class D3D11ShaderPipeline : public IShaderPipeline
|
||||||
CD3D11_DEPTH_STENCIL_DESC dsDesc(D3D11_DEFAULT);
|
CD3D11_DEPTH_STENCIL_DESC dsDesc(D3D11_DEFAULT);
|
||||||
dsDesc.DepthEnable = depthTest;
|
dsDesc.DepthEnable = depthTest;
|
||||||
dsDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK(depthWrite);
|
dsDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK(depthWrite);
|
||||||
dsDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
|
dsDesc.DepthFunc = D3D11_COMPARISON_GREATER;
|
||||||
ThrowIfFailed(ctx->m_dev->CreateDepthStencilState(&dsDesc, &m_dsState));
|
ThrowIfFailed(ctx->m_dev->CreateDepthStencilState(&dsDesc, &m_dsState));
|
||||||
|
|
||||||
CD3D11_BLEND_DESC blDesc(D3D11_DEFAULT);
|
CD3D11_BLEND_DESC blDesc(D3D11_DEFAULT);
|
||||||
|
@ -915,7 +915,7 @@ struct D3D11CommandQueue : IGraphicsCommandQueue
|
||||||
if (render)
|
if (render)
|
||||||
m_deferredCtx->ClearRenderTargetView(m_boundTarget->m_rtv.Get(), m_clearColor);
|
m_deferredCtx->ClearRenderTargetView(m_boundTarget->m_rtv.Get(), m_clearColor);
|
||||||
if (depth)
|
if (depth)
|
||||||
m_deferredCtx->ClearDepthStencilView(m_boundTarget->m_dsv.Get(), D3D11_CLEAR_DEPTH, 1.0, 0);
|
m_deferredCtx->ClearDepthStencilView(m_boundTarget->m_dsv.Get(), D3D11_CLEAR_DEPTH, 0.0f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(size_t start, size_t count)
|
void draw(size_t start, size_t count)
|
||||||
|
|
|
@ -644,10 +644,11 @@ class D3D12ShaderPipeline : public IShaderPipeline
|
||||||
desc.BlendState.RenderTarget[0].DestBlend = BLEND_FACTOR_TABLE[int(dstFac)];
|
desc.BlendState.RenderTarget[0].DestBlend = BLEND_FACTOR_TABLE[int(dstFac)];
|
||||||
}
|
}
|
||||||
desc.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT);
|
desc.RasterizerState = CD3DX12_RASTERIZER_DESC(D3D12_DEFAULT);
|
||||||
|
desc.RasterizerState.FrontCounterClockwise = TRUE;
|
||||||
if (!backfaceCulling)
|
if (!backfaceCulling)
|
||||||
desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
|
desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
|
||||||
desc.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT);
|
desc.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT);
|
||||||
desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL;
|
desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_GREATER;
|
||||||
if (!depthTest)
|
if (!depthTest)
|
||||||
desc.DepthStencilState.DepthEnable = false;
|
desc.DepthStencilState.DepthEnable = false;
|
||||||
if (!depthWrite)
|
if (!depthWrite)
|
||||||
|
@ -1198,7 +1199,7 @@ struct D3D12CommandQueue : IGraphicsCommandQueue
|
||||||
if (depth)
|
if (depth)
|
||||||
{
|
{
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE handle(m_boundTarget->m_dsvHeap->GetCPUDescriptorHandleForHeapStart());
|
CD3DX12_CPU_DESCRIPTOR_HANDLE handle(m_boundTarget->m_dsvHeap->GetCPUDescriptorHandleForHeapStart());
|
||||||
m_cmdList->ClearDepthStencilView(handle, D3D12_CLEAR_FLAG_DEPTH, 1.0, 0, 0, nullptr);
|
m_cmdList->ClearDepthStencilView(handle, D3D12_CLEAR_FLAG_DEPTH, 0.0f, 0, 0, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue