зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 12 changesets (bug 1170855) for Windows build bustage
CLOSED TREE Backed out changeset 47070f494c9e (bug 1170855) Backed out changeset 86e3fb3a2295 (bug 1170855) Backed out changeset 49284df5294e (bug 1170855) Backed out changeset ae7c769cb78d (bug 1170855) Backed out changeset 1fbb0ef29363 (bug 1170855) Backed out changeset 1fd9140044be (bug 1170855) Backed out changeset cca48a1bc6ef (bug 1170855) Backed out changeset 835570bc63bf (bug 1170855) Backed out changeset 4ee1883ffc65 (bug 1170855) Backed out changeset c666d71f4899 (bug 1170855) Backed out changeset 046422ea849f (bug 1170855) Backed out changeset d38fb3aea20a (bug 1170855)
This commit is contained in:
Родитель
977758d61c
Коммит
e9695717ce
|
@ -324,7 +324,6 @@ public:
|
|||
void BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer);
|
||||
void BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer, GLintptr offset, GLsizeiptr size);
|
||||
*/
|
||||
virtual JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) override;
|
||||
void GetIndexedParameter(GLenum target, GLuint index,
|
||||
dom::Nullable<dom::OwningWebGLBufferOrLongLong>& retval);
|
||||
void GetUniformIndices(WebGLProgram* program,
|
||||
|
|
|
@ -36,12 +36,6 @@ WebGL2Context::DeleteSampler(WebGLSampler* sampler)
|
|||
if (!sampler || sampler->IsDeleted())
|
||||
return;
|
||||
|
||||
for (int n = 0; n < mGLMaxTextureUnits; n++) {
|
||||
if (mBoundSamplers[n] == sampler) {
|
||||
mBoundSamplers[n] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
sampler->RequestDelete();
|
||||
}
|
||||
|
||||
|
@ -80,8 +74,6 @@ WebGL2Context::BindSampler(GLuint unit, WebGLSampler* sampler)
|
|||
return ErrorInvalidOperation("bindSampler: binding deleted sampler");
|
||||
|
||||
WebGLContextUnchecked::BindSampler(unit, sampler);
|
||||
|
||||
mBoundSamplers[unit] = sampler;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,177 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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 "WebGL2Context.h"
|
||||
#include "WebGLContextUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
JS::Value
|
||||
WebGL2Context::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
||||
{
|
||||
// The following cases are handled in WebGLContext::GetParameter():
|
||||
// case LOCAL_GL_MAX_COLOR_ATTACHMENTS:
|
||||
// case LOCAL_GL_MAX_DRAW_BUFFERS:
|
||||
// case LOCAL_GL_DRAW_BUFFERi:
|
||||
|
||||
if (IsContextLost())
|
||||
return JS::NullValue();
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
switch (pname) {
|
||||
/* GLboolean */
|
||||
case LOCAL_GL_RASTERIZER_DISCARD:
|
||||
case LOCAL_GL_SAMPLE_ALPHA_TO_COVERAGE:
|
||||
case LOCAL_GL_SAMPLE_COVERAGE:
|
||||
case LOCAL_GL_TRANSFORM_FEEDBACK_PAUSED:
|
||||
case LOCAL_GL_TRANSFORM_FEEDBACK_ACTIVE:
|
||||
case LOCAL_GL_UNPACK_SKIP_IMAGES:
|
||||
case LOCAL_GL_UNPACK_SKIP_PIXELS:
|
||||
case LOCAL_GL_UNPACK_SKIP_ROWS: {
|
||||
realGLboolean b = 0;
|
||||
gl->fGetBooleanv(pname, &b);
|
||||
return JS::BooleanValue(bool(b));
|
||||
}
|
||||
|
||||
/* GLenum */
|
||||
case LOCAL_GL_READ_BUFFER: {
|
||||
if (mBoundReadFramebuffer) {
|
||||
GLint val = LOCAL_GL_NONE;
|
||||
gl->fGetIntegerv(pname, &val);
|
||||
return JS::Int32Value(val);
|
||||
}
|
||||
|
||||
return JS::Int32Value(LOCAL_GL_BACK);
|
||||
}
|
||||
|
||||
case LOCAL_GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
|
||||
/* fall through */
|
||||
|
||||
/* GLint */
|
||||
case LOCAL_GL_MAX_3D_TEXTURE_SIZE:
|
||||
case LOCAL_GL_MAX_ARRAY_TEXTURE_LAYERS:
|
||||
case LOCAL_GL_MAX_COMBINED_UNIFORM_BLOCKS:
|
||||
case LOCAL_GL_MAX_ELEMENTS_INDICES:
|
||||
case LOCAL_GL_MAX_ELEMENTS_VERTICES:
|
||||
case LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS:
|
||||
case LOCAL_GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
|
||||
case LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
|
||||
case LOCAL_GL_MAX_PROGRAM_TEXEL_OFFSET:
|
||||
case LOCAL_GL_MAX_SAMPLES:
|
||||
case LOCAL_GL_MAX_TEXTURE_LOD_BIAS:
|
||||
case LOCAL_GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
|
||||
case LOCAL_GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
|
||||
case LOCAL_GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
|
||||
case LOCAL_GL_MAX_UNIFORM_BUFFER_BINDINGS:
|
||||
case LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS:
|
||||
case LOCAL_GL_MAX_VERTEX_UNIFORM_BLOCKS:
|
||||
case LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS:
|
||||
case LOCAL_GL_MIN_PROGRAM_TEXEL_OFFSET:
|
||||
case LOCAL_GL_PACK_ROW_LENGTH:
|
||||
case LOCAL_GL_PACK_SKIP_PIXELS:
|
||||
case LOCAL_GL_PACK_SKIP_ROWS:
|
||||
case LOCAL_GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
|
||||
case LOCAL_GL_UNPACK_IMAGE_HEIGHT:
|
||||
case LOCAL_GL_UNPACK_ROW_LENGTH: {
|
||||
GLint val;
|
||||
gl->fGetIntegerv(pname, &val);
|
||||
return JS::Int32Value(val);
|
||||
}
|
||||
|
||||
case LOCAL_GL_MAX_VARYING_COMPONENTS: {
|
||||
// On OS X Core Profile this is buggy. The spec says that the
|
||||
// value is 4 * GL_MAX_VARYING_VECTORS
|
||||
GLint val;
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, &val);
|
||||
return JS::Int32Value(4*val);
|
||||
}
|
||||
|
||||
/* GLint64 */
|
||||
case LOCAL_GL_MAX_CLIENT_WAIT_TIMEOUT_WEBGL:
|
||||
return JS::NumberValue(0); // TODO
|
||||
|
||||
case LOCAL_GL_MAX_ELEMENT_INDEX:
|
||||
// GL_MAX_ELEMENT_INDEX becomes available in GL 4.3 or via ES3
|
||||
// compatibility
|
||||
if (!gl->IsSupported(gl::GLFeature::ES3_compatibility))
|
||||
return JS::NumberValue(0);
|
||||
|
||||
/*** fall through to fGetInteger64v ***/
|
||||
|
||||
case LOCAL_GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
|
||||
case LOCAL_GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
|
||||
case LOCAL_GL_MAX_UNIFORM_BLOCK_SIZE: {
|
||||
GLint64 val;
|
||||
gl->fGetInteger64v(pname, &val);
|
||||
return JS::DoubleValue(static_cast<double>(val));
|
||||
}
|
||||
|
||||
|
||||
/* GLuint64 */
|
||||
case LOCAL_GL_MAX_SERVER_WAIT_TIMEOUT: {
|
||||
GLuint64 val;
|
||||
gl->fGetInteger64v(pname, (GLint64*) &val);
|
||||
return JS::DoubleValue(static_cast<double>(val));
|
||||
}
|
||||
|
||||
case LOCAL_GL_COPY_READ_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundCopyReadBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_COPY_WRITE_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundCopyWriteBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_PIXEL_PACK_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundPixelPackBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_PIXEL_UNPACK_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundPixelUnpackBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundTransformFeedbackBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_UNIFORM_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundUniformBuffer.get(), rv);
|
||||
|
||||
// DRAW_FRAMEBUFFER_BINDING is the same as FRAMEBUFFER_BINDING.
|
||||
case LOCAL_GL_READ_FRAMEBUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundReadFramebuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_SAMPLER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundSamplers[mActiveTexture].get(), rv);
|
||||
|
||||
case LOCAL_GL_TEXTURE_BINDING_2D_ARRAY:
|
||||
// TODO: Implement gl.TEXTURE_2D_ARRAY
|
||||
// return WebGLObjectAsJSValue(cx, mBound2DTextureArrays[mActiveTexture].get(), rv);
|
||||
return JS::NullValue();
|
||||
|
||||
case LOCAL_GL_TEXTURE_BINDING_3D:
|
||||
return WebGLObjectAsJSValue(cx, mBound3DTextures[mActiveTexture].get(), rv);
|
||||
|
||||
case LOCAL_GL_TRANSFORM_FEEDBACK_BINDING: {
|
||||
WebGLTransformFeedback* tf =
|
||||
(mBoundTransformFeedback != mDefaultTransformFeedback) ? mBoundTransformFeedback.get() : nullptr;
|
||||
return WebGLObjectAsJSValue(cx, tf, rv);
|
||||
}
|
||||
|
||||
case LOCAL_GL_VERTEX_ARRAY_BINDING: {
|
||||
WebGLVertexArray* vao =
|
||||
(mBoundVertexArray != mDefaultVertexArray) ? mBoundVertexArray.get() : nullptr;
|
||||
return WebGLObjectAsJSValue(cx, vao, rv);
|
||||
}
|
||||
|
||||
case LOCAL_GL_VERSION:
|
||||
return StringValue(cx, "WebGL 2.0", rv);
|
||||
|
||||
case LOCAL_GL_SHADING_LANGUAGE_VERSION:
|
||||
return StringValue(cx, "WebGL GLSL ES 3.00", rv);
|
||||
|
||||
default:
|
||||
return WebGLContext::GetParameter(cx, pname, rv);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -325,7 +325,6 @@ WebGLContext::DestroyResourcesAndContext()
|
|||
mBound2DTextures.Clear();
|
||||
mBoundCubeMapTextures.Clear();
|
||||
mBound3DTextures.Clear();
|
||||
mBoundSamplers.Clear();
|
||||
mBoundArrayBuffer = nullptr;
|
||||
mBoundCopyReadBuffer = nullptr;
|
||||
mBoundCopyWriteBuffer = nullptr;
|
||||
|
@ -1950,7 +1949,6 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebGLContext,
|
|||
mBound2DTextures,
|
||||
mBoundCubeMapTextures,
|
||||
mBound3DTextures,
|
||||
mBoundSamplers,
|
||||
mBoundArrayBuffer,
|
||||
mBoundCopyReadBuffer,
|
||||
mBoundCopyWriteBuffer,
|
||||
|
|
|
@ -65,16 +65,6 @@ class nsIDocShell;
|
|||
#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE 1024 // Different from the spec, which sets it to 1 on page 164
|
||||
#define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 8 // Page 164
|
||||
|
||||
/*
|
||||
* WebGL-only GLenums
|
||||
*/
|
||||
#define LOCAL_GL_BROWSER_DEFAULT_WEBGL 0x9244
|
||||
#define LOCAL_GL_CONTEXT_LOST_WEBGL 0x9242
|
||||
#define LOCAL_GL_MAX_CLIENT_WAIT_TIMEOUT_WEBGL 0x9247
|
||||
#define LOCAL_GL_UNPACK_COLORSPACE_CONVERSION_WEBGL 0x9243
|
||||
#define LOCAL_GL_UNPACK_FLIP_Y_WEBGL 0x9240
|
||||
#define LOCAL_GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL 0x9241
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WebGLActiveInfo;
|
||||
|
@ -965,7 +955,7 @@ public:
|
|||
void Disable(GLenum cap);
|
||||
void Enable(GLenum cap);
|
||||
bool GetStencilBits(GLint* out_stencilBits);
|
||||
virtual JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv);
|
||||
JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv);
|
||||
|
||||
void GetParameter(JSContext* cx, GLenum pname,
|
||||
JS::MutableHandle<JS::Value> retval, ErrorResult& rv)
|
||||
|
@ -1445,7 +1435,6 @@ protected:
|
|||
nsTArray<WebGLRefPtr<WebGLTexture> > mBound2DTextures;
|
||||
nsTArray<WebGLRefPtr<WebGLTexture> > mBoundCubeMapTextures;
|
||||
nsTArray<WebGLRefPtr<WebGLTexture> > mBound3DTextures;
|
||||
nsTArray<WebGLRefPtr<WebGLSampler> > mBoundSamplers;
|
||||
|
||||
void ResolveTexturesForDraw() const;
|
||||
|
||||
|
|
|
@ -58,6 +58,18 @@ WebGLContext::Enable(GLenum cap)
|
|||
gl->fEnable(cap);
|
||||
}
|
||||
|
||||
static JS::Value
|
||||
StringValue(JSContext* cx, const char* chars, ErrorResult& rv)
|
||||
{
|
||||
JSString* str = JS_NewStringCopyZ(cx, chars);
|
||||
if (!str) {
|
||||
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
return JS::StringValue(str);
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::GetStencilBits(GLint* out_stencilBits)
|
||||
{
|
||||
|
@ -138,15 +150,18 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
|||
} else if (pname >= LOCAL_GL_DRAW_BUFFER0 &&
|
||||
pname < GLenum(LOCAL_GL_DRAW_BUFFER0 + mGLMaxDrawBuffers))
|
||||
{
|
||||
if (mBoundDrawFramebuffer) {
|
||||
GLint iv = 0;
|
||||
gl->fGetIntegerv(pname, &iv);
|
||||
return JS::Int32Value(iv);
|
||||
}
|
||||
|
||||
GLint iv = 0;
|
||||
gl->fGetIntegerv(pname, &iv);
|
||||
|
||||
if (mBoundDrawFramebuffer)
|
||||
return JS::Int32Value(iv);
|
||||
|
||||
const GLint index = (pname - LOCAL_GL_DRAW_BUFFER0);
|
||||
if (iv == LOCAL_GL_COLOR_ATTACHMENT0 + index)
|
||||
if (iv == GLint(LOCAL_GL_COLOR_ATTACHMENT0 + pname - LOCAL_GL_DRAW_BUFFER0)) {
|
||||
return JS::Int32Value(LOCAL_GL_BACK);
|
||||
}
|
||||
|
||||
return JS::Int32Value(LOCAL_GL_NONE);
|
||||
}
|
||||
|
@ -154,9 +169,11 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
|||
|
||||
if (IsExtensionEnabled(WebGLExtensionID::OES_vertex_array_object)) {
|
||||
if (pname == LOCAL_GL_VERTEX_ARRAY_BINDING) {
|
||||
WebGLVertexArray* vao =
|
||||
(mBoundVertexArray != mDefaultVertexArray) ? mBoundVertexArray.get() : nullptr;
|
||||
return WebGLObjectAsJSValue(cx, vao, rv);
|
||||
if (mBoundVertexArray == mDefaultVertexArray){
|
||||
return WebGLObjectAsJSValue(cx, (WebGLVertexArray *) nullptr, rv);
|
||||
}
|
||||
|
||||
return WebGLObjectAsJSValue(cx, mBoundVertexArray.get(), rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,12 +181,10 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
|||
if (pname == LOCAL_GL_TIMESTAMP_EXT) {
|
||||
GLuint64 iv = 0;
|
||||
gl->fGetInteger64v(pname, (GLint64*) &iv);
|
||||
// TODO: JS doesn't support 64-bit integers. Be lossy and
|
||||
// cast to double (53 bits)
|
||||
return JS::NumberValue(static_cast<double>(iv));
|
||||
return JS::NumberValue(uint64_t(iv));
|
||||
} else if (pname == LOCAL_GL_GPU_DISJOINT_EXT) {
|
||||
// When disjoint isn't supported, leave as false.
|
||||
realGLboolean disjoint = LOCAL_GL_FALSE;
|
||||
realGLboolean disjoint = 0;
|
||||
if (gl->IsExtensionSupported(gl::GLContext::EXT_disjoint_timer_query)) {
|
||||
gl->fGetBooleanv(pname, &disjoint);
|
||||
}
|
||||
|
@ -177,35 +192,40 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
|||
}
|
||||
}
|
||||
|
||||
// Privileged string params exposed by WEBGL_debug_renderer_info:
|
||||
if (IsExtensionEnabled(WebGLExtensionID::WEBGL_debug_renderer_info)) {
|
||||
if (IsWebGL2()) {
|
||||
switch (pname) {
|
||||
case UNMASKED_VENDOR_WEBGL:
|
||||
case UNMASKED_RENDERER_WEBGL:
|
||||
GLenum glstringname = LOCAL_GL_NONE;
|
||||
if (pname == UNMASKED_VENDOR_WEBGL) {
|
||||
glstringname = LOCAL_GL_VENDOR;
|
||||
} else if (pname == UNMASKED_RENDERER_WEBGL) {
|
||||
glstringname = LOCAL_GL_RENDERER;
|
||||
}
|
||||
const GLchar* string = (const GLchar*) gl->fGetString(glstringname);
|
||||
return StringValue(cx, string, rv);
|
||||
case LOCAL_GL_MAX_SAMPLES:
|
||||
case LOCAL_GL_MAX_UNIFORM_BLOCK_SIZE:
|
||||
case LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS: {
|
||||
GLint val;
|
||||
gl->fGetIntegerv(pname, &val);
|
||||
return JS::NumberValue(uint32_t(val));
|
||||
}
|
||||
}
|
||||
|
||||
if (IsExtensionEnabled(WebGLExtensionID::OES_standard_derivatives)) {
|
||||
if (pname == LOCAL_GL_FRAGMENT_SHADER_DERIVATIVE_HINT) {
|
||||
GLint i = 0;
|
||||
gl->fGetIntegerv(pname, &i);
|
||||
return JS::Int32Value(i);
|
||||
}
|
||||
}
|
||||
case LOCAL_GL_TEXTURE_BINDING_3D:
|
||||
return WebGLObjectAsJSValue(cx, mBound3DTextures[mActiveTexture].get(), rv);
|
||||
|
||||
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);
|
||||
// DRAW_FRAMEBUFFER_BINDING is the same as FRAMEBUFFER_BINDING.
|
||||
case LOCAL_GL_READ_FRAMEBUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundReadFramebuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_PIXEL_PACK_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundPixelPackBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_PIXEL_UNPACK_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundPixelUnpackBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_UNIFORM_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundUniformBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundTransformFeedbackBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_COPY_READ_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundCopyReadBuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_COPY_WRITE_BUFFER_BINDING:
|
||||
return WebGLObjectAsJSValue(cx, mBoundCopyWriteBuffer.get(), rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,13 +234,42 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
|||
// String params
|
||||
//
|
||||
case LOCAL_GL_VENDOR:
|
||||
return StringValue(cx, "Mozilla", rv);
|
||||
case LOCAL_GL_RENDERER:
|
||||
return StringValue(cx, "Mozilla", rv);
|
||||
case LOCAL_GL_VERSION:
|
||||
return StringValue(cx, "WebGL 1.0", rv);
|
||||
case LOCAL_GL_VERSION: {
|
||||
const char* version = 0;
|
||||
|
||||
if (IsWebGL2()) {
|
||||
version = "WebGL 2.0";
|
||||
} else {
|
||||
version = "WebGL 1.0";
|
||||
}
|
||||
|
||||
MOZ_ASSERT(version != 0);
|
||||
return StringValue(cx, version, rv);
|
||||
}
|
||||
case LOCAL_GL_SHADING_LANGUAGE_VERSION:
|
||||
return StringValue(cx, "WebGL GLSL ES 1.0", rv);
|
||||
|
||||
// Privileged string params exposed by WEBGL_debug_renderer_info:
|
||||
case UNMASKED_VENDOR_WEBGL:
|
||||
case UNMASKED_RENDERER_WEBGL: {
|
||||
// The privilege check is done in WebGLContext::IsExtensionSupported.
|
||||
// So here we just have to check that the extension is enabled.
|
||||
if (!IsExtensionEnabled(WebGLExtensionID::WEBGL_debug_renderer_info)) {
|
||||
break;
|
||||
}
|
||||
GLenum glstringname = LOCAL_GL_NONE;
|
||||
if (pname == UNMASKED_VENDOR_WEBGL) {
|
||||
glstringname = LOCAL_GL_VENDOR;
|
||||
} else if (pname == UNMASKED_RENDERER_WEBGL) {
|
||||
glstringname = LOCAL_GL_RENDERER;
|
||||
}
|
||||
const char* string = reinterpret_cast<const char*>(gl->fGetString(glstringname));
|
||||
return StringValue(cx, string, rv);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// Single-value params
|
||||
|
||||
|
@ -331,6 +380,15 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
|||
}
|
||||
return JS::Int32Value(i);
|
||||
}
|
||||
case LOCAL_GL_FRAGMENT_SHADER_DERIVATIVE_HINT: {
|
||||
if (IsExtensionEnabled(WebGLExtensionID::OES_standard_derivatives)) {
|
||||
GLint i = 0;
|
||||
gl->fGetIntegerv(pname, &i);
|
||||
return JS::Int32Value(i);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case LOCAL_GL_MAX_TEXTURE_SIZE:
|
||||
return JS::Int32Value(mGLMaxTextureSize);
|
||||
|
||||
|
@ -359,22 +417,38 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
|||
}
|
||||
return JS::ObjectOrNullValue(obj);
|
||||
}
|
||||
case LOCAL_GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: {
|
||||
if (!IsWebGL2()) {
|
||||
break;
|
||||
}
|
||||
return JS::Int32Value(mGLMaxTransformFeedbackSeparateAttribs);
|
||||
}
|
||||
|
||||
// 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.
|
||||
case LOCAL_GL_STENCIL_BACK_VALUE_MASK:
|
||||
case LOCAL_GL_STENCIL_BACK_VALUE_MASK: {
|
||||
return JS::DoubleValue(mStencilValueMaskBack); // pass as FP value to allow large values such as 2^32-1.
|
||||
|
||||
case LOCAL_GL_STENCIL_BACK_WRITEMASK:
|
||||
}
|
||||
case LOCAL_GL_STENCIL_BACK_WRITEMASK: {
|
||||
return JS::DoubleValue(mStencilWriteMaskBack);
|
||||
|
||||
case LOCAL_GL_STENCIL_VALUE_MASK:
|
||||
}
|
||||
case LOCAL_GL_STENCIL_VALUE_MASK: {
|
||||
return JS::DoubleValue(mStencilValueMaskFront);
|
||||
|
||||
case LOCAL_GL_STENCIL_WRITEMASK:
|
||||
}
|
||||
case LOCAL_GL_STENCIL_WRITEMASK: {
|
||||
return JS::DoubleValue(mStencilWriteMaskFront);
|
||||
}
|
||||
|
||||
// float
|
||||
case LOCAL_GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: {
|
||||
if (IsExtensionEnabled(WebGLExtensionID::EXT_texture_filter_anisotropic)) {
|
||||
GLfloat f = 0.f;
|
||||
gl->fGetFloatv(pname, &f);
|
||||
return JS::DoubleValue(f);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case LOCAL_GL_DEPTH_CLEAR_VALUE:
|
||||
case LOCAL_GL_LINE_WIDTH:
|
||||
case LOCAL_GL_POLYGON_OFFSET_FACTOR:
|
||||
|
|
|
@ -75,18 +75,6 @@ TexImageTargetToTexTarget(TexImageTarget texImageTarget)
|
|||
}
|
||||
}
|
||||
|
||||
JS::Value
|
||||
StringValue(JSContext* cx, const char* chars, ErrorResult& rv)
|
||||
{
|
||||
JSString* str = JS_NewStringCopyZ(cx, chars);
|
||||
if (!str) {
|
||||
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
return JS::StringValue(str);
|
||||
}
|
||||
|
||||
GLComponents::GLComponents(TexInternalFormat internalformat)
|
||||
{
|
||||
TexInternalFormat unsizedformat = UnsizedInternalFormatFromInternalFormat(internalformat);
|
||||
|
|
|
@ -56,9 +56,6 @@ size_t GetBitsPerTexel(TexInternalFormat effectiveinternalformat);
|
|||
// Returns GL_NONE if passed an invalid texture image target
|
||||
TexTarget TexImageTargetToTexTarget(TexImageTarget texImageTarget);
|
||||
|
||||
// Helper function to create a JS::Value from a C string
|
||||
JS::Value StringValue(JSContext* cx, const char* str, ErrorResult& rv);
|
||||
|
||||
struct GLComponents
|
||||
{
|
||||
unsigned char mComponents;
|
||||
|
|
|
@ -1755,7 +1755,6 @@ WebGLContext::InitAndValidateGL()
|
|||
mBound2DTextures.Clear();
|
||||
mBoundCubeMapTextures.Clear();
|
||||
mBound3DTextures.Clear();
|
||||
mBoundSamplers.Clear();
|
||||
|
||||
mBoundArrayBuffer = nullptr;
|
||||
mBoundTransformFeedbackBuffer = nullptr;
|
||||
|
@ -1799,7 +1798,6 @@ WebGLContext::InitAndValidateGL()
|
|||
mBound2DTextures.SetLength(mGLMaxTextureUnits);
|
||||
mBoundCubeMapTextures.SetLength(mGLMaxTextureUnits);
|
||||
mBound3DTextures.SetLength(mGLMaxTextureUnits);
|
||||
mBoundSamplers.SetLength(mGLMaxTextureUnits);
|
||||
|
||||
if (MinCapabilityMode()) {
|
||||
mGLMaxTextureSize = MINVALUE_GL_MAX_TEXTURE_SIZE;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef WEBGL_TIMER_QUERY_H_
|
||||
#define WEBGL_TIMER_QUERY_H_
|
||||
|
||||
#include "GLConsts.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "WebGLObjectModel.h"
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ UNIFIED_SOURCES += [
|
|||
'WebGL2ContextPrograms.cpp',
|
||||
'WebGL2ContextQueries.cpp',
|
||||
'WebGL2ContextSamplers.cpp',
|
||||
'WebGL2ContextState.cpp',
|
||||
'WebGL2ContextSync.cpp',
|
||||
'WebGL2ContextTextures.cpp',
|
||||
'WebGL2ContextTransformFeedback.cpp',
|
||||
|
|
|
@ -310,10 +310,7 @@ interface WebGL2RenderingContext : WebGLRenderingContext
|
|||
const GLenum NUM_SAMPLE_COUNTS = 0x9380;
|
||||
const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF;
|
||||
|
||||
const GLuint64 TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFF;
|
||||
|
||||
/* WebGL-specific enums */
|
||||
const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247;
|
||||
const GLint64 TIMEOUT_IGNORED = -1;
|
||||
|
||||
/* Buffer objects */
|
||||
void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset,
|
||||
|
|
|
@ -283,6 +283,7 @@
|
|||
#define LOCAL_GL_BOOL_VEC4_ARB 0x8B59
|
||||
#define LOCAL_GL_BOUNDING_BOX_NV 0x908D
|
||||
#define LOCAL_GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
|
||||
#define LOCAL_GL_BROWSER_DEFAULT_WEBGL 0x9244
|
||||
#define LOCAL_GL_BUFFER 0x82E0
|
||||
#define LOCAL_GL_BUFFER_ACCESS 0x88BB
|
||||
#define LOCAL_GL_BUFFER_ACCESS_ARB 0x88BB
|
||||
|
@ -730,6 +731,7 @@
|
|||
#define LOCAL_GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002
|
||||
#define LOCAL_GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
|
||||
#define LOCAL_GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
|
||||
#define LOCAL_GL_CONTEXT_LOST_WEBGL 0x9242
|
||||
#define LOCAL_GL_CONTEXT_PROFILE_MASK 0x9126
|
||||
#define LOCAL_GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
|
||||
#define LOCAL_GL_CONTINUOUS_AMD 0x9007
|
||||
|
@ -4678,16 +4680,19 @@
|
|||
#define LOCAL_GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define LOCAL_GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
|
||||
#define LOCAL_GL_UNPACK_CMYK_HINT_EXT 0x800F
|
||||
#define LOCAL_GL_UNPACK_COLORSPACE_CONVERSION_WEBGL 0x9243
|
||||
#define LOCAL_GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129
|
||||
#define LOCAL_GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
|
||||
#define LOCAL_GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A
|
||||
#define LOCAL_GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127
|
||||
#define LOCAL_GL_UNPACK_COMPRESSED_SIZE_SGIX 0x831A
|
||||
#define LOCAL_GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5
|
||||
#define LOCAL_GL_UNPACK_FLIP_Y_WEBGL 0x9240
|
||||
#define LOCAL_GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133
|
||||
#define LOCAL_GL_UNPACK_IMAGE_HEIGHT 0x806E
|
||||
#define LOCAL_GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E
|
||||
#define LOCAL_GL_UNPACK_LSB_FIRST 0x0CF1
|
||||
#define LOCAL_GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL 0x9241
|
||||
#define LOCAL_GL_UNPACK_RESAMPLE_OML 0x8985
|
||||
#define LOCAL_GL_UNPACK_RESAMPLE_SGIX 0x842D
|
||||
#define LOCAL_GL_UNPACK_ROW_BYTES_APPLE 0x8A16
|
||||
|
|
|
@ -794,7 +794,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
}
|
||||
}
|
||||
|
||||
if (IsSupported(GLFeature::sync)) {
|
||||
if (IsExtensionSupported(ARB_sync)) {
|
||||
SymLoadStruct syncSymbols[] = {
|
||||
{ (PRFuncPtr*) &mSymbols.fFenceSync, { "FenceSync", nullptr } },
|
||||
{ (PRFuncPtr*) &mSymbols.fIsSync, { "IsSync", nullptr } },
|
||||
|
@ -807,7 +807,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
};
|
||||
|
||||
if (!LoadSymbols(&syncSymbols[0], trygl, prefix)) {
|
||||
NS_ERROR("GL supports sync without supplying its functions.");
|
||||
NS_ERROR("GL supports ARB_sync without supplying its functions.");
|
||||
|
||||
MarkExtensionUnsupported(ARB_sync);
|
||||
ClearSymbols(syncSymbols);
|
||||
|
|
|
@ -122,7 +122,6 @@ enum class GLFeature {
|
|||
sRGB_texture,
|
||||
sampler_objects,
|
||||
standard_derivatives,
|
||||
sync,
|
||||
texture_3D,
|
||||
texture_3D_compressed,
|
||||
texture_3D_copy,
|
||||
|
|
|
@ -529,15 +529,6 @@ static const FeatureInfo sFeatureInfoArr[] = {
|
|||
GLContext::Extensions_End
|
||||
}
|
||||
},
|
||||
{
|
||||
"sync",
|
||||
GLVersion::GL3_2,
|
||||
GLESVersion::ES3,
|
||||
GLContext::ARB_sync,
|
||||
{
|
||||
GLContext::Extensions_End
|
||||
}
|
||||
},
|
||||
{
|
||||
"texture_3D",
|
||||
GLVersion::GL1_2,
|
||||
|
|
Загрузка…
Ссылка в новой задаче