author | Dan Glastonbury <dglastonbury@mozilla.com> |
Wed, 22 Apr 2015 23:39:00 +0200 | |
changeset 241772 | 20de9d756c9b668caa95f277dee6de7b558b014c |
parent 241771 | 20406039cdebb797c6990dbbb7d3bf42bbacaa30 |
child 241773 | 485cf348d18c4ab3f7df5bf7a6630ebcd119f50d |
push id | 28669 |
push user | ryanvm@gmail.com |
push date | Thu, 30 Apr 2015 17:57:05 +0000 |
treeherder | mozilla-central@7723b15ea695 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jgilbert |
bugs | 1156980 |
milestone | 40.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
|
dom/canvas/WebGLContext.h | file | annotate | diff | comparison | revisions | |
dom/canvas/WebGLContextGL.cpp | file | annotate | diff | comparison | revisions |
--- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -632,16 +632,20 @@ public: dom::ImageData* pixels, ErrorResult& rv); // Allow whatever element types the bindings are willing to pass // us in TexSubImage2D template<class ElementType> void TexSubImage2D(GLenum rawTexImageTarget, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, ElementType& elt, ErrorResult& rv) { + // TODO: Consolidate all the parameter validation + // checks. Instead of spreading out the cheks in multple + // places, consolidate into one spot. + if (IsContextLost()) return; if (!ValidateTexImageTarget(rawTexImageTarget, WebGLTexImageFunc::TexSubImage, WebGLTexDimensions::Tex2D)) { ErrorInvalidEnumInfo("texSubImage2D: target", rawTexImageTarget); @@ -1303,17 +1307,17 @@ protected: // If jsArrayType is MaxTypedArrayViewType, it means no array. void TexImage2D_base(TexImageTarget texImageTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei srcStrideOrZero, GLint border, GLenum format, GLenum type, void* data, uint32_t byteLength, js::Scalar::Type jsArrayType, WebGLTexelFormat srcFormat, bool srcPremultiplied); - void TexSubImage2D_base(TexImageTarget texImageTarget, GLint level, + void TexSubImage2D_base(GLenum texImageTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei srcStrideOrZero, GLenum format, GLenum type, void* pixels, uint32_t byteLength, js::Scalar::Type jsArrayType, WebGLTexelFormat srcFormat, bool srcPremultiplied); void TexParameter_base(GLenum target, GLenum pname, GLint* const out_intParam,
--- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -3418,30 +3418,35 @@ WebGLContext::TexImage2D(GLenum rawTarge return TexImage2D_base(rawTarget, level, internalformat, pixels->Width(), pixels->Height(), 4*pixels->Width(), 0, format, type, pixelData, pixelDataLength, js::Scalar::MaxTypedArrayViewType, WebGLTexelFormat::RGBA8, false); } void -WebGLContext::TexSubImage2D_base(TexImageTarget texImageTarget, GLint level, +WebGLContext::TexSubImage2D_base(GLenum rawImageTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei srcStrideOrZero, GLenum format, GLenum type, void* data, uint32_t byteLength, js::Scalar::Type jsArrayType, WebGLTexelFormat srcFormat, bool srcPremultiplied) { const WebGLTexImageFunc func = WebGLTexImageFunc::TexSubImage; const WebGLTexDimensions dims = WebGLTexDimensions::Tex2D; if (type == LOCAL_GL_HALF_FLOAT_OES) type = LOCAL_GL_HALF_FLOAT; + if (!ValidateTexImageTarget(rawImageTarget, func, dims)) + return; + + TexImageTarget texImageTarget(rawImageTarget); + WebGLTexture* tex = ActiveBoundTextureForTexImageTarget(texImageTarget); if (!tex) return ErrorInvalidOperation("texSubImage2D: no texture bound on active texture unit"); if (!tex->HasImageInfoAt(texImageTarget, level)) return ErrorInvalidOperation("texSubImage2D: no previously defined texture image"); const WebGLTexture::ImageInfo& imageInfo = tex->ImageInfoAt(texImageTarget, level);