зеркало из https://github.com/AvaloniaUI/angle.git
Fix D3D11 polygon offset.
We were not taking the state of GL_POLYGON_OFFSET_FILL into account. BUG=371604 Change-Id: I9b490ed043faeece86665acaef0b865bf1f7b60d Reviewed-on: https://chromium-review.googlesource.com/199121 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Tested-by: Nicolas Capens <nicolascapens@chromium.org>
This commit is contained in:
Родитель
ed14b79dc8
Коммит
5075e13bd2
|
@ -248,14 +248,23 @@ ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::Rasterizer
|
||||||
rasterDesc.FillMode = D3D11_FILL_SOLID;
|
rasterDesc.FillMode = D3D11_FILL_SOLID;
|
||||||
rasterDesc.CullMode = cullMode;
|
rasterDesc.CullMode = cullMode;
|
||||||
rasterDesc.FrontCounterClockwise = (rasterState.frontFace == GL_CCW) ? FALSE: TRUE;
|
rasterDesc.FrontCounterClockwise = (rasterState.frontFace == GL_CCW) ? FALSE: TRUE;
|
||||||
rasterDesc.DepthBias = ldexp(rasterState.polygonOffsetUnits, -static_cast<int>(depthSize));
|
|
||||||
rasterDesc.DepthBiasClamp = 0.0f; // MSDN documentation of DepthBiasClamp implies a value of zero will preform no clamping, must be tested though.
|
rasterDesc.DepthBiasClamp = 0.0f; // MSDN documentation of DepthBiasClamp implies a value of zero will preform no clamping, must be tested though.
|
||||||
rasterDesc.SlopeScaledDepthBias = rasterState.polygonOffsetFactor;
|
|
||||||
rasterDesc.DepthClipEnable = TRUE;
|
rasterDesc.DepthClipEnable = TRUE;
|
||||||
rasterDesc.ScissorEnable = scissorEnabled ? TRUE : FALSE;
|
rasterDesc.ScissorEnable = scissorEnabled ? TRUE : FALSE;
|
||||||
rasterDesc.MultisampleEnable = rasterState.multiSample;
|
rasterDesc.MultisampleEnable = rasterState.multiSample;
|
||||||
rasterDesc.AntialiasedLineEnable = FALSE;
|
rasterDesc.AntialiasedLineEnable = FALSE;
|
||||||
|
|
||||||
|
if (rasterState.polygonOffsetFill)
|
||||||
|
{
|
||||||
|
rasterDesc.SlopeScaledDepthBias = rasterState.polygonOffsetFactor;
|
||||||
|
rasterDesc.DepthBias = ldexp(rasterState.polygonOffsetUnits, -static_cast<int>(depthSize));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rasterDesc.SlopeScaledDepthBias = 0.0f;
|
||||||
|
rasterDesc.DepthBias = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
ID3D11RasterizerState *dx11RasterizerState = NULL;
|
ID3D11RasterizerState *dx11RasterizerState = NULL;
|
||||||
HRESULT result = mDevice->CreateRasterizerState(&rasterDesc, &dx11RasterizerState);
|
HRESULT result = mDevice->CreateRasterizerState(&rasterDesc, &dx11RasterizerState);
|
||||||
if (FAILED(result) || !dx11RasterizerState)
|
if (FAILED(result) || !dx11RasterizerState)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче