Commit 4fb8a8bd by Geoff Lang Committed by Commit Bot

Move the EGL-based initial state to the gl::State constructor.

This is a small refactor to allow State::initialize to be called without needing the EGL context creation attributes. BUG=angleproject:2464 Change-Id: Ifa167cc83f652435ecc00a0a73e4c6c4a3295430 Reviewed-on: https://chromium-review.googlesource.com/1083312Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 2f3f4141
...@@ -281,6 +281,11 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -281,6 +281,11 @@ Context::Context(rx::EGLImplFactory *implFactory,
mSavedArgsType(nullptr), mSavedArgsType(nullptr),
mImplementation(implFactory->createContext(mState)), mImplementation(implFactory->createContext(mState)),
mCompiler(), mCompiler(),
mGLState(GetDebug(attribs),
GetBindGeneratesResource(attribs),
GetClientArraysEnabled(attribs),
GetRobustResourceInit(attribs),
memoryProgramCache != nullptr),
mConfig(config), mConfig(config),
mClientType(EGL_OPENGL_ES_API), mClientType(EGL_OPENGL_ES_API),
mHasBeenCurrent(false), mHasBeenCurrent(false),
...@@ -307,9 +312,7 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -307,9 +312,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
initCaps(displayExtensions, clientExtensions, robustResourceInit); initCaps(displayExtensions, clientExtensions, robustResourceInit);
initWorkarounds(); initWorkarounds();
mGLState.initialize(this, GetDebug(attribs), GetBindGeneratesResource(attribs), mGLState.initialize(this);
GetClientArraysEnabled(attribs), robustResourceInit,
mMemoryProgramCache != nullptr);
mFenceNVHandleAllocator.setBaseHandle(0); mFenceNVHandleAllocator.setBaseHandle(0);
......
...@@ -36,8 +36,8 @@ Debug::Group::~Group() ...@@ -36,8 +36,8 @@ Debug::Group::~Group()
Debug::Group::Group(const Group &other) = default; Debug::Group::Group(const Group &other) = default;
Debug::Debug() Debug::Debug(bool initialDebugState)
: mOutputEnabled(false), : mOutputEnabled(initialDebugState),
mCallbackFunction(nullptr), mCallbackFunction(nullptr),
mCallbackUserParam(nullptr), mCallbackUserParam(nullptr),
mMessages(), mMessages(),
......
...@@ -30,7 +30,7 @@ class LabeledObject ...@@ -30,7 +30,7 @@ class LabeledObject
class Debug : angle::NonCopyable class Debug : angle::NonCopyable
{ {
public: public:
Debug(); Debug(bool initialDebugState);
~Debug(); ~Debug();
void setMaxLoggedMessages(GLuint maxLoggedMessages); void setMaxLoggedMessages(GLuint maxLoggedMessages);
......
...@@ -75,7 +75,11 @@ void UpdateBufferBinding(const Context *context, ...@@ -75,7 +75,11 @@ void UpdateBufferBinding(const Context *context,
(*binding)->onBindingChanged(context, true, target); (*binding)->onBindingChanged(context, true, target);
} }
State::State() State::State(bool debug,
bool bindGeneratesResource,
bool clientArraysEnabled,
bool robustResourceInit,
bool programBinaryCacheEnabled)
: mMaxDrawBuffers(0), : mMaxDrawBuffers(0),
mMaxCombinedTextureImageUnits(0), mMaxCombinedTextureImageUnits(0),
mDepthClearValue(0), mDepthClearValue(0),
...@@ -91,8 +95,8 @@ State::State() ...@@ -91,8 +95,8 @@ State::State()
mLineWidth(0), mLineWidth(0),
mGenerateMipmapHint(GL_NONE), mGenerateMipmapHint(GL_NONE),
mFragmentShaderDerivativeHint(GL_NONE), mFragmentShaderDerivativeHint(GL_NONE),
mBindGeneratesResource(true), mBindGeneratesResource(bindGeneratesResource),
mClientArraysEnabled(true), mClientArraysEnabled(clientArraysEnabled),
mNearZ(0), mNearZ(0),
mFarZ(0), mFarZ(0),
mReadFramebuffer(nullptr), mReadFramebuffer(nullptr),
...@@ -101,11 +105,12 @@ State::State() ...@@ -101,11 +105,12 @@ State::State()
mVertexArray(nullptr), mVertexArray(nullptr),
mActiveSampler(0), mActiveSampler(0),
mPrimitiveRestart(false), mPrimitiveRestart(false),
mDebug(debug),
mMultiSampling(false), mMultiSampling(false),
mSampleAlphaToOne(false), mSampleAlphaToOne(false),
mFramebufferSRGB(true), mFramebufferSRGB(true),
mRobustResourceInit(false), mRobustResourceInit(robustResourceInit),
mProgramBinaryCacheEnabled(false) mProgramBinaryCacheEnabled(programBinaryCacheEnabled)
{ {
} }
...@@ -113,12 +118,7 @@ State::~State() ...@@ -113,12 +118,7 @@ State::~State()
{ {
} }
void State::initialize(const Context *context, void State::initialize(const Context *context)
bool debug,
bool bindGeneratesResource,
bool clientArraysEnabled,
bool robustResourceInit,
bool programBinaryCacheEnabled)
{ {
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
const Extensions &extensions = context->getExtensions(); const Extensions &extensions = context->getExtensions();
...@@ -158,9 +158,6 @@ void State::initialize(const Context *context, ...@@ -158,9 +158,6 @@ void State::initialize(const Context *context,
mGenerateMipmapHint = GL_DONT_CARE; mGenerateMipmapHint = GL_DONT_CARE;
mFragmentShaderDerivativeHint = GL_DONT_CARE; mFragmentShaderDerivativeHint = GL_DONT_CARE;
mBindGeneratesResource = bindGeneratesResource;
mClientArraysEnabled = clientArraysEnabled;
mLineWidth = 1.0f; mLineWidth = 1.0f;
mViewport.x = 0; mViewport.x = 0;
...@@ -234,7 +231,6 @@ void State::initialize(const Context *context, ...@@ -234,7 +231,6 @@ void State::initialize(const Context *context,
mPrimitiveRestart = false; mPrimitiveRestart = false;
mDebug.setOutputEnabled(debug);
mDebug.setMaxLoggedMessages(extensions.maxDebugLoggedMessages); mDebug.setMaxLoggedMessages(extensions.maxDebugLoggedMessages);
mMultiSampling = true; mMultiSampling = true;
...@@ -248,9 +244,6 @@ void State::initialize(const Context *context, ...@@ -248,9 +244,6 @@ void State::initialize(const Context *context,
mPathStencilRef = 0; mPathStencilRef = 0;
mPathStencilMask = std::numeric_limits<GLuint>::max(); mPathStencilMask = std::numeric_limits<GLuint>::max();
mRobustResourceInit = robustResourceInit;
mProgramBinaryCacheEnabled = programBinaryCacheEnabled;
// GLES1 emulation: Initialize state for GLES1 if version // GLES1 emulation: Initialize state for GLES1 if version
// applies // applies
if (clientVersion < Version(2, 0)) if (clientVersion < Version(2, 0))
......
...@@ -38,15 +38,14 @@ struct Caps; ...@@ -38,15 +38,14 @@ struct Caps;
class State : public angle::ObserverInterface, angle::NonCopyable class State : public angle::ObserverInterface, angle::NonCopyable
{ {
public: public:
State(); State(bool debug,
bool bindGeneratesResource,
bool clientArraysEnabled,
bool robustResourceInit,
bool programBinaryCacheEnabled);
~State() override; ~State() override;
void initialize(const Context *context, void initialize(const Context *context);
bool debug,
bool bindGeneratesResource,
bool clientArraysEnabled,
bool robustResourceInit,
bool programBinaryCacheEnabled);
void reset(const Context *context); void reset(const Context *context);
// State chunk getters // State chunk getters
...@@ -517,8 +516,8 @@ class State : public angle::ObserverInterface, angle::NonCopyable ...@@ -517,8 +516,8 @@ class State : public angle::ObserverInterface, angle::NonCopyable
GLenum mGenerateMipmapHint; GLenum mGenerateMipmapHint;
GLenum mFragmentShaderDerivativeHint; GLenum mFragmentShaderDerivativeHint;
bool mBindGeneratesResource; const bool mBindGeneratesResource;
bool mClientArraysEnabled; const bool mClientArraysEnabled;
Rectangle mViewport; Rectangle mViewport;
float mNearZ; float mNearZ;
...@@ -607,10 +606,10 @@ class State : public angle::ObserverInterface, angle::NonCopyable ...@@ -607,10 +606,10 @@ class State : public angle::ObserverInterface, angle::NonCopyable
bool mFramebufferSRGB; bool mFramebufferSRGB;
// GL_ANGLE_robust_resource_intialization // GL_ANGLE_robust_resource_intialization
bool mRobustResourceInit; const bool mRobustResourceInit;
// GL_ANGLE_program_cache_control // GL_ANGLE_program_cache_control
bool mProgramBinaryCacheEnabled; const bool mProgramBinaryCacheEnabled;
// GLES1 emulation: state specific to GLES1 // GLES1 emulation: state specific to GLES1
GLES1State mGLES1State; GLES1State mGLES1State;
......
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