2013-08-16 04:43:47 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "WebGLContext.h"
|
2015-07-22 03:41:57 +03:00
|
|
|
|
|
|
|
#include "GLContext.h"
|
2016-07-22 09:25:41 +03:00
|
|
|
#include "GLScreenBuffer.h"
|
2015-07-22 03:41:57 +03:00
|
|
|
#include "mozilla/dom/ToJSValue.h"
|
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
#include "nsString.h"
|
2015-07-17 12:29:51 +03:00
|
|
|
#include "WebGLBuffer.h"
|
2015-07-22 03:41:57 +03:00
|
|
|
#include "WebGLContextUtils.h"
|
2015-07-17 12:29:51 +03:00
|
|
|
#include "WebGLFramebuffer.h"
|
2015-07-22 03:41:57 +03:00
|
|
|
#include "WebGLProgram.h"
|
2013-08-16 04:43:47 +04:00
|
|
|
#include "WebGLRenderbuffer.h"
|
2015-07-22 03:41:57 +03:00
|
|
|
#include "WebGLShader.h"
|
2013-08-16 04:43:47 +04:00
|
|
|
#include "WebGLTexture.h"
|
|
|
|
#include "WebGLVertexArray.h"
|
|
|
|
|
2015-07-15 03:37:28 +03:00
|
|
|
namespace mozilla {
|
2013-08-16 04:43:47 +04:00
|
|
|
|
|
|
|
void
|
2013-09-04 16:14:43 +04:00
|
|
|
WebGLContext::Disable(GLenum cap)
|
2013-08-16 04:43:47 +04:00
|
|
|
{
|
2013-09-04 16:14:44 +04:00
|
|
|
if (IsContextLost())
|
2013-08-16 04:43:47 +04:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ValidateCapabilityEnum(cap, "disable"))
|
|
|
|
return;
|
|
|
|
|
2013-08-23 04:11:27 +04:00
|
|
|
realGLboolean* trackingSlot = GetStateTrackingSlot(cap);
|
|
|
|
|
|
|
|
if (trackingSlot)
|
|
|
|
{
|
|
|
|
*trackingSlot = 0;
|
2013-08-16 04:43:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
MakeContextCurrent();
|
|
|
|
gl->fDisable(cap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-09-04 16:14:43 +04:00
|
|
|
WebGLContext::Enable(GLenum cap)
|
2013-08-16 04:43:47 +04:00
|
|
|
{
|
2013-09-04 16:14:44 +04:00
|
|
|
if (IsContextLost())
|
2013-08-16 04:43:47 +04:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ValidateCapabilityEnum(cap, "enable"))
|
|
|
|
return;
|
|
|
|
|
2013-08-23 04:11:27 +04:00
|
|
|
realGLboolean* trackingSlot = GetStateTrackingSlot(cap);
|
|
|
|
|
|
|
|
if (trackingSlot)
|
|
|
|
{
|
|
|
|
*trackingSlot = 1;
|
2013-08-16 04:43:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
MakeContextCurrent();
|
|
|
|
gl->fEnable(cap);
|
|
|
|
}
|
|
|
|
|
2015-07-22 03:41:57 +03:00
|
|
|
static JS::Value
|
|
|
|
StringValue(JSContext* cx, const nsAString& str, ErrorResult& rv)
|
|
|
|
{
|
|
|
|
JSString* jsStr = JS_NewUCStringCopyN(cx, str.BeginReading(), str.Length());
|
|
|
|
if (!jsStr) {
|
|
|
|
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
return JS::NullValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
return JS::StringValue(jsStr);
|
|
|
|
}
|
|
|
|
|
2014-09-27 02:06:38 +04:00
|
|
|
bool
|
2016-01-23 05:00:54 +03:00
|
|
|
WebGLContext::GetStencilBits(GLint* const out_stencilBits)
|
2014-09-27 02:06:38 +04:00
|
|
|
{
|
|
|
|
*out_stencilBits = 0;
|
2015-01-13 02:05:21 +03:00
|
|
|
if (mBoundDrawFramebuffer) {
|
2015-11-25 07:15:29 +03:00
|
|
|
if (mBoundDrawFramebuffer->StencilAttachment().IsDefined() &&
|
|
|
|
mBoundDrawFramebuffer->DepthStencilAttachment().IsDefined())
|
|
|
|
{
|
2014-09-27 02:06:38 +04:00
|
|
|
// Error, we don't know which stencil buffer's bits to use
|
|
|
|
ErrorInvalidFramebufferOperation("getParameter: framebuffer has two stencil buffers bound");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-13 02:05:21 +03:00
|
|
|
if (mBoundDrawFramebuffer->StencilAttachment().IsDefined() ||
|
|
|
|
mBoundDrawFramebuffer->DepthStencilAttachment().IsDefined())
|
2014-09-27 02:06:38 +04:00
|
|
|
{
|
|
|
|
*out_stencilBits = 8;
|
|
|
|
}
|
|
|
|
} else if (mOptions.stencil) {
|
|
|
|
*out_stencilBits = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-23 05:00:54 +03:00
|
|
|
bool
|
|
|
|
WebGLContext::GetChannelBits(const char* funcName, GLenum pname, GLint* const out_val)
|
|
|
|
{
|
|
|
|
if (mBoundDrawFramebuffer) {
|
|
|
|
if (!mBoundDrawFramebuffer->ValidateAndInitAttachments(funcName))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mBoundDrawFramebuffer) {
|
|
|
|
switch (pname) {
|
|
|
|
case LOCAL_GL_RED_BITS:
|
|
|
|
case LOCAL_GL_GREEN_BITS:
|
|
|
|
case LOCAL_GL_BLUE_BITS:
|
|
|
|
*out_val = 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_ALPHA_BITS:
|
|
|
|
*out_val = (mOptions.alpha ? 8 : 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_DEPTH_BITS:
|
|
|
|
if (mOptions.depth) {
|
2016-04-25 23:17:25 +03:00
|
|
|
*out_val = gl->Screen()->DepthBits();
|
2016-01-23 05:00:54 +03:00
|
|
|
} else {
|
|
|
|
*out_val = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_STENCIL_BITS:
|
|
|
|
*out_val = (mOptions.stencil ? 8 : 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2016-06-06 18:17:23 +03:00
|
|
|
MOZ_CRASH("GFX: bad pname");
|
2016-01-23 05:00:54 +03:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gl->IsCoreProfile()) {
|
|
|
|
gl->fGetIntegerv(pname, out_val);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
GLenum fbAttachment = 0;
|
|
|
|
GLenum fbPName = 0;
|
|
|
|
switch (pname) {
|
|
|
|
case LOCAL_GL_RED_BITS:
|
|
|
|
fbAttachment = LOCAL_GL_COLOR_ATTACHMENT0;
|
|
|
|
fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_GREEN_BITS:
|
|
|
|
fbAttachment = LOCAL_GL_COLOR_ATTACHMENT0;
|
|
|
|
fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_BLUE_BITS:
|
|
|
|
fbAttachment = LOCAL_GL_COLOR_ATTACHMENT0;
|
|
|
|
fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_ALPHA_BITS:
|
|
|
|
fbAttachment = LOCAL_GL_COLOR_ATTACHMENT0;
|
|
|
|
fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_DEPTH_BITS:
|
|
|
|
fbAttachment = LOCAL_GL_DEPTH_ATTACHMENT;
|
|
|
|
fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_STENCIL_BITS:
|
|
|
|
fbAttachment = LOCAL_GL_STENCIL_ATTACHMENT;
|
|
|
|
fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2016-06-06 18:17:23 +03:00
|
|
|
MOZ_CRASH("GFX: bad pname");
|
2016-01-23 05:00:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
gl->fGetFramebufferAttachmentParameteriv(LOCAL_GL_DRAW_FRAMEBUFFER, fbAttachment,
|
|
|
|
fbPName, out_val);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-16 04:43:47 +04:00
|
|
|
JS::Value
|
2013-09-04 16:14:43 +04:00
|
|
|
WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
2013-08-16 04:43:47 +04:00
|
|
|
{
|
2016-01-23 05:00:54 +03:00
|
|
|
const char funcName[] = "getParameter";
|
|
|
|
|
2013-09-04 16:14:44 +04:00
|
|
|
if (IsContextLost())
|
2013-08-16 04:43:47 +04:00
|
|
|
return JS::NullValue();
|
|
|
|
|
|
|
|
MakeContextCurrent();
|
|
|
|
|
|
|
|
if (MinCapabilityMode()) {
|
|
|
|
switch(pname) {
|
2014-04-17 01:36:53 +04:00
|
|
|
////////////////////////////
|
2013-08-16 04:43:47 +04:00
|
|
|
// Single-value params
|
|
|
|
|
|
|
|
// int
|
|
|
|
case LOCAL_GL_MAX_VERTEX_ATTRIBS:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_VERTEX_ATTRIBS);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_VARYING_VECTORS:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_VARYING_VECTORS);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_TEXTURE_SIZE:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_TEXTURE_SIZE);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
|
|
|
|
return JS::Int32Value(MINVALUE_GL_MAX_RENDERBUFFER_SIZE);
|
|
|
|
|
|
|
|
default:
|
|
|
|
// Return the real value; we're not overriding this one
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::WEBGL_draw_buffers)) {
|
2014-04-17 01:36:53 +04:00
|
|
|
if (pname == LOCAL_GL_MAX_COLOR_ATTACHMENTS) {
|
2015-11-25 07:15:29 +03:00
|
|
|
return JS::Int32Value(mImplMaxColorAttachments);
|
2014-04-17 01:36:53 +04:00
|
|
|
|
|
|
|
} else if (pname == LOCAL_GL_MAX_DRAW_BUFFERS) {
|
2015-11-25 07:15:29 +03:00
|
|
|
return JS::Int32Value(mImplMaxDrawBuffers);
|
2014-04-17 01:36:53 +04:00
|
|
|
|
|
|
|
} else if (pname >= LOCAL_GL_DRAW_BUFFER0 &&
|
2015-11-25 07:15:29 +03:00
|
|
|
pname < GLenum(LOCAL_GL_DRAW_BUFFER0 + mImplMaxDrawBuffers))
|
2013-08-16 04:43:47 +04:00
|
|
|
{
|
|
|
|
GLint iv = 0;
|
|
|
|
gl->fGetIntegerv(pname, &iv);
|
|
|
|
|
2015-06-05 08:12:11 +03:00
|
|
|
if (mBoundDrawFramebuffer)
|
|
|
|
return JS::Int32Value(iv);
|
|
|
|
|
|
|
|
const GLint index = (pname - LOCAL_GL_DRAW_BUFFER0);
|
|
|
|
if (iv == LOCAL_GL_COLOR_ATTACHMENT0 + index)
|
2013-08-16 04:43:47 +04:00
|
|
|
return JS::Int32Value(LOCAL_GL_BACK);
|
|
|
|
|
|
|
|
return JS::Int32Value(LOCAL_GL_NONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::OES_vertex_array_object)) {
|
2014-04-17 01:36:53 +04:00
|
|
|
if (pname == LOCAL_GL_VERTEX_ARRAY_BINDING) {
|
2015-06-05 08:12:11 +03:00
|
|
|
WebGLVertexArray* vao =
|
|
|
|
(mBoundVertexArray != mDefaultVertexArray) ? mBoundVertexArray.get() : nullptr;
|
|
|
|
return WebGLObjectAsJSValue(cx, vao, rv);
|
2013-08-16 04:43:47 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::EXT_disjoint_timer_query)) {
|
2015-05-27 14:12:00 +03:00
|
|
|
if (pname == LOCAL_GL_TIMESTAMP_EXT) {
|
|
|
|
GLuint64 iv = 0;
|
|
|
|
gl->fGetInteger64v(pname, (GLint64*) &iv);
|
2015-06-05 08:12:11 +03:00
|
|
|
// TODO: JS doesn't support 64-bit integers. Be lossy and
|
|
|
|
// cast to double (53 bits)
|
|
|
|
return JS::NumberValue(static_cast<double>(iv));
|
2015-05-27 14:12:00 +03:00
|
|
|
} else if (pname == LOCAL_GL_GPU_DISJOINT_EXT) {
|
|
|
|
// When disjoint isn't supported, leave as false.
|
2015-06-05 08:12:11 +03:00
|
|
|
realGLboolean disjoint = LOCAL_GL_FALSE;
|
2015-05-27 14:12:00 +03:00
|
|
|
if (gl->IsExtensionSupported(gl::GLContext::EXT_disjoint_timer_query)) {
|
|
|
|
gl->fGetBooleanv(pname, &disjoint);
|
|
|
|
}
|
|
|
|
return JS::BooleanValue(bool(disjoint));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-22 03:41:57 +03:00
|
|
|
// Privileged string params exposed by WEBGL_debug_renderer_info.
|
|
|
|
// The privilege check is done in WebGLContext::IsExtensionSupported.
|
|
|
|
// So here we just have to check that the extension is enabled.
|
2015-06-05 08:06:01 +03:00
|
|
|
if (IsExtensionEnabled(WebGLExtensionID::WEBGL_debug_renderer_info)) {
|
|
|
|
switch (pname) {
|
|
|
|
case UNMASKED_VENDOR_WEBGL:
|
|
|
|
case UNMASKED_RENDERER_WEBGL:
|
2015-07-22 03:41:57 +03:00
|
|
|
{
|
|
|
|
const char* overridePref = nullptr;
|
|
|
|
GLenum driverEnum = LOCAL_GL_NONE;
|
|
|
|
|
|
|
|
switch (pname) {
|
|
|
|
case UNMASKED_RENDERER_WEBGL:
|
|
|
|
overridePref = "webgl.renderer-string-override";
|
|
|
|
driverEnum = LOCAL_GL_RENDERER;
|
|
|
|
break;
|
|
|
|
case UNMASKED_VENDOR_WEBGL:
|
|
|
|
overridePref = "webgl.vendor-string-override";
|
|
|
|
driverEnum = LOCAL_GL_VENDOR;
|
|
|
|
break;
|
|
|
|
default:
|
2016-06-06 18:17:23 +03:00
|
|
|
MOZ_CRASH("GFX: bad `pname`");
|
2015-07-22 03:41:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool hasRetVal = false;
|
|
|
|
|
|
|
|
nsAutoString ret;
|
|
|
|
if (overridePref) {
|
|
|
|
nsresult res = Preferences::GetString(overridePref, &ret);
|
|
|
|
if (NS_SUCCEEDED(res) && ret.Length() > 0)
|
|
|
|
hasRetVal = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!hasRetVal) {
|
|
|
|
const char* chars = reinterpret_cast<const char*>(gl->fGetString(driverEnum));
|
|
|
|
ret = NS_ConvertASCIItoUTF16(chars);
|
|
|
|
hasRetVal = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return StringValue(cx, ret, rv);
|
2015-06-05 08:06:01 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::OES_standard_derivatives)) {
|
2015-06-05 08:06:01 +03:00
|
|
|
if (pname == LOCAL_GL_FRAGMENT_SHADER_DERIVATIVE_HINT) {
|
|
|
|
GLint i = 0;
|
|
|
|
gl->fGetIntegerv(pname, &i);
|
|
|
|
return JS::Int32Value(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsExtensionEnabled(WebGLExtensionID::EXT_texture_filter_anisotropic)) {
|
|
|
|
if (pname == LOCAL_GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT) {
|
|
|
|
GLfloat f = 0.f;
|
|
|
|
gl->fGetFloatv(pname, &f);
|
|
|
|
return JS::NumberValue(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-16 04:43:47 +04:00
|
|
|
switch (pname) {
|
|
|
|
//
|
|
|
|
// String params
|
|
|
|
//
|
|
|
|
case LOCAL_GL_VENDOR:
|
|
|
|
case LOCAL_GL_RENDERER:
|
|
|
|
return StringValue(cx, "Mozilla", rv);
|
2015-06-05 06:26:34 +03:00
|
|
|
case LOCAL_GL_VERSION:
|
|
|
|
return StringValue(cx, "WebGL 1.0", rv);
|
2013-08-16 04:43:47 +04:00
|
|
|
case LOCAL_GL_SHADING_LANGUAGE_VERSION:
|
|
|
|
return StringValue(cx, "WebGL GLSL ES 1.0", rv);
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
////////////////////////////////
|
2013-08-16 04:43:47 +04:00
|
|
|
// Single-value params
|
|
|
|
|
|
|
|
// unsigned int
|
|
|
|
case LOCAL_GL_CULL_FACE_MODE:
|
|
|
|
case LOCAL_GL_FRONT_FACE:
|
|
|
|
case LOCAL_GL_ACTIVE_TEXTURE:
|
|
|
|
case LOCAL_GL_STENCIL_FUNC:
|
|
|
|
case LOCAL_GL_STENCIL_FAIL:
|
|
|
|
case LOCAL_GL_STENCIL_PASS_DEPTH_FAIL:
|
|
|
|
case LOCAL_GL_STENCIL_PASS_DEPTH_PASS:
|
|
|
|
case LOCAL_GL_STENCIL_BACK_FUNC:
|
|
|
|
case LOCAL_GL_STENCIL_BACK_FAIL:
|
|
|
|
case LOCAL_GL_STENCIL_BACK_PASS_DEPTH_FAIL:
|
|
|
|
case LOCAL_GL_STENCIL_BACK_PASS_DEPTH_PASS:
|
|
|
|
case LOCAL_GL_DEPTH_FUNC:
|
|
|
|
case LOCAL_GL_BLEND_SRC_RGB:
|
|
|
|
case LOCAL_GL_BLEND_SRC_ALPHA:
|
|
|
|
case LOCAL_GL_BLEND_DST_RGB:
|
|
|
|
case LOCAL_GL_BLEND_DST_ALPHA:
|
|
|
|
case LOCAL_GL_BLEND_EQUATION_RGB:
|
|
|
|
case LOCAL_GL_BLEND_EQUATION_ALPHA:
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_GENERATE_MIPMAP_HINT: {
|
2013-08-16 04:43:47 +04:00
|
|
|
GLint i = 0;
|
|
|
|
gl->fGetIntegerv(pname, &i);
|
|
|
|
return JS::NumberValue(uint32_t(i));
|
|
|
|
}
|
2014-06-19 02:09:56 +04:00
|
|
|
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE: {
|
2016-05-27 04:08:31 +03:00
|
|
|
const webgl::FormatUsageInfo* usage;
|
|
|
|
uint32_t width, height;
|
2016-07-13 10:58:16 +03:00
|
|
|
if (!ValidateCurFBForRead(funcName, &usage, &width, &height))
|
2016-05-27 04:08:31 +03:00
|
|
|
return JS::NullValue();
|
2015-02-25 01:09:09 +03:00
|
|
|
|
2014-06-19 02:09:56 +04:00
|
|
|
GLint i = 0;
|
|
|
|
if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
|
|
|
|
gl->fGetIntegerv(pname, &i);
|
|
|
|
} else {
|
|
|
|
i = LOCAL_GL_UNSIGNED_BYTE;
|
|
|
|
}
|
2016-01-21 09:51:59 +03:00
|
|
|
|
2014-06-19 02:09:56 +04:00
|
|
|
return JS::NumberValue(uint32_t(i));
|
|
|
|
}
|
|
|
|
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT: {
|
2016-05-27 04:08:31 +03:00
|
|
|
const webgl::FormatUsageInfo* usage;
|
|
|
|
uint32_t width, height;
|
2016-07-13 10:58:16 +03:00
|
|
|
if (!ValidateCurFBForRead(funcName, &usage, &width, &height))
|
2016-05-27 04:08:31 +03:00
|
|
|
return JS::NullValue();
|
2015-02-25 01:09:09 +03:00
|
|
|
|
2014-06-19 02:09:56 +04:00
|
|
|
GLint i = 0;
|
|
|
|
if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
|
|
|
|
gl->fGetIntegerv(pname, &i);
|
|
|
|
} else {
|
|
|
|
i = LOCAL_GL_RGBA;
|
|
|
|
}
|
2016-01-21 09:51:59 +03:00
|
|
|
|
|
|
|
// OpenGL ES 3.0.4 p112 Table 3.2 shows that read format SRGB_ALPHA is
|
|
|
|
// not supported. And if internal format of fbo is SRGB8_ALPHA8, then
|
|
|
|
// IMPLEMENTATION_COLOR_READ_FORMAT is SRGB_ALPHA which is not supported
|
|
|
|
// by ReadPixels. So, just return RGBA here.
|
|
|
|
if (i == LOCAL_GL_SRGB_ALPHA)
|
|
|
|
i = LOCAL_GL_RGBA;
|
|
|
|
|
2014-06-19 02:09:56 +04:00
|
|
|
return JS::NumberValue(uint32_t(i));
|
|
|
|
}
|
2013-08-16 04:43:47 +04:00
|
|
|
// int
|
|
|
|
case LOCAL_GL_STENCIL_REF:
|
2014-09-27 02:06:38 +04:00
|
|
|
case LOCAL_GL_STENCIL_BACK_REF: {
|
|
|
|
GLint stencilBits = 0;
|
|
|
|
if (!GetStencilBits(&stencilBits))
|
|
|
|
return JS::NullValue();
|
|
|
|
|
|
|
|
// Assuming stencils have 8 bits
|
|
|
|
const GLint stencilMask = (1 << stencilBits) - 1;
|
|
|
|
|
|
|
|
GLint refValue = 0;
|
|
|
|
gl->fGetIntegerv(pname, &refValue);
|
|
|
|
|
|
|
|
return JS::Int32Value(refValue & stencilMask);
|
|
|
|
}
|
2016-01-23 05:00:54 +03:00
|
|
|
|
2014-09-27 02:06:38 +04:00
|
|
|
case LOCAL_GL_STENCIL_CLEAR_VALUE:
|
2013-08-16 04:43:47 +04:00
|
|
|
case LOCAL_GL_UNPACK_ALIGNMENT:
|
|
|
|
case LOCAL_GL_PACK_ALIGNMENT:
|
|
|
|
case LOCAL_GL_SUBPIXEL_BITS:
|
|
|
|
case LOCAL_GL_SAMPLE_BUFFERS:
|
|
|
|
case LOCAL_GL_SAMPLES:
|
|
|
|
case LOCAL_GL_MAX_VERTEX_ATTRIBS:
|
|
|
|
case LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
|
|
|
|
case LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
|
2016-01-23 05:00:54 +03:00
|
|
|
case LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS: {
|
2015-09-23 02:49:25 +03:00
|
|
|
GLint i = 0;
|
2015-09-23 05:26:13 +03:00
|
|
|
gl->fGetIntegerv(pname, &i);
|
2015-09-23 02:49:25 +03:00
|
|
|
return JS::Int32Value(i);
|
|
|
|
}
|
2016-01-23 05:00:54 +03:00
|
|
|
|
|
|
|
case LOCAL_GL_RED_BITS:
|
|
|
|
case LOCAL_GL_GREEN_BITS:
|
|
|
|
case LOCAL_GL_BLUE_BITS:
|
|
|
|
case LOCAL_GL_ALPHA_BITS:
|
|
|
|
case LOCAL_GL_DEPTH_BITS:
|
|
|
|
case LOCAL_GL_STENCIL_BITS: {
|
|
|
|
// Deprecated and removed in GL Core profiles, so special handling required.
|
|
|
|
GLint val;
|
|
|
|
if (!GetChannelBits(funcName, pname, &val))
|
|
|
|
return JS::NullValue();
|
|
|
|
|
|
|
|
return JS::Int32Value(val);
|
2014-10-09 03:30:01 +04:00
|
|
|
}
|
2016-01-23 05:00:54 +03:00
|
|
|
|
2013-08-16 04:43:47 +04:00
|
|
|
case LOCAL_GL_MAX_TEXTURE_SIZE:
|
2015-11-25 07:15:29 +03:00
|
|
|
return JS::Int32Value(mImplMaxTextureSize);
|
2013-08-16 04:43:47 +04:00
|
|
|
|
|
|
|
case LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE:
|
2015-11-25 07:15:29 +03:00
|
|
|
return JS::Int32Value(mImplMaxCubeMapTextureSize);
|
2013-08-16 04:43:47 +04:00
|
|
|
|
|
|
|
case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
|
2015-11-25 07:15:29 +03:00
|
|
|
return JS::Int32Value(mImplMaxRenderbufferSize);
|
2013-08-16 04:43:47 +04:00
|
|
|
|
|
|
|
case LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS:
|
|
|
|
return JS::Int32Value(mGLMaxVertexUniformVectors);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
|
|
|
|
return JS::Int32Value(mGLMaxFragmentUniformVectors);
|
|
|
|
|
|
|
|
case LOCAL_GL_MAX_VARYING_VECTORS:
|
|
|
|
return JS::Int32Value(mGLMaxVaryingVectors);
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS: {
|
2013-08-16 04:43:47 +04:00
|
|
|
uint32_t length = mCompressedTextureFormats.Length();
|
2015-07-15 03:37:28 +03:00
|
|
|
JSObject* obj = dom::Uint32Array::Create(cx, this, length,
|
|
|
|
mCompressedTextureFormats.Elements());
|
2013-08-16 04:43:47 +04:00
|
|
|
if (!obj) {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
return JS::ObjectOrNullValue(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
// unsigned int. here we may have to return very large values like 2^32-1 that can't be represented as
|
|
|
|
// javascript integer values. We just return them as doubles and javascript doesn't care.
|
2015-06-05 08:12:11 +03:00
|
|
|
case LOCAL_GL_STENCIL_BACK_VALUE_MASK:
|
2015-06-09 07:37:00 +03:00
|
|
|
return JS::DoubleValue(mStencilValueMaskBack); // pass as FP value to allow large values such as 2^32-1.
|
2015-06-05 08:12:11 +03:00
|
|
|
|
|
|
|
case LOCAL_GL_STENCIL_BACK_WRITEMASK:
|
2015-06-09 07:37:00 +03:00
|
|
|
return JS::DoubleValue(mStencilWriteMaskBack);
|
2015-06-05 08:12:11 +03:00
|
|
|
|
|
|
|
case LOCAL_GL_STENCIL_VALUE_MASK:
|
2015-06-09 07:37:00 +03:00
|
|
|
return JS::DoubleValue(mStencilValueMaskFront);
|
2015-06-05 08:12:11 +03:00
|
|
|
|
|
|
|
case LOCAL_GL_STENCIL_WRITEMASK:
|
2015-06-09 07:37:00 +03:00
|
|
|
return JS::DoubleValue(mStencilWriteMaskFront);
|
2013-08-16 04:43:47 +04:00
|
|
|
|
|
|
|
// float
|
|
|
|
case LOCAL_GL_DEPTH_CLEAR_VALUE:
|
|
|
|
case LOCAL_GL_LINE_WIDTH:
|
|
|
|
case LOCAL_GL_POLYGON_OFFSET_FACTOR:
|
|
|
|
case LOCAL_GL_POLYGON_OFFSET_UNITS:
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_SAMPLE_COVERAGE_VALUE: {
|
2013-08-16 04:43:47 +04:00
|
|
|
GLfloat f = 0.f;
|
|
|
|
gl->fGetFloatv(pname, &f);
|
|
|
|
return JS::DoubleValue(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
// bool
|
|
|
|
case LOCAL_GL_BLEND:
|
|
|
|
case LOCAL_GL_DEPTH_TEST:
|
|
|
|
case LOCAL_GL_STENCIL_TEST:
|
|
|
|
case LOCAL_GL_CULL_FACE:
|
|
|
|
case LOCAL_GL_DITHER:
|
|
|
|
case LOCAL_GL_POLYGON_OFFSET_FILL:
|
|
|
|
case LOCAL_GL_SCISSOR_TEST:
|
|
|
|
case LOCAL_GL_SAMPLE_COVERAGE_INVERT:
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_DEPTH_WRITEMASK: {
|
2013-08-16 04:43:47 +04:00
|
|
|
realGLboolean b = 0;
|
|
|
|
gl->fGetBooleanv(pname, &b);
|
|
|
|
return JS::BooleanValue(bool(b));
|
|
|
|
}
|
|
|
|
|
|
|
|
// bool, WebGL-specific
|
|
|
|
case UNPACK_FLIP_Y_WEBGL:
|
2015-11-25 07:15:29 +03:00
|
|
|
return JS::BooleanValue(mPixelStore_FlipY);
|
2013-08-16 04:43:47 +04:00
|
|
|
case UNPACK_PREMULTIPLY_ALPHA_WEBGL:
|
2015-11-25 07:15:29 +03:00
|
|
|
return JS::BooleanValue(mPixelStore_PremultiplyAlpha);
|
2013-08-16 04:43:47 +04:00
|
|
|
|
|
|
|
// uint, WebGL-specific
|
|
|
|
case UNPACK_COLORSPACE_CONVERSION_WEBGL:
|
2015-11-25 07:15:29 +03:00
|
|
|
return JS::NumberValue(uint32_t(mPixelStore_ColorspaceConversion));
|
2013-08-16 04:43:47 +04:00
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
////////////////////////////////
|
2013-08-16 04:43:47 +04:00
|
|
|
// Complex values
|
2014-04-17 01:36:53 +04:00
|
|
|
|
|
|
|
// 2 floats
|
|
|
|
case LOCAL_GL_DEPTH_RANGE:
|
|
|
|
case LOCAL_GL_ALIASED_POINT_SIZE_RANGE:
|
|
|
|
case LOCAL_GL_ALIASED_LINE_WIDTH_RANGE: {
|
2016-04-14 02:27:49 +03:00
|
|
|
GLenum driverPName = pname;
|
|
|
|
if (gl->IsCoreProfile() &&
|
|
|
|
driverPName == LOCAL_GL_ALIASED_POINT_SIZE_RANGE)
|
|
|
|
{
|
|
|
|
driverPName = LOCAL_GL_POINT_SIZE_RANGE;
|
|
|
|
}
|
|
|
|
|
2013-08-16 04:43:47 +04:00
|
|
|
GLfloat fv[2] = { 0 };
|
2016-04-14 02:27:49 +03:00
|
|
|
gl->fGetFloatv(driverPName, fv);
|
2015-07-15 03:37:28 +03:00
|
|
|
JSObject* obj = dom::Float32Array::Create(cx, this, 2, fv);
|
2013-08-16 04:43:47 +04:00
|
|
|
if (!obj) {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
return JS::ObjectOrNullValue(obj);
|
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
// 4 floats
|
|
|
|
case LOCAL_GL_COLOR_CLEAR_VALUE:
|
|
|
|
case LOCAL_GL_BLEND_COLOR: {
|
2013-08-16 04:43:47 +04:00
|
|
|
GLfloat fv[4] = { 0 };
|
|
|
|
gl->fGetFloatv(pname, fv);
|
2015-07-15 03:37:28 +03:00
|
|
|
JSObject* obj = dom::Float32Array::Create(cx, this, 4, fv);
|
2013-08-16 04:43:47 +04:00
|
|
|
if (!obj) {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
return JS::ObjectOrNullValue(obj);
|
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
// 2 ints
|
|
|
|
case LOCAL_GL_MAX_VIEWPORT_DIMS: {
|
2013-08-16 04:43:47 +04:00
|
|
|
GLint iv[2] = { 0 };
|
|
|
|
gl->fGetIntegerv(pname, iv);
|
2015-07-15 03:37:28 +03:00
|
|
|
JSObject* obj = dom::Int32Array::Create(cx, this, 2, iv);
|
2013-08-16 04:43:47 +04:00
|
|
|
if (!obj) {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
return JS::ObjectOrNullValue(obj);
|
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
// 4 ints
|
|
|
|
case LOCAL_GL_SCISSOR_BOX:
|
|
|
|
case LOCAL_GL_VIEWPORT: {
|
2013-08-16 04:43:47 +04:00
|
|
|
GLint iv[4] = { 0 };
|
|
|
|
gl->fGetIntegerv(pname, iv);
|
2015-07-15 03:37:28 +03:00
|
|
|
JSObject* obj = dom::Int32Array::Create(cx, this, 4, iv);
|
2013-08-16 04:43:47 +04:00
|
|
|
if (!obj) {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
return JS::ObjectOrNullValue(obj);
|
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
// 4 bools
|
|
|
|
case LOCAL_GL_COLOR_WRITEMASK: {
|
2013-08-16 04:43:47 +04:00
|
|
|
realGLboolean gl_bv[4] = { 0 };
|
|
|
|
gl->fGetBooleanv(pname, gl_bv);
|
2014-04-10 22:57:42 +04:00
|
|
|
bool vals[4] = { bool(gl_bv[0]), bool(gl_bv[1]),
|
|
|
|
bool(gl_bv[2]), bool(gl_bv[3]) };
|
2014-04-10 22:57:41 +04:00
|
|
|
JS::Rooted<JS::Value> arr(cx);
|
2015-07-15 03:37:28 +03:00
|
|
|
if (!dom::ToJSValue(cx, vals, &arr)) {
|
2013-08-16 04:43:47 +04:00
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2014-04-10 22:57:41 +04:00
|
|
|
return arr;
|
2013-08-16 04:43:47 +04:00
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_ARRAY_BUFFER_BINDING: {
|
2013-08-16 04:43:47 +04:00
|
|
|
return WebGLObjectAsJSValue(cx, mBoundArrayBuffer.get(), rv);
|
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_ELEMENT_ARRAY_BUFFER_BINDING: {
|
2014-06-06 03:38:27 +04:00
|
|
|
return WebGLObjectAsJSValue(cx, mBoundVertexArray->mElementArrayBuffer.get(), rv);
|
2013-08-16 04:43:47 +04:00
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_RENDERBUFFER_BINDING: {
|
2013-08-16 04:43:47 +04:00
|
|
|
return WebGLObjectAsJSValue(cx, mBoundRenderbuffer.get(), rv);
|
|
|
|
}
|
|
|
|
|
2015-01-13 02:05:21 +03:00
|
|
|
// DRAW_FRAMEBUFFER_BINDING is the same as FRAMEBUFFER_BINDING.
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_FRAMEBUFFER_BINDING: {
|
2015-01-13 02:05:21 +03:00
|
|
|
return WebGLObjectAsJSValue(cx, mBoundDrawFramebuffer.get(), rv);
|
2013-08-16 04:43:47 +04:00
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_CURRENT_PROGRAM: {
|
2013-08-16 04:43:47 +04:00
|
|
|
return WebGLObjectAsJSValue(cx, mCurrentProgram.get(), rv);
|
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_TEXTURE_BINDING_2D: {
|
2013-08-16 04:43:47 +04:00
|
|
|
return WebGLObjectAsJSValue(cx, mBound2DTextures[mActiveTexture].get(), rv);
|
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
case LOCAL_GL_TEXTURE_BINDING_CUBE_MAP: {
|
2013-08-16 04:43:47 +04:00
|
|
|
return WebGLObjectAsJSValue(cx, mBoundCubeMapTextures[mActiveTexture].get(), rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
2014-04-17 01:36:53 +04:00
|
|
|
break;
|
2013-08-16 04:43:47 +04:00
|
|
|
}
|
|
|
|
|
2014-04-17 01:36:53 +04:00
|
|
|
ErrorInvalidEnumInfo("getParameter: parameter", pname);
|
2013-08-16 04:43:47 +04:00
|
|
|
return JS::NullValue();
|
|
|
|
}
|
|
|
|
|
2014-06-12 00:26:52 +04:00
|
|
|
void
|
|
|
|
WebGLContext::GetParameterIndexed(JSContext* cx, GLenum pname, GLuint index,
|
|
|
|
JS::MutableHandle<JS::Value> retval)
|
2013-08-20 19:36:20 +04:00
|
|
|
{
|
2014-06-12 00:26:52 +04:00
|
|
|
if (IsContextLost()) {
|
|
|
|
retval.setNull();
|
|
|
|
return;
|
|
|
|
}
|
2013-08-20 19:36:20 +04:00
|
|
|
|
|
|
|
MakeContextCurrent();
|
|
|
|
|
|
|
|
switch (pname) {
|
|
|
|
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
|
|
|
|
{
|
|
|
|
if (index >= mGLMaxTransformFeedbackSeparateAttribs) {
|
|
|
|
ErrorInvalidValue("getParameterIndexed: index should be less than MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", index);
|
2014-06-12 00:26:52 +04:00
|
|
|
retval.setNull();
|
|
|
|
return;
|
2013-08-20 19:36:20 +04:00
|
|
|
}
|
2014-06-12 00:26:52 +04:00
|
|
|
retval.setNull(); // See bug 903594
|
|
|
|
return;
|
2013-08-20 19:36:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ErrorInvalidEnumInfo("getParameterIndexed: parameter", pname);
|
2014-06-12 00:26:52 +04:00
|
|
|
retval.setNull();
|
2013-08-20 19:36:20 +04:00
|
|
|
}
|
|
|
|
|
2013-08-16 04:43:47 +04:00
|
|
|
bool
|
2013-09-04 16:14:43 +04:00
|
|
|
WebGLContext::IsEnabled(GLenum cap)
|
2013-08-16 04:43:47 +04:00
|
|
|
{
|
2013-09-04 16:14:44 +04:00
|
|
|
if (IsContextLost())
|
2013-08-16 04:43:47 +04:00
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!ValidateCapabilityEnum(cap, "isEnabled"))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
MakeContextCurrent();
|
|
|
|
return gl->fIsEnabled(cap);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-09-04 16:14:43 +04:00
|
|
|
WebGLContext::ValidateCapabilityEnum(GLenum cap, const char* info)
|
2013-08-16 04:43:47 +04:00
|
|
|
{
|
|
|
|
switch (cap) {
|
|
|
|
case LOCAL_GL_BLEND:
|
|
|
|
case LOCAL_GL_CULL_FACE:
|
|
|
|
case LOCAL_GL_DEPTH_TEST:
|
|
|
|
case LOCAL_GL_DITHER:
|
|
|
|
case LOCAL_GL_POLYGON_OFFSET_FILL:
|
|
|
|
case LOCAL_GL_SAMPLE_ALPHA_TO_COVERAGE:
|
|
|
|
case LOCAL_GL_SAMPLE_COVERAGE:
|
|
|
|
case LOCAL_GL_SCISSOR_TEST:
|
|
|
|
case LOCAL_GL_STENCIL_TEST:
|
|
|
|
return true;
|
|
|
|
case LOCAL_GL_RASTERIZER_DISCARD:
|
|
|
|
return IsWebGL2();
|
|
|
|
default:
|
|
|
|
ErrorInvalidEnumInfo(info, cap);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2013-08-23 04:11:27 +04:00
|
|
|
|
|
|
|
realGLboolean*
|
2013-09-04 16:14:43 +04:00
|
|
|
WebGLContext::GetStateTrackingSlot(GLenum cap)
|
2013-08-23 04:11:27 +04:00
|
|
|
{
|
|
|
|
switch (cap) {
|
2015-09-24 22:21:05 +03:00
|
|
|
case LOCAL_GL_DEPTH_TEST:
|
|
|
|
return &mDepthTestEnabled;
|
2013-08-23 04:11:27 +04:00
|
|
|
case LOCAL_GL_DITHER:
|
|
|
|
return &mDitherEnabled;
|
2013-08-23 04:11:40 +04:00
|
|
|
case LOCAL_GL_RASTERIZER_DISCARD:
|
|
|
|
return &mRasterizerDiscardEnabled;
|
2015-03-12 04:23:56 +03:00
|
|
|
case LOCAL_GL_SCISSOR_TEST:
|
|
|
|
return &mScissorTestEnabled;
|
|
|
|
case LOCAL_GL_STENCIL_TEST:
|
|
|
|
return &mStencilTestEnabled;
|
2013-08-23 04:11:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-07-15 03:37:28 +03:00
|
|
|
|
|
|
|
} // namespace mozilla
|