mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Bug 973815 - Implements WebGL draft extension EXT_blend_minmax - r=jgilbert,bzbarsky
This commit is contained in:
parent
2f2dae3d06
commit
8b404b63af
@ -64,6 +64,7 @@ WebGLContext::InitWebGL2()
|
||||
|
||||
const WebGLExtensionID sExtensionNativelySupportedArr[] = {
|
||||
WebGLExtensionID::ANGLE_instanced_arrays,
|
||||
WebGLExtensionID::EXT_blend_minmax,
|
||||
WebGLExtensionID::OES_element_index_uint,
|
||||
WebGLExtensionID::OES_standard_derivatives,
|
||||
WebGLExtensionID::OES_texture_float,
|
||||
@ -73,7 +74,6 @@ WebGLContext::InitWebGL2()
|
||||
WebGLExtensionID::WEBGL_draw_buffers
|
||||
};
|
||||
const GLFeature sFeatureRequiredArr[] = {
|
||||
GLFeature::blend_minmax,
|
||||
GLFeature::instanced_non_arrays,
|
||||
GLFeature::transform_feedback
|
||||
};
|
||||
|
@ -31,6 +31,7 @@ WebGLContext::GetExtensionString(WebGLExtensionID ext)
|
||||
sExtensionNamesEnumeratedArray[WebGLExtensionID::x] = #x;
|
||||
|
||||
WEBGL_EXTENSION_IDENTIFIER(ANGLE_instanced_arrays)
|
||||
WEBGL_EXTENSION_IDENTIFIER(EXT_blend_minmax)
|
||||
WEBGL_EXTENSION_IDENTIFIER(EXT_color_buffer_half_float)
|
||||
WEBGL_EXTENSION_IDENTIFIER(EXT_frag_depth)
|
||||
WEBGL_EXTENSION_IDENTIFIER(EXT_sRGB)
|
||||
@ -162,16 +163,16 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
|
||||
// For warnings-as-errors.
|
||||
break;
|
||||
}
|
||||
// Uncomment this switch for any new extensions
|
||||
#if 0
|
||||
|
||||
if (Preferences::GetBool("webgl.enable-draft-extensions", false) || IsWebGL2()) {
|
||||
switch (ext) {
|
||||
case WebGLExtensionID::EXT_blend_minmax:
|
||||
return WebGLExtensionBlendMinMax::IsSupported(this);
|
||||
default:
|
||||
// For warnings-as-errors.
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -330,6 +331,9 @@ WebGLContext::EnableExtension(WebGLExtensionID ext)
|
||||
case WebGLExtensionID::EXT_frag_depth:
|
||||
obj = new WebGLExtensionFragDepth(this);
|
||||
break;
|
||||
case WebGLExtensionID::EXT_blend_minmax:
|
||||
obj = new WebGLExtensionBlendMinMax(this);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "should not get there.");
|
||||
}
|
||||
|
@ -328,8 +328,7 @@ bool WebGLContext::ValidateBlendEquationEnum(GLenum mode, const char *info)
|
||||
return true;
|
||||
case LOCAL_GL_MIN:
|
||||
case LOCAL_GL_MAX:
|
||||
if (IsWebGL2()) {
|
||||
// http://www.opengl.org/registry/specs/EXT/blend_minmax.txt
|
||||
if (IsExtensionEnabled(WebGLExtensionID::EXT_blend_minmax)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
28
content/canvas/src/WebGLExtensionBlendMinMax.cpp
Normal file
28
content/canvas/src/WebGLExtensionBlendMinMax.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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"
|
||||
#include "WebGLExtensions.h"
|
||||
|
||||
#include "GLContext.h"
|
||||
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionBlendMinMax::WebGLExtensionBlendMinMax(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
}
|
||||
|
||||
WebGLExtensionBlendMinMax::~WebGLExtensionBlendMinMax()
|
||||
{
|
||||
}
|
||||
|
||||
bool WebGLExtensionBlendMinMax::IsSupported(const WebGLContext* context)
|
||||
{
|
||||
return context->GL()->IsSupported(gl::GLFeature::blend_minmax);
|
||||
}
|
||||
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionBlendMinMax)
|
@ -309,6 +309,18 @@ public:
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionBlendMinMax
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionBlendMinMax(WebGLContext*);
|
||||
virtual ~WebGLExtensionBlendMinMax();
|
||||
|
||||
static bool IsSupported(const WebGLContext*);
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // WEBGLEXTENSIONS_H_
|
||||
|
@ -146,6 +146,7 @@ MOZ_END_ENUM_CLASS(WebGLTexImageFunc)
|
||||
// Please keep extensions in alphabetic order.
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLExtensionID, uint8_t)
|
||||
ANGLE_instanced_arrays,
|
||||
EXT_blend_minmax,
|
||||
EXT_color_buffer_half_float,
|
||||
EXT_frag_depth,
|
||||
EXT_sRGB,
|
||||
|
@ -45,6 +45,7 @@ if CONFIG['MOZ_WEBGL']:
|
||||
'WebGLContextVertices.cpp',
|
||||
'WebGLElementArrayCache.cpp',
|
||||
'WebGLExtensionBase.cpp',
|
||||
'WebGLExtensionBlendMinMax.cpp',
|
||||
'WebGLExtensionColorBufferFloat.cpp',
|
||||
'WebGLExtensionColorBufferHalfFloat.cpp',
|
||||
'WebGLExtensionCompressedTextureATC.cpp',
|
||||
|
@ -1489,6 +1489,11 @@ DOMInterfaces = {
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionBlendMinMax': {
|
||||
'nativeType': 'mozilla::WebGLExtensionBlendMinMax',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLFramebuffer': {
|
||||
'nativeType': 'mozilla::WebGLFramebuffer',
|
||||
'headerFile': 'WebGLFramebuffer.h'
|
||||
|
@ -959,3 +959,9 @@ interface WebGLExtensionInstancedArrays {
|
||||
void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount);
|
||||
void vertexAttribDivisorANGLE(GLuint index, GLuint divisor);
|
||||
};
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface WebGLExtensionBlendMinMax {
|
||||
const GLenum MIN_EXT = 0x8007;
|
||||
const GLenum MAX_EXT = 0x8008;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user