зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1427668 - Special-case lazy glEnable caps. - r=daoshengmu
MozReview-Commit-ID: KD5N2y1U804
This commit is contained in:
Родитель
fad02050d8
Коммит
182a604cde
|
@ -986,9 +986,11 @@ public:
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
// State and State Requests (WebGLContextState.cpp)
|
||||
private:
|
||||
void SetEnabled(const char* funcName, GLenum cap, bool enabled);
|
||||
public:
|
||||
void Disable(GLenum cap);
|
||||
void Enable(GLenum cap);
|
||||
void Disable(GLenum cap) { SetEnabled("disabled", cap, false); }
|
||||
void Enable(GLenum cap) { SetEnabled("enabled", cap, true); }
|
||||
bool GetStencilBits(GLint* const out_stencilBits) const;
|
||||
bool GetChannelBits(const char* funcName, GLenum pname, GLint* const out_val);
|
||||
virtual JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv);
|
||||
|
|
|
@ -23,41 +23,29 @@
|
|||
namespace mozilla {
|
||||
|
||||
void
|
||||
WebGLContext::Disable(GLenum cap)
|
||||
WebGLContext::SetEnabled(const char* const funcName, const GLenum cap, const bool enabled)
|
||||
{
|
||||
if (IsContextLost())
|
||||
return;
|
||||
|
||||
if (!ValidateCapabilityEnum(cap, "disable"))
|
||||
if (!ValidateCapabilityEnum(cap, funcName))
|
||||
return;
|
||||
|
||||
realGLboolean* trackingSlot = GetStateTrackingSlot(cap);
|
||||
|
||||
if (trackingSlot)
|
||||
{
|
||||
*trackingSlot = 0;
|
||||
const auto& slot = GetStateTrackingSlot(cap);
|
||||
if (slot) {
|
||||
*slot = enabled;
|
||||
}
|
||||
|
||||
gl->fDisable(cap);
|
||||
}
|
||||
switch (cap) {
|
||||
case LOCAL_GL_DEPTH_TEST:
|
||||
case LOCAL_GL_STENCIL_TEST:
|
||||
break; // Lazily applied, so don't tell GL yet or we will desync.
|
||||
|
||||
void
|
||||
WebGLContext::Enable(GLenum cap)
|
||||
{
|
||||
if (IsContextLost())
|
||||
return;
|
||||
|
||||
if (!ValidateCapabilityEnum(cap, "enable"))
|
||||
return;
|
||||
|
||||
realGLboolean* trackingSlot = GetStateTrackingSlot(cap);
|
||||
|
||||
if (trackingSlot)
|
||||
{
|
||||
*trackingSlot = 1;
|
||||
default:
|
||||
// Non-lazy caps.
|
||||
gl->SetEnabled(cap, enabled);
|
||||
break;
|
||||
}
|
||||
|
||||
gl->fEnable(cap);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -664,6 +652,10 @@ WebGLContext::IsEnabled(GLenum cap)
|
|||
if (!ValidateCapabilityEnum(cap, "isEnabled"))
|
||||
return false;
|
||||
|
||||
const auto& slot = GetStateTrackingSlot(cap);
|
||||
if (slot)
|
||||
return *slot;
|
||||
|
||||
return gl->fIsEnabled(cap);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче