Commit 6dd06eac by Jamie Madill Committed by Commit Bot

Give StateManager11 internal dirty bits.

Intead of checking a series of bools and special variables, organize the state application into a switch with internal dirty bits. This should be faster for no-op, and makes it clear where we have to further optimize the state update to pre-compute certain values. BUG=angleproject:1156 Change-Id: I8eca8716340499085afa170ff45f7788e84fecab Reviewed-on: https://chromium-review.googlesource.com/531794 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 298a35f0
......@@ -622,6 +622,11 @@ const FramebufferAttachment *Framebuffer::getFirstColorbuffer() const
return mState.getFirstColorAttachment();
}
const FramebufferAttachment *Framebuffer::getFirstNonNullAttachment() const
{
return mState.getFirstNonNullAttachment();
}
const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
{
return mState.getAttachment(attachment);
......
......@@ -162,6 +162,7 @@ class Framebuffer final : public LabeledObject, public OnAttachmentDirtyReceiver
const FramebufferAttachment *getReadColorbuffer() const;
GLenum getReadColorbufferType() const;
const FramebufferAttachment *getFirstColorbuffer() const;
const FramebufferAttachment *getFirstNonNullAttachment() const;
const FramebufferAttachment *getAttachment(GLenum attachment) const;
......
......@@ -110,7 +110,6 @@ class StateManager11 final : angle::NonCopyable
gl::Error updateState(const gl::Context *context, GLenum drawMode);
private:
void setViewportBounds(const int width, const int height);
void unsetConflictingSRVs(gl::SamplerType shaderType,
uintptr_t resource,
const gl::ImageIndex &index);
......@@ -125,7 +124,7 @@ class StateManager11 final : angle::NonCopyable
gl::Error syncDepthStencilState(const gl::State &glState);
gl::Error syncRasterizerState(const gl::Context *context, GLenum drawMode);
gl::Error syncRasterizerState(const gl::Context *context, bool pointDrawMode);
void syncScissorRectangle(const gl::Rectangle &scissor, bool enabled);
......@@ -135,18 +134,31 @@ class StateManager11 final : angle::NonCopyable
gl::Error syncFramebuffer(const gl::Context *context, gl::Framebuffer *framebuffer);
enum DirtyBitType
{
DIRTY_BIT_RENDER_TARGET,
DIRTY_BIT_VIEWPORT_STATE,
DIRTY_BIT_SCISSOR_STATE,
DIRTY_BIT_RASTERIZER_STATE,
DIRTY_BIT_BLEND_STATE,
DIRTY_BIT_DEPTH_STENCIL_STATE,
DIRTY_BIT_INVALID,
DIRTY_BIT_MAX = DIRTY_BIT_INVALID,
};
using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
Renderer11 *mRenderer;
// Internal dirty bits.
DirtyBits mInternalDirtyBits;
// Blend State
bool mBlendStateIsDirty;
// TODO(dianx) temporary representation of a dirty bit. once we move enough states in,
// try experimenting with dirty bit instead of a bool
gl::BlendState mCurBlendState;
gl::ColorF mCurBlendColor;
unsigned int mCurSampleMask;
// Currently applied depth stencil state
bool mDepthStencilStateIsDirty;
gl::DepthStencilState mCurDepthStencilState;
int mCurStencilRef;
int mCurStencilBackRef;
......@@ -155,16 +167,13 @@ class StateManager11 final : angle::NonCopyable
Optional<bool> mCurDisableStencil;
// Currently applied rasterizer state
bool mRasterizerStateIsDirty;
gl::RasterizerState mCurRasterState;
// Currently applied scissor rectangle state
bool mScissorStateIsDirty;
bool mCurScissorEnabled;
gl::Rectangle mCurScissorRect;
// Currently applied viewport state
bool mViewportStateIsDirty;
gl::Rectangle mCurViewport;
float mCurNear;
float mCurFar;
......@@ -182,9 +191,6 @@ class StateManager11 final : angle::NonCopyable
bool mCurPresentPathFastEnabled;
int mCurPresentPathFastColorBufferHeight;
// Current RenderTarget state
bool mRenderTargetIsDirty;
// Queries that are currently active in this state
std::set<Query11 *> mCurrentQueries;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment