From 6ae03fe72e0fbb4783a6dc57f4ac2b3bc57fd39f Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Tue, 29 Mar 2016 15:47:00 -0700 Subject: [PATCH] Sync ordering of gl fields/reset commands --- libraries/gpu/src/gpu/GLBackend.h | 1 - libraries/gpu/src/gpu/GLBackendState.cpp | 5 +++-- libraries/gpu/src/gpu/State.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/gpu/src/gpu/GLBackend.h b/libraries/gpu/src/gpu/GLBackend.h index d4efe7fe99..f5abacd279 100644 --- a/libraries/gpu/src/gpu/GLBackend.h +++ b/libraries/gpu/src/gpu/GLBackend.h @@ -158,7 +158,6 @@ public: ~GLState(); // The state commands to reset to default, - // WARNING depending on the order of the State::Field enum static const Commands _resetStateCommands; friend class GLBackend; diff --git a/libraries/gpu/src/gpu/GLBackendState.cpp b/libraries/gpu/src/gpu/GLBackendState.cpp index 64bd87c876..36ce1dd555 100644 --- a/libraries/gpu/src/gpu/GLBackendState.cpp +++ b/libraries/gpu/src/gpu/GLBackendState.cpp @@ -35,6 +35,7 @@ const GLBackend::GLState::Commands makeResetStateCommands(); const GLBackend::GLState::Commands GLBackend::GLState::_resetStateCommands = makeResetStateCommands(); +// NOTE: This must stay in sync with the ordering of the State::Field enum const GLBackend::GLState::Commands makeResetStateCommands() { // Since State::DEFAULT is a static defined in another .cpp the initialisation order is random // and we have a 50/50 chance that State::DEFAULT is not yet initialized. @@ -69,9 +70,9 @@ const GLBackend::GLState::Commands makeResetStateCommands() { CommandPointer(stencilCommand), CommandPointer(stencilCommand), - std::make_shared(&GLBackend::do_setStateAlphaToCoverageEnable, DEFAULT.alphaToCoverageEnable), - std::make_shared(&GLBackend::do_setStateSampleMask, DEFAULT.sampleMask), + + std::make_shared(&GLBackend::do_setStateAlphaToCoverageEnable, DEFAULT.alphaToCoverageEnable), std::make_shared(&GLBackend::do_setStateBlend, DEFAULT.blendFunction), diff --git a/libraries/gpu/src/gpu/State.h b/libraries/gpu/src/gpu/State.h index 7e32a7280a..385edec277 100755 --- a/libraries/gpu/src/gpu/State.h +++ b/libraries/gpu/src/gpu/State.h @@ -345,6 +345,7 @@ public: uint8 getColorWriteMask() const { return _values.colorWriteMask; } // All the possible fields + // NOTE: If you change this, you must update GLBackend::GLState::_resetStateCommands enum Field { FILL_MODE, CULL_MODE, @@ -364,6 +365,7 @@ public: STENCIL_TEST_BACK, SAMPLE_MASK, + ALPHA_TO_COVERAGE_ENABLE, BLEND_FUNCTION,