mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00
Bug 1170454: Fix up instance type for VAOs. r=smaug,r=jgilbert
--HG-- rename : dom/canvas/WebGLVertexArrayGL.h => dom/canvas/WebGLVertexArrayObject.cpp rename : dom/canvas/WebGLVertexArrayGL.h => dom/canvas/WebGLVertexArrayObject.h
This commit is contained in:
parent
7cbdd8c8fd
commit
b8459e912c
@ -365,6 +365,8 @@ private:
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
const char* info);
|
||||
|
||||
// CreateVertexArrayImpl is assumed to be infallible.
|
||||
virtual WebGLVertexArray* CreateVertexArrayImpl() override;
|
||||
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type, GLsizei* alignment, const char* info) override;
|
||||
virtual bool ValidateBufferTarget(GLenum target, const char* info) override;
|
||||
virtual bool ValidateBufferIndexedTarget(GLenum target, const char* info) override;
|
||||
|
@ -5,16 +5,17 @@
|
||||
|
||||
#include "WebGL2Context.h"
|
||||
#include "GLContext.h"
|
||||
#include "WebGLVertexArrayObject.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Vertex Array Object
|
||||
// TODO(djg): Implemented in WebGLContext
|
||||
/*
|
||||
already_AddRefed<WebGLVertexArrayObject> CreateVertexArray();
|
||||
void DeleteVertexArray(WebGLVertexArrayObject* vertexArray);
|
||||
bool IsVertexArray(WebGLVertexArrayObject* vertexArray);
|
||||
void BindVertexArray(WebGLVertexArrayObject* vertexArray);
|
||||
*/
|
||||
|
||||
WebGLVertexArray*
|
||||
WebGL2Context::CreateVertexArrayImpl()
|
||||
{
|
||||
return dom::WebGLVertexArrayObject::Create(this);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -1390,6 +1390,8 @@ private:
|
||||
private:
|
||||
// -------------------------------------------------------------------------
|
||||
// Context customization points
|
||||
virtual WebGLVertexArray* CreateVertexArrayImpl();
|
||||
|
||||
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type, GLsizei* alignment, const char* info) = 0;
|
||||
virtual bool ValidateBufferTarget(GLenum target, const char* info) = 0;
|
||||
virtual bool ValidateBufferIndexedTarget(GLenum target, const char* info) = 0;
|
||||
|
@ -51,7 +51,7 @@ WebGLContext::CreateVertexArray()
|
||||
if (IsContextLost())
|
||||
return nullptr;
|
||||
|
||||
nsRefPtr<WebGLVertexArray> globj = WebGLVertexArray::Create(this);
|
||||
nsRefPtr<WebGLVertexArray> globj = CreateVertexArrayImpl();
|
||||
|
||||
MakeContextCurrent();
|
||||
globj->GenVertexArray();
|
||||
@ -59,6 +59,12 @@ WebGLContext::CreateVertexArray()
|
||||
return globj.forget();
|
||||
}
|
||||
|
||||
WebGLVertexArray*
|
||||
WebGLContext::CreateVertexArrayImpl()
|
||||
{
|
||||
return WebGLVertexArray::Create(this);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::DeleteVertexArray(WebGLVertexArray* array)
|
||||
{
|
||||
|
@ -10,15 +10,17 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WebGLVertexArrayGL final
|
||||
class WebGLVertexArrayGL
|
||||
: public WebGLVertexArray
|
||||
{
|
||||
friend class WebGLVertexArray;
|
||||
|
||||
public:
|
||||
virtual void DeleteImpl() override;
|
||||
virtual void BindVertexArrayImpl() override;
|
||||
virtual void GenVertexArray() override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
explicit WebGLVertexArrayGL(WebGLContext* webgl)
|
||||
: WebGLVertexArray(webgl)
|
||||
{ }
|
||||
@ -26,8 +28,6 @@ private:
|
||||
~WebGLVertexArrayGL() {
|
||||
DeleteOnce();
|
||||
}
|
||||
|
||||
friend class WebGLVertexArray;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
35
dom/canvas/WebGLVertexArrayObject.cpp
Normal file
35
dom/canvas/WebGLVertexArrayObject.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
/* -*- 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 "WebGLVertexArrayObject.h"
|
||||
|
||||
#include "mozilla/dom/WebGL2RenderingContextBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
WebGLVertexArray*
|
||||
WebGLVertexArrayObject::Create(WebGLContext* webgl)
|
||||
{
|
||||
// WebGL 2: This is core in GL ES 3. If support is missing something
|
||||
// is very wrong.
|
||||
bool vaoSupport = webgl->GL()->IsSupported(gl::GLFeature::vertex_array_object);
|
||||
MOZ_RELEASE_ASSERT(vaoSupport, "Vertex Array Objects aren't supported.");
|
||||
if (vaoSupport)
|
||||
return new WebGLVertexArrayObject(webgl);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
WebGLVertexArrayObject::WrapObject(JSContext* cx,
|
||||
JS::Handle<JSObject*> givenProto)
|
||||
{
|
||||
return dom::WebGLVertexArrayObjectBinding::Wrap(cx, this, givenProto);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
42
dom/canvas/WebGLVertexArrayObject.h
Normal file
42
dom/canvas/WebGLVertexArrayObject.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* -*- 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/. */
|
||||
#ifndef mozilla_dom_WebGLVertexArrayObject_h
|
||||
#define mozilla_dom_WebGLVertexArrayObject_h
|
||||
|
||||
#include "WebGLVertexArrayGL.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/**
|
||||
* This class implements the DOM bindings for WebGL 2 VAO.
|
||||
*
|
||||
* This exists to so the object returned from gl.createVertexArray()
|
||||
* is an instance of WebGLVertexArrayObject (to match the WebGL 2
|
||||
* spec.)
|
||||
*/
|
||||
class WebGLVertexArrayObject final
|
||||
: public WebGLVertexArrayGL
|
||||
{
|
||||
public:
|
||||
static WebGLVertexArray* Create(WebGLContext* webgl);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override;
|
||||
|
||||
private:
|
||||
explicit WebGLVertexArrayObject(WebGLContext* webgl)
|
||||
: WebGLVertexArrayGL(webgl)
|
||||
{ }
|
||||
|
||||
~WebGLVertexArrayObject() {
|
||||
DeleteOnce();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // !mozilla_dom_WebGLVertexArrayObject_h
|
@ -31,6 +31,7 @@ EXPORTS.mozilla.dom += [
|
||||
'CanvasUtils.h',
|
||||
'ImageData.h',
|
||||
'TextMetrics.h',
|
||||
'WebGLVertexArrayObject.h',
|
||||
]
|
||||
|
||||
# http://support.microsoft.com/kb/143208
|
||||
@ -128,6 +129,7 @@ UNIFIED_SOURCES += [
|
||||
'WebGLVertexArray.cpp',
|
||||
'WebGLVertexArrayFake.cpp',
|
||||
'WebGLVertexArrayGL.cpp',
|
||||
'WebGLVertexArrayObject.cpp',
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
'/js/xpconnect/wrappers',
|
||||
|
@ -26,11 +26,9 @@ interface WebGLSync {
|
||||
interface WebGLTransformFeedback {
|
||||
};
|
||||
|
||||
/*
|
||||
[Pref="webgl.enable-prototype-webgl2"]
|
||||
interface WebGLVertexArrayObject {
|
||||
};
|
||||
*/
|
||||
|
||||
[Pref="webgl.enable-prototype-webgl2"]
|
||||
interface WebGL2RenderingContext : WebGLRenderingContext
|
||||
@ -475,10 +473,8 @@ interface WebGL2RenderingContext : WebGLRenderingContext
|
||||
void uniformBlockBinding(WebGLProgram? program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
|
||||
|
||||
/* Vertex Array Objects */
|
||||
/*
|
||||
WebGLVertexArrayObject? createVertexArray();
|
||||
void deleteVertexArray(WebGLVertexArrayObject? vertexArray);
|
||||
[WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray);
|
||||
void bindVertexArray(WebGLVertexArrayObject? array);
|
||||
*/
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user