зеркало из https://github.com/AvaloniaUI/angle.git
Move dither from blend state to rasterizer state
Dither is technically not a part of blend state so it was removed from there as a first step towards exposing OES_draw_buffers_indexed (that defines independent blend state for each draw buffer). Rasterizer state seems to be the closest (although also not accurate) place for it to keep code changes to a minimum. ANGLE's D3D11, Vulkan, and Metal renderers ignore dithering altogether. Bug: angleproject:4394 Change-Id: Ib138624b9218851d18cd63e2033e8e8ac8ca71d9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2050464 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
92b00ca882
Коммит
caf7becc1f
|
@ -898,7 +898,7 @@ void State::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
|
|||
|
||||
void State::setDither(bool enabled)
|
||||
{
|
||||
mBlend.dither = enabled;
|
||||
mRasterizer.dither = enabled;
|
||||
mDirtyBits.set(DIRTY_BIT_DITHER_ENABLED);
|
||||
}
|
||||
|
||||
|
@ -1906,7 +1906,7 @@ void State::getBooleanv(GLenum pname, GLboolean *params)
|
|||
*params = mBlend.blend;
|
||||
break;
|
||||
case GL_DITHER:
|
||||
*params = mBlend.dither;
|
||||
*params = mRasterizer.dither;
|
||||
break;
|
||||
case GL_TRANSFORM_FEEDBACK_ACTIVE:
|
||||
*params = getCurrentTransformFeedback()->isActive() ? GL_TRUE : GL_FALSE;
|
||||
|
|
|
@ -207,7 +207,7 @@ class State : angle::NonCopyable
|
|||
const Rectangle &getScissor() const { return mScissor; }
|
||||
|
||||
// Dither state toggle & query
|
||||
bool isDitherEnabled() const { return mBlend.dither; }
|
||||
bool isDitherEnabled() const { return mRasterizer.dither; }
|
||||
void setDither(bool enabled);
|
||||
|
||||
// Generic state toggle & query
|
||||
|
|
|
@ -27,6 +27,12 @@ RasterizerState::RasterizerState()
|
|||
polygonOffsetUnits = 0.0f;
|
||||
pointDrawMode = false;
|
||||
multiSample = false;
|
||||
dither = true;
|
||||
}
|
||||
|
||||
RasterizerState::RasterizerState(const RasterizerState &other)
|
||||
{
|
||||
memcpy(this, &other, sizeof(RasterizerState));
|
||||
}
|
||||
|
||||
bool operator==(const RasterizerState &a, const RasterizerState &b)
|
||||
|
@ -51,7 +57,6 @@ BlendState::BlendState()
|
|||
blendEquationRGB = GL_FUNC_ADD;
|
||||
blendEquationAlpha = GL_FUNC_ADD;
|
||||
sampleAlphaToCoverage = false;
|
||||
dither = true;
|
||||
colorMaskRed = true;
|
||||
colorMaskGreen = true;
|
||||
colorMaskBlue = true;
|
||||
|
|
|
@ -127,6 +127,7 @@ struct RasterizerState final
|
|||
{
|
||||
// This will zero-initialize the struct, including padding.
|
||||
RasterizerState();
|
||||
RasterizerState(const RasterizerState &other);
|
||||
|
||||
bool cullFace;
|
||||
CullFaceMode cullMode;
|
||||
|
@ -140,6 +141,8 @@ struct RasterizerState final
|
|||
bool multiSample;
|
||||
|
||||
bool rasterizerDiscard;
|
||||
|
||||
bool dither;
|
||||
};
|
||||
|
||||
bool operator==(const RasterizerState &a, const RasterizerState &b);
|
||||
|
@ -167,8 +170,6 @@ struct BlendState final
|
|||
bool colorMaskAlpha;
|
||||
|
||||
bool sampleAlphaToCoverage;
|
||||
|
||||
bool dither;
|
||||
};
|
||||
|
||||
bool operator==(const BlendState &a, const BlendState &b);
|
||||
|
|
|
@ -295,7 +295,6 @@ angle::Result Clear11::ensureResourcesInitialized(const gl::Context *context)
|
|||
mBlendStateKey.blendState.blendEquationRGB = GL_FUNC_ADD;
|
||||
mBlendStateKey.blendState.blendEquationAlpha = GL_FUNC_ADD;
|
||||
mBlendStateKey.blendState.sampleAlphaToCoverage = false;
|
||||
mBlendStateKey.blendState.dither = true;
|
||||
|
||||
mResourcesInitialized = true;
|
||||
return angle::Result::Continue;
|
||||
|
|
|
@ -711,7 +711,6 @@ StateManager11::StateManager11(Renderer11 *renderer)
|
|||
mCurBlendState.colorMaskGreen = true;
|
||||
mCurBlendState.colorMaskAlpha = true;
|
||||
mCurBlendState.sampleAlphaToCoverage = false;
|
||||
mCurBlendState.dither = false;
|
||||
|
||||
mCurDepthStencilState.depthTest = false;
|
||||
mCurDepthStencilState.depthFunc = GL_LESS;
|
||||
|
@ -738,6 +737,7 @@ StateManager11::StateManager11(Renderer11 *renderer)
|
|||
mCurRasterState.polygonOffsetUnits = 0.0f;
|
||||
mCurRasterState.pointDrawMode = false;
|
||||
mCurRasterState.multiSample = false;
|
||||
mCurRasterState.dither = false;
|
||||
|
||||
// Start with all internal dirty bits set except DIRTY_BIT_COMPUTE_SRVUAV_STATE and
|
||||
// DIRTY_BIT_GRAPHICS_SRVUAV_STATE.
|
||||
|
@ -993,9 +993,9 @@ void StateManager11::syncState(const gl::Context *context, const gl::State::Dirt
|
|||
}
|
||||
break;
|
||||
case gl::State::DIRTY_BIT_DITHER_ENABLED:
|
||||
if (state.getBlendState().dither != mCurBlendState.dither)
|
||||
if (state.getRasterizerState().dither != mCurRasterState.dither)
|
||||
{
|
||||
mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
|
||||
mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
|
||||
}
|
||||
break;
|
||||
case gl::State::DIRTY_BIT_COLOR_MASK:
|
||||
|
|
|
@ -201,7 +201,7 @@ void StateManager9::syncState(const gl::State &state, const gl::State::DirtyBits
|
|||
break;
|
||||
}
|
||||
case gl::State::DIRTY_BIT_DITHER_ENABLED:
|
||||
if (state.getBlendState().dither != mCurBlendState.dither)
|
||||
if (state.getRasterizerState().dither != mCurRasterState.dither)
|
||||
{
|
||||
mDirtyBits.set(DIRTY_BIT_DITHER);
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ void StateManager9::setBlendDepthRasterStates(const gl::State &glState, unsigned
|
|||
blendState.colorMaskGreen, blendState.colorMaskAlpha);
|
||||
break;
|
||||
case DIRTY_BIT_DITHER:
|
||||
setDither(blendState.dither);
|
||||
setDither(rasterState.dither);
|
||||
break;
|
||||
case DIRTY_BIT_CULL_MODE:
|
||||
setCullMode(rasterState.cullFace, rasterState.cullMode, rasterState.frontFace);
|
||||
|
@ -763,7 +763,7 @@ void StateManager9::setBlendEnabled(bool enabled)
|
|||
void StateManager9::setDither(bool dither)
|
||||
{
|
||||
mRenderer9->getDevice()->SetRenderState(D3DRS_DITHERENABLE, dither ? TRUE : FALSE);
|
||||
mCurBlendState.dither = dither;
|
||||
mCurRasterState.dither = dither;
|
||||
}
|
||||
|
||||
// TODO(dianx) one bit for color mask
|
||||
|
|
Загрузка…
Ссылка в новой задаче