WebGL2: implement TEXTURE_IMMUTABLE_FORMAT for getTexParameter (
bug 1080299, r=jgilbert).
--- a/dom/canvas/WebGL2Context.h
+++ b/dom/canvas/WebGL2Context.h
@@ -243,13 +243,14 @@ public:
private:
WebGL2Context();
bool ValidateSizedInternalFormat(GLenum internalFormat, const char* info);
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
#endif
--- a/dom/canvas/WebGL2ContextTextures.cpp
+++ b/dom/canvas/WebGL2ContextTextures.cpp
@@ -340,8 +340,22 @@ WebGL2Context::CompressedTexImage3D(GLen
void
WebGL2Context::CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLsizei imageSize, const dom::ArrayBufferView& data)
{
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);
+}
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -985,16 +985,18 @@ protected:
void UndoFakeVertexAttrib0();
static CheckedUint32 GetImageSize(GLsizei height,
GLsizei width,
GLsizei depth,
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;
}
nsRefPtr<gl::GLContext> gl;
CheckedUint32 mGeneration;
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -1606,16 +1606,22 @@ WebGLContext::GetTexParameter(GLenum raw
const TexTarget target(rawTarget);
if (!activeBoundTextureForTarget(target)) {
ErrorInvalidOperation("getTexParameter: no texture bound");
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:
case LOCAL_GL_TEXTURE_WRAP_S:
case LOCAL_GL_TEXTURE_WRAP_T:
{
GLint i = 0;
gl->fGetTexParameteriv(target.get(), pname, &i);