author | Benoit Jacob <bjacob@mozilla.com> |
Wed, 04 Sep 2013 08:14:43 -0400 | |
changeset 145449 | f40f6fb9d98cffdefa4ef92c0313e2d8608ab1ae |
parent 145448 | 104a75d724dd99220949900c4eb3567f9f4e7c70 |
child 145450 | dc6759deb5e1feb35ab0b032be47cc0b9eb0fd13 |
push id | 25213 |
push user | kwierso@gmail.com |
push date | Wed, 04 Sep 2013 23:18:26 +0000 |
treeherder | mozilla-central@dffedf20a02d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jgilbert |
bugs | 911855 |
milestone | 26.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/canvas/src/WebGLActiveInfo.h +++ b/content/canvas/src/WebGLActiveInfo.h @@ -11,41 +11,41 @@ #include "nsString.h" #include "js/TypeDecls.h" namespace mozilla { class WebGLActiveInfo MOZ_FINAL { public: - WebGLActiveInfo(WebGLint size, WebGLenum type, const nsACString& name) : + WebGLActiveInfo(GLint size, GLenum type, const nsACString& name) : mSize(size), mType(type), mName(NS_ConvertASCIItoUTF16(name)) {} // WebIDL attributes - WebGLint Size() const { + GLint Size() const { return mSize; } - WebGLenum Type() const { + GLenum Type() const { return mType; } void GetName(nsString& retval) const { retval = mName; } JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> scope); NS_INLINE_DECL_REFCOUNTING(WebGLActiveInfo) protected: - WebGLint mSize; - WebGLenum mType; + GLint mSize; + GLenum mType; nsString mName; }; } // namespace mozilla #endif
--- a/content/canvas/src/WebGLBuffer.h +++ b/content/canvas/src/WebGLBuffer.h @@ -46,33 +46,33 @@ public: void SetByteLength(WebGLsizeiptr byteLength) { mByteLength = byteLength; } void SetTarget(GLenum target); bool ElementArrayCacheBufferData(const void* ptr, size_t buffer_size_in_bytes); void ElementArrayCacheBufferSubData(size_t pos, const void* ptr, size_t update_size_in_bytes); - bool Validate(WebGLenum type, uint32_t max_allowed, size_t first, size_t count) { + bool Validate(GLenum type, uint32_t max_allowed, size_t first, size_t count) { return mCache->Validate(type, max_allowed, first, count); } WebGLContext *GetParentObject() const { return Context(); } virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> scope) MOZ_OVERRIDE; NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLBuffer) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLBuffer) protected: - WebGLuint mGLName; + GLuint mGLName; bool mHasEverBeenBound; WebGLsizeiptr mByteLength; GLenum mTarget; nsAutoPtr<WebGLElementArrayCache> mCache; }; } #endif //WEBGLBUFFER_H_
--- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -909,17 +909,17 @@ WebGLContext::GetContextAttributes(Nulla result.mAlpha.Construct(format.alpha > 0); result.mDepth = format.depth > 0; result.mStencil = format.stencil > 0; result.mAntialias = format.samples > 1; result.mPremultipliedAlpha = mOptions.premultipliedAlpha; result.mPreserveDrawingBuffer = mOptions.preserveDrawingBuffer; } -/* [noscript] DOMString mozGetUnderlyingParamString(in WebGLenum pname); */ +/* [noscript] DOMString mozGetUnderlyingParamString(in GLenum pname); */ NS_IMETHODIMP WebGLContext::MozGetUnderlyingParamString(uint32_t pname, nsAString& retval) { if (!IsContextStable()) return NS_OK; retval.SetIsVoid(true); @@ -1151,17 +1151,17 @@ WebGLContext::PresentScreenBuffer() mShouldPresent = false; return true; } void WebGLContext::DummyFramebufferOperation(const char *info) { - WebGLenum status = CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER); + GLenum status = CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER); if (status == LOCAL_GL_FRAMEBUFFER_COMPLETE) return; else return ErrorInvalidFramebufferOperation("%s: incomplete framebuffer", info); } // We use this timer for many things. Here are the things that it is activated for: // 1) If a script is using the MOZ_WEBGL_lose_context extension.
--- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -178,34 +178,34 @@ public: { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHOD Swap(uint32_t nativeID, int32_t x, int32_t y, int32_t w, int32_t h) { return NS_ERROR_NOT_IMPLEMENTED; } bool LoseContext(); bool RestoreContext(); - void SynthesizeGLError(WebGLenum err); - void SynthesizeGLError(WebGLenum err, const char *fmt, ...); + void SynthesizeGLError(GLenum err); + void SynthesizeGLError(GLenum err, const char *fmt, ...); void ErrorInvalidEnum(const char *fmt = 0, ...); void ErrorInvalidOperation(const char *fmt = 0, ...); void ErrorInvalidValue(const char *fmt = 0, ...); void ErrorInvalidFramebufferOperation(const char *fmt = 0, ...); - void ErrorInvalidEnumInfo(const char *info, WebGLenum enumvalue) { + void ErrorInvalidEnumInfo(const char *info, GLenum enumvalue) { return ErrorInvalidEnum("%s: invalid enum value 0x%x", info, enumvalue); } void ErrorOutOfMemory(const char *fmt = 0, ...); const char *ErrorName(GLenum error); bool IsTextureFormatCompressed(GLenum format); void DummyFramebufferOperation(const char *info); - WebGLTexture *activeBoundTextureForTarget(WebGLenum target) { + WebGLTexture *activeBoundTextureForTarget(GLenum target) { return target == LOCAL_GL_TEXTURE_2D ? mBound2DTextures[mActiveTexture] : mBoundCubeMapTextures[mActiveTexture]; } already_AddRefed<CanvasLayer> GetCanvasLayer(nsDisplayListBuilder* aBuilder, CanvasLayer *aOldLayer, LayerManager *aManager) MOZ_OVERRIDE; @@ -291,215 +291,215 @@ public: mContextLossTimerRunning = false; } } // WebIDL WebGLRenderingContext API dom::HTMLCanvasElement* GetCanvas() const { return mCanvasElement; } - WebGLsizei DrawingBufferWidth() const { + GLsizei DrawingBufferWidth() const { if (!IsContextStable()) return 0; return mWidth; } - WebGLsizei DrawingBufferHeight() const { + GLsizei DrawingBufferHeight() const { if (!IsContextStable()) return 0; return mHeight; } void GetContextAttributes(dom::Nullable<dom::WebGLContextAttributesInitializer>& retval); bool IsContextLost() const { return !IsContextStable(); } void GetSupportedExtensions(JSContext *cx, dom::Nullable< nsTArray<nsString> > &retval); JSObject* GetExtension(JSContext* cx, const nsAString& aName, ErrorResult& rv); - void ActiveTexture(WebGLenum texture); + void ActiveTexture(GLenum texture); void AttachShader(WebGLProgram* program, WebGLShader* shader); - void BindAttribLocation(WebGLProgram* program, WebGLuint location, + void BindAttribLocation(WebGLProgram* program, GLuint location, const nsAString& name); - void BindFramebuffer(WebGLenum target, WebGLFramebuffer* wfb); - void BindRenderbuffer(WebGLenum target, WebGLRenderbuffer* wrb); - void BindTexture(WebGLenum target, WebGLTexture *tex); + void BindFramebuffer(GLenum target, WebGLFramebuffer* wfb); + void BindRenderbuffer(GLenum target, WebGLRenderbuffer* wrb); + void BindTexture(GLenum target, WebGLTexture *tex); void BindVertexArray(WebGLVertexArray *vao); - void BlendColor(WebGLclampf r, WebGLclampf g, WebGLclampf b, WebGLclampf a) { + void BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) { if (!IsContextStable()) return; MakeContextCurrent(); gl->fBlendColor(r, g, b, a); } - void BlendEquation(WebGLenum mode); - void BlendEquationSeparate(WebGLenum modeRGB, WebGLenum modeAlpha); - void BlendFunc(WebGLenum sfactor, WebGLenum dfactor); - void BlendFuncSeparate(WebGLenum srcRGB, WebGLenum dstRGB, - WebGLenum srcAlpha, WebGLenum dstAlpha); - WebGLenum CheckFramebufferStatus(WebGLenum target); - void Clear(WebGLbitfield mask); - void ClearColor(WebGLclampf r, WebGLclampf g, WebGLclampf b, WebGLclampf a); - void ClearDepth(WebGLclampf v); - void ClearStencil(WebGLint v); + void BlendEquation(GLenum mode); + void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + void BlendFunc(GLenum sfactor, GLenum dfactor); + void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, + GLenum srcAlpha, GLenum dstAlpha); + GLenum CheckFramebufferStatus(GLenum target); + void Clear(GLbitfield mask); + void ClearColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a); + void ClearDepth(GLclampf v); + void ClearStencil(GLint v); void ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b, WebGLboolean a); void CompileShader(WebGLShader *shader); - void CompressedTexImage2D(WebGLenum target, WebGLint level, - WebGLenum internalformat, WebGLsizei width, - WebGLsizei height, WebGLint border, + void CompressedTexImage2D(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, const dom::ArrayBufferView& view); - void CompressedTexSubImage2D(WebGLenum target, WebGLint level, - WebGLint xoffset, WebGLint yoffset, - WebGLsizei width, WebGLsizei height, - WebGLenum format, + void CompressedTexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, const dom::ArrayBufferView& view); - void CopyTexImage2D(WebGLenum target, WebGLint level, - WebGLenum internalformat, WebGLint x, WebGLint y, - WebGLsizei width, WebGLsizei height, WebGLint border); - void CopyTexSubImage2D(WebGLenum target, WebGLint level, WebGLint xoffset, - WebGLint yoffset, WebGLint x, WebGLint y, - WebGLsizei width, WebGLsizei height); + void CopyTexImage2D(GLenum target, GLint level, + GLenum internalformat, GLint x, GLint y, + GLsizei width, GLsizei height, GLint border); + void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint x, GLint y, + GLsizei width, GLsizei height); already_AddRefed<WebGLFramebuffer> CreateFramebuffer(); already_AddRefed<WebGLProgram> CreateProgram(); already_AddRefed<WebGLRenderbuffer> CreateRenderbuffer(); already_AddRefed<WebGLTexture> CreateTexture(); - already_AddRefed<WebGLShader> CreateShader(WebGLenum type); + already_AddRefed<WebGLShader> CreateShader(GLenum type); already_AddRefed<WebGLVertexArray> CreateVertexArray(); - void CullFace(WebGLenum face); + void CullFace(GLenum face); void DeleteFramebuffer(WebGLFramebuffer *fbuf); void DeleteProgram(WebGLProgram *prog); void DeleteRenderbuffer(WebGLRenderbuffer *rbuf); void DeleteShader(WebGLShader *shader); void DeleteVertexArray(WebGLVertexArray *vao); void DeleteTexture(WebGLTexture *tex); - void DepthFunc(WebGLenum func); + void DepthFunc(GLenum func); void DepthMask(WebGLboolean b); - void DepthRange(WebGLclampf zNear, WebGLclampf zFar); + void DepthRange(GLclampf zNear, GLclampf zFar); void DetachShader(WebGLProgram *program, WebGLShader *shader); void DrawBuffers(const dom::Sequence<GLenum>& buffers); void Flush() { if (!IsContextStable()) return; MakeContextCurrent(); gl->fFlush(); } void Finish() { if (!IsContextStable()) return; MakeContextCurrent(); gl->fFinish(); } - void FramebufferRenderbuffer(WebGLenum target, WebGLenum attachment, - WebGLenum rbtarget, WebGLRenderbuffer *wrb); - void FramebufferTexture2D(WebGLenum target, WebGLenum attachment, - WebGLenum textarget, WebGLTexture *tobj, - WebGLint level); - void FrontFace(WebGLenum mode); - void GenerateMipmap(WebGLenum target); + void FramebufferRenderbuffer(GLenum target, GLenum attachment, + GLenum rbtarget, WebGLRenderbuffer *wrb); + void FramebufferTexture2D(GLenum target, GLenum attachment, + GLenum textarget, WebGLTexture *tobj, + GLint level); + void FrontFace(GLenum mode); + void GenerateMipmap(GLenum target); already_AddRefed<WebGLActiveInfo> GetActiveAttrib(WebGLProgram *prog, - WebGLuint index); + GLuint index); already_AddRefed<WebGLActiveInfo> GetActiveUniform(WebGLProgram *prog, - WebGLuint index); + GLuint index); void GetAttachedShaders(WebGLProgram* prog, dom::Nullable< nsTArray<WebGLShader*> > &retval); - WebGLint GetAttribLocation(WebGLProgram* prog, const nsAString& name); - JS::Value GetBufferParameter(WebGLenum target, WebGLenum pname); - JS::Value GetBufferParameter(JSContext* /* unused */, WebGLenum target, - WebGLenum pname) { + GLint GetAttribLocation(WebGLProgram* prog, const nsAString& name); + JS::Value GetBufferParameter(GLenum target, GLenum pname); + JS::Value GetBufferParameter(JSContext* /* unused */, GLenum target, + GLenum pname) { return GetBufferParameter(target, pname); } - WebGLenum GetError(); + GLenum GetError(); JS::Value GetFramebufferAttachmentParameter(JSContext* cx, - WebGLenum target, - WebGLenum attachment, - WebGLenum pname, + GLenum target, + GLenum attachment, + GLenum pname, ErrorResult& rv); - JS::Value GetProgramParameter(WebGLProgram *prog, WebGLenum pname); + JS::Value GetProgramParameter(WebGLProgram *prog, GLenum pname); JS::Value GetProgramParameter(JSContext* /* unused */, WebGLProgram *prog, - WebGLenum pname) { + GLenum pname) { return GetProgramParameter(prog, pname); } void GetProgramInfoLog(WebGLProgram *prog, nsACString& retval); void GetProgramInfoLog(WebGLProgram *prog, nsAString& retval); - JS::Value GetRenderbufferParameter(WebGLenum target, WebGLenum pname); + JS::Value GetRenderbufferParameter(GLenum target, GLenum pname); JS::Value GetRenderbufferParameter(JSContext* /* unused */, - WebGLenum target, WebGLenum pname) { + GLenum target, GLenum pname) { return GetRenderbufferParameter(target, pname); } - JS::Value GetShaderParameter(WebGLShader *shader, WebGLenum pname); + JS::Value GetShaderParameter(WebGLShader *shader, GLenum pname); JS::Value GetShaderParameter(JSContext* /* unused */, WebGLShader *shader, - WebGLenum pname) { + GLenum pname) { return GetShaderParameter(shader, pname); } already_AddRefed<WebGLShaderPrecisionFormat> - GetShaderPrecisionFormat(WebGLenum shadertype, WebGLenum precisiontype); + GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); void GetShaderInfoLog(WebGLShader *shader, nsACString& retval); void GetShaderInfoLog(WebGLShader *shader, nsAString& retval); void GetShaderSource(WebGLShader *shader, nsAString& retval); - JS::Value GetTexParameter(WebGLenum target, WebGLenum pname); - JS::Value GetTexParameter(JSContext * /* unused */, WebGLenum target, - WebGLenum pname) { + JS::Value GetTexParameter(GLenum target, GLenum pname); + JS::Value GetTexParameter(JSContext * /* unused */, GLenum target, + GLenum pname) { return GetTexParameter(target, pname); } JS::Value GetUniform(JSContext* cx, WebGLProgram *prog, WebGLUniformLocation *location, ErrorResult& rv); already_AddRefed<WebGLUniformLocation> GetUniformLocation(WebGLProgram *prog, const nsAString& name); - void Hint(WebGLenum target, WebGLenum mode); + void Hint(GLenum target, GLenum mode); bool IsFramebuffer(WebGLFramebuffer *fb); bool IsProgram(WebGLProgram *prog); bool IsRenderbuffer(WebGLRenderbuffer *rb); bool IsShader(WebGLShader *shader); bool IsTexture(WebGLTexture *tex); bool IsVertexArray(WebGLVertexArray *vao); - void LineWidth(WebGLfloat width) { + void LineWidth(GLfloat width) { if (!IsContextStable()) return; MakeContextCurrent(); gl->fLineWidth(width); } void LinkProgram(WebGLProgram *program); - void PixelStorei(WebGLenum pname, WebGLint param); - void PolygonOffset(WebGLfloat factor, WebGLfloat units) { + void PixelStorei(GLenum pname, GLint param); + void PolygonOffset(GLfloat factor, GLfloat units) { if (!IsContextStable()) return; MakeContextCurrent(); gl->fPolygonOffset(factor, units); } - void ReadPixels(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height, - WebGLenum format, WebGLenum type, + void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, const Nullable<dom::ArrayBufferView> &pixels, ErrorResult& rv); - void RenderbufferStorage(WebGLenum target, WebGLenum internalformat, - WebGLsizei width, WebGLsizei height); - void SampleCoverage(WebGLclampf value, WebGLboolean invert) { + void RenderbufferStorage(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height); + void SampleCoverage(GLclampf value, WebGLboolean invert) { if (!IsContextStable()) return; MakeContextCurrent(); gl->fSampleCoverage(value, invert); } - void Scissor(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height); + void Scissor(GLint x, GLint y, GLsizei width, GLsizei height); void ShaderSource(WebGLShader *shader, const nsAString& source); - void StencilFunc(WebGLenum func, WebGLint ref, WebGLuint mask); - void StencilFuncSeparate(WebGLenum face, WebGLenum func, WebGLint ref, - WebGLuint mask); - void StencilMask(WebGLuint mask); - void StencilMaskSeparate(WebGLenum face, WebGLuint mask); - void StencilOp(WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass); - void StencilOpSeparate(WebGLenum face, WebGLenum sfail, WebGLenum dpfail, - WebGLenum dppass); - void TexImage2D(WebGLenum target, WebGLint level, - WebGLenum internalformat, WebGLsizei width, - WebGLsizei height, WebGLint border, WebGLenum format, - WebGLenum type, + void StencilFunc(GLenum func, GLint ref, GLuint mask); + void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, + GLuint mask); + void StencilMask(GLuint mask); + void StencilMaskSeparate(GLenum face, GLuint mask); + void StencilOp(GLenum sfail, GLenum dpfail, GLenum dppass); + void StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, + GLenum dppass); + void TexImage2D(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLenum format, + GLenum type, const Nullable<dom::ArrayBufferView> &pixels, ErrorResult& rv); - void TexImage2D(WebGLenum target, WebGLint level, - WebGLenum internalformat, WebGLenum format, WebGLenum type, + void TexImage2D(GLenum target, GLint level, + GLenum internalformat, GLenum format, GLenum type, dom::ImageData* pixels, ErrorResult& rv); // Allow whatever element types the bindings are willing to pass // us in TexImage2D template<class ElementType> - void TexImage2D(WebGLenum target, WebGLint level, - WebGLenum internalformat, WebGLenum format, WebGLenum type, + void TexImage2D(GLenum target, GLint level, + GLenum internalformat, GLenum format, GLenum type, ElementType& elt, ErrorResult& rv) { if (!IsContextStable()) return; nsRefPtr<gfxImageSurface> isurf; WebGLTexelFormat srcFormat; nsLayoutUtils::SurfaceFromElementResult res = SurfaceFromElement(elt); rv = SurfaceFromElementResultToImageSurface(res, getter_AddRefs(isurf), @@ -508,38 +508,38 @@ public: return; uint32_t byteLength = isurf->Stride() * isurf->Height(); return TexImage2D_base(target, level, internalformat, isurf->Width(), isurf->Height(), isurf->Stride(), 0, format, type, isurf->Data(), byteLength, -1, srcFormat, mPixelStorePremultiplyAlpha); } - void TexParameterf(WebGLenum target, WebGLenum pname, WebGLfloat param) { + void TexParameterf(GLenum target, GLenum pname, GLfloat param) { TexParameter_base(target, pname, nullptr, ¶m); } - void TexParameteri(WebGLenum target, WebGLenum pname, WebGLint param) { + void TexParameteri(GLenum target, GLenum pname, GLint param) { TexParameter_base(target, pname, ¶m, nullptr); } - void TexSubImage2D(WebGLenum target, WebGLint level, - WebGLint xoffset, WebGLint yoffset, - WebGLsizei width, WebGLsizei height, WebGLenum format, - WebGLenum type, + void TexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const Nullable<dom::ArrayBufferView> &pixels, ErrorResult& rv); - void TexSubImage2D(WebGLenum target, WebGLint level, - WebGLint xoffset, WebGLint yoffset, WebGLenum format, - WebGLenum type, dom::ImageData* pixels, ErrorResult& rv); + void TexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLenum format, + GLenum type, dom::ImageData* pixels, ErrorResult& rv); // Allow whatever element types the bindings are willing to pass // us in TexSubImage2D template<class ElementType> - void TexSubImage2D(WebGLenum target, WebGLint level, - WebGLint xoffset, WebGLint yoffset, WebGLenum format, - WebGLenum type, ElementType& elt, ErrorResult& rv) + void TexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLenum format, + GLenum type, ElementType& elt, ErrorResult& rv) { if (!IsContextStable()) return; nsRefPtr<gfxImageSurface> isurf; WebGLTexelFormat srcFormat; nsLayoutUtils::SurfaceFromElementResult res = SurfaceFromElement(elt); rv = SurfaceFromElementResultToImageSurface(res, getter_AddRefs(isurf), &srcFormat); @@ -550,117 +550,117 @@ public: return TexSubImage2D_base(target, level, xoffset, yoffset, isurf->Width(), isurf->Height(), isurf->Stride(), format, type, isurf->Data(), byteLength, -1, srcFormat, mPixelStorePremultiplyAlpha); } - void Uniform1i(WebGLUniformLocation* location, WebGLint x); - void Uniform2i(WebGLUniformLocation* location, WebGLint x, WebGLint y); - void Uniform3i(WebGLUniformLocation* location, WebGLint x, WebGLint y, - WebGLint z); - void Uniform4i(WebGLUniformLocation* location, WebGLint x, WebGLint y, - WebGLint z, WebGLint w); + void Uniform1i(WebGLUniformLocation* location, GLint x); + void Uniform2i(WebGLUniformLocation* location, GLint x, GLint y); + void Uniform3i(WebGLUniformLocation* location, GLint x, GLint y, + GLint z); + void Uniform4i(WebGLUniformLocation* location, GLint x, GLint y, + GLint z, GLint w); - void Uniform1f(WebGLUniformLocation* location, WebGLfloat x); - void Uniform2f(WebGLUniformLocation* location, WebGLfloat x, WebGLfloat y); - void Uniform3f(WebGLUniformLocation* location, WebGLfloat x, WebGLfloat y, - WebGLfloat z); - void Uniform4f(WebGLUniformLocation* location, WebGLfloat x, WebGLfloat y, - WebGLfloat z, WebGLfloat w); + void Uniform1f(WebGLUniformLocation* location, GLfloat x); + void Uniform2f(WebGLUniformLocation* location, GLfloat x, GLfloat y); + void Uniform3f(WebGLUniformLocation* location, GLfloat x, GLfloat y, + GLfloat z); + void Uniform4f(WebGLUniformLocation* location, GLfloat x, GLfloat y, + GLfloat z, GLfloat w); void Uniform1iv(WebGLUniformLocation* location, const dom::Int32Array& arr) { Uniform1iv_base(location, arr.Length(), arr.Data()); } void Uniform1iv(WebGLUniformLocation* location, - const dom::Sequence<WebGLint>& arr) { + const dom::Sequence<GLint>& arr) { Uniform1iv_base(location, arr.Length(), arr.Elements()); } void Uniform1iv_base(WebGLUniformLocation* location, uint32_t arrayLength, - const WebGLint* data); + const GLint* data); void Uniform2iv(WebGLUniformLocation* location, const dom::Int32Array& arr) { Uniform2iv_base(location, arr.Length(), arr.Data()); } void Uniform2iv(WebGLUniformLocation* location, - const dom::Sequence<WebGLint>& arr) { + const dom::Sequence<GLint>& arr) { Uniform2iv_base(location, arr.Length(), arr.Elements()); } void Uniform2iv_base(WebGLUniformLocation* location, uint32_t arrayLength, - const WebGLint* data); + const GLint* data); void Uniform3iv(WebGLUniformLocation* location, const dom::Int32Array& arr) { Uniform3iv_base(location, arr.Length(), arr.Data()); } void Uniform3iv(WebGLUniformLocation* location, - const dom::Sequence<WebGLint>& arr) { + const dom::Sequence<GLint>& arr) { Uniform3iv_base(location, arr.Length(), arr.Elements()); } void Uniform3iv_base(WebGLUniformLocation* location, uint32_t arrayLength, - const WebGLint* data); + const GLint* data); void Uniform4iv(WebGLUniformLocation* location, const dom::Int32Array& arr) { Uniform4iv_base(location, arr.Length(), arr.Data()); } void Uniform4iv(WebGLUniformLocation* location, - const dom::Sequence<WebGLint>& arr) { + const dom::Sequence<GLint>& arr) { Uniform4iv_base(location, arr.Length(), arr.Elements()); } void Uniform4iv_base(WebGLUniformLocation* location, uint32_t arrayLength, - const WebGLint* data); + const GLint* data); void Uniform1fv(WebGLUniformLocation* location, const dom::Float32Array& arr) { Uniform1fv_base(location, arr.Length(), arr.Data()); } void Uniform1fv(WebGLUniformLocation* location, - const dom::Sequence<WebGLfloat>& arr) { + const dom::Sequence<GLfloat>& arr) { Uniform1fv_base(location, arr.Length(), arr.Elements()); } void Uniform1fv_base(WebGLUniformLocation* location, uint32_t arrayLength, - const WebGLfloat* data); + const GLfloat* data); void Uniform2fv(WebGLUniformLocation* location, const dom::Float32Array& arr) { Uniform2fv_base(location, arr.Length(), arr.Data()); } void Uniform2fv(WebGLUniformLocation* location, - const dom::Sequence<WebGLfloat>& arr) { + const dom::Sequence<GLfloat>& arr) { Uniform2fv_base(location, arr.Length(), arr.Elements()); } void Uniform2fv_base(WebGLUniformLocation* location, uint32_t arrayLength, - const WebGLfloat* data); + const GLfloat* data); void Uniform3fv(WebGLUniformLocation* location, const dom::Float32Array& arr) { Uniform3fv_base(location, arr.Length(), arr.Data()); } void Uniform3fv(WebGLUniformLocation* location, - const dom::Sequence<WebGLfloat>& arr) { + const dom::Sequence<GLfloat>& arr) { Uniform3fv_base(location, arr.Length(), arr.Elements()); } void Uniform3fv_base(WebGLUniformLocation* location, uint32_t arrayLength, - const WebGLfloat* data); + const GLfloat* data); void Uniform4fv(WebGLUniformLocation* location, const dom::Float32Array& arr) { Uniform4fv_base(location, arr.Length(), arr.Data()); } void Uniform4fv(WebGLUniformLocation* location, - const dom::Sequence<WebGLfloat>& arr) { + const dom::Sequence<GLfloat>& arr) { Uniform4fv_base(location, arr.Length(), arr.Elements()); } void Uniform4fv_base(WebGLUniformLocation* location, uint32_t arrayLength, - const WebGLfloat* data); + const GLfloat* data); void UniformMatrix2fv(WebGLUniformLocation* location, WebGLboolean transpose, const dom::Float32Array &value) { UniformMatrix2fv_base(location, transpose, value.Length(), value.Data()); } void UniformMatrix2fv(WebGLUniformLocation* location, WebGLboolean transpose, @@ -709,146 +709,146 @@ public: bool ValidateUniformMatrixArraySetter(const char* name, int dim, WebGLUniformLocation *location_object, GLint& location, uint32_t& numElementsToUpload, uint32_t arrayLength, WebGLboolean aTranspose); bool ValidateUniformSetter(const char* name, WebGLUniformLocation *location_object, GLint& location); void ValidateProgram(WebGLProgram *prog); bool ValidateUniformLocation(const char* info, WebGLUniformLocation *location_object); bool ValidateSamplerUniformSetter(const char* info, WebGLUniformLocation *location, - WebGLint value); + GLint value); - void Viewport(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height); + void Viewport(GLint x, GLint y, GLsizei width, GLsizei height); // ----------------------------------------------------------------------------- // Asynchronous Queries (WebGLContextAsyncQueries.cpp) public: already_AddRefed<WebGLQuery> CreateQuery(); void DeleteQuery(WebGLQuery *query); - void BeginQuery(WebGLenum target, WebGLQuery *query); - void EndQuery(WebGLenum target); + void BeginQuery(GLenum target, WebGLQuery *query); + void EndQuery(GLenum target); bool IsQuery(WebGLQuery *query); - already_AddRefed<WebGLQuery> GetQuery(WebGLenum target, WebGLenum pname); - JS::Value GetQueryObject(JSContext* cx, WebGLQuery *query, WebGLenum pname); + already_AddRefed<WebGLQuery> GetQuery(GLenum target, GLenum pname); + JS::Value GetQueryObject(JSContext* cx, WebGLQuery *query, GLenum pname); private: // ANY_SAMPLES_PASSED(_CONSERVATIVE) slot WebGLRefPtr<WebGLQuery> mActiveOcclusionQuery; // LOCAL_GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN slot WebGLRefPtr<WebGLQuery> mActiveTransformFeedbackQuery; - WebGLRefPtr<WebGLQuery>* GetQueryTargetSlot(WebGLenum target, const char* infos); + WebGLRefPtr<WebGLQuery>* GetQueryTargetSlot(GLenum target, const char* infos); // ----------------------------------------------------------------------------- // Buffer Objects (WebGLContextBuffers.cpp) public: - void BindBuffer(WebGLenum target, WebGLBuffer* buf); - void BindBufferBase(WebGLenum target, WebGLuint index, WebGLBuffer* buffer); - void BindBufferRange(WebGLenum target, WebGLuint index, WebGLBuffer* buffer, + void BindBuffer(GLenum target, WebGLBuffer* buf); + void BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer); + void BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer, WebGLintptr offset, WebGLsizeiptr size); - void BufferData(WebGLenum target, WebGLsizeiptr size, WebGLenum usage); - void BufferData(WebGLenum target, const dom::ArrayBufferView &data, - WebGLenum usage); - void BufferData(WebGLenum target, + void BufferData(GLenum target, WebGLsizeiptr size, GLenum usage); + void BufferData(GLenum target, const dom::ArrayBufferView &data, + GLenum usage); + void BufferData(GLenum target, const Nullable<dom::ArrayBuffer> &maybeData, - WebGLenum usage); - void BufferSubData(WebGLenum target, WebGLsizeiptr byteOffset, + GLenum usage); + void BufferSubData(GLenum target, WebGLsizeiptr byteOffset, const dom::ArrayBufferView &data); - void BufferSubData(WebGLenum target, WebGLsizeiptr byteOffset, + void BufferSubData(GLenum target, WebGLsizeiptr byteOffset, const Nullable<dom::ArrayBuffer> &maybeData); already_AddRefed<WebGLBuffer> CreateBuffer(); void DeleteBuffer(WebGLBuffer *buf); bool IsBuffer(WebGLBuffer *buffer); private: // ARRAY_BUFFER slot WebGLRefPtr<WebGLBuffer> mBoundArrayBuffer; // TRANSFORM_FEEDBACK_BUFFER slot WebGLRefPtr<WebGLBuffer> mBoundTransformFeedbackBuffer; // these two functions emit INVALID_ENUM for invalid `target`. WebGLRefPtr<WebGLBuffer>* GetBufferSlotByTarget(GLenum target, const char* infos); WebGLRefPtr<WebGLBuffer>* GetBufferSlotByTargetIndexed(GLenum target, GLuint index, const char* infos); - bool ValidateBufferUsageEnum(WebGLenum target, const char* infos); + bool ValidateBufferUsageEnum(GLenum target, const char* infos); // ----------------------------------------------------------------------------- // State and State Requests (WebGLContextState.cpp) public: - void Disable(WebGLenum cap); - void Enable(WebGLenum cap); - JS::Value GetParameter(JSContext* cx, WebGLenum pname, ErrorResult& rv); - JS::Value GetParameterIndexed(JSContext* cx, WebGLenum pname, WebGLuint index); - bool IsEnabled(WebGLenum cap); + void Disable(GLenum cap); + void Enable(GLenum cap); + JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv); + JS::Value GetParameterIndexed(JSContext* cx, GLenum pname, GLuint index); + bool IsEnabled(GLenum cap); private: // State tracking slots realGLboolean mDitherEnabled; realGLboolean mRasterizerDiscardEnabled; realGLboolean mScissorTestEnabled; - bool ValidateCapabilityEnum(WebGLenum cap, const char* info); - realGLboolean* GetStateTrackingSlot(WebGLenum cap); + bool ValidateCapabilityEnum(GLenum cap, const char* info); + realGLboolean* GetStateTrackingSlot(GLenum cap); // ----------------------------------------------------------------------------- // Vertices Feature (WebGLContextVertices.cpp) public: - void DrawArrays(GLenum mode, WebGLint first, WebGLsizei count); - void DrawArraysInstanced(GLenum mode, WebGLint first, WebGLsizei count, WebGLsizei primcount); - void DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, WebGLintptr byteOffset); - void DrawElementsInstanced(WebGLenum mode, WebGLsizei count, WebGLenum type, - WebGLintptr byteOffset, WebGLsizei primcount); + void DrawArrays(GLenum mode, GLint first, GLsizei count); + void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount); + void DrawElements(GLenum mode, GLsizei count, GLenum type, WebGLintptr byteOffset); + void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, + WebGLintptr byteOffset, GLsizei primcount); - void EnableVertexAttribArray(WebGLuint index); - void DisableVertexAttribArray(WebGLuint index); + void EnableVertexAttribArray(GLuint index); + void DisableVertexAttribArray(GLuint index); - JS::Value GetVertexAttrib(JSContext* cx, WebGLuint index, WebGLenum pname, + JS::Value GetVertexAttrib(JSContext* cx, GLuint index, GLenum pname, ErrorResult& rv); - WebGLsizeiptr GetVertexAttribOffset(WebGLuint index, WebGLenum pname); + WebGLsizeiptr GetVertexAttribOffset(GLuint index, GLenum pname); - void VertexAttrib1f(WebGLuint index, WebGLfloat x0); - void VertexAttrib2f(WebGLuint index, WebGLfloat x0, WebGLfloat x1); - void VertexAttrib3f(WebGLuint index, WebGLfloat x0, WebGLfloat x1, - WebGLfloat x2); - void VertexAttrib4f(WebGLuint index, WebGLfloat x0, WebGLfloat x1, - WebGLfloat x2, WebGLfloat x3); + void VertexAttrib1f(GLuint index, GLfloat x0); + void VertexAttrib2f(GLuint index, GLfloat x0, GLfloat x1); + void VertexAttrib3f(GLuint index, GLfloat x0, GLfloat x1, + GLfloat x2); + void VertexAttrib4f(GLuint index, GLfloat x0, GLfloat x1, + GLfloat x2, GLfloat x3); - void VertexAttrib1fv(WebGLuint idx, const dom::Float32Array &arr) { + void VertexAttrib1fv(GLuint idx, const dom::Float32Array &arr) { VertexAttrib1fv_base(idx, arr.Length(), arr.Data()); } - void VertexAttrib1fv(WebGLuint idx, const dom::Sequence<WebGLfloat>& arr) { + void VertexAttrib1fv(GLuint idx, const dom::Sequence<GLfloat>& arr) { VertexAttrib1fv_base(idx, arr.Length(), arr.Elements()); } - void VertexAttrib2fv(WebGLuint idx, const dom::Float32Array &arr) { + void VertexAttrib2fv(GLuint idx, const dom::Float32Array &arr) { VertexAttrib2fv_base(idx, arr.Length(), arr.Data()); } - void VertexAttrib2fv(WebGLuint idx, const dom::Sequence<WebGLfloat>& arr) { + void VertexAttrib2fv(GLuint idx, const dom::Sequence<GLfloat>& arr) { VertexAttrib2fv_base(idx, arr.Length(), arr.Elements()); } - void VertexAttrib3fv(WebGLuint idx, const dom::Float32Array &arr) { + void VertexAttrib3fv(GLuint idx, const dom::Float32Array &arr) { VertexAttrib3fv_base(idx, arr.Length(), arr.Data()); } - void VertexAttrib3fv(WebGLuint idx, const dom::Sequence<WebGLfloat>& arr) { + void VertexAttrib3fv(GLuint idx, const dom::Sequence<GLfloat>& arr) { VertexAttrib3fv_base(idx, arr.Length(), arr.Elements()); } - void VertexAttrib4fv(WebGLuint idx, const dom::Float32Array &arr) { + void VertexAttrib4fv(GLuint idx, const dom::Float32Array &arr) { VertexAttrib4fv_base(idx, arr.Length(), arr.Data()); } - void VertexAttrib4fv(WebGLuint idx, const dom::Sequence<WebGLfloat>& arr) { + void VertexAttrib4fv(GLuint idx, const dom::Sequence<GLfloat>& arr) { VertexAttrib4fv_base(idx, arr.Length(), arr.Elements()); } - void VertexAttribPointer(WebGLuint index, WebGLint size, WebGLenum type, - WebGLboolean normalized, WebGLsizei stride, + void VertexAttribPointer(GLuint index, GLint size, GLenum type, + WebGLboolean normalized, GLsizei stride, WebGLintptr byteOffset); - void VertexAttribDivisor(WebGLuint index, WebGLuint divisor); + void VertexAttribDivisor(GLuint index, GLuint divisor); private: // Cache the max number of vertices and instances that can be read from // bound VBOs (result of ValidateBuffers). bool mBufferFetchingIsVerified; bool mBufferFetchingHasPerVertex; uint32_t mMaxFetchedVertices; uint32_t mMaxFetchedInstances; @@ -856,47 +856,47 @@ private: inline void InvalidateBufferFetching() { mBufferFetchingIsVerified = false; mBufferFetchingHasPerVertex = false; mMaxFetchedVertices = 0; mMaxFetchedInstances = 0; } - bool DrawArrays_check(WebGLint first, WebGLsizei count, WebGLsizei primcount, const char* info); - bool DrawElements_check(WebGLsizei count, WebGLenum type, WebGLintptr byteOffset, - WebGLsizei primcount, const char* info); + bool DrawArrays_check(GLint first, GLsizei count, GLsizei primcount, const char* info); + bool DrawElements_check(GLsizei count, GLenum type, WebGLintptr byteOffset, + GLsizei primcount, const char* info); void Draw_cleanup(); - void VertexAttrib1fv_base(WebGLuint idx, uint32_t arrayLength, const WebGLfloat* ptr); - void VertexAttrib2fv_base(WebGLuint idx, uint32_t arrayLength, const WebGLfloat* ptr); - void VertexAttrib3fv_base(WebGLuint idx, uint32_t arrayLength, const WebGLfloat* ptr); - void VertexAttrib4fv_base(WebGLuint idx, uint32_t arrayLength, const WebGLfloat* ptr); + void VertexAttrib1fv_base(GLuint idx, uint32_t arrayLength, const GLfloat* ptr); + void VertexAttrib2fv_base(GLuint idx, uint32_t arrayLength, const GLfloat* ptr); + void VertexAttrib3fv_base(GLuint idx, uint32_t arrayLength, const GLfloat* ptr); + void VertexAttrib4fv_base(GLuint idx, uint32_t arrayLength, const GLfloat* ptr); bool ValidateBufferFetching(const char *info); bool BindArrayAttribToLocation0(WebGLProgram *program); // ----------------------------------------------------------------------------- // PROTECTED protected: void SetDontKnowIfNeedFakeBlack() { mFakeBlackStatus = DontKnowIfNeedFakeBlack; } bool NeedFakeBlack(); void BindFakeBlackTextures(); void UnbindFakeBlackTextures(); int WhatDoesVertexAttrib0Need(); - bool DoFakeVertexAttrib0(WebGLuint vertexCount); + bool DoFakeVertexAttrib0(GLuint vertexCount); void UndoFakeVertexAttrib0(); void InvalidateFakeVertexAttrib0(); - static CheckedUint32 GetImageSize(WebGLsizei height, - WebGLsizei width, + static CheckedUint32 GetImageSize(GLsizei height, + GLsizei width, uint32_t pixelSize, uint32_t alignment); // Returns x rounded to the next highest multiple of y. static CheckedUint32 RoundedToNextMultipleOf(CheckedUint32 x, CheckedUint32 y) { return ((x + y - 1) / y) * y; } @@ -917,18 +917,18 @@ protected: bool mCanLoseContextInForeground; bool mShouldPresent; bool mIsScreenCleared; bool mDisableFragHighP; template<typename WebGLObjectType> void DeleteWebGLObjectsArray(nsTArray<WebGLObjectType>& array); - WebGLuint mActiveTexture; - WebGLenum mWebGLError; + GLuint mActiveTexture; + GLenum mWebGLError; // whether shader validation is supported bool mShaderValidation; // some GL constants int32_t mGLMaxVertexAttribs; int32_t mGLMaxTextureUnits; int32_t mGLMaxTextureSize; @@ -991,75 +991,75 @@ protected: bool IsExtensionEnabled(WebGLExtensionID ext) const; // returns true if the extension is supported for this JSContext (this decides what getSupportedExtensions exposes) bool IsExtensionSupported(JSContext *cx, WebGLExtensionID ext) const; bool IsExtensionSupported(WebGLExtensionID ext) const; static const char* GetExtensionString(WebGLExtensionID ext); - nsTArray<WebGLenum> mCompressedTextureFormats; + nsTArray<GLenum> mCompressedTextureFormats; // ------------------------------------------------------------------------- // WebGL 2 specifics (implemented in WebGL2Context.cpp) virtual bool IsWebGL2() const = 0; bool InitWebGL2(); // ------------------------------------------------------------------------- // Validation functions (implemented in WebGLContextValidate.cpp) bool InitAndValidateGL(); - bool ValidateBlendEquationEnum(WebGLenum cap, const char *info); - bool ValidateBlendFuncDstEnum(WebGLenum mode, const char *info); - bool ValidateBlendFuncSrcEnum(WebGLenum mode, const char *info); - bool ValidateBlendFuncEnumsCompatibility(WebGLenum sfactor, WebGLenum dfactor, const char *info); - bool ValidateTextureTargetEnum(WebGLenum target, const char *info); - bool ValidateComparisonEnum(WebGLenum target, const char *info); - bool ValidateStencilOpEnum(WebGLenum action, const char *info); - bool ValidateFaceEnum(WebGLenum face, const char *info); - bool ValidateTexFormatAndType(WebGLenum format, WebGLenum type, int jsArrayType, + bool ValidateBlendEquationEnum(GLenum cap, const char *info); + bool ValidateBlendFuncDstEnum(GLenum mode, const char *info); + bool ValidateBlendFuncSrcEnum(GLenum mode, const char *info); + bool ValidateBlendFuncEnumsCompatibility(GLenum sfactor, GLenum dfactor, const char *info); + bool ValidateTextureTargetEnum(GLenum target, const char *info); + bool ValidateComparisonEnum(GLenum target, const char *info); + bool ValidateStencilOpEnum(GLenum action, const char *info); + bool ValidateFaceEnum(GLenum face, const char *info); + bool ValidateTexFormatAndType(GLenum format, GLenum type, int jsArrayType, uint32_t *texelSize, const char *info); - bool ValidateDrawModeEnum(WebGLenum mode, const char *info); - bool ValidateAttribIndex(WebGLuint index, const char *info); + bool ValidateDrawModeEnum(GLenum mode, const char *info); + bool ValidateAttribIndex(GLuint index, const char *info); bool ValidateStencilParamsForDrawCall(); bool ValidateGLSLVariableName(const nsAString& name, const char *info); bool ValidateGLSLCharacter(PRUnichar c); bool ValidateGLSLString(const nsAString& string, const char *info); - bool ValidateTexImage2DTarget(WebGLenum target, WebGLsizei width, WebGLsizei height, const char* info); - bool ValidateCompressedTextureSize(WebGLenum target, WebGLint level, WebGLenum format, WebGLsizei width, WebGLsizei height, uint32_t byteLength, const char* info); - bool ValidateLevelWidthHeightForTarget(WebGLenum target, WebGLint level, WebGLsizei width, WebGLsizei height, const char* info); + bool ValidateTexImage2DTarget(GLenum target, GLsizei width, GLsizei height, const char* info); + bool ValidateCompressedTextureSize(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, uint32_t byteLength, const char* info); + bool ValidateLevelWidthHeightForTarget(GLenum target, GLint level, GLsizei width, GLsizei height, const char* info); - static uint32_t GetBitsPerTexel(WebGLenum format, WebGLenum type); + static uint32_t GetBitsPerTexel(GLenum format, GLenum type); void Invalidate(); void DestroyResourcesAndContext(); void MakeContextCurrent() const { gl->MakeCurrent(); } // helpers - void TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum internalformat, - WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero, WebGLint border, - WebGLenum format, WebGLenum type, + void TexImage2D_base(GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLsizei srcStrideOrZero, GLint border, + GLenum format, GLenum type, void *data, uint32_t byteLength, int jsArrayType, WebGLTexelFormat srcFormat, bool srcPremultiplied); - void TexSubImage2D_base(WebGLenum target, WebGLint level, - WebGLint xoffset, WebGLint yoffset, - WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero, - WebGLenum format, WebGLenum type, + void TexSubImage2D_base(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLsizei srcStrideOrZero, + GLenum format, GLenum type, void *pixels, uint32_t byteLength, int jsArrayType, WebGLTexelFormat srcFormat, bool srcPremultiplied); - void TexParameter_base(WebGLenum target, WebGLenum pname, - WebGLint *intParamPtr, WebGLfloat *floatParamPtr); + void TexParameter_base(GLenum target, GLenum pname, + GLint *intParamPtr, GLfloat *floatParamPtr); void ConvertImage(size_t width, size_t height, size_t srcStride, size_t dstStride, const uint8_t* src, uint8_t *dst, WebGLTexelFormat srcFormat, bool srcPremultiplied, WebGLTexelFormat dstFormat, bool dstPremultiplied, size_t dstTexelSize); template<class ElementType> @@ -1079,25 +1079,25 @@ protected: { return SurfaceFromElement(&aElement); } nsresult SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromElementResult& res, gfxImageSurface **imageOut, WebGLTexelFormat *format); - void CopyTexSubImage2D_base(WebGLenum target, - WebGLint level, - WebGLenum internalformat, - WebGLint xoffset, - WebGLint yoffset, - WebGLint x, - WebGLint y, - WebGLsizei width, - WebGLsizei height, + void CopyTexSubImage2D_base(GLenum target, + GLint level, + GLenum internalformat, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, bool sub); // Returns false if aObject is null or not valid template<class ObjectType> bool ValidateObject(const char* info, ObjectType *aObject); // Returns false if aObject is not valid. Considers null to be valid. template<class ObjectType> bool ValidateObjectAllowNull(const char* info, ObjectType *aObject); @@ -1111,17 +1111,17 @@ protected: bool ValidateObjectAllowDeleted(const char* info, ObjectType *aObject); private: // Like ValidateObject, but only for cases when aObject is known // to not be null already. template<class ObjectType> bool ValidateObjectAssumeNonNull(const char* info, ObjectType *aObject); protected: - int32_t MaxTextureSizeForTarget(WebGLenum target) const { + int32_t MaxTextureSizeForTarget(GLenum target) const { return target == LOCAL_GL_TEXTURE_2D ? mGLMaxTextureSize : mGLMaxCubeMapTextureSize; } /** like glBufferData but if the call may change the buffer size, checks any GL error generated * by this glBufferData call and returns it */ GLenum CheckedBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, @@ -1168,33 +1168,33 @@ protected: WebGLRefPtr<WebGLVertexArray> mDefaultVertexArray; // PixelStore parameters uint32_t mPixelStorePackAlignment, mPixelStoreUnpackAlignment, mPixelStoreColorspaceConversion; bool mPixelStoreFlipY, mPixelStorePremultiplyAlpha; FakeBlackStatus mFakeBlackStatus; - WebGLuint mBlackTexture2D, mBlackTextureCubeMap; + GLuint mBlackTexture2D, mBlackTextureCubeMap; bool mBlackTexturesAreInitialized; - WebGLfloat mVertexAttrib0Vector[4]; - WebGLfloat mFakeVertexAttrib0BufferObjectVector[4]; + GLfloat mVertexAttrib0Vector[4]; + GLfloat mFakeVertexAttrib0BufferObjectVector[4]; size_t mFakeVertexAttrib0BufferObjectSize; GLuint mFakeVertexAttrib0BufferObject; int mFakeVertexAttrib0BufferStatus; - WebGLint mStencilRefFront, mStencilRefBack; - WebGLuint mStencilValueMaskFront, mStencilValueMaskBack, + GLint mStencilRefFront, mStencilRefBack; + GLuint mStencilValueMaskFront, mStencilValueMaskBack, mStencilWriteMaskFront, mStencilWriteMaskBack; realGLboolean mColorWriteMask[4]; realGLboolean mDepthWriteMask; - WebGLfloat mColorClearValue[4]; - WebGLint mStencilClearValue; - WebGLfloat mDepthClearValue; + GLfloat mColorClearValue[4]; + GLint mStencilClearValue; + GLfloat mDepthClearValue; nsCOMPtr<nsITimer> mContextRestorer; bool mAllowRestore; bool mContextLossTimerRunning; bool mDrawSinceContextLossTimerSet; ContextStatus mContextStatus; bool mContextLostErrorSet; @@ -1219,17 +1219,17 @@ protected: void LoseOldestWebGLContextIfLimitExceeded(); void UpdateLastUseIndex(); template <typename WebGLObjectType> JS::Value WebGLObjectAsJSValue(JSContext *cx, const WebGLObjectType *, ErrorResult& rv) const; template <typename WebGLObjectType> JSObject* WebGLObjectAsJSObject(JSContext *cx, const WebGLObjectType *, ErrorResult& rv) const; - void ReattachTextureToAnyFramebufferToWorkAroundBugs(WebGLTexture *tex, WebGLint level); + void ReattachTextureToAnyFramebufferToWorkAroundBugs(WebGLTexture *tex, GLint level); #ifdef XP_MACOSX // see bug 713305. This RAII helper guarantees that we're on the discrete GPU, during its lifetime // Debouncing note: we don't want to switch GPUs too frequently, so try to not create and destroy // these objects at high frequency. Having WebGLContext's hold one such object seems fine, // because WebGLContext objects only go away during GC, which shouldn't happen too frequently. // If in the future GC becomes much more frequent, we may have to revisit then (maybe use a timer). ForceDiscreteGPUHelperCGL mForceDiscreteGPUHelper;
--- a/content/canvas/src/WebGLContextAsyncQueries.cpp +++ b/content/canvas/src/WebGLContextAsyncQueries.cpp @@ -14,17 +14,17 @@ using namespace mozilla; * * OpenGL ES 3.0 spec 4.1.6 * If the target of the query is ANY_SAMPLES_PASSED_CONSERVATIVE, an implementation * may choose to use a less precise version of the test which can additionally set * the samples-boolean state to TRUE in some other implementation-dependent cases. */ static const char* -GetQueryTargetEnumString(WebGLenum target) +GetQueryTargetEnumString(GLenum target) { switch (target) { case LOCAL_GL_ANY_SAMPLES_PASSED: return "ANY_SAMPLES_PASSED"; case LOCAL_GL_ANY_SAMPLES_PASSED_CONSERVATIVE: return "ANY_SAMPLES_PASSED_CONSERVATIVE"; case LOCAL_GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: @@ -103,17 +103,17 @@ WebGLContext::DeleteQuery(WebGLQuery *qu GenerateWarning("deleteQuery: the WebGL 2 prototype might generate INVALID_OPERATION" "when deleting a query object while one other is active."); } query->RequestDelete(); } void -WebGLContext::BeginQuery(WebGLenum target, WebGLQuery *query) +WebGLContext::BeginQuery(GLenum target, WebGLQuery *query) { if (!IsContextStable()) return; WebGLRefPtr<WebGLQuery>* targetSlot = GetQueryTargetSlot(target, "beginQuery"); if (!targetSlot) { return; } @@ -173,17 +173,17 @@ WebGLContext::BeginQuery(WebGLenum targe } else { gl->fBeginQuery(SimulateOcclusionQueryTarget(gl, target), query->mGLName); } *targetSlot = query; } void -WebGLContext::EndQuery(WebGLenum target) +WebGLContext::EndQuery(GLenum target) { if (!IsContextStable()) return; WebGLRefPtr<WebGLQuery>* targetSlot = GetQueryTargetSlot(target, "endQuery"); if (!targetSlot) { return; } @@ -229,17 +229,17 @@ WebGLContext::IsQuery(WebGLQuery *query) return false; return ValidateObjectAllowDeleted("isQuery", query) && !query->IsDeleted() && query->HasEverBeenActive(); } already_AddRefed<WebGLQuery> -WebGLContext::GetQuery(WebGLenum target, WebGLenum pname) +WebGLContext::GetQuery(GLenum target, GLenum pname) { if (!IsContextStable()) return nullptr; WebGLRefPtr<WebGLQuery>* targetSlot = GetQueryTargetSlot(target, "getQuery"); if (!targetSlot) { return nullptr; } @@ -252,17 +252,17 @@ WebGLContext::GetQuery(WebGLenum target, return nullptr; } nsRefPtr<WebGLQuery> tmp = targetSlot->get(); return tmp.forget(); } JS::Value -WebGLContext::GetQueryObject(JSContext* cx, WebGLQuery *query, WebGLenum pname) +WebGLContext::GetQueryObject(JSContext* cx, WebGLQuery *query, GLenum pname) { if (!IsContextStable()) return JS::NullValue(); if (!query) { /* OpenGL ES 3.0 spec 6.1.7 (spec getQueryObject 1) * If id is not the name of a query object, or if the query object named by id is * currently active, then an INVALID_OPERATION error is generated. pname must be @@ -328,17 +328,17 @@ WebGLContext::GetQueryObject(JSContext* break; } ErrorInvalidEnum("getQueryObject: pname must be QUERY_RESULT{_AVAILABLE}"); return JS::NullValue(); } WebGLRefPtr<WebGLQuery>* -WebGLContext::GetQueryTargetSlot(WebGLenum target, const char* infos) +WebGLContext::GetQueryTargetSlot(GLenum target, const char* infos) { switch (target) { case LOCAL_GL_ANY_SAMPLES_PASSED: case LOCAL_GL_ANY_SAMPLES_PASSED_CONSERVATIVE: return &mActiveOcclusionQuery; case LOCAL_GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: return &mActiveTransformFeedbackQuery; }
--- a/content/canvas/src/WebGLContextBuffers.cpp +++ b/content/canvas/src/WebGLContextBuffers.cpp @@ -6,17 +6,17 @@ #include "WebGLContext.h" #include "WebGLBuffer.h" #include "WebGLVertexArray.h" using namespace mozilla; using namespace mozilla::dom; void -WebGLContext::BindBuffer(WebGLenum target, WebGLBuffer *buffer) +WebGLContext::BindBuffer(GLenum target, WebGLBuffer *buffer) { if (!IsContextStable()) return; if (!ValidateObjectAllowDeletedOrNull("bindBuffer", buffer)) return; // silently ignore a deleted buffer @@ -41,17 +41,17 @@ WebGLContext::BindBuffer(WebGLenum targe *bufferSlot = buffer; MakeContextCurrent(); gl->fBindBuffer(target, buffer ? buffer->GLName() : 0); } void -WebGLContext::BindBufferBase(WebGLenum target, WebGLuint index, WebGLBuffer* buffer) +WebGLContext::BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer) { if (!IsContextStable()) return; if (!ValidateObjectAllowDeletedOrNull("bindBufferBase", buffer)) return; // silently ignore a deleted buffer @@ -82,17 +82,17 @@ WebGLContext::BindBufferBase(WebGLenum t *bufferSlot = buffer; MakeContextCurrent(); gl->fBindBufferBase(target, index, buffer ? buffer->GLName() : 0); } void -WebGLContext::BindBufferRange(WebGLenum target, WebGLuint index, WebGLBuffer* buffer, +WebGLContext::BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer, WebGLintptr offset, WebGLsizeiptr size) { if (!IsContextStable()) return; if (!ValidateObjectAllowDeletedOrNull("bindBufferRange", buffer)) return; @@ -129,18 +129,18 @@ WebGLContext::BindBufferRange(WebGLenum *bufferSlot = buffer; MakeContextCurrent(); gl->fBindBufferRange(target, index, buffer ? buffer->GLName() : 0, offset, size); } void -WebGLContext::BufferData(WebGLenum target, WebGLsizeiptr size, - WebGLenum usage) +WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, + GLenum usage) { if (!IsContextStable()) return; WebGLRefPtr<WebGLBuffer>* bufferSlot = GetBufferSlotByTarget(target, "bufferData"); if (!bufferSlot) { return; @@ -178,19 +178,19 @@ WebGLContext::BufferData(WebGLenum targe boundBuffer->SetByteLength(size); if (!boundBuffer->ElementArrayCacheBufferData(nullptr, size)) { return ErrorOutOfMemory("bufferData: out of memory"); } } void -WebGLContext::BufferData(WebGLenum target, +WebGLContext::BufferData(GLenum target, const Nullable<ArrayBuffer> &maybeData, - WebGLenum usage) + GLenum usage) { if (!IsContextStable()) return; if (maybeData.IsNull()) { // see http://www.khronos.org/bugzilla/show_bug.cgi?id=386 return ErrorInvalidValue("bufferData: null object passed"); } @@ -227,18 +227,18 @@ WebGLContext::BufferData(WebGLenum targe boundBuffer->SetByteLength(data.Length()); if (!boundBuffer->ElementArrayCacheBufferData(data.Data(), data.Length())) { return ErrorOutOfMemory("bufferData: out of memory"); } } void -WebGLContext::BufferData(WebGLenum target, const ArrayBufferView& data, - WebGLenum usage) +WebGLContext::BufferData(GLenum target, const ArrayBufferView& data, + GLenum usage) { if (!IsContextStable()) return; WebGLRefPtr<WebGLBuffer>* bufferSlot = GetBufferSlotByTarget(target, "bufferSubData"); if (!bufferSlot) { return; @@ -310,17 +310,17 @@ WebGLContext::BufferSubData(GLenum targe MakeContextCurrent(); boundBuffer->ElementArrayCacheBufferSubData(byteOffset, data.Data(), data.Length()); gl->fBufferSubData(target, byteOffset, data.Length(), data.Data()); } void -WebGLContext::BufferSubData(WebGLenum target, WebGLsizeiptr byteOffset, +WebGLContext::BufferSubData(GLenum target, WebGLsizeiptr byteOffset, const ArrayBufferView& data) { if (!IsContextStable()) return; WebGLRefPtr<WebGLBuffer>* bufferSlot = GetBufferSlotByTarget(target, "bufferSubData"); if (!bufferSlot) { @@ -396,17 +396,17 @@ WebGLContext::IsBuffer(WebGLBuffer *buff return false; return ValidateObjectAllowDeleted("isBuffer", buffer) && !buffer->IsDeleted() && buffer->HasEverBeenBound(); } bool -WebGLContext::ValidateBufferUsageEnum(WebGLenum target, const char *infos) +WebGLContext::ValidateBufferUsageEnum(GLenum target, const char *infos) { switch (target) { case LOCAL_GL_STREAM_DRAW: case LOCAL_GL_STATIC_DRAW: case LOCAL_GL_DYNAMIC_DRAW: return true; default: break;
--- a/content/canvas/src/WebGLContextFramebufferOperations.cpp +++ b/content/canvas/src/WebGLContextFramebufferOperations.cpp @@ -6,17 +6,17 @@ #include "WebGLContext.h" #include "WebGLTexture.h" #include "WebGLRenderbuffer.h" #include "WebGLFramebuffer.h" using namespace mozilla; void -WebGLContext::Clear(WebGLbitfield mask) +WebGLContext::Clear(GLbitfield mask) { if (!IsContextStable()) return; MakeContextCurrent(); uint32_t m = mask & (LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT); if (mask != m) @@ -71,56 +71,56 @@ WebGLContext::Clear(WebGLbitfield mask) gl->fClear(mask); mIsScreenCleared = false; } Invalidate(); mShouldPresent = true; } -static WebGLclampf -GLClampFloat(WebGLclampf val) +static GLclampf +GLClampFloat(GLclampf val) { if (val < 0.0) return 0.0; if (val > 1.0) return 1.0; return val; } void -WebGLContext::ClearColor(WebGLclampf r, WebGLclampf g, - WebGLclampf b, WebGLclampf a) +WebGLContext::ClearColor(GLclampf r, GLclampf g, + GLclampf b, GLclampf a) { if (!IsContextStable()) return; MakeContextCurrent(); mColorClearValue[0] = GLClampFloat(r); mColorClearValue[1] = GLClampFloat(g); mColorClearValue[2] = GLClampFloat(b); mColorClearValue[3] = GLClampFloat(a); gl->fClearColor(r, g, b, a); } void -WebGLContext::ClearDepth(WebGLclampf v) +WebGLContext::ClearDepth(GLclampf v) { if (!IsContextStable()) return; MakeContextCurrent(); mDepthClearValue = GLClampFloat(v); gl->fClearDepth(v); } void -WebGLContext::ClearStencil(WebGLint v) +WebGLContext::ClearStencil(GLint v) { if (!IsContextStable()) return; MakeContextCurrent(); mStencilClearValue = v; gl->fClearStencil(v); } @@ -222,30 +222,30 @@ WebGLContext::DrawBuffers(const dom::Seq } MakeContextCurrent(); gl->fDrawBuffers(buffersLength, buffers.Elements()); } void -WebGLContext::StencilMask(WebGLuint mask) +WebGLContext::StencilMask(GLuint mask) { if (!IsContextStable()) return; mStencilWriteMaskFront = mask; mStencilWriteMaskBack = mask; MakeContextCurrent(); gl->fStencilMask(mask); } void -WebGLContext::StencilMaskSeparate(WebGLenum face, WebGLuint mask) +WebGLContext::StencilMaskSeparate(GLenum face, GLuint mask) { if (!IsContextStable()) return; if (!ValidateFaceEnum(face, "stencilMaskSeparate: face")) return; switch (face) {
--- a/content/canvas/src/WebGLContextGL.cpp +++ b/content/canvas/src/WebGLContextGL.cpp @@ -43,30 +43,30 @@ #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/ImageData.h" using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::gl; -static bool BaseTypeAndSizeFromUniformType(WebGLenum uType, WebGLenum *baseType, WebGLint *unitSize); -static WebGLenum InternalFormatForFormatAndType(WebGLenum format, WebGLenum type, bool isGLES2); +static bool BaseTypeAndSizeFromUniformType(GLenum uType, GLenum *baseType, GLint *unitSize); +static GLenum InternalFormatForFormatAndType(GLenum format, GLenum type, bool isGLES2); // // WebGL API // inline const WebGLRectangleObject *WebGLContext::FramebufferRectangleObject() const { return mBoundFramebuffer ? mBoundFramebuffer->RectangleObject() : static_cast<const WebGLRectangleObject*>(this); } void -WebGLContext::ActiveTexture(WebGLenum texture) +WebGLContext::ActiveTexture(GLenum texture) { if (!IsContextStable()) return; if (texture < LOCAL_GL_TEXTURE0 || texture >= LOCAL_GL_TEXTURE0 + uint32_t(mGLMaxTextureUnits)) { return ErrorInvalidEnum( @@ -98,43 +98,43 @@ WebGLContext::AttachShader(WebGLProgram return ErrorInvalidOperation("attachShader: only one of each type of shader may be attached to a program"); if (!program->AttachShader(shader)) return ErrorInvalidOperation("attachShader: shader is already attached"); } void -WebGLContext::BindAttribLocation(WebGLProgram *prog, WebGLuint location, +WebGLContext::BindAttribLocation(WebGLProgram *prog, GLuint location, const nsAString& name) { if (!IsContextStable()) return; if (!ValidateObject("bindAttribLocation: program", prog)) return; - WebGLuint progname = prog->GLName(); + GLuint progname = prog->GLName(); if (!ValidateGLSLVariableName(name, "bindAttribLocation")) return; if (!ValidateAttribIndex(location, "bindAttribLocation")) return; NS_LossyConvertUTF16toASCII cname(name); nsCString mappedName; prog->MapIdentifier(cname, &mappedName); MakeContextCurrent(); gl->fBindAttribLocation(progname, location, mappedName.get()); } void -WebGLContext::BindFramebuffer(WebGLenum target, WebGLFramebuffer *wfb) +WebGLContext::BindFramebuffer(GLenum target, WebGLFramebuffer *wfb) { if (!IsContextStable()) return; if (target != LOCAL_GL_FRAMEBUFFER) return ErrorInvalidEnum("bindFramebuffer: target must be GL_FRAMEBUFFER"); if (!ValidateObjectAllowDeletedOrNull("bindFramebuffer", wfb)) @@ -144,26 +144,26 @@ WebGLContext::BindFramebuffer(WebGLenum if (wfb && wfb->IsDeleted()) return; MakeContextCurrent(); if (!wfb) { gl->fBindFramebuffer(target, 0); } else { - WebGLuint framebuffername = wfb->GLName(); + GLuint framebuffername = wfb->GLName(); gl->fBindFramebuffer(target, framebuffername); wfb->SetHasEverBeenBound(true); } mBoundFramebuffer = wfb; } void -WebGLContext::BindRenderbuffer(WebGLenum target, WebGLRenderbuffer *wrb) +WebGLContext::BindRenderbuffer(GLenum target, WebGLRenderbuffer *wrb) { if (!IsContextStable()) return; if (target != LOCAL_GL_RENDERBUFFER) return ErrorInvalidEnumInfo("bindRenderbuffer: target", target); if (!ValidateObjectAllowDeletedOrNull("bindRenderbuffer", wrb)) @@ -173,24 +173,24 @@ WebGLContext::BindRenderbuffer(WebGLenum if (wrb && wrb->IsDeleted()) return; if (wrb) wrb->SetHasEverBeenBound(true); MakeContextCurrent(); - WebGLuint renderbuffername = wrb ? wrb->GLName() : 0; + GLuint renderbuffername = wrb ? wrb->GLName() : 0; gl->fBindRenderbuffer(target, renderbuffername); mBoundRenderbuffer = wrb; } void -WebGLContext::BindTexture(WebGLenum target, WebGLTexture *tex) +WebGLContext::BindTexture(GLenum target, WebGLTexture *tex) { if (!IsContextStable()) return; if (!ValidateObjectAllowDeletedOrNull("bindTexture", tex)) return; // silently ignore a deleted texture @@ -209,60 +209,60 @@ WebGLContext::BindTexture(WebGLenum targ MakeContextCurrent(); if (tex) tex->Bind(target); else gl->fBindTexture(target, 0 /* == texturename */); } -void WebGLContext::BlendEquation(WebGLenum mode) +void WebGLContext::BlendEquation(GLenum mode) { if (!IsContextStable()) return; if (!ValidateBlendEquationEnum(mode, "blendEquation: mode")) return; MakeContextCurrent(); gl->fBlendEquation(mode); } -void WebGLContext::BlendEquationSeparate(WebGLenum modeRGB, WebGLenum modeAlpha) +void WebGLContext::BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { if (!IsContextStable()) return; if (!ValidateBlendEquationEnum(modeRGB, "blendEquationSeparate: modeRGB") || !ValidateBlendEquationEnum(modeAlpha, "blendEquationSeparate: modeAlpha")) return; MakeContextCurrent(); gl->fBlendEquationSeparate(modeRGB, modeAlpha); } -void WebGLContext::BlendFunc(WebGLenum sfactor, WebGLenum dfactor) +void WebGLContext::BlendFunc(GLenum sfactor, GLenum dfactor) { if (!IsContextStable()) return; if (!ValidateBlendFuncSrcEnum(sfactor, "blendFunc: sfactor") || !ValidateBlendFuncDstEnum(dfactor, "blendFunc: dfactor")) return; if (!ValidateBlendFuncEnumsCompatibility(sfactor, dfactor, "blendFuncSeparate: srcRGB and dstRGB")) return; MakeContextCurrent(); gl->fBlendFunc(sfactor, dfactor); } void -WebGLContext::BlendFuncSeparate(WebGLenum srcRGB, WebGLenum dstRGB, - WebGLenum srcAlpha, WebGLenum dstAlpha) +WebGLContext::BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, + GLenum srcAlpha, GLenum dstAlpha) { if (!IsContextStable()) return; if (!ValidateBlendFuncSrcEnum(srcRGB, "blendFuncSeparate: srcRGB") || !ValidateBlendFuncSrcEnum(srcAlpha, "blendFuncSeparate: srcAlpha") || !ValidateBlendFuncDstEnum(dstRGB, "blendFuncSeparate: dstRGB") || !ValidateBlendFuncDstEnum(dstAlpha, "blendFuncSeparate: dstAlpha")) @@ -307,18 +307,18 @@ GLenum WebGLContext::CheckedBufferData(G UpdateWebGLErrorAndClearGLError(&error); return error; } else { gl->fBufferData(target, size, data, usage); return LOCAL_GL_NO_ERROR; } } -WebGLenum -WebGLContext::CheckFramebufferStatus(WebGLenum target) +GLenum +WebGLContext::CheckFramebufferStatus(GLenum target) { if (!IsContextStable()) { return LOCAL_GL_FRAMEBUFFER_UNSUPPORTED; } MakeContextCurrent(); if (target != LOCAL_GL_FRAMEBUFFER) { @@ -358,30 +358,30 @@ WebGLContext::CheckFramebufferStatus(Web if(mBoundFramebuffer->HasIncompleteAttachment()) return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; if(mBoundFramebuffer->HasAttachmentsOfMismatchedDimensions()) return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; return gl->fCheckFramebufferStatus(target); } void -WebGLContext::CopyTexSubImage2D_base(WebGLenum target, - WebGLint level, - WebGLenum internalformat, - WebGLint xoffset, - WebGLint yoffset, - WebGLint x, - WebGLint y, - WebGLsizei width, - WebGLsizei height, +WebGLContext::CopyTexSubImage2D_base(GLenum target, + GLint level, + GLenum internalformat, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, bool sub) { const WebGLRectangleObject *framebufferRect = FramebufferRectangleObject(); - WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0; - WebGLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0; + GLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0; + GLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0; const char *info = sub ? "copyTexSubImage2D" : "copyTexImage2D"; if (!ValidateLevelWidthHeightForTarget(target, level, width, height, info)) { return; } MakeContextCurrent(); @@ -458,24 +458,24 @@ WebGLContext::CopyTexSubImage2D_base(Web gl->fCopyTexSubImage2D(target, level, actual_xoffset, actual_yoffset, actual_x, actual_y, actual_width, actual_height); } if (!sub) ReattachTextureToAnyFramebufferToWorkAroundBugs(tex, level); } void -WebGLContext::CopyTexImage2D(WebGLenum target, - WebGLint level, - WebGLenum internalformat, - WebGLint x, - WebGLint y, - WebGLsizei width, - WebGLsizei height, - WebGLint border) +WebGLContext::CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) { if (!IsContextStable()) return; switch (target) { case LOCAL_GL_TEXTURE_2D: case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X: case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X: @@ -504,17 +504,17 @@ WebGLContext::CopyTexImage2D(WebGLenum t return ErrorInvalidValue("copyTexImage2D: border must be 0"); if (width < 0 || height < 0) return ErrorInvalidValue("copyTexImage2D: width and height may not be negative"); if (level < 0) return ErrorInvalidValue("copyTexImage2D: level may not be negative"); - WebGLsizei maxTextureSize = MaxTextureSizeForTarget(target); + GLsizei maxTextureSize = MaxTextureSizeForTarget(target); if (!(maxTextureSize >> level)) return ErrorInvalidValue("copyTexImage2D: 2^level exceeds maximum texture size"); if (level >= 1) { if (!(is_pot_assuming_nonnegative(width) && is_pot_assuming_nonnegative(height))) return ErrorInvalidValue("copyTexImage2D: with level > 0, width and height must be powers of two"); } @@ -567,24 +567,24 @@ WebGLContext::CopyTexImage2D(WebGLenum t } else { CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false); } tex->SetImageInfo(target, level, width, height, internalformat, type); } void -WebGLContext::CopyTexSubImage2D(WebGLenum target, - WebGLint level, - WebGLint xoffset, - WebGLint yoffset, - WebGLint x, - WebGLint y, - WebGLsizei width, - WebGLsizei height) +WebGLContext::CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { if (!IsContextStable()) return; switch (target) { case LOCAL_GL_TEXTURE_2D: case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X: case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X: @@ -595,45 +595,45 @@ WebGLContext::CopyTexSubImage2D(WebGLenu break; default: return ErrorInvalidEnumInfo("copyTexSubImage2D: target", target); } if (level < 0) return ErrorInvalidValue("copyTexSubImage2D: level may not be negative"); - WebGLsizei maxTextureSize = MaxTextureSizeForTarget(target); + GLsizei maxTextureSize = MaxTextureSizeForTarget(target); if (!(maxTextureSize >> level)) return ErrorInvalidValue("copyTexSubImage2D: 2^level exceeds maximum texture size"); if (width < 0 || height < 0) return ErrorInvalidValue("copyTexSubImage2D: width and height may not be negative"); if (xoffset < 0 || yoffset < 0) return ErrorInvalidValue("copyTexSubImage2D: xoffset and yoffset may not be negative"); WebGLTexture *tex = activeBoundTextureForTarget(target); if (!tex) return ErrorInvalidOperation("copyTexSubImage2D: no texture bound to this target"); - WebGLint face = WebGLTexture::FaceForTarget(target); + GLint face = WebGLTexture::FaceForTarget(target); if (!tex->HasImageInfoAt(level, face)) return ErrorInvalidOperation("copyTexSubImage2D: no texture image previously defined for this level and face"); const WebGLTexture::ImageInfo &imageInfo = tex->ImageInfoAt(level, face); - WebGLsizei texWidth = imageInfo.Width(); - WebGLsizei texHeight = imageInfo.Height(); + GLsizei texWidth = imageInfo.Width(); + GLsizei texHeight = imageInfo.Height(); if (xoffset + width > texWidth || xoffset + width < 0) return ErrorInvalidValue("copyTexSubImage2D: xoffset+width is too large"); if (yoffset + height > texHeight || yoffset + height < 0) return ErrorInvalidValue("copyTexSubImage2D: yoffset+height is too large"); - WebGLenum format = imageInfo.Format(); + GLenum format = imageInfo.Format(); bool texFormatRequiresAlpha = format == LOCAL_GL_RGBA || format == LOCAL_GL_ALPHA || format == LOCAL_GL_LUMINANCE_ALPHA; bool fboFormatHasAlpha = mBoundFramebuffer ? mBoundFramebuffer->ColorAttachment(0).HasAlpha() : bool(gl->GetPixelFormat().alpha > 0); if (texFormatRequiresAlpha && !fboFormatHasAlpha) return ErrorInvalidOperation("copyTexSubImage2D: texture format requires an alpha channel " @@ -656,34 +656,34 @@ WebGLContext::CreateProgram() { if (!IsContextStable()) return nullptr; nsRefPtr<WebGLProgram> globj = new WebGLProgram(this); return globj.forget(); } already_AddRefed<WebGLShader> -WebGLContext::CreateShader(WebGLenum type) +WebGLContext::CreateShader(GLenum type) { if (!IsContextStable()) return nullptr; if (type != LOCAL_GL_VERTEX_SHADER && type != LOCAL_GL_FRAGMENT_SHADER) { ErrorInvalidEnumInfo("createShader: type", type); return nullptr; } nsRefPtr<WebGLShader> shader = new WebGLShader(this, type); return shader.forget(); } void -WebGLContext::CullFace(WebGLenum face) +WebGLContext::CullFace(GLenum face) { if (!IsContextStable()) return; if (!ValidateFaceEnum(face, "cullFace")) return; MakeContextCurrent(); @@ -741,17 +741,17 @@ WebGLContext::DeleteTexture(WebGLTexture return; if (!tex || tex->IsDeleted()) return; if (mBoundFramebuffer) mBoundFramebuffer->DetachTexture(tex); - WebGLuint activeTexture = mActiveTexture; + GLuint activeTexture = mActiveTexture; for (int32_t i = 0; i < mGLMaxTextureUnits; i++) { if ((tex->Target() == LOCAL_GL_TEXTURE_2D && mBound2DTextures[i] == tex) || (tex->Target() == LOCAL_GL_TEXTURE_CUBE_MAP && mBoundCubeMapTextures[i] == tex)) { ActiveTexture(LOCAL_GL_TEXTURE0 + i); BindTexture(tex->Target(), static_cast<WebGLTexture*>(nullptr)); } } @@ -802,30 +802,30 @@ WebGLContext::DetachShader(WebGLProgram !ValidateObjectAllowDeleted("detashShader: shader", shader)) return; if (!program->DetachShader(shader)) return ErrorInvalidOperation("detachShader: shader is not attached"); } void -WebGLContext::DepthFunc(WebGLenum func) +WebGLContext::DepthFunc(GLenum func) { if (!IsContextStable()) return; if (!ValidateComparisonEnum(func, "depthFunc")) return; MakeContextCurrent(); gl->fDepthFunc(func); } void -WebGLContext::DepthRange(WebGLfloat zNear, WebGLfloat zFar) +WebGLContext::DepthRange(GLfloat zNear, GLfloat zFar) { if (!IsContextStable()) return; if (zNear > zFar) return ErrorInvalidOperation("depthRange: the near value is greater than the far value!"); MakeContextCurrent(); @@ -848,41 +848,41 @@ WebGLContext::WhatDoesVertexAttrib0Need( #endif return (gl->IsGLES2() || mBoundVertexArray->mAttribBuffers[0].enabled) ? VertexAttrib0Status::Default : mCurrentProgram->IsAttribInUse(0) ? VertexAttrib0Status::EmulatedInitializedArray : VertexAttrib0Status::EmulatedUninitializedArray; } bool -WebGLContext::DoFakeVertexAttrib0(WebGLuint vertexCount) +WebGLContext::DoFakeVertexAttrib0(GLuint vertexCount) { int whatDoesAttrib0Need = WhatDoesVertexAttrib0Need(); if (whatDoesAttrib0Need == VertexAttrib0Status::Default) return true; if (!mAlreadyWarnedAboutFakeVertexAttrib0) { GenerateWarning("Drawing without vertex attrib 0 array enabled forces the browser " "to do expensive emulation work when running on desktop OpenGL " "platforms, for example on Mac. It is preferable to always draw " "with vertex attrib 0 array enabled, by using bindAttribLocation " "to bind some always-used attribute to location 0."); mAlreadyWarnedAboutFakeVertexAttrib0 = true; } - CheckedUint32 checked_dataSize = CheckedUint32(vertexCount) * 4 * sizeof(WebGLfloat); + CheckedUint32 checked_dataSize = CheckedUint32(vertexCount) * 4 * sizeof(GLfloat); if (!checked_dataSize.isValid()) { ErrorOutOfMemory("Integer overflow trying to construct a fake vertex attrib 0 array for a draw-operation " "with %d vertices. Try reducing the number of vertices.", vertexCount); return false; } - WebGLuint dataSize = checked_dataSize.value(); + GLuint dataSize = checked_dataSize.value(); if (!mFakeVertexAttrib0BufferObject) { gl->fGenBuffers(1, &mFakeVertexAttrib0BufferObject); } // if the VBO status is already exactly what we need, or if the only difference is that it's initialized and // we don't need it to be, then consider it OK bool vertexAttrib0BufferStatusOK = @@ -905,17 +905,17 @@ WebGLContext::DoFakeVertexAttrib0(WebGLu mFakeVertexAttrib0BufferObjectVector[3] = mVertexAttrib0Vector[3]; gl->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mFakeVertexAttrib0BufferObject); GLenum error = LOCAL_GL_NO_ERROR; UpdateWebGLErrorAndClearGLError(); if (mFakeVertexAttrib0BufferStatus == VertexAttrib0Status::EmulatedInitializedArray) { - nsAutoArrayPtr<WebGLfloat> array(new WebGLfloat[4 * vertexCount]); + nsAutoArrayPtr<GLfloat> array(new GLfloat[4 * vertexCount]); for(size_t i = 0; i < vertexCount; ++i) { array[4 * i + 0] = mVertexAttrib0Vector[0]; array[4 * i + 1] = mVertexAttrib0Vector[1]; array[4 * i + 2] = mVertexAttrib0Vector[2]; array[4 * i + 3] = mVertexAttrib0Vector[3]; } gl->fBufferData(LOCAL_GL_ARRAY_BUFFER, dataSize, array, LOCAL_GL_DYNAMIC_DRAW); } else { @@ -1000,17 +1000,17 @@ WebGLContext::BindFakeBlackTextures() gl->fGenTextures(1, &mBlackTexture2D); gl->fBindTexture(LOCAL_GL_TEXTURE_2D, mBlackTexture2D); gl->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGBA, 1, 1, 0, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, &black); gl->fGenTextures(1, &mBlackTextureCubeMap); gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, mBlackTextureCubeMap); - for (WebGLuint i = 0; i < 6; ++i) { + for (GLuint i = 0; i < 6; ++i) { gl->fTexImage2D(LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, LOCAL_GL_RGBA, 1, 1, 0, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, &black); } // Reset bound textures gl->fBindTexture(LOCAL_GL_TEXTURE_2D, bound2DTex); gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, boundCubeTex); @@ -1046,45 +1046,45 @@ WebGLContext::UnbindFakeBlackTextures() gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, mBoundCubeMapTextures[i]->GLName()); } } gl->fActiveTexture(LOCAL_GL_TEXTURE0 + mActiveTexture); } void -WebGLContext::FramebufferRenderbuffer(WebGLenum target, WebGLenum attachment, WebGLenum rbtarget, WebGLRenderbuffer *wrb) +WebGLContext::FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum rbtarget, WebGLRenderbuffer *wrb) { if (!IsContextStable()) return; if (!mBoundFramebuffer) return ErrorInvalidOperation("framebufferRenderbuffer: cannot modify framebuffer 0"); return mBoundFramebuffer->FramebufferRenderbuffer(target, attachment, rbtarget, wrb); } void -WebGLContext::FramebufferTexture2D(WebGLenum target, - WebGLenum attachment, - WebGLenum textarget, +WebGLContext::FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, WebGLTexture *tobj, - WebGLint level) + GLint level) { if (!IsContextStable()) return; if (!mBoundFramebuffer) return ErrorInvalidOperation("framebufferRenderbuffer: cannot modify framebuffer 0"); return mBoundFramebuffer->FramebufferTexture2D(target, attachment, textarget, tobj, level); } void -WebGLContext::FrontFace(WebGLenum mode) +WebGLContext::FrontFace(GLenum mode) { if (!IsContextStable()) return; switch (mode) { case LOCAL_GL_CW: case LOCAL_GL_CCW: break; @@ -1103,17 +1103,17 @@ WebGLContext::GetActiveAttrib(WebGLProgr return nullptr; if (!ValidateObject("getActiveAttrib: program", prog)) return nullptr; MakeContextCurrent(); GLint len = 0; - WebGLuint progname = prog->GLName();; + GLuint progname = prog->GLName();; gl->fGetProgramiv(progname, LOCAL_GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); if (len == 0) return nullptr; nsAutoArrayPtr<char> name(new char[len]); GLint attrsize = 0; GLuint attrtype = 0; @@ -1126,17 +1126,17 @@ WebGLContext::GetActiveAttrib(WebGLProgr prog->ReverseMapIdentifier(nsDependentCString(name), &reverseMappedName); nsRefPtr<WebGLActiveInfo> retActiveInfo = new WebGLActiveInfo(attrsize, attrtype, reverseMappedName); return retActiveInfo.forget(); } void -WebGLContext::GenerateMipmap(WebGLenum target) +WebGLContext::GenerateMipmap(GLenum target) { if (!IsContextStable()) return; if (!ValidateTextureTargetEnum(target, "generateMipmap")) return; WebGLTexture *tex = activeBoundTextureForTarget(target); @@ -1188,17 +1188,17 @@ WebGLContext::GetActiveUniform(WebGLProg return nullptr; if (!ValidateObject("getActiveUniform: program", prog)) return nullptr; MakeContextCurrent(); GLint len = 0; - WebGLuint progname = prog->GLName(); + GLuint progname = prog->GLName(); gl->fGetProgramiv(progname, LOCAL_GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); if (len == 0) return nullptr; nsAutoArrayPtr<char> name(new char[len]); GLint usize = 0; GLuint utype = 0; @@ -1250,40 +1250,40 @@ WebGLContext::GetAttachedShaders(WebGLPr ErrorInvalidValue("getAttachedShaders: invalid program"); } else if (prog->AttachedShaders().Length() == 0) { retval.SetValue().TruncateLength(0); } else { retval.SetValue().AppendElements(prog->AttachedShaders()); } } -WebGLint +GLint WebGLContext::GetAttribLocation(WebGLProgram *prog, const nsAString& name) { if (!IsContextStable()) return -1; if (!ValidateObject("getAttribLocation: program", prog)) return -1; if (!ValidateGLSLVariableName(name, "getAttribLocation")) return -1; NS_LossyConvertUTF16toASCII cname(name); nsCString mappedName; prog->MapIdentifier(cname, &mappedName); - WebGLuint progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); return gl->fGetAttribLocation(progname, mappedName.get()); } JS::Value -WebGLContext::GetBufferParameter(WebGLenum target, WebGLenum pname) +WebGLContext::GetBufferParameter(GLenum target, GLenum pname) { if (!IsContextStable()) return JS::NullValue(); if (target != LOCAL_GL_ARRAY_BUFFER && target != LOCAL_GL_ELEMENT_ARRAY_BUFFER) { ErrorInvalidEnumInfo("getBufferParameter: target", target); return JS::NullValue(); } @@ -1309,19 +1309,19 @@ WebGLContext::GetBufferParameter(WebGLen ErrorInvalidEnumInfo("getBufferParameter: parameter", pname); } return JS::NullValue(); } JS::Value WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx, - WebGLenum target, - WebGLenum attachment, - WebGLenum pname, + GLenum target, + GLenum attachment, + GLenum pname, ErrorResult& rv) { if (!IsContextStable()) return JS::NullValue(); if (target != LOCAL_GL_FRAMEBUFFER) { ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: target", target); return JS::NullValue(); @@ -1329,17 +1329,17 @@ WebGLContext::GetFramebufferAttachmentPa if (attachment != LOCAL_GL_DEPTH_ATTACHMENT && attachment != LOCAL_GL_STENCIL_ATTACHMENT && attachment != LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) { if (IsExtensionEnabled(WEBGL_draw_buffers)) { if (attachment < LOCAL_GL_COLOR_ATTACHMENT0 || - attachment >= WebGLenum(LOCAL_GL_COLOR_ATTACHMENT0 + mGLMaxColorAttachments)) + attachment >= GLenum(LOCAL_GL_COLOR_ATTACHMENT0 + mGLMaxColorAttachments)) { ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: attachment", attachment); return JS::NullValue(); } mBoundFramebuffer->EnsureColorAttachments(attachment - LOCAL_GL_COLOR_ATTACHMENT0); } else if (attachment != LOCAL_GL_COLOR_ATTACHMENT0) @@ -1402,17 +1402,17 @@ WebGLContext::GetFramebufferAttachmentPa return JS::NullValue(); } } return JS::NullValue(); } JS::Value -WebGLContext::GetRenderbufferParameter(WebGLenum target, WebGLenum pname) +WebGLContext::GetRenderbufferParameter(GLenum target, GLenum pname) { if (!IsContextStable()) return JS::NullValue(); if (target != LOCAL_GL_RENDERBUFFER) { ErrorInvalidEnumInfo("getRenderbufferParameter: target", target); return JS::NullValue(); } @@ -1453,42 +1453,42 @@ already_AddRefed<WebGLTexture> WebGLContext::CreateTexture() { if (!IsContextStable()) return nullptr; nsRefPtr<WebGLTexture> globj = new WebGLTexture(this); return globj.forget(); } -WebGLenum +GLenum WebGLContext::GetError() { if (mContextStatus == ContextStable) { MakeContextCurrent(); UpdateWebGLErrorAndClearGLError(); } else if (!mContextLostErrorSet) { mWebGLError = LOCAL_GL_CONTEXT_LOST; mContextLostErrorSet = true; } - WebGLenum err = mWebGLError; + GLenum err = mWebGLError; mWebGLError = LOCAL_GL_NO_ERROR; return err; } JS::Value -WebGLContext::GetProgramParameter(WebGLProgram *prog, WebGLenum pname) +WebGLContext::GetProgramParameter(WebGLProgram *prog, GLenum pname) { if (!IsContextStable()) return JS::NullValue(); if (!ValidateObjectAllowDeleted("getProgramParameter: program", prog)) return JS::NullValue(); - WebGLuint progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); switch (pname) { case LOCAL_GL_ATTACHED_SHADERS: case LOCAL_GL_ACTIVE_UNIFORMS: case LOCAL_GL_ACTIVE_ATTRIBUTES: { @@ -1545,17 +1545,17 @@ WebGLContext::GetProgramInfoLog(WebGLPro return; } if (!ValidateObject("getProgramInfoLog: program", prog)) { retval.Truncate(); return; } - WebGLuint progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); GLint k = -1; gl->fGetProgramiv(progname, LOCAL_GL_INFO_LOG_LENGTH, &k); if (k == -1) { // If GetProgramiv doesn't modify |k|, // it's because there was a GL error. @@ -1572,27 +1572,27 @@ WebGLContext::GetProgramInfoLog(WebGLPro retval.SetCapacity(k); gl->fGetProgramInfoLog(progname, k, &k, (char*) retval.BeginWriting()); retval.SetLength(k); } // here we have to support all pnames with both int and float params. // See this discussion: // https://www.khronos.org/webgl/public-mailing-list/archives/1008/msg00014.html -void WebGLContext::TexParameter_base(WebGLenum target, WebGLenum pname, - WebGLint *intParamPtr, - WebGLfloat *floatParamPtr) +void WebGLContext::TexParameter_base(GLenum target, GLenum pname, + GLint *intParamPtr, + GLfloat *floatParamPtr) { MOZ_ASSERT(intParamPtr || floatParamPtr); if (!IsContextStable()) return; - WebGLint intParam = intParamPtr ? *intParamPtr : WebGLint(*floatParamPtr); - WebGLfloat floatParam = floatParamPtr ? *floatParamPtr : WebGLfloat(*intParamPtr); + GLint intParam = intParamPtr ? *intParamPtr : GLint(*floatParamPtr); + GLfloat floatParam = floatParamPtr ? *floatParamPtr : GLfloat(*intParamPtr); if (!ValidateTextureTargetEnum(target, "texParameter: target")) return; WebGLTexture *tex = activeBoundTextureForTarget(target); if (!tex) return ErrorInvalidOperation("texParameter: no texture is bound to this target"); @@ -1679,17 +1679,17 @@ void WebGLContext::TexParameter_base(Web MakeContextCurrent(); if (intParamPtr) gl->fTexParameteri(target, pname, intParam); else gl->fTexParameterf(target, pname, floatParam); } JS::Value -WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname) +WebGLContext::GetTexParameter(GLenum target, GLenum pname) { if (!IsContextStable()) return JS::NullValue(); MakeContextCurrent(); if (!ValidateTextureTargetEnum(target, "getTexParameter: target")) return JS::NullValue(); @@ -1744,17 +1744,17 @@ WebGLContext::GetUniform(JSContext* cx, return JS::NullValue(); } if (location->ProgramGeneration() != prog->Generation()) { ErrorInvalidOperation("getUniform: this uniform location is obsolete since the program has been relinked"); return JS::NullValue(); } - WebGLuint progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); GLint uniforms = 0; GLint uniformNameMaxLength = 0; gl->fGetProgramiv(progname, LOCAL_GL_ACTIVE_UNIFORMS, &uniforms); gl->fGetProgramiv(progname, LOCAL_GL_ACTIVE_UNIFORM_MAX_LENGTH, &uniformNameMaxLength); @@ -1870,33 +1870,33 @@ WebGLContext::GetUniformLocation(WebGLPr if (!ValidateGLSLVariableName(name, "getUniformLocation")) return nullptr; NS_LossyConvertUTF16toASCII cname(name); nsCString mappedName; prog->MapIdentifier(cname, &mappedName); - WebGLuint progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); GLint intlocation = gl->fGetUniformLocation(progname, mappedName.get()); nsRefPtr<WebGLUniformLocation> loc; if (intlocation >= 0) { WebGLUniformInfo info = prog->GetUniformInfoForMappedIdentifier(mappedName); loc = new WebGLUniformLocation(this, prog, intlocation, info); } return loc.forget(); } void -WebGLContext::Hint(WebGLenum target, WebGLenum mode) +WebGLContext::Hint(GLenum target, GLenum mode) { if (!IsContextStable()) return; bool isValid = false; switch (target) { case LOCAL_GL_GENERATE_MIPMAP_HINT: @@ -2122,17 +2122,17 @@ WebGLContext::LinkProgram(WebGLProgram * log.get()); } } } } } void -WebGLContext::PixelStorei(WebGLenum pname, WebGLint param) +WebGLContext::PixelStorei(GLenum pname, GLint param) { if (!IsContextStable()) return; switch (pname) { case UNPACK_FLIP_Y_WEBGL: mPixelStoreFlipY = (param != 0); break; @@ -2160,19 +2160,19 @@ WebGLContext::PixelStorei(WebGLenum pnam gl->fPixelStorei(pname, param); break; default: return ErrorInvalidEnumInfo("pixelStorei: parameter", pname); } } void -WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width, - WebGLsizei height, WebGLenum format, - WebGLenum type, const Nullable<ArrayBufferView> &pixels, +WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, + GLsizei height, GLenum format, + GLenum type, const Nullable<ArrayBufferView> &pixels, ErrorResult& rv) { if (!IsContextStable()) { return; } if (mCanvasElement->IsWriteOnly() && !nsContentUtils::IsCallerChrome()) { GenerateWarning("readPixels: Not allowed"); @@ -2181,18 +2181,18 @@ WebGLContext::ReadPixels(WebGLint x, Web if (width < 0 || height < 0) return ErrorInvalidValue("readPixels: negative size passed"); if (pixels.IsNull()) return ErrorInvalidValue("readPixels: null destination buffer"); const WebGLRectangleObject *framebufferRect = FramebufferRectangleObject(); - WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0; - WebGLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0; + GLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0; + GLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0; uint32_t channels = 0; // Check the format param switch (format) { case LOCAL_GL_ALPHA: channels = 1; break; @@ -2386,17 +2386,17 @@ WebGLContext::ReadPixels(WebGLint x, Web NS_WARNING("Unhandled case, how'd we get here?"); return rv.Throw(NS_ERROR_FAILURE); } } } } void -WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, WebGLsizei width, WebGLsizei height) +WebGLContext::RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { if (!IsContextStable()) return; if (!mBoundRenderbuffer || !mBoundRenderbuffer->GLName()) return ErrorInvalidOperation("renderbufferStorage called on renderbuffer 0"); if (target != LOCAL_GL_RENDERBUFFER) @@ -2404,17 +2404,17 @@ WebGLContext::RenderbufferStorage(WebGLe if (width < 0 || height < 0) return ErrorInvalidValue("renderbufferStorage: width and height must be >= 0"); if (width > mGLMaxRenderbufferSize || height > mGLMaxRenderbufferSize) return ErrorInvalidValue("renderbufferStorage: width or height exceeds maximum renderbuffer size"); // certain OpenGL ES renderbuffer formats may not exist on desktop OpenGL - WebGLenum internalformatForGL = internalformat; + GLenum internalformatForGL = internalformat; switch (internalformat) { case LOCAL_GL_RGBA4: case LOCAL_GL_RGB5_A1: // 16-bit RGBA formats are not supported on desktop GL if (!gl->IsGLES2()) internalformatForGL = LOCAL_GL_RGBA8; break; case LOCAL_GL_RGB565: @@ -2463,30 +2463,30 @@ WebGLContext::RenderbufferStorage(WebGLe mBoundRenderbuffer->SetInternalFormat(internalformat); mBoundRenderbuffer->SetInternalFormatForGL(internalformatForGL); mBoundRenderbuffer->setDimensions(width, height); mBoundRenderbuffer->SetInitialized(false); } void -WebGLContext::Scissor(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height) +WebGLContext::Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { if (!IsContextStable()) return; if (width < 0 || height < 0) return ErrorInvalidValue("scissor: negative size"); MakeContextCurrent(); gl->fScissor(x, y, width, height); } void -WebGLContext::StencilFunc(WebGLenum func, WebGLint ref, WebGLuint mask) +WebGLContext::StencilFunc(GLenum func, GLint ref, GLuint mask) { if (!IsContextStable()) return; if (!ValidateComparisonEnum(func, "stencilFunc: func")) return; mStencilRefFront = ref; @@ -2494,17 +2494,17 @@ WebGLContext::StencilFunc(WebGLenum func mStencilValueMaskFront = mask; mStencilValueMaskBack = mask; MakeContextCurrent(); gl->fStencilFunc(func, ref, mask); } void -WebGLContext::StencilFuncSeparate(WebGLenum face, WebGLenum func, WebGLint ref, WebGLuint mask) +WebGLContext::StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { if (!IsContextStable()) return; if (!ValidateFaceEnum(face, "stencilFuncSeparate: face") || !ValidateComparisonEnum(func, "stencilFuncSeparate: func")) return; @@ -2525,32 +2525,32 @@ WebGLContext::StencilFuncSeparate(WebGLe break; } MakeContextCurrent(); gl->fStencilFuncSeparate(face, func, ref, mask); } void -WebGLContext::StencilOp(WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass) +WebGLContext::StencilOp(GLenum sfail, GLenum dpfail, GLenum dppass) { if (!IsContextStable()) return; if (!ValidateStencilOpEnum(sfail, "stencilOp: sfail") || !ValidateStencilOpEnum(dpfail, "stencilOp: dpfail") || !ValidateStencilOpEnum(dppass, "stencilOp: dppass")) return; MakeContextCurrent(); gl->fStencilOp(sfail, dpfail, dppass); } void -WebGLContext::StencilOpSeparate(WebGLenum face, WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass) +WebGLContext::StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) { if (!IsContextStable()) return; if (!ValidateFaceEnum(face, "stencilOpSeparate: face") || !ValidateStencilOpEnum(sfail, "stencilOpSeparate: sfail") || !ValidateStencilOpEnum(dpfail, "stencilOpSeparate: dpfail") || !ValidateStencilOpEnum(dppass, "stencilOpSeparate: dppass")) @@ -2630,50 +2630,50 @@ WebGLContext::SurfaceFromElementResultTo } return NS_OK; } void -WebGLContext::Uniform1i(WebGLUniformLocation *location_object, WebGLint a1) +WebGLContext::Uniform1i(WebGLUniformLocation *location_object, GLint a1) { GLint location; if (!ValidateUniformSetter("Uniform1i", location_object, location)) return; if (!ValidateSamplerUniformSetter("Uniform1i", location_object, a1)) return; MakeContextCurrent(); gl->fUniform1i(location, a1); } void -WebGLContext::Uniform2i(WebGLUniformLocation *location_object, WebGLint a1, - WebGLint a2) +WebGLContext::Uniform2i(WebGLUniformLocation *location_object, GLint a1, + GLint a2) { GLint location; if (!ValidateUniformSetter("Uniform2i", location_object, location)) return; if (!ValidateSamplerUniformSetter("Uniform2i", location_object, a1) || !ValidateSamplerUniformSetter("Uniform2i", location_object, a2)) { return; } MakeContextCurrent(); gl->fUniform2i(location, a1, a2); } void -WebGLContext::Uniform3i(WebGLUniformLocation *location_object, WebGLint a1, - WebGLint a2, WebGLint a3) +WebGLContext::Uniform3i(WebGLUniformLocation *location_object, GLint a1, + GLint a2, GLint a3) { GLint location; if (!ValidateUniformSetter("Uniform3i", location_object, location)) return; if (!ValidateSamplerUniformSetter("Uniform3i", location_object, a1) || !ValidateSamplerUniformSetter("Uniform3i", location_object, a2) || !ValidateSamplerUniformSetter("Uniform3i", location_object, a3)) @@ -2681,18 +2681,18 @@ WebGLContext::Uniform3i(WebGLUniformLoca return; } MakeContextCurrent(); gl->fUniform3i(location, a1, a2, a3); } void -WebGLContext::Uniform4i(WebGLUniformLocation *location_object, WebGLint a1, - WebGLint a2, WebGLint a3, WebGLint a4) +WebGLContext::Uniform4i(WebGLUniformLocation *location_object, GLint a1, + GLint a2, GLint a3, GLint a4) { GLint location; if (!ValidateUniformSetter("Uniform4i", location_object, location)) return; if (!ValidateSamplerUniformSetter("Uniform4i", location_object, a1) || !ValidateSamplerUniformSetter("Uniform4i", location_object, a2) || !ValidateSamplerUniformSetter("Uniform4i", location_object, a3) || @@ -2701,61 +2701,61 @@ WebGLContext::Uniform4i(WebGLUniformLoca return; } MakeContextCurrent(); gl->fUniform4i(location, a1, a2, a3, a4); } void -WebGLContext::Uniform1f(WebGLUniformLocation *location_object, WebGLfloat a1) +WebGLContext::Uniform1f(WebGLUniformLocation *location_object, GLfloat a1) { GLint location; if (!ValidateUniformSetter("Uniform1f", location_object, location)) return; MakeContextCurrent(); gl->fUniform1f(location, a1); } void -WebGLContext::Uniform2f(WebGLUniformLocation *location_object, WebGLfloat a1, - WebGLfloat a2) +WebGLContext::Uniform2f(WebGLUniformLocation *location_object, GLfloat a1, + GLfloat a2) { GLint location; if (!ValidateUniformSetter("Uniform2f", location_object, location)) return; MakeContextCurrent(); gl->fUniform2f(location, a1, a2); } void -WebGLContext::Uniform3f(WebGLUniformLocation *location_object, WebGLfloat a1, - WebGLfloat a2, WebGLfloat a3) +WebGLContext::Uniform3f(WebGLUniformLocation *location_object, GLfloat a1, + GLfloat a2, GLfloat a3) { GLint location; if (!ValidateUniformSetter("Uniform3f", location_object, location)) return; MakeContextCurrent(); gl->fUniform3f(location, a1, a2, a3); } void -WebGLContext::Uniform4f(WebGLUniformLocation *location_object, WebGLfloat a1, - WebGLfloat a2, WebGLfloat a3, WebGLfloat a4) +WebGLContext::Uniform4f(WebGLUniformLocation *location_object, GLfloat a1, + GLfloat a2, GLfloat a3, GLfloat a4) { GLint location; if (!ValidateUniformSetter("Uniform4f", location_object, location)) return; MakeContextCurrent(); gl->fUniform4f(location, a1, a2, a3, a4); } void WebGLContext::Uniform1iv_base(WebGLUniformLocation *location_object, - uint32_t arrayLength, const WebGLint* data) + uint32_t arrayLength, const GLint* data) { uint32_t numElementsToUpload; GLint location; if (!ValidateUniformArraySetter("Uniform1iv", 1, location_object, location, numElementsToUpload, arrayLength)) { return; } @@ -2763,17 +2763,17 @@ WebGLContext::Uniform1iv_base(WebGLUnifo return; MakeContextCurrent(); gl->fUniform1iv(location, numElementsToUpload, data); } void WebGLContext::Uniform2iv_base(WebGLUniformLocation *location_object, - uint32_t arrayLength, const WebGLint* data) + uint32_t arrayLength, const GLint* data) { uint32_t numElementsToUpload; GLint location; if (!ValidateUniformArraySetter("Uniform2iv", 2, location_object, location, numElementsToUpload, arrayLength)) { return; } @@ -2784,17 +2784,17 @@ WebGLContext::Uniform2iv_base(WebGLUnifo } MakeContextCurrent(); gl->fUniform2iv(location, numElementsToUpload, data); } void WebGLContext::Uniform3iv_base(WebGLUniformLocation *location_object, - uint32_t arrayLength, const WebGLint* data) + uint32_t arrayLength, const GLint* data) { uint32_t numElementsToUpload; GLint location; if (!ValidateUniformArraySetter("Uniform3iv", 3, location_object, location, numElementsToUpload, arrayLength)) { return; } @@ -2806,17 +2806,17 @@ WebGLContext::Uniform3iv_base(WebGLUnifo } MakeContextCurrent(); gl->fUniform3iv(location, numElementsToUpload, data); } void WebGLContext::Uniform4iv_base(WebGLUniformLocation *location_object, - uint32_t arrayLength, const WebGLint* data) + uint32_t arrayLength, const GLint* data) { uint32_t numElementsToUpload; GLint location; if (!ValidateUniformArraySetter("Uniform4iv", 4, location_object, location, numElementsToUpload, arrayLength)) { return; } @@ -2829,59 +2829,59 @@ WebGLContext::Uniform4iv_base(WebGLUnifo } MakeContextCurrent(); gl->fUniform4iv(location, numElementsToUpload, data); } void WebGLContext::Uniform1fv_base(WebGLUniformLocation *location_object, - uint32_t arrayLength, const WebGLfloat* data) + uint32_t arrayLength, const GLfloat* data) { uint32_t numElementsToUpload; GLint location; if (!ValidateUniformArraySetter("Uniform1fv", 1, location_object, location, numElementsToUpload, arrayLength)) { return; } MakeContextCurrent(); gl->fUniform1fv(location, numElementsToUpload, data); } void WebGLContext::Uniform2fv_base(WebGLUniformLocation *location_object, - uint32_t arrayLength, const WebGLfloat* data) + uint32_t arrayLength, const GLfloat* data) { uint32_t numElementsToUpload; GLint location; if (!ValidateUniformArraySetter("Uniform2fv", 2, location_object, location, numElementsToUpload, arrayLength)) { return; } MakeContextCurrent(); gl->fUniform2fv(location, numElementsToUpload, data); } void WebGLContext::Uniform3fv_base(WebGLUniformLocation *location_object, - uint32_t arrayLength, const WebGLfloat* data) + uint32_t arrayLength, const GLfloat* data) { uint32_t numElementsToUpload; GLint location; if (!ValidateUniformArraySetter("Uniform3fv", 3, location_object, location, numElementsToUpload, arrayLength)) { return; } MakeContextCurrent(); gl->fUniform3fv(location, numElementsToUpload, data); } void WebGLContext::Uniform4fv_base(WebGLUniformLocation *location_object, - uint32_t arrayLength, const WebGLfloat* data) + uint32_t arrayLength, const GLfloat* data) { uint32_t numElementsToUpload; GLint location; if (!ValidateUniformArraySetter("Uniform4fv", 4, location_object, location, numElementsToUpload, arrayLength)) { return; } MakeContextCurrent(); @@ -2941,17 +2941,17 @@ WebGLContext::UseProgram(WebGLProgram *p if (!ValidateObjectAllowNull("useProgram", prog)) return; MakeContextCurrent(); InvalidateBufferFetching(); - WebGLuint progname = prog ? prog->GLName() : 0; + GLuint progname = prog ? prog->GLName() : 0; if (prog && !prog->LinkStatus()) return ErrorInvalidOperation("useProgram: program was not linked successfully"); gl->fUseProgram(progname); mCurrentProgram = prog; } @@ -2970,17 +2970,17 @@ WebGLContext::ValidateProgram(WebGLProgr #ifdef XP_MACOSX // see bug 593867 for NVIDIA and bug 657201 for ATI. The latter is confirmed with Mac OS 10.6.7 if (gl->WorkAroundDriverBugs()) { GenerateWarning("validateProgram: implemented as a no-operation on Mac to work around crashes"); return; } #endif - WebGLuint progname = prog->GLName(); + GLuint progname = prog->GLName(); gl->fValidateProgram(progname); } already_AddRefed<WebGLFramebuffer> WebGLContext::CreateFramebuffer() { if (!IsContextStable()) return nullptr; @@ -2993,17 +2993,17 @@ WebGLContext::CreateRenderbuffer() { if (!IsContextStable()) return nullptr; nsRefPtr<WebGLRenderbuffer> globj = new WebGLRenderbuffer(this); return globj.forget(); } void -WebGLContext::Viewport(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height) +WebGLContext::Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { if (!IsContextStable()) return; if (width < 0 || height < 0) return ErrorInvalidValue("viewport: negative size"); MakeContextCurrent(); @@ -3014,17 +3014,17 @@ void WebGLContext::CompileShader(WebGLShader *shader) { if (!IsContextStable()) return; if (!ValidateObject("compileShader", shader)) return; - WebGLuint shadername = shader->GLName(); + GLuint shadername = shader->GLName(); shader->SetCompileStatus(false); MakeContextCurrent(); ShShaderOutput targetShaderSourceLanguage = gl->IsGLES2() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT; bool useShaderSourceTranslation = true; @@ -3274,18 +3274,18 @@ WebGLContext::CompileShader(WebGLShader gl->fCompileShader(shadername); GLint ok; gl->fGetShaderiv(shadername, LOCAL_GL_COMPILE_STATUS, &ok); shader->SetCompileStatus(ok); } } void -WebGLContext::CompressedTexImage2D(WebGLenum target, WebGLint level, WebGLenum internalformat, - WebGLsizei width, WebGLsizei height, WebGLint border, +WebGLContext::CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLint border, const ArrayBufferView& view) { if (!IsContextStable()) { return; } if (!ValidateTexImage2DTarget(target, width, height, "compressedTexImage2D")) { return; @@ -3314,19 +3314,19 @@ WebGLContext::CompressedTexImage2D(WebGL gl->fCompressedTexImage2D(target, level, internalformat, width, height, border, byteLength, view.Data()); tex->SetImageInfo(target, level, width, height, internalformat, LOCAL_GL_UNSIGNED_BYTE); ReattachTextureToAnyFramebufferToWorkAroundBugs(tex, level); } void -WebGLContext::CompressedTexSubImage2D(WebGLenum target, WebGLint level, WebGLint xoffset, - WebGLint yoffset, WebGLsizei width, WebGLsizei height, - WebGLenum format, const ArrayBufferView& view) +WebGLContext::CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, const ArrayBufferView& view) { if (!IsContextStable()) { return; } switch (target) { case LOCAL_GL_TEXTURE_2D: case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X: @@ -3414,25 +3414,25 @@ WebGLContext::CompressedTexSubImage2D(We } gl->fCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, byteLength, view.Data()); return; } JS::Value -WebGLContext::GetShaderParameter(WebGLShader *shader, WebGLenum pname) +WebGLContext::GetShaderParameter(WebGLShader *shader, GLenum pname) { if (!IsContextStable()) return JS::NullValue(); if (!ValidateObject("getShaderParameter: shader", shader)) return JS::NullValue(); - WebGLuint shadername = shader->GLName(); + GLuint shadername = shader->GLName(); MakeContextCurrent(); switch (pname) { case LOCAL_GL_SHADER_TYPE: { GLint i = 0; gl->fGetShaderiv(shadername, pname, &i); @@ -3481,17 +3481,17 @@ WebGLContext::GetShaderInfoLog(WebGLShad retval = shader->TranslationLog(); if (!retval.IsVoid()) { return; } MakeContextCurrent(); - WebGLuint shadername = shader->GLName(); + GLuint shadername = shader->GLName(); GLint k = -1; gl->fGetShaderiv(shadername, LOCAL_GL_INFO_LOG_LENGTH, &k); if (k == -1) { // XXX GL Error? should never happen. return; } if (k == 0) { @@ -3500,17 +3500,17 @@ WebGLContext::GetShaderInfoLog(WebGLShad } retval.SetCapacity(k); gl->fGetShaderInfoLog(shadername, k, &k, (char*) retval.BeginWriting()); retval.SetLength(k); } already_AddRefed<WebGLShaderPrecisionFormat> -WebGLContext::GetShaderPrecisionFormat(WebGLenum shadertype, WebGLenum precisiontype) +WebGLContext::GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype) { if (!IsContextStable()) return nullptr; switch (shadertype) { case LOCAL_GL_FRAGMENT_SHADER: case LOCAL_GL_VERTEX_SHADER: break; @@ -3621,20 +3621,20 @@ GLenum WebGLContext::CheckedTexImage2D(G return error; } else { gl->fTexImage2D(target, level, internalFormat, width, height, border, format, type, data); return LOCAL_GL_NO_ERROR; } } void -WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum internalformat, - WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero, - WebGLint border, - WebGLenum format, WebGLenum type, +WebGLContext::TexImage2D_base(GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLsizei srcStrideOrZero, + GLint border, + GLenum format, GLenum type, void *data, uint32_t byteLength, int jsArrayType, // a TypedArray format enum, or -1 if not relevant WebGLTexelFormat srcFormat, bool srcPremultiplied) { if (!ValidateTexImage2DTarget(target, width, height, "texImage2D")) { return; } @@ -3766,35 +3766,35 @@ WebGLContext::TexImage2D_base(WebGLenum } tex->SetImageInfo(target, level, width, height, format, type); ReattachTextureToAnyFramebufferToWorkAroundBugs(tex, level); } void -WebGLContext::TexImage2D(WebGLenum target, WebGLint level, - WebGLenum internalformat, WebGLsizei width, - WebGLsizei height, WebGLint border, WebGLenum format, - WebGLenum type, const Nullable<ArrayBufferView> &pixels, ErrorResult& rv) +WebGLContext::TexImage2D(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLenum format, + GLenum type, const Nullable<ArrayBufferView> &pixels, ErrorResult& rv) { if (!IsContextStable()) return; return TexImage2D_base(target, level, internalformat, width, height, 0, border, format, type, pixels.IsNull() ? 0 : pixels.Value().Data(), pixels.IsNull() ? 0 : pixels.Value().Length(), pixels.IsNull() ? -1 : (int)JS_GetArrayBufferViewType(pixels.Value().Obj()), WebGLTexelConversions::Auto, false); } void -WebGLContext::TexImage2D(WebGLenum target, WebGLint level, - WebGLenum internalformat, WebGLenum format, - WebGLenum type, ImageData* pixels, ErrorResult& rv) +WebGLContext::TexImage2D(GLenum target, GLint level, + GLenum internalformat, GLenum format, + GLenum type, ImageData* pixels, ErrorResult& rv) { if (!IsContextStable()) return; if (!pixels) { // Spec says to generate an INVALID_VALUE error return ErrorInvalidValue("texImage2D: null ImageData"); } @@ -3803,20 +3803,20 @@ WebGLContext::TexImage2D(WebGLenum targe return TexImage2D_base(target, level, internalformat, pixels->Width(), pixels->Height(), 4*pixels->Width(), 0, format, type, arr.Data(), arr.Length(), -1, WebGLTexelConversions::RGBA8, false); } void -WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level, - WebGLint xoffset, WebGLint yoffset, - WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero, - WebGLenum format, WebGLenum type, +WebGLContext::TexSubImage2D_base(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLsizei srcStrideOrZero, + GLenum format, GLenum type, void *pixels, uint32_t byteLength, int jsArrayType, WebGLTexelFormat srcFormat, bool srcPremultiplied) { switch (target) { case LOCAL_GL_TEXTURE_2D: case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X: case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X: @@ -3915,20 +3915,20 @@ WebGLContext::TexSubImage2D_base(WebGLen actualSrcFormat, srcPremultiplied, dstFormat, mPixelStorePremultiplyAlpha, dstTexelSize); gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, convertedData); } } void -WebGLContext::TexSubImage2D(WebGLenum target, WebGLint level, - WebGLint xoffset, WebGLint yoffset, - WebGLsizei width, WebGLsizei height, - WebGLenum format, WebGLenum type, +WebGLContext::TexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const Nullable<ArrayBufferView> &pixels, ErrorResult& rv) { if (!IsContextStable()) return; if (pixels.IsNull()) return ErrorInvalidValue("texSubImage2D: pixels must not be null!"); @@ -3936,19 +3936,19 @@ WebGLContext::TexSubImage2D(WebGLenum ta return TexSubImage2D_base(target, level, xoffset, yoffset, width, height, 0, format, type, pixels.Value().Data(), pixels.Value().Length(), JS_GetArrayBufferViewType(pixels.Value().Obj()), WebGLTexelConversions::Auto, false); } void -WebGLContext::TexSubImage2D(WebGLenum target, WebGLint level, - WebGLint xoffset, WebGLint yoffset, - WebGLenum format, WebGLenum type, ImageData* pixels, +WebGLContext::TexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageData* pixels, ErrorResult& rv) { if (!IsContextStable()) return; if (!pixels) return ErrorInvalidValue("texSubImage2D: pixels must not be null!"); @@ -3980,17 +3980,17 @@ WebGLContext::RestoreContext() } ForceRestoreContext(); return true; } bool -BaseTypeAndSizeFromUniformType(WebGLenum uType, WebGLenum *baseType, WebGLint *unitSize) +BaseTypeAndSizeFromUniformType(GLenum uType, GLenum *baseType, GLint *unitSize) { switch (uType) { case LOCAL_GL_INT: case LOCAL_GL_INT_VEC2: case LOCAL_GL_INT_VEC3: case LOCAL_GL_INT_VEC4: case LOCAL_GL_SAMPLER_2D: case LOCAL_GL_SAMPLER_CUBE: @@ -4121,18 +4121,18 @@ WebGLTexelFormat mozilla::GetWebGLTexelF return WebGLTexelConversions::RGB565; default: NS_ABORT_IF_FALSE(false, "Coding mistake?! Should never reach this point."); return WebGLTexelConversions::BadFormat; } } } -WebGLenum -InternalFormatForFormatAndType(WebGLenum format, WebGLenum type, bool isGLES2) +GLenum +InternalFormatForFormatAndType(GLenum format, GLenum type, bool isGLES2) { // ES2 requires that format == internalformat; floating-point is // indicated purely by the type that's loaded. For desktop GL, we // have to specify a floating point internal format. if (isGLES2) return format; if (format == LOCAL_GL_DEPTH_COMPONENT) { @@ -4174,17 +4174,17 @@ InternalFormatForFormatAndType(WebGLenum } NS_ASSERTION(false, "Coding mistake -- bad format/type passed?"); return 0; } void WebGLContext::ReattachTextureToAnyFramebufferToWorkAroundBugs(WebGLTexture *tex, - WebGLint level) + GLint level) { MOZ_ASSERT(tex); if (!gl->WorkAroundDriverBugs()) return; if (!mIsMesa) return;
--- a/content/canvas/src/WebGLContextState.cpp +++ b/content/canvas/src/WebGLContextState.cpp @@ -12,17 +12,17 @@ #include "WebGLRenderbuffer.h" #include "WebGLTexture.h" #include "WebGLVertexArray.h" using namespace mozilla; using namespace dom; void -WebGLContext::Disable(WebGLenum cap) +WebGLContext::Disable(GLenum cap) { if (!IsContextStable()) return; if (!ValidateCapabilityEnum(cap, "disable")) return; realGLboolean* trackingSlot = GetStateTrackingSlot(cap); @@ -32,17 +32,17 @@ WebGLContext::Disable(WebGLenum cap) *trackingSlot = 0; } MakeContextCurrent(); gl->fDisable(cap); } void -WebGLContext::Enable(WebGLenum cap) +WebGLContext::Enable(GLenum cap) { if (!IsContextStable()) return; if (!ValidateCapabilityEnum(cap, "enable")) return; realGLboolean* trackingSlot = GetStateTrackingSlot(cap); @@ -64,17 +64,17 @@ StringValue(JSContext* cx, const char* c rv.Throw(NS_ERROR_OUT_OF_MEMORY); return JS::NullValue(); } return JS::StringValue(str); } JS::Value -WebGLContext::GetParameter(JSContext* cx, WebGLenum pname, ErrorResult& rv) +WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) { if (!IsContextStable()) return JS::NullValue(); MakeContextCurrent(); if (MinCapabilityMode()) { switch(pname) { @@ -122,17 +122,17 @@ WebGLContext::GetParameter(JSContext* cx { return JS::Int32Value(mGLMaxColorAttachments); } else if (pname == LOCAL_GL_MAX_DRAW_BUFFERS) { return JS::Int32Value(mGLMaxDrawBuffers); } else if (pname >= LOCAL_GL_DRAW_BUFFER0 && - pname < WebGLenum(LOCAL_GL_DRAW_BUFFER0 + mGLMaxDrawBuffers)) + pname < GLenum(LOCAL_GL_DRAW_BUFFER0 + mGLMaxDrawBuffers)) { if (mBoundFramebuffer) { GLint iv = 0; gl->fGetIntegerv(pname, &iv); return JS::Int32Value(iv); } GLint iv = 0; @@ -479,17 +479,17 @@ WebGLContext::GetParameter(JSContext* cx default: ErrorInvalidEnumInfo("getParameter: parameter", pname); } return JS::NullValue(); } JS::Value -WebGLContext::GetParameterIndexed(JSContext* cx, WebGLenum pname, WebGLuint index) +WebGLContext::GetParameterIndexed(JSContext* cx, GLenum pname, GLuint index) { if (!IsContextStable()) return JS::NullValue(); MakeContextCurrent(); switch (pname) { case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: @@ -505,30 +505,30 @@ WebGLContext::GetParameterIndexed(JSCont break; } ErrorInvalidEnumInfo("getParameterIndexed: parameter", pname); return JS::NullValue(); } bool -WebGLContext::IsEnabled(WebGLenum cap) +WebGLContext::IsEnabled(GLenum cap) { if (!IsContextStable()) return false; if (!ValidateCapabilityEnum(cap, "isEnabled")) return false; MakeContextCurrent(); return gl->fIsEnabled(cap); } bool -WebGLContext::ValidateCapabilityEnum(WebGLenum cap, const char* info) +WebGLContext::ValidateCapabilityEnum(GLenum cap, const char* info) { 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: @@ -540,17 +540,17 @@ WebGLContext::ValidateCapabilityEnum(Web return IsWebGL2(); default: ErrorInvalidEnumInfo(info, cap); return false; } } realGLboolean* -WebGLContext::GetStateTrackingSlot(WebGLenum cap) +WebGLContext::GetStateTrackingSlot(GLenum cap) { switch (cap) { case LOCAL_GL_SCISSOR_TEST: return &mScissorTestEnabled; case LOCAL_GL_DITHER: return &mDitherEnabled; case LOCAL_GL_RASTERIZER_DISCARD: return &mRasterizerDiscardEnabled;
--- a/content/canvas/src/WebGLContextUtils.cpp +++ b/content/canvas/src/WebGLContextUtils.cpp @@ -51,51 +51,51 @@ WebGLContext::GenerateWarning(const char if (!ShouldGenerateWarnings()) { JS_ReportWarning(cx, "WebGL: No further warnings will be reported for this WebGL context " "(already reported %d warnings)", mAlreadyGeneratedWarnings); } } CheckedUint32 -WebGLContext::GetImageSize(WebGLsizei height, - WebGLsizei width, +WebGLContext::GetImageSize(GLsizei height, + GLsizei width, uint32_t pixelSize, uint32_t packOrUnpackAlignment) { CheckedUint32 checked_plainRowSize = CheckedUint32(width) * pixelSize; // alignedRowSize = row size rounded up to next multiple of packAlignment CheckedUint32 checked_alignedRowSize = RoundedToNextMultipleOf(checked_plainRowSize, packOrUnpackAlignment); // if height is 0, we don't need any memory to store this; without this check, we'll get an overflow CheckedUint32 checked_neededByteLength = height <= 0 ? 0 : (height-1) * checked_alignedRowSize + checked_plainRowSize; return checked_neededByteLength; } void -WebGLContext::SynthesizeGLError(WebGLenum err) +WebGLContext::SynthesizeGLError(GLenum err) { // If there is already a pending error, don't overwrite it; // but if there isn't, then we need to check for a gl error // that may have occurred before this one and use that code // instead. MakeContextCurrent(); UpdateWebGLErrorAndClearGLError(); if (!mWebGLError) mWebGLError = err; } void -WebGLContext::SynthesizeGLError(WebGLenum err, const char *fmt, ...) +WebGLContext::SynthesizeGLError(GLenum err, const char *fmt, ...) { va_list va; va_start(va, fmt); GenerateWarning(fmt, va); va_end(va); return SynthesizeGLError(err); }
--- a/content/canvas/src/WebGLContextValidate.cpp +++ b/content/canvas/src/WebGLContextValidate.cpp @@ -103,17 +103,17 @@ WebGLProgram::UpdateInfo() GLint attrLoc = mContext->gl->fGetAttribLocation(mGLName, attrName); MOZ_ASSERT(attrLoc >= 0); mActiveAttribMap.insert(std::make_pair(attrLoc, nsCString(attrName))); } return true; } -bool WebGLContext::ValidateBlendEquationEnum(WebGLenum mode, const char *info) +bool WebGLContext::ValidateBlendEquationEnum(GLenum mode, const char *info) { switch (mode) { case LOCAL_GL_FUNC_ADD: case LOCAL_GL_FUNC_SUBTRACT: case LOCAL_GL_FUNC_REVERSE_SUBTRACT: return true; case LOCAL_GL_MIN: case LOCAL_GL_MAX: @@ -125,17 +125,17 @@ bool WebGLContext::ValidateBlendEquation default: break; } ErrorInvalidEnumInfo(info, mode); return false; } -bool WebGLContext::ValidateBlendFuncDstEnum(WebGLenum factor, const char *info) +bool WebGLContext::ValidateBlendFuncDstEnum(GLenum factor, const char *info) { switch (factor) { case LOCAL_GL_ZERO: case LOCAL_GL_ONE: case LOCAL_GL_SRC_COLOR: case LOCAL_GL_ONE_MINUS_SRC_COLOR: case LOCAL_GL_DST_COLOR: case LOCAL_GL_ONE_MINUS_DST_COLOR: @@ -149,25 +149,25 @@ bool WebGLContext::ValidateBlendFuncDstE case LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA: return true; default: ErrorInvalidEnumInfo(info, factor); return false; } } -bool WebGLContext::ValidateBlendFuncSrcEnum(WebGLenum factor, const char *info) +bool WebGLContext::ValidateBlendFuncSrcEnum(GLenum factor, const char *info) { if (factor == LOCAL_GL_SRC_ALPHA_SATURATE) return true; else return ValidateBlendFuncDstEnum(factor, info); } -bool WebGLContext::ValidateBlendFuncEnumsCompatibility(WebGLenum sfactor, WebGLenum dfactor, const char *info) +bool WebGLContext::ValidateBlendFuncEnumsCompatibility(GLenum sfactor, GLenum dfactor, const char *info) { bool sfactorIsConstantColor = sfactor == LOCAL_GL_CONSTANT_COLOR || sfactor == LOCAL_GL_ONE_MINUS_CONSTANT_COLOR; bool sfactorIsConstantAlpha = sfactor == LOCAL_GL_CONSTANT_ALPHA || sfactor == LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA; bool dfactorIsConstantColor = dfactor == LOCAL_GL_CONSTANT_COLOR || dfactor == LOCAL_GL_ONE_MINUS_CONSTANT_COLOR; bool dfactorIsConstantAlpha = dfactor == LOCAL_GL_CONSTANT_ALPHA || @@ -176,29 +176,29 @@ bool WebGLContext::ValidateBlendFuncEnum (dfactorIsConstantColor && sfactorIsConstantAlpha) ) { ErrorInvalidOperation("%s are mutually incompatible, see section 6.8 in the WebGL 1.0 spec", info); return false; } else { return true; } } -bool WebGLContext::ValidateTextureTargetEnum(WebGLenum target, const char *info) +bool WebGLContext::ValidateTextureTargetEnum(GLenum target, const char *info) { switch (target) { case LOCAL_GL_TEXTURE_2D: case LOCAL_GL_TEXTURE_CUBE_MAP: return true; default: ErrorInvalidEnumInfo(info, target); return false; } } -bool WebGLContext::ValidateComparisonEnum(WebGLenum target, const char *info) +bool WebGLContext::ValidateComparisonEnum(GLenum target, const char *info) { switch (target) { case LOCAL_GL_NEVER: case LOCAL_GL_LESS: case LOCAL_GL_LEQUAL: case LOCAL_GL_GREATER: case LOCAL_GL_GEQUAL: case LOCAL_GL_EQUAL: @@ -206,17 +206,17 @@ bool WebGLContext::ValidateComparisonEnu case LOCAL_GL_ALWAYS: return true; default: ErrorInvalidEnumInfo(info, target); return false; } } -bool WebGLContext::ValidateStencilOpEnum(WebGLenum action, const char *info) +bool WebGLContext::ValidateStencilOpEnum(GLenum action, const char *info) { switch (action) { case LOCAL_GL_KEEP: case LOCAL_GL_ZERO: case LOCAL_GL_REPLACE: case LOCAL_GL_INCR: case LOCAL_GL_INCR_WRAP: case LOCAL_GL_DECR: @@ -224,30 +224,30 @@ bool WebGLContext::ValidateStencilOpEnum case LOCAL_GL_INVERT: return true; default: ErrorInvalidEnumInfo(info, action); return false; } } -bool WebGLContext::ValidateFaceEnum(WebGLenum face, const char *info) +bool WebGLContext::ValidateFaceEnum(GLenum face, const char *info) { switch (face) { case LOCAL_GL_FRONT: case LOCAL_GL_BACK: case LOCAL_GL_FRONT_AND_BACK: return true; default: ErrorInvalidEnumInfo(info, face); return false; } } -bool WebGLContext::ValidateDrawModeEnum(WebGLenum mode, const char *info) +bool WebGLContext::ValidateDrawModeEnum(GLenum mode, const char *info) { switch (mode) { case LOCAL_GL_TRIANGLES: case LOCAL_GL_TRIANGLE_STRIP: case LOCAL_GL_TRIANGLE_FAN: case LOCAL_GL_POINTS: case LOCAL_GL_LINE_STRIP: case LOCAL_GL_LINE_LOOP: @@ -295,17 +295,17 @@ bool WebGLContext::ValidateGLSLString(co ErrorInvalidValue("%s: string contains the illegal character '%d'", info, string.CharAt(i)); return false; } } return true; } -bool WebGLContext::ValidateTexImage2DTarget(WebGLenum target, WebGLsizei width, WebGLsizei height, +bool WebGLContext::ValidateTexImage2DTarget(GLenum target, GLsizei width, GLsizei height, const char* info) { switch (target) { case LOCAL_GL_TEXTURE_2D: break; case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X: case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X: case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y: @@ -320,19 +320,19 @@ bool WebGLContext::ValidateTexImage2DTar default: ErrorInvalidEnum("%s: invalid target enum 0x%x", info, target); return false; } return true; } -bool WebGLContext::ValidateCompressedTextureSize(WebGLenum target, WebGLint level, - WebGLenum format, - WebGLsizei width, WebGLsizei height, uint32_t byteLength, const char* info) +bool WebGLContext::ValidateCompressedTextureSize(GLenum target, GLint level, + GLenum format, + GLsizei width, GLsizei height, uint32_t byteLength, const char* info) { if (!ValidateLevelWidthHeightForTarget(target, level, width, height, info)) { return false; } // negative width and height must already have been handled above MOZ_ASSERT(width >= 0 && height >= 0); @@ -403,27 +403,27 @@ bool WebGLContext::ValidateCompressedTex return false; } } } return true; } -bool WebGLContext::ValidateLevelWidthHeightForTarget(WebGLenum target, WebGLint level, WebGLsizei width, - WebGLsizei height, const char* info) +bool WebGLContext::ValidateLevelWidthHeightForTarget(GLenum target, GLint level, GLsizei width, + GLsizei height, const char* info) { - WebGLsizei maxTextureSize = MaxTextureSizeForTarget(target); + GLsizei maxTextureSize = MaxTextureSizeForTarget(target); if (level < 0) { ErrorInvalidValue("%s: level must be >= 0", info); return false; } - WebGLsizei maxAllowedSize = maxTextureSize >> level; + GLsizei maxAllowedSize = maxTextureSize >> level; if (!maxAllowedSize) { ErrorInvalidValue("%s: 2^level exceeds maximum texture size", info); return false; } if (width < 0 || height < 0) { ErrorInvalidValue("%s: width and height must be >= 0", info); @@ -433,17 +433,17 @@ bool WebGLContext::ValidateLevelWidthHei if (width > maxAllowedSize || height > maxAllowedSize) { ErrorInvalidValue("%s: the maximum texture size for level %d is %d", info, level, maxAllowedSize); return false; } return true; } -uint32_t WebGLContext::GetBitsPerTexel(WebGLenum format, WebGLenum type) +uint32_t WebGLContext::GetBitsPerTexel(GLenum format, GLenum type) { // If there is no defined format or type, we're not taking up any memory if (!format || !type) { return 0; } if (format == LOCAL_GL_DEPTH_COMPONENT) { if (type == LOCAL_GL_UNSIGNED_SHORT) @@ -490,17 +490,17 @@ uint32_t WebGLContext::GetBitsPerTexel(W { return 16; } NS_ABORT(); return 0; } -bool WebGLContext::ValidateTexFormatAndType(WebGLenum format, WebGLenum type, int jsArrayType, +bool WebGLContext::ValidateTexFormatAndType(GLenum format, GLenum type, int jsArrayType, uint32_t *texelSize, const char *info) { if (IsExtensionEnabled(WEBGL_depth_texture)) { if (format == LOCAL_GL_DEPTH_COMPONENT) { if (jsArrayType != -1) { if ((type == LOCAL_GL_UNSIGNED_SHORT && jsArrayType != js::ArrayBufferView::TYPE_UINT16) || (type == LOCAL_GL_UNSIGNED_INT && jsArrayType != js::ArrayBufferView::TYPE_UINT32)) { ErrorInvalidOperation("%s: invalid typed array type for given texture data type", info); @@ -630,17 +630,17 @@ WebGLContext::ValidateUniformLocation(co if (mCurrentProgram->Generation() != location_object->ProgramGeneration()) { ErrorInvalidOperation("%s: This uniform location is obsolete since the program has been relinked", info); return false; } return true; } bool -WebGLContext::ValidateSamplerUniformSetter(const char* info, WebGLUniformLocation *location, WebGLint value) +WebGLContext::ValidateSamplerUniformSetter(const char* info, WebGLUniformLocation *location, GLint value) { if (location->Info().type != SH_SAMPLER_2D && location->Info().type != SH_SAMPLER_CUBE) { return true; } if (value >= 0 && value < mGLMaxTextureUnits) @@ -759,17 +759,17 @@ WebGLContext::ValidateUniformSetter(cons if (!IsContextStable()) return false; if (!ValidateUniformLocation(name, location_object)) return false; location = location_object->Location(); return true; } -bool WebGLContext::ValidateAttribIndex(WebGLuint index, const char *info) +bool WebGLContext::ValidateAttribIndex(GLuint index, const char *info) { return mBoundVertexArray->EnsureAttribIndex(index, info); } bool WebGLContext::ValidateStencilParamsForDrawCall() { const char *msg = "%s set different front and back stencil %s. Drawing in this configuration is not allowed."; if (mStencilRefFront != mStencilRefBack) {
--- a/content/canvas/src/WebGLContextVertices.cpp +++ b/content/canvas/src/WebGLContextVertices.cpp @@ -16,17 +16,17 @@ using namespace mozilla; using namespace dom; // For a Tegra workaround. static const int MAX_DRAW_CALLS_SINCE_FLUSH = 100; void -WebGLContext::VertexAttrib1f(WebGLuint index, WebGLfloat x0) +WebGLContext::VertexAttrib1f(GLuint index, GLfloat x0) { if (!IsContextStable()) return; MakeContextCurrent(); if (index) { gl->fVertexAttrib1f(index, x0); @@ -36,17 +36,17 @@ WebGLContext::VertexAttrib1f(WebGLuint i mVertexAttrib0Vector[2] = 0; mVertexAttrib0Vector[3] = 1; if (gl->IsGLES2()) gl->fVertexAttrib1f(index, x0); } } void -WebGLContext::VertexAttrib2f(WebGLuint index, WebGLfloat x0, WebGLfloat x1) +WebGLContext::VertexAttrib2f(GLuint index, GLfloat x0, GLfloat x1) { if (!IsContextStable()) return; MakeContextCurrent(); if (index) { gl->fVertexAttrib2f(index, x0, x1); @@ -56,17 +56,17 @@ WebGLContext::VertexAttrib2f(WebGLuint i mVertexAttrib0Vector[2] = 0; mVertexAttrib0Vector[3] = 1; if (gl->IsGLES2()) gl->fVertexAttrib2f(index, x0, x1); } } void -WebGLContext::VertexAttrib3f(WebGLuint index, WebGLfloat x0, WebGLfloat x1, WebGLfloat x2) +WebGLContext::VertexAttrib3f(GLuint index, GLfloat x0, GLfloat x1, GLfloat x2) { if (!IsContextStable()) return; MakeContextCurrent(); if (index) { gl->fVertexAttrib3f(index, x0, x1, x2); @@ -76,18 +76,18 @@ WebGLContext::VertexAttrib3f(WebGLuint i mVertexAttrib0Vector[2] = x2; mVertexAttrib0Vector[3] = 1; if (gl->IsGLES2()) gl->fVertexAttrib3f(index, x0, x1, x2); } } void -WebGLContext::VertexAttrib4f(WebGLuint index, WebGLfloat x0, WebGLfloat x1, - WebGLfloat x2, WebGLfloat x3) +WebGLContext::VertexAttrib4f(GLuint index, GLfloat x0, GLfloat x1, + GLfloat x2, GLfloat x3) { if (!IsContextStable()) return; MakeContextCurrent(); if (index) { gl->fVertexAttrib4f(index, x0, x1, x2, x3); @@ -98,78 +98,78 @@ WebGLContext::VertexAttrib4f(WebGLuint i mVertexAttrib0Vector[3] = x3; if (gl->IsGLES2()) gl->fVertexAttrib4f(index, x0, x1, x2, x3); } } void -WebGLContext::VertexAttrib1fv_base(WebGLuint idx, uint32_t arrayLength, - const WebGLfloat* ptr) +WebGLContext::VertexAttrib1fv_base(GLuint idx, uint32_t arrayLength, + const GLfloat* ptr) { if (!ValidateAttribArraySetter("VertexAttrib1fv", 1, arrayLength)) return; MakeContextCurrent(); if (idx) { gl->fVertexAttrib1fv(idx, ptr); } else { mVertexAttrib0Vector[0] = ptr[0]; - mVertexAttrib0Vector[1] = WebGLfloat(0); - mVertexAttrib0Vector[2] = WebGLfloat(0); - mVertexAttrib0Vector[3] = WebGLfloat(1); + mVertexAttrib0Vector[1] = GLfloat(0); + mVertexAttrib0Vector[2] = GLfloat(0); + mVertexAttrib0Vector[3] = GLfloat(1); if (gl->IsGLES2()) gl->fVertexAttrib1fv(idx, ptr); } } void -WebGLContext::VertexAttrib2fv_base(WebGLuint idx, uint32_t arrayLength, - const WebGLfloat* ptr) +WebGLContext::VertexAttrib2fv_base(GLuint idx, uint32_t arrayLength, + const GLfloat* ptr) { if (!ValidateAttribArraySetter("VertexAttrib2fv", 2, arrayLength)) return; MakeContextCurrent(); if (idx) { gl->fVertexAttrib2fv(idx, ptr); } else { mVertexAttrib0Vector[0] = ptr[0]; mVertexAttrib0Vector[1] = ptr[1]; - mVertexAttrib0Vector[2] = WebGLfloat(0); - mVertexAttrib0Vector[3] = WebGLfloat(1); + mVertexAttrib0Vector[2] = GLfloat(0); + mVertexAttrib0Vector[3] = GLfloat(1); if (gl->IsGLES2()) gl->fVertexAttrib2fv(idx, ptr); } } void -WebGLContext::VertexAttrib3fv_base(WebGLuint idx, uint32_t arrayLength, - const WebGLfloat* ptr) +WebGLContext::VertexAttrib3fv_base(GLuint idx, uint32_t arrayLength, + const GLfloat* ptr) { if (!ValidateAttribArraySetter("VertexAttrib3fv", 3, arrayLength)) return; MakeContextCurrent(); if (idx) { gl->fVertexAttrib3fv(idx, ptr); } else { mVertexAttrib0Vector[0] = ptr[0]; mVertexAttrib0Vector[1] = ptr[1]; mVertexAttrib0Vector[2] = ptr[2]; - mVertexAttrib0Vector[3] = WebGLfloat(1); + mVertexAttrib0Vector[3] = GLfloat(1); if (gl->IsGLES2()) gl->fVertexAttrib3fv(idx, ptr); } } void -WebGLContext::VertexAttrib4fv_base(WebGLuint idx, uint32_t arrayLength, - const WebGLfloat* ptr) +WebGLContext::VertexAttrib4fv_base(GLuint idx, uint32_t arrayLength, + const GLfloat* ptr) { if (!ValidateAttribArraySetter("VertexAttrib4fv", 4, arrayLength)) return; MakeContextCurrent(); if (idx) { gl->fVertexAttrib4fv(idx, ptr); } else { @@ -178,33 +178,33 @@ WebGLContext::VertexAttrib4fv_base(WebGL mVertexAttrib0Vector[2] = ptr[2]; mVertexAttrib0Vector[3] = ptr[3]; if (gl->IsGLES2()) gl->fVertexAttrib4fv(idx, ptr); } } void -WebGLContext::EnableVertexAttribArray(WebGLuint index) +WebGLContext::EnableVertexAttribArray(GLuint index) { if (!IsContextStable()) return; if (!ValidateAttribIndex(index, "enableVertexAttribArray")) return; MakeContextCurrent(); InvalidateBufferFetching(); gl->fEnableVertexAttribArray(index); mBoundVertexArray->mAttribBuffers[index].enabled = true; } void -WebGLContext::DisableVertexAttribArray(WebGLuint index) +WebGLContext::DisableVertexAttribArray(GLuint index) { if (!IsContextStable()) return; if (!ValidateAttribIndex(index, "disableVertexAttribArray")) return; MakeContextCurrent(); @@ -213,17 +213,17 @@ WebGLContext::DisableVertexAttribArray(W if (index || gl->IsGLES2()) gl->fDisableVertexAttribArray(index); mBoundVertexArray->mAttribBuffers[index].enabled = false; } JS::Value -WebGLContext::GetVertexAttrib(JSContext* cx, WebGLuint index, WebGLenum pname, +WebGLContext::GetVertexAttrib(JSContext* cx, GLuint index, GLenum pname, ErrorResult& rv) { if (!IsContextStable()) return JS::NullValue(); if (!mBoundVertexArray->EnsureAttribIndex(index, "getVertexAttrib")) return JS::NullValue(); @@ -266,17 +266,17 @@ WebGLContext::GetVertexAttrib(JSContext* { return JS::Int32Value(mBoundVertexArray->mAttribBuffers[index].divisor); } break; } case LOCAL_GL_CURRENT_VERTEX_ATTRIB: { - WebGLfloat vec[4] = {0, 0, 0, 1}; + GLfloat vec[4] = {0, 0, 0, 1}; if (index) { gl->fGetVertexAttribfv(index, LOCAL_GL_CURRENT_VERTEX_ATTRIB, &vec[0]); } else { vec[0] = mVertexAttrib0Vector[0]; vec[1] = mVertexAttrib0Vector[1]; vec[2] = mVertexAttrib0Vector[2]; vec[3] = mVertexAttrib0Vector[3]; } @@ -302,44 +302,44 @@ WebGLContext::GetVertexAttrib(JSContext* } ErrorInvalidEnumInfo("getVertexAttrib: parameter", pname); return JS::NullValue(); } WebGLsizeiptr -WebGLContext::GetVertexAttribOffset(WebGLuint index, WebGLenum pname) +WebGLContext::GetVertexAttribOffset(GLuint index, GLenum pname) { if (!IsContextStable()) return 0; if (!ValidateAttribIndex(index, "getVertexAttribOffset")) return 0; if (pname != LOCAL_GL_VERTEX_ATTRIB_ARRAY_POINTER) { ErrorInvalidEnum("getVertexAttribOffset: bad parameter"); return 0; } return mBoundVertexArray->mAttribBuffers[index].byteOffset; } void -WebGLContext::VertexAttribPointer(WebGLuint index, WebGLint size, WebGLenum type, - WebGLboolean normalized, WebGLsizei stride, +WebGLContext::VertexAttribPointer(GLuint index, GLint size, GLenum type, + WebGLboolean normalized, GLsizei stride, WebGLintptr byteOffset) { if (!IsContextStable()) return; if (mBoundArrayBuffer == nullptr) return ErrorInvalidOperation("vertexAttribPointer: must have valid GL_ARRAY_BUFFER binding"); - WebGLsizei requiredAlignment = 1; + GLsizei requiredAlignment = 1; switch (type) { case LOCAL_GL_BYTE: case LOCAL_GL_UNSIGNED_BYTE: requiredAlignment = 1; break; case LOCAL_GL_SHORT: case LOCAL_GL_UNSIGNED_SHORT: requiredAlignment = 2; @@ -348,17 +348,17 @@ WebGLContext::VertexAttribPointer(WebGLu case LOCAL_GL_FLOAT: requiredAlignment = 4; break; default: return ErrorInvalidEnumInfo("vertexAttribPointer: type", type); } // requiredAlignment should always be a power of two. - WebGLsizei requiredAlignmentMask = requiredAlignment - 1; + GLsizei requiredAlignmentMask = requiredAlignment - 1; if ( !mBoundVertexArray->EnsureAttribIndex(index, "vertexAttribPointer") ) { return; } if (size < 1 || size > 4) return ErrorInvalidValue("vertexAttribPointer: invalid element size"); @@ -398,17 +398,17 @@ WebGLContext::VertexAttribPointer(WebGLu MakeContextCurrent(); gl->fVertexAttribPointer(index, size, type, normalized, stride, reinterpret_cast<void*>(byteOffset)); } void -WebGLContext::VertexAttribDivisor(WebGLuint index, WebGLuint divisor) +WebGLContext::VertexAttribDivisor(GLuint index, GLuint divisor) { if (!IsContextStable()) return; if ( !mBoundVertexArray->EnsureAttribIndex(index, "vertexAttribDivisor") ) { return; } @@ -417,17 +417,17 @@ WebGLContext::VertexAttribDivisor(WebGLu InvalidateBufferFetching(); MakeContextCurrent(); gl->fVertexAttribDivisor(index, divisor); } -bool WebGLContext::DrawArrays_check(WebGLint first, WebGLsizei count, WebGLsizei primcount, const char* info) +bool WebGLContext::DrawArrays_check(GLint first, GLsizei count, GLsizei primcount, const char* info) { if (first < 0 || count < 0) { ErrorInvalidValue("%s: negative first or count", info); return false; } if (primcount < 0) { ErrorInvalidValue("%s: negative primcount", info); @@ -493,17 +493,17 @@ bool WebGLContext::DrawArrays_check(WebG return false; } BindFakeBlackTextures(); return true; } void -WebGLContext::DrawArrays(GLenum mode, WebGLint first, WebGLsizei count) +WebGLContext::DrawArrays(GLenum mode, GLint first, GLsizei count) { if (!IsContextStable()) return; if (!ValidateDrawModeEnum(mode, "drawArrays: mode")) return; if (!DrawArrays_check(first, count, 1, "drawArrays")) @@ -511,17 +511,17 @@ WebGLContext::DrawArrays(GLenum mode, We SetupContextLossTimer(); gl->fDrawArrays(mode, first, count); Draw_cleanup(); } void -WebGLContext::DrawArraysInstanced(GLenum mode, WebGLint first, WebGLsizei count, WebGLsizei primcount) +WebGLContext::DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { if (!IsContextStable()) return; if (!ValidateDrawModeEnum(mode, "drawArraysInstanced: mode")) return; if (!DrawArrays_check(first, count, primcount, "drawArraysInstanced")) @@ -529,17 +529,17 @@ WebGLContext::DrawArraysInstanced(GLenum SetupContextLossTimer(); gl->fDrawArraysInstanced(mode, first, count, primcount); Draw_cleanup(); } bool -WebGLContext::DrawElements_check(WebGLsizei count, WebGLenum type, WebGLintptr byteOffset, WebGLsizei primcount, const char* info) +WebGLContext::DrawElements_check(GLsizei count, GLenum type, WebGLintptr byteOffset, GLsizei primcount, const char* info) { if (count < 0 || byteOffset < 0) { ErrorInvalidValue("%s: negative count or offset", info); return false; } if (primcount < 0) { ErrorInvalidValue("%s: negative primcount", info); @@ -552,17 +552,17 @@ WebGLContext::DrawElements_check(WebGLsi // If count is 0, there's nothing to do. if (count == 0 || primcount == 0) { return false; } CheckedUint32 checked_byteCount; - WebGLsizei first = 0; + GLsizei first = 0; if (type == LOCAL_GL_UNSIGNED_SHORT) { checked_byteCount = 2 * CheckedUint32(count); if (byteOffset % 2 != 0) { ErrorInvalidOperation("%s: invalid byteOffset for UNSIGNED_SHORT (must be a multiple of 2)", info); return false; } first = byteOffset / 2; @@ -657,17 +657,17 @@ WebGLContext::DrawElements_check(WebGLsi return false; } BindFakeBlackTextures(); return true; } void -WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, +WebGLContext::DrawElements(GLenum mode, GLsizei count, GLenum type, WebGLintptr byteOffset) { if (!IsContextStable()) return; if (!ValidateDrawModeEnum(mode, "drawElements: mode")) return; @@ -676,18 +676,18 @@ WebGLContext::DrawElements(WebGLenum mod SetupContextLossTimer(); gl->fDrawElements(mode, count, type, reinterpret_cast<GLvoid*>(byteOffset)); Draw_cleanup(); } void -WebGLContext::DrawElementsInstanced(WebGLenum mode, WebGLsizei count, WebGLenum type, - WebGLintptr byteOffset, WebGLsizei primcount) +WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, + WebGLintptr byteOffset, GLsizei primcount) { if (!IsContextStable()) return; if (!ValidateDrawModeEnum(mode, "drawElementsInstanced: mode")) return; if (!DrawElements_check(count, type, byteOffset, primcount, "drawElementsInstanced"))
--- a/content/canvas/src/WebGLExtensionInstancedArrays.cpp +++ b/content/canvas/src/WebGLExtensionInstancedArrays.cpp @@ -16,32 +16,32 @@ WebGLExtensionInstancedArrays::WebGLExte "ANGLE_instanced_arrays unsupported."); } WebGLExtensionInstancedArrays::~WebGLExtensionInstancedArrays() { } void -WebGLExtensionInstancedArrays::DrawArraysInstancedANGLE(WebGLenum mode, WebGLint first, - WebGLsizei count, WebGLsizei primcount) +WebGLExtensionInstancedArrays::DrawArraysInstancedANGLE(GLenum mode, GLint first, + GLsizei count, GLsizei primcount) { mContext->DrawArraysInstanced(mode, first, count, primcount); } void -WebGLExtensionInstancedArrays::DrawElementsInstancedANGLE(WebGLenum mode, WebGLsizei count, - WebGLenum type, WebGLintptr offset, - WebGLsizei primcount) +WebGLExtensionInstancedArrays::DrawElementsInstancedANGLE(GLenum mode, GLsizei count, + GLenum type, WebGLintptr offset, + GLsizei primcount) { mContext->DrawElementsInstanced(mode, count, type, offset, primcount); } void -WebGLExtensionInstancedArrays::VertexAttribDivisorANGLE(WebGLuint index, WebGLuint divisor) +WebGLExtensionInstancedArrays::VertexAttribDivisorANGLE(GLuint index, GLuint divisor) { mContext->VertexAttribDivisor(index, divisor); } bool WebGLExtensionInstancedArrays::IsSupported(const WebGLContext* context) { gl::GLContext* gl = context->GL();
--- a/content/canvas/src/WebGLExtensions.h +++ b/content/canvas/src/WebGLExtensions.h @@ -191,22 +191,22 @@ public: class WebGLExtensionInstancedArrays : public WebGLExtensionBase { public: WebGLExtensionInstancedArrays(WebGLContext* context); virtual ~WebGLExtensionInstancedArrays(); - void DrawArraysInstancedANGLE(WebGLenum mode, WebGLint first, - WebGLsizei count, WebGLsizei primcount); - void DrawElementsInstancedANGLE(WebGLenum mode, WebGLsizei count, - WebGLenum type, WebGLintptr offset, - WebGLsizei primcount); - void VertexAttribDivisorANGLE(WebGLuint index, WebGLuint divisor); + void DrawArraysInstancedANGLE(GLenum mode, GLint first, + GLsizei count, GLsizei primcount); + void DrawElementsInstancedANGLE(GLenum mode, GLsizei count, + GLenum type, WebGLintptr offset, + GLsizei primcount); + void VertexAttribDivisorANGLE(GLuint index, GLuint divisor); static bool IsSupported(const WebGLContext* context); DECL_WEBGL_EXTENSION_GOOP }; } // namespace mozilla
--- a/content/canvas/src/WebGLFramebuffer.cpp +++ b/content/canvas/src/WebGLFramebuffer.cpp @@ -39,30 +39,30 @@ bool WebGLFramebuffer::Attachment::IsDeleteRequested() const { return Texture() ? Texture()->IsDeleteRequested() : Renderbuffer() ? Renderbuffer()->IsDeleteRequested() : false; } bool WebGLFramebuffer::Attachment::HasAlpha() const { - WebGLenum format = 0; + GLenum format = 0; if (Texture() && Texture()->HasImageInfoAt(mTextureLevel, mTextureCubeMapFace)) format = Texture()->ImageInfoAt(mTextureLevel, mTextureCubeMapFace).Format(); else if (Renderbuffer()) format = Renderbuffer()->InternalFormat(); return format == LOCAL_GL_RGBA || format == LOCAL_GL_LUMINANCE_ALPHA || format == LOCAL_GL_ALPHA || format == LOCAL_GL_RGBA4 || format == LOCAL_GL_RGB5_A1; } void -WebGLFramebuffer::Attachment::SetTexture(WebGLTexture *tex, WebGLint level, WebGLenum face) { +WebGLFramebuffer::Attachment::SetTexture(WebGLTexture *tex, GLint level, GLenum face) { mTexturePtr = tex; mRenderbufferPtr = nullptr; mTextureLevel = level; mTextureCubeMapFace = face; } bool WebGLFramebuffer::Attachment::HasUninitializedRenderbuffer() const { @@ -96,49 +96,49 @@ WebGLFramebuffer::Attachment::IsComplete !thisRect->Width() || !thisRect->Height()) return false; if (mTexturePtr) { if (!mTexturePtr->HasImageInfoAt(0, 0)) return false; - WebGLenum format = mTexturePtr->ImageInfoAt(0).Format(); + GLenum format = mTexturePtr->ImageInfoAt(0).Format(); if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT) { return format == LOCAL_GL_DEPTH_COMPONENT; } else if (mAttachmentPoint == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) { return format == LOCAL_GL_DEPTH_STENCIL; } else if (mAttachmentPoint >= LOCAL_GL_COLOR_ATTACHMENT0 && - mAttachmentPoint < WebGLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::sMaxColorAttachments)) { + mAttachmentPoint < GLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::sMaxColorAttachments)) { return (format == LOCAL_GL_ALPHA || format == LOCAL_GL_LUMINANCE || format == LOCAL_GL_LUMINANCE_ALPHA || format == LOCAL_GL_RGB || format == LOCAL_GL_RGBA); } MOZ_CRASH("Invalid WebGL attachment poin?"); } if (mRenderbufferPtr) { - WebGLenum format = mRenderbufferPtr->InternalFormat(); + GLenum format = mRenderbufferPtr->InternalFormat(); if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT) { return format == LOCAL_GL_DEPTH_COMPONENT16; } else if (mAttachmentPoint == LOCAL_GL_STENCIL_ATTACHMENT) { return format == LOCAL_GL_STENCIL_INDEX8; } else if (mAttachmentPoint == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) { return format == LOCAL_GL_DEPTH_STENCIL; } else if (mAttachmentPoint >= LOCAL_GL_COLOR_ATTACHMENT0 && - mAttachmentPoint < WebGLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::sMaxColorAttachments)) { + mAttachmentPoint < GLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::sMaxColorAttachments)) { return (format == LOCAL_GL_RGB565 || format == LOCAL_GL_RGB5_A1 || format == LOCAL_GL_RGBA4); } MOZ_CRASH("Invalid WebGL attachment poin?"); } NS_ABORT(); // should never get there @@ -152,19 +152,19 @@ WebGLFramebuffer::Delete() { mStencilAttachment.Reset(); mDepthStencilAttachment.Reset(); mContext->MakeContextCurrent(); mContext->gl->fDeleteFramebuffers(1, &mGLName); LinkedListElement<WebGLFramebuffer>::removeFrom(mContext->mFramebuffers); } void -WebGLFramebuffer::FramebufferRenderbuffer(WebGLenum target, - WebGLenum attachment, - WebGLenum rbtarget, +WebGLFramebuffer::FramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum rbtarget, WebGLRenderbuffer *wrb) { MOZ_ASSERT(mContext->mBoundFramebuffer == this); if (!mContext->ValidateObjectAllowNull("framebufferRenderbuffer: renderbuffer", wrb)) { return; } @@ -192,41 +192,41 @@ WebGLFramebuffer::FramebufferRenderbuffe size_t colorAttachmentId = size_t(attachment - LOCAL_GL_COLOR_ATTACHMENT0); EnsureColorAttachments(colorAttachmentId); mColorAttachments[colorAttachmentId].SetRenderbuffer(wrb); break; } mContext->MakeContextCurrent(); - WebGLuint parambuffername = wrb ? wrb->GLName() : 0; + GLuint parambuffername = wrb ? wrb->GLName() : 0; if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) { - WebGLuint depthbuffername = parambuffername; - WebGLuint stencilbuffername = parambuffername; + GLuint depthbuffername = parambuffername; + GLuint stencilbuffername = parambuffername; if (!parambuffername){ depthbuffername = mDepthAttachment.Renderbuffer() ? mDepthAttachment.Renderbuffer()->GLName() : 0; stencilbuffername = mStencilAttachment.Renderbuffer() ? mStencilAttachment.Renderbuffer()->GLName() : 0; } mContext->gl->fFramebufferRenderbuffer(target, LOCAL_GL_DEPTH_ATTACHMENT, rbtarget, depthbuffername); mContext->gl->fFramebufferRenderbuffer(target, LOCAL_GL_STENCIL_ATTACHMENT, rbtarget, stencilbuffername); } else { - WebGLuint renderbuffername = parambuffername; + GLuint renderbuffername = parambuffername; if(!parambuffername && (attachment == LOCAL_GL_DEPTH_ATTACHMENT || attachment == LOCAL_GL_STENCIL_ATTACHMENT)){ renderbuffername = mDepthStencilAttachment.Renderbuffer() ? mDepthStencilAttachment.Renderbuffer()->GLName() : 0; } mContext->gl->fFramebufferRenderbuffer(target, attachment, rbtarget, renderbuffername); } } void -WebGLFramebuffer::FramebufferTexture2D(WebGLenum target, - WebGLenum attachment, - WebGLenum textarget, +WebGLFramebuffer::FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, WebGLTexture *wtex, - WebGLint level) + GLint level) { MOZ_ASSERT(mContext->mBoundFramebuffer == this); if (!mContext->ValidateObjectAllowNull("framebufferTexture2D: texture", wtex)) { return; } @@ -259,28 +259,28 @@ WebGLFramebuffer::FramebufferTexture2D(W size_t colorAttachmentId = size_t(attachment - LOCAL_GL_COLOR_ATTACHMENT0); EnsureColorAttachments(colorAttachmentId); mColorAttachments[colorAttachmentId].SetTexture(wtex, level, face); break; } mContext->MakeContextCurrent(); - WebGLuint paramtexturename = wtex ? wtex->GLName() : 0; + GLuint paramtexturename = wtex ? wtex->GLName() : 0; if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) { - WebGLuint depthtexturename = paramtexturename; - WebGLuint stenciltexturename = paramtexturename; + GLuint depthtexturename = paramtexturename; + GLuint stenciltexturename = paramtexturename; if(!paramtexturename){ depthtexturename = mDepthAttachment.Texture() ? mDepthAttachment.Texture()->GLName() : 0; stenciltexturename = mStencilAttachment.Texture() ? mStencilAttachment.Texture()->GLName() : 0; } mContext->gl->fFramebufferTexture2D(target, LOCAL_GL_DEPTH_ATTACHMENT, textarget, depthtexturename, level); mContext->gl->fFramebufferTexture2D(target, LOCAL_GL_STENCIL_ATTACHMENT, textarget, stenciltexturename, level); } else { - WebGLuint texturename = paramtexturename; + GLuint texturename = paramtexturename; if(!paramtexturename && (attachment == LOCAL_GL_DEPTH_ATTACHMENT || attachment == LOCAL_GL_STENCIL_ATTACHMENT)){ texturename = mDepthStencilAttachment.Texture() ? mDepthStencilAttachment.Texture()->GLName() : 0; } mContext->gl->fFramebufferTexture2D(target, attachment, textarget, texturename, level); } return; } @@ -315,17 +315,17 @@ WebGLFramebuffer::HasAttachmentsOfMismat } return ((mDepthAttachment.IsDefined() && !mDepthAttachment.HasSameDimensionsAs(mColorAttachments[0])) || (mStencilAttachment.IsDefined() && !mStencilAttachment.HasSameDimensionsAs(mColorAttachments[0])) || (mDepthStencilAttachment.IsDefined() && !mDepthStencilAttachment.HasSameDimensionsAs(mColorAttachments[0]))); } const WebGLFramebuffer::Attachment& -WebGLFramebuffer::GetAttachment(WebGLenum attachment) const { +WebGLFramebuffer::GetAttachment(GLenum attachment) const { if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) return mDepthStencilAttachment; if (attachment == LOCAL_GL_DEPTH_ATTACHMENT) return mDepthAttachment; if (attachment == LOCAL_GL_STENCIL_ATTACHMENT) return mStencilAttachment; if (!CheckColorAttachementNumber(attachment, "getAttachment")) { @@ -415,17 +415,17 @@ WebGLFramebuffer::CheckAndInitializeRend const WebGLRectangleObject *rect = mColorAttachments[0].RectangleObject(); if (!rect || !rect->Width() || !rect->Height()) return false; mContext->MakeContextCurrent(); - WebGLenum status = mContext->CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER); + GLenum status = mContext->CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER); if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) return false; uint32_t mask = 0; bool colorAttachmentsMask[WebGLContext::sMaxColorAttachments] = { false }; MOZ_ASSERT( colorAttachmentCount <= WebGLContext::sMaxColorAttachments ); @@ -466,24 +466,24 @@ WebGLFramebuffer::CheckAndInitializeRend mStencilAttachment.Renderbuffer()->SetInitialized(true); if (mDepthStencilAttachment.HasUninitializedRenderbuffer()) mDepthStencilAttachment.Renderbuffer()->SetInitialized(true); return true; } -bool WebGLFramebuffer::CheckColorAttachementNumber(WebGLenum attachment, const char * functionName) const +bool WebGLFramebuffer::CheckColorAttachementNumber(GLenum attachment, const char * functionName) const { const char* const errorFormating = "%s: attachment: invalid enum value 0x%x"; if (mContext->IsExtensionEnabled(WebGLContext::WEBGL_draw_buffers)) { if (attachment < LOCAL_GL_COLOR_ATTACHMENT0 || - attachment > WebGLenum(LOCAL_GL_COLOR_ATTACHMENT0 + mContext->mGLMaxColorAttachments)) + attachment > GLenum(LOCAL_GL_COLOR_ATTACHMENT0 + mContext->mGLMaxColorAttachments)) { mContext->ErrorInvalidEnum(errorFormating, functionName, attachment); return false; } } else if (attachment != LOCAL_GL_COLOR_ATTACHMENT0) { if (attachment > LOCAL_GL_COLOR_ATTACHMENT0 &&
--- a/content/canvas/src/WebGLFramebuffer.h +++ b/content/canvas/src/WebGLFramebuffer.h @@ -30,53 +30,53 @@ public: DeleteOnce(); } struct Attachment { // deleting a texture or renderbuffer immediately detaches it WebGLRefPtr<WebGLTexture> mTexturePtr; WebGLRefPtr<WebGLRenderbuffer> mRenderbufferPtr; - WebGLenum mAttachmentPoint; - WebGLint mTextureLevel; - WebGLenum mTextureCubeMapFace; + GLenum mAttachmentPoint; + GLint mTextureLevel; + GLenum mTextureCubeMapFace; - Attachment(WebGLenum aAttachmentPoint = LOCAL_GL_COLOR_ATTACHMENT0) + Attachment(GLenum aAttachmentPoint = LOCAL_GL_COLOR_ATTACHMENT0) : mAttachmentPoint(aAttachmentPoint) {} bool IsDefined() const { return Texture() || Renderbuffer(); } bool IsDeleteRequested() const; bool HasAlpha() const; - void SetTexture(WebGLTexture *tex, WebGLint level, WebGLenum face); + void SetTexture(WebGLTexture *tex, GLint level, GLenum face); void SetRenderbuffer(WebGLRenderbuffer *rb) { mTexturePtr = nullptr; mRenderbufferPtr = rb; } const WebGLTexture *Texture() const { return mTexturePtr; } WebGLTexture *Texture() { return mTexturePtr; } const WebGLRenderbuffer *Renderbuffer() const { return mRenderbufferPtr; } WebGLRenderbuffer *Renderbuffer() { return mRenderbufferPtr; } - WebGLint TextureLevel() const { + GLint TextureLevel() const { return mTextureLevel; } - WebGLenum TextureCubeMapFace() const { + GLenum TextureCubeMapFace() const { return mTextureCubeMapFace; } bool HasUninitializedRenderbuffer() const; void Reset() { mTexturePtr = nullptr; mRenderbufferPtr = nullptr; @@ -87,28 +87,28 @@ public: bool IsComplete() const; }; void Delete(); bool HasEverBeenBound() { return mHasEverBeenBound; } void SetHasEverBeenBound(bool x) { mHasEverBeenBound = x; } - WebGLuint GLName() { return mGLName; } + GLuint GLName() { return mGLName; } - void FramebufferRenderbuffer(WebGLenum target, - WebGLenum attachment, - WebGLenum rbtarget, + void FramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum rbtarget, WebGLRenderbuffer *wrb); - void FramebufferTexture2D(WebGLenum target, - WebGLenum attachment, - WebGLenum textarget, + void FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, WebGLTexture *wtex, - WebGLint level); + GLint level); bool HasIncompleteAttachment() const; bool HasDepthStencilConflict() const { return int(mDepthAttachment.IsDefined()) + int(mStencilAttachment.IsDefined()) + int(mDepthStencilAttachment.IsDefined()) >= 2; } @@ -126,17 +126,17 @@ public: const Attachment& StencilAttachment() const { return mStencilAttachment; } const Attachment& DepthStencilAttachment() const { return mDepthStencilAttachment; } - const Attachment& GetAttachment(WebGLenum attachment) const; + const Attachment& GetAttachment(GLenum attachment) const; void DetachTexture(const WebGLTexture *tex); void DetachRenderbuffer(const WebGLRenderbuffer *rb); const WebGLRectangleObject *RectangleObject() { return mColorAttachments[0].RectangleObject(); } @@ -148,19 +148,19 @@ public: virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> scope) MOZ_OVERRIDE; NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLFramebuffer) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLFramebuffer) bool CheckAndInitializeRenderbuffers(); - bool CheckColorAttachementNumber(WebGLenum attachment, const char * functionName) const; + bool CheckColorAttachementNumber(GLenum attachment, const char * functionName) const; - WebGLuint mGLName; + GLuint mGLName; bool mHasEverBeenBound; void EnsureColorAttachments(size_t colorAttachmentId); // we only store pointers to attached renderbuffers, not to attached textures, because // we will only need to initialize renderbuffers. Textures are already initialized. nsTArray<Attachment> mColorAttachments; Attachment mDepthAttachment,
--- a/content/canvas/src/WebGLObjectModel.h +++ b/content/canvas/src/WebGLObjectModel.h @@ -275,26 +275,26 @@ protected: // this class is a mixin for GL objects that have dimensions // that we need to track. class WebGLRectangleObject { public: WebGLRectangleObject() : mWidth(0), mHeight(0) { } - WebGLRectangleObject(WebGLsizei width, WebGLsizei height) + WebGLRectangleObject(GLsizei width, GLsizei height) : mWidth(width), mHeight(height) { } - WebGLsizei Width() const { return mWidth; } - void width(WebGLsizei value) { mWidth = value; } + GLsizei Width() const { return mWidth; } + void width(GLsizei value) { mWidth = value; } - WebGLsizei Height() const { return mHeight; } - void height(WebGLsizei value) { mHeight = value; } + GLsizei Height() const { return mHeight; } + void height(GLsizei value) { mHeight = value; } - void setDimensions(WebGLsizei width, WebGLsizei height) { + void setDimensions(GLsizei width, GLsizei height) { mWidth = width; mHeight = height; } void setDimensions(WebGLRectangleObject *rect) { if (rect) { mWidth = rect->Width(); mHeight = rect->Height(); @@ -304,18 +304,18 @@ public: } } bool HasSameDimensionsAs(const WebGLRectangleObject& other) const { return Width() == other.Width() && Height() == other.Height(); } protected: - WebGLsizei mWidth; - WebGLsizei mHeight; + GLsizei mWidth; + GLsizei mHeight; }; }// namespace mozilla template <typename T> inline void ImplCycleCollectionUnlink(mozilla::WebGLRefPtr<T>& aField) {
--- a/content/canvas/src/WebGLProgram.h +++ b/content/canvas/src/WebGLProgram.h @@ -35,17 +35,17 @@ public: } void Delete(); void DetachShaders() { mAttachedShaders.Clear(); } - WebGLuint GLName() { return mGLName; } + GLuint GLName() { return mGLName; } const nsTArray<WebGLRefPtr<WebGLShader> >& AttachedShaders() const { return mAttachedShaders; } bool LinkStatus() { return mLinkStatus; } uint32_t Generation() const { return mGeneration.value(); } void SetLinkStatus(bool val) { mLinkStatus = val; } bool ContainsShader(WebGLShader *shader) { return mAttachedShaders.Contains(shader); } @@ -109,17 +109,17 @@ public: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLProgram) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLProgram) // public post-link data std::map<GLint, nsCString> mActiveAttribMap; protected: - WebGLuint mGLName; + GLuint mGLName; bool mLinkStatus; // attached shaders of the program object nsTArray<WebGLRefPtr<WebGLShader> > mAttachedShaders; CheckedUint32 mGeneration; // post-link data nsTArray<bool> mAttribsInUse; nsAutoPtr<CStringMap> mIdentifierMap, mIdentifierReverseMap;
--- a/content/canvas/src/WebGLQuery.h +++ b/content/canvas/src/WebGLQuery.h @@ -75,18 +75,18 @@ public: // ----------------------------------------------------------------------------- // PRIVATE private: // ------------------------------------------------------------------------- // MEMBERS - WebGLuint mGLName; - WebGLenum mType; + GLuint mGLName; + GLenum mType; // ------------------------------------------------------------------------- // FRIENDSHIPS friend class WebGLContext; }; } // namespace mozilla
--- a/content/canvas/src/WebGLRenderbuffer.h +++ b/content/canvas/src/WebGLRenderbuffer.h @@ -27,44 +27,44 @@ public: ~WebGLRenderbuffer() { DeleteOnce(); } void Delete(); bool HasEverBeenBound() { return mHasEverBeenBound; } void SetHasEverBeenBound(bool x) { mHasEverBeenBound = x; } - WebGLuint GLName() const { return mGLName; } + GLuint GLName() const { return mGLName; } bool Initialized() const { return mInitialized; } void SetInitialized(bool aInitialized) { mInitialized = aInitialized; } - WebGLenum InternalFormat() const { return mInternalFormat; } - void SetInternalFormat(WebGLenum aInternalFormat) { mInternalFormat = aInternalFormat; } + GLenum InternalFormat() const { return mInternalFormat; } + void SetInternalFormat(GLenum aInternalFormat) { mInternalFormat = aInternalFormat; } - WebGLenum InternalFormatForGL() const { return mInternalFormatForGL; } - void SetInternalFormatForGL(WebGLenum aInternalFormatForGL) { mInternalFormatForGL = aInternalFormatForGL; } + GLenum InternalFormatForGL() const { return mInternalFormatForGL; } + void SetInternalFormatForGL(GLenum aInternalFormatForGL) { mInternalFormatForGL = aInternalFormatForGL; } int64_t MemoryUsage() const; WebGLContext *GetParentObject() const { return Context(); } virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> scope) MOZ_OVERRIDE; NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLRenderbuffer) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLRenderbuffer) protected: - WebGLuint mGLName; - WebGLenum mInternalFormat; - WebGLenum mInternalFormatForGL; + GLuint mGLName; + GLenum mInternalFormat; + GLenum mInternalFormatForGL; bool mHasEverBeenBound; bool mInitialized; friend class WebGLFramebuffer; }; } // namespace mozilla #endif
--- a/content/canvas/src/WebGLShader.cpp +++ b/content/canvas/src/WebGLShader.cpp @@ -11,17 +11,17 @@ using namespace mozilla; JSObject* WebGLShader::WrapObject(JSContext *cx, JS::Handle<JSObject*> scope) { return dom::WebGLShaderBinding::Wrap(cx, scope, this); } -WebGLShader::WebGLShader(WebGLContext *context, WebGLenum stype) +WebGLShader::WebGLShader(WebGLContext *context, GLenum stype) : WebGLContextBoundObject(context) , mType(stype) , mNeedsTranslation(true) , mAttribMaxNameLength(0) , mCompileStatus(false) { SetIsDOMBinding(); mContext->MakeContextCurrent();
--- a/content/canvas/src/WebGLShader.h +++ b/content/canvas/src/WebGLShader.h @@ -28,26 +28,26 @@ class WebGLShader MOZ_FINAL , public WebGLRefCountedObject<WebGLShader> , public LinkedListElement<WebGLShader> , public WebGLContextBoundObject { friend class WebGLContext; friend class WebGLProgram; public: - WebGLShader(WebGLContext *context, WebGLenum stype); + WebGLShader(WebGLContext *context, GLenum stype); ~WebGLShader() { DeleteOnce(); } size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; - WebGLuint GLName() { return mGLName; } - WebGLenum ShaderType() { return mType; } + GLuint GLName() { return mGLName; } + GLenum ShaderType() { return mType; } void SetSource(const nsAString& src) { // XXX do some quick gzip here maybe -- getting this will be very rare mSource.Assign(src); } const nsString& Source() const { return mSource; } @@ -79,18 +79,18 @@ public: virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> scope) MOZ_OVERRIDE; NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLShader) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLShader) protected: - WebGLuint mGLName; - WebGLenum mType; + GLuint mGLName; + GLenum mType; nsString mSource; nsCString mTranslationLog; // The translation log should contain only ASCII characters bool mNeedsTranslation; nsTArray<WebGLMappedIdentifier> mAttributes; nsTArray<WebGLMappedIdentifier> mUniforms; nsTArray<WebGLUniformInfo> mUniformInfos; int mAttribMaxNameLength; bool mCompileStatus;
--- a/content/canvas/src/WebGLShaderPrecisionFormat.h +++ b/content/canvas/src/WebGLShaderPrecisionFormat.h @@ -11,40 +11,40 @@ namespace mozilla { class WebGLBuffer; class WebGLShaderPrecisionFormat MOZ_FINAL : public WebGLContextBoundObject { public: - WebGLShaderPrecisionFormat(WebGLContext *context, WebGLint rangeMin, WebGLint rangeMax, WebGLint precision) : + WebGLShaderPrecisionFormat(WebGLContext *context, GLint rangeMin, GLint rangeMax, GLint precision) : WebGLContextBoundObject(context), mRangeMin(rangeMin), mRangeMax(rangeMax), mPrecision(precision) { } JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> scope); // WebIDL WebGLShaderPrecisionFormat API - WebGLint RangeMin() const { + GLint RangeMin() const { return mRangeMin; } - WebGLint RangeMax() const { + GLint RangeMax() const { return mRangeMax; } - WebGLint Precision() const { + GLint Precision() const { return mPrecision; } NS_INLINE_DECL_REFCOUNTING(WebGLShaderPrecisionFormat) protected: - WebGLint mRangeMin; - WebGLint mRangeMax; - WebGLint mPrecision; + GLint mRangeMin; + GLint mRangeMax; + GLint mPrecision; }; } // namespace mozilla #endif
--- a/content/canvas/src/WebGLTexture.cpp +++ b/content/canvas/src/WebGLTexture.cpp @@ -97,17 +97,17 @@ WebGLTexture::DoesTexture2DMipmapHaveAll void WebGLTexture::SetDontKnowIfNeedFakeBlack() { mFakeBlackStatus = DontKnowIfNeedFakeBlack; mContext->SetDontKnowIfNeedFakeBlack(); } void -WebGLTexture::Bind(WebGLenum aTarget) { +WebGLTexture::Bind(GLenum aTarget) { // this function should only be called by bindTexture(). // it assumes that the GL context is already current. bool firstTimeThisTextureIsBound = !mHasEverBeenBound; if (!firstTimeThisTextureIsBound && aTarget != mTarget) { mContext->ErrorInvalidOperation("bindTexture: this texture has already been bound to a different target"); // very important to return here before modifying texture state! This was the place when I lost a whole day figuring @@ -130,19 +130,19 @@ WebGLTexture::Bind(WebGLenum aTarget) { if (mTarget == LOCAL_GL_TEXTURE_CUBE_MAP && !mContext->gl->IsGLES2()) mContext->gl->fTexParameteri(mTarget, LOCAL_GL_TEXTURE_WRAP_R, LOCAL_GL_CLAMP_TO_EDGE); } mHasEverBeenBound = true; } void -WebGLTexture::SetImageInfo(WebGLenum aTarget, WebGLint aLevel, - WebGLsizei aWidth, WebGLsizei aHeight, - WebGLenum aFormat, WebGLenum aType) +WebGLTexture::SetImageInfo(GLenum aTarget, GLint aLevel, + GLsizei aWidth, GLsizei aHeight, + GLenum aFormat, GLenum aType) { if ( (aTarget == LOCAL_GL_TEXTURE_2D) != (mTarget == LOCAL_GL_TEXTURE_2D) ) return; size_t face = FaceForTarget(aTarget); EnsureMaxLevelWithCustomImagesAtLeast(aLevel); @@ -168,21 +168,21 @@ WebGLTexture::SetCustomMipmap() { // if we were in GeneratedMipmap mode and are now switching to CustomMipmap mode, // we need to compute now all the mipmap image info. // since we were in GeneratedMipmap mode, we know that the level 0 images all have the same info, // and are power-of-two. ImageInfo imageInfo = ImageInfoAt(0, 0); NS_ASSERTION(imageInfo.IsPowerOfTwo(), "this texture is NPOT, so how could GenerateMipmap() ever accept it?"); - WebGLsizei size = std::max(imageInfo.mWidth, imageInfo.mHeight); + GLsizei size = std::max(imageInfo.mWidth, imageInfo.mHeight); // so, the size is a power of two, let's find its log in base 2. size_t maxLevel = 0; - for (WebGLsizei n = size; n > 1; n >>= 1) + for (GLsizei n = size; n > 1; n >>= 1) ++maxLevel; EnsureMaxLevelWithCustomImagesAtLeast(maxLevel); for (size_t level = 1; level <= maxLevel; ++level) { // again, since the sizes are powers of two, no need for any max(1,x) computation imageInfo.mWidth >>= 1; imageInfo.mHeight >>= 1;
--- a/content/canvas/src/WebGLTexture.h +++ b/content/canvas/src/WebGLTexture.h @@ -11,17 +11,17 @@ #include "nsWrapperCache.h" #include "mozilla/LinkedList.h" #include <algorithm> namespace mozilla { // Zero is not an integer power of two. -inline bool is_pot_assuming_nonnegative(WebGLsizei x) +inline bool is_pot_assuming_nonnegative(GLsizei x) { return x && (x & (x-1)) == 0; } // NOTE: When this class is switched to new DOM bindings, update the (then-slow) // WrapObject calls in GetParameter and GetFramebufferAttachmentParameter. class WebGLTexture MOZ_FINAL : public nsWrapperCache @@ -35,17 +35,17 @@ public: ~WebGLTexture() { DeleteOnce(); } void Delete(); bool HasEverBeenBound() { return mHasEverBeenBound; } void SetHasEverBeenBound(bool x) { mHasEverBeenBound = x; } - WebGLuint GLName() { return mGLName; } + GLuint GLName() { return mGLName; } GLenum Target() const { return mTarget; } WebGLContext *GetParentObject() const { return Context(); } virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> scope) MOZ_OVERRIDE; @@ -54,33 +54,33 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLTexture) protected: friend class WebGLContext; friend class WebGLFramebuffer; bool mHasEverBeenBound; - WebGLuint mGLName; + GLuint mGLName; // we store information about the various images that are part of // this texture (cubemap faces, mipmap levels) public: class ImageInfo : public WebGLRectangleObject { public: ImageInfo() : mFormat(0) , mType(0) , mIsDefined(false) {} - ImageInfo(WebGLsizei width, WebGLsizei height, - WebGLenum format, WebGLenum type) + ImageInfo(GLsizei width, GLsizei height, + GLenum format, GLenum type) : WebGLRectangleObject(width, height) , mFormat(format) , mType(type) , mIsDefined(true) {} bool operator==(const ImageInfo& a) const { return mIsDefined == a.mIsDefined && @@ -98,20 +98,20 @@ public: bool IsPositive() const { return mWidth > 0 && mHeight > 0; } bool IsPowerOfTwo() const { return is_pot_assuming_nonnegative(mWidth) && is_pot_assuming_nonnegative(mHeight); // negative sizes should never happen (caught in texImage2D...) } int64_t MemoryUsage() const; - WebGLenum Format() const { return mFormat; } - WebGLenum Type() const { return mType; } + GLenum Format() const { return mFormat; } + GLenum Type() const { return mType; } protected: - WebGLenum mFormat, mType; + GLenum mFormat, mType; bool mIsDefined; friend class WebGLTexture; }; ImageInfo& ImageInfoAt(size_t level, size_t face = 0) { #ifdef DEBUG if (face >= mFacesCount) @@ -127,26 +127,26 @@ public: bool HasImageInfoAt(size_t level, size_t face) const { CheckedUint32 checked_index = CheckedUint32(level) * mFacesCount + face; return checked_index.isValid() && checked_index.value() < mImageInfos.Length() && ImageInfoAt(level, face).mIsDefined; } - static size_t FaceForTarget(WebGLenum target) { + static size_t FaceForTarget(GLenum target) { return target == LOCAL_GL_TEXTURE_2D ? 0 : target - LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X; } int64_t MemoryUsage() const; protected: - WebGLenum mTarget; - WebGLenum mMinFilter, mMagFilter, mWrapS, mWrapT; + GLenum mTarget; + GLenum mMinFilter, mMagFilter, mWrapS, mWrapT; size_t mFacesCount, mMaxLevelWithCustomImages; nsTArray<ImageInfo> mImageInfos; bool mHaveGeneratedMipmap; FakeBlackStatus mFakeBlackStatus; void EnsureMaxLevelWithCustomImagesAtLeast(size_t aMaxLevelWithCustomImages) { @@ -165,39 +165,39 @@ protected: } bool DoesTexture2DMipmapHaveAllLevelsConsistentlyDefined(size_t face) const; public: void SetDontKnowIfNeedFakeBlack(); - void Bind(WebGLenum aTarget); + void Bind(GLenum aTarget); - void SetImageInfo(WebGLenum aTarget, WebGLint aLevel, - WebGLsizei aWidth, WebGLsizei aHeight, - WebGLenum aFormat, WebGLenum aType); + void SetImageInfo(GLenum aTarget, GLint aLevel, + GLsizei aWidth, GLsizei aHeight, + GLenum aFormat, GLenum aType); - void SetMinFilter(WebGLenum aMinFilter) { + void SetMinFilter(GLenum aMinFilter) { mMinFilter = aMinFilter; SetDontKnowIfNeedFakeBlack(); } - void SetMagFilter(WebGLenum aMagFilter) { + void SetMagFilter(GLenum aMagFilter) { mMagFilter = aMagFilter; SetDontKnowIfNeedFakeBlack(); } - void SetWrapS(WebGLenum aWrapS) { + void SetWrapS(GLenum aWrapS) { mWrapS = aWrapS; SetDontKnowIfNeedFakeBlack(); } - void SetWrapT(WebGLenum aWrapT) { + void SetWrapT(GLenum aWrapT) { mWrapT = aWrapT; SetDontKnowIfNeedFakeBlack(); } - WebGLenum MinFilter() const { return mMinFilter; } + GLenum MinFilter() const { return mMinFilter; } bool DoesMinFilterRequireMipmap() const { return !(mMinFilter == LOCAL_GL_NEAREST || mMinFilter == LOCAL_GL_LINEAR); } void SetGeneratedMipmap(); void SetCustomMipmap();
--- a/content/canvas/src/WebGLTypes.h +++ b/content/canvas/src/WebGLTypes.h @@ -1,26 +1,20 @@ /* -*- 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/. */ #ifndef WEBGLTYPES_H_ #define WEBGLTYPES_H_ -// Manual reflection of WebIDL typedefs -typedef uint32_t WebGLenum; -typedef uint32_t WebGLbitfield; -typedef int32_t WebGLint; -typedef int32_t WebGLsizei; +// Manual reflection of WebIDL typedefs that are different from the +// corresponding OpenGL typedefs. typedef int64_t WebGLsizeiptr; typedef int64_t WebGLintptr; -typedef uint32_t WebGLuint; -typedef float WebGLfloat; -typedef float WebGLclampf; typedef bool WebGLboolean; namespace mozilla { enum FakeBlackStatus { DoNotNeedFakeBlack, DoNeedFakeBlack, DontKnowIfNeedFakeBlack }; struct VertexAttrib0Status { enum { Default, EmulatedUninitializedArray, EmulatedInitializedArray };
--- a/content/canvas/src/WebGLVertexArray.cpp +++ b/content/canvas/src/WebGLVertexArray.cpp @@ -31,20 +31,20 @@ void WebGLVertexArray::Delete() { mContext->gl->fDeleteVertexArrays(1, &mGLName); LinkedListElement<WebGLVertexArray>::removeFrom(mContext->mVertexArrays); } mBoundElementArrayBuffer = nullptr; mAttribBuffers.Clear(); } -bool WebGLVertexArray::EnsureAttribIndex(WebGLuint index, const char *info) +bool WebGLVertexArray::EnsureAttribIndex(GLuint index, const char *info) { - if (index >= WebGLuint(mContext->mGLMaxVertexAttribs)) { - if (index == WebGLuint(-1)) { + if (index >= GLuint(mContext->mGLMaxVertexAttribs)) { + if (index == GLuint(-1)) { mContext->ErrorInvalidValue("%s: index -1 is invalid. That probably comes from a getAttribLocation() call, " "where this return value -1 means that the passed name didn't correspond to an active attribute in " "the specified program.", info); } else { mContext->ErrorInvalidValue("%s: index %d is out of range", info, index); } return false; }
--- a/content/canvas/src/WebGLVertexArray.h +++ b/content/canvas/src/WebGLVertexArray.h @@ -53,29 +53,29 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLVertexArray) // ------------------------------------------------------------------------- // MEMBER FUNCTIONS bool HasEverBeenBound() { return mHasEverBeenBound; } void SetHasEverBeenBound(bool x) { mHasEverBeenBound = x; } - WebGLuint GLName() const { return mGLName; } + GLuint GLName() const { return mGLName; } - bool EnsureAttribIndex(WebGLuint index, const char *info); + bool EnsureAttribIndex(GLuint index, const char *info); // ----------------------------------------------------------------------------- // PRIVATE private: // ------------------------------------------------------------------------- // MEMBERS - WebGLuint mGLName; + GLuint mGLName; bool mHasEverBeenBound; nsTArray<WebGLVertexAttribData> mAttribBuffers; WebGLRefPtr<WebGLBuffer> mBoundElementArrayBuffer; // ------------------------------------------------------------------------- // FRIENDSHIPS
--- a/content/canvas/src/WebGLVertexAttribData.h +++ b/content/canvas/src/WebGLVertexAttribData.h @@ -19,19 +19,19 @@ struct WebGLVertexAttribData { , divisor(0) // OpenGL ES 3.0 specs paragraphe 6.2 p240 , byteOffset(0) , type(LOCAL_GL_FLOAT) , enabled(false) , normalized(false) { } WebGLRefPtr<WebGLBuffer> buf; - WebGLuint stride; - WebGLuint size; - WebGLuint divisor; + GLuint stride; + GLuint size; + GLuint divisor; GLuint byteOffset; GLenum type; bool enabled; bool normalized; GLuint componentSize() const { switch(type) { case LOCAL_GL_BYTE: