diff --git a/dom/canvas/WebGL2Context.h b/dom/canvas/WebGL2Context.h index 34a7a016da0d..23b6eeaa0c3b 100644 --- a/dom/canvas/WebGL2Context.h +++ b/dom/canvas/WebGL2Context.h @@ -248,6 +248,7 @@ private: bool ValidateTexStorage(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, const char* info); + JS::Value GetTexParameterInternal(const TexTarget& target, GLenum pname) MOZ_OVERRIDE; }; } // namespace mozilla diff --git a/dom/canvas/WebGL2ContextTextures.cpp b/dom/canvas/WebGL2ContextTextures.cpp index 3cef3736d708..637837e372aa 100644 --- a/dom/canvas/WebGL2ContextTextures.cpp +++ b/dom/canvas/WebGL2ContextTextures.cpp @@ -345,3 +345,17 @@ WebGL2Context::CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset { MOZ_CRASH("Not Implemented."); } + +JS::Value +WebGL2Context::GetTexParameterInternal(const TexTarget& target, GLenum pname) +{ + switch (pname) { + case LOCAL_GL_TEXTURE_IMMUTABLE_FORMAT: + { + GLint i = 0; + gl->fGetTexParameteriv(target.get(), pname, &i); + return JS::NumberValue(uint32_t(i)); + } + } + return WebGLContext::GetTexParameterInternal(target, pname); +} diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h index dd528176b27a..6a10cfe38c2f 100644 --- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -990,6 +990,8 @@ protected: uint32_t pixelSize, uint32_t alignment); + virtual JS::Value GetTexParameterInternal(const TexTarget& target, GLenum pname); + // Returns x rounded to the next highest multiple of y. static CheckedUint32 RoundedToNextMultipleOf(CheckedUint32 x, CheckedUint32 y) { return ((x + y - 1) / y) * y; diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index 8608deeaa528..ad5143caa4de 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -1611,6 +1611,12 @@ WebGLContext::GetTexParameter(GLenum rawTarget, GLenum pname) return JS::NullValue(); } + return GetTexParameterInternal(target, pname); +} + +JS::Value +WebGLContext::GetTexParameterInternal(const TexTarget& target, GLenum pname) +{ switch (pname) { case LOCAL_GL_TEXTURE_MIN_FILTER: case LOCAL_GL_TEXTURE_MAG_FILTER: