2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-08-04 00:34:46 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "WebGLContext.h"
|
|
|
|
#include "WebGLContextUtils.h"
|
|
|
|
#include "WebGLBuffer.h"
|
|
|
|
#include "WebGLVertexAttribData.h"
|
|
|
|
#include "WebGLShader.h"
|
|
|
|
#include "WebGLProgram.h"
|
|
|
|
#include "WebGLUniformLocation.h"
|
|
|
|
#include "WebGLFramebuffer.h"
|
|
|
|
#include "WebGLRenderbuffer.h"
|
|
|
|
#include "WebGLShaderPrecisionFormat.h"
|
|
|
|
#include "WebGLTexture.h"
|
|
|
|
#include "WebGLExtensions.h"
|
|
|
|
#include "WebGLVertexArray.h"
|
|
|
|
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsDebug.h"
|
|
|
|
#include "nsReadableUtils.h"
|
|
|
|
|
|
|
|
#include "gfxContext.h"
|
|
|
|
#include "gfxPlatform.h"
|
|
|
|
#include "GLContext.h"
|
|
|
|
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
#include "nsError.h"
|
|
|
|
#include "nsLayoutUtils.h"
|
|
|
|
|
|
|
|
#include "CanvasUtils.h"
|
|
|
|
#include "gfxUtils.h"
|
|
|
|
|
|
|
|
#include "jsfriendapi.h"
|
|
|
|
|
|
|
|
#include "WebGLTexelConversions.h"
|
|
|
|
#include "WebGLValidateStrings.h"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
// needed to check if current OS is lower than 10.7
|
|
|
|
#if defined(MOZ_WIDGET_COCOA)
|
|
|
|
# include "nsCocoaFeatures.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "mozilla/DebugOnly.h"
|
|
|
|
#include "mozilla/dom/BindingUtils.h"
|
|
|
|
#include "mozilla/dom/ImageData.h"
|
|
|
|
#include "mozilla/dom/ToJSValue.h"
|
2016-05-22 23:31:11 +03:00
|
|
|
#include "mozilla/EndianUtils.h"
|
2015-08-04 00:34:46 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
static bool IsValidTexTarget(WebGLContext* webgl, uint8_t funcDims,
|
|
|
|
GLenum rawTexTarget, TexTarget* const out) {
|
|
|
|
uint8_t targetDims;
|
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
switch (rawTexTarget) {
|
|
|
|
case LOCAL_GL_TEXTURE_2D:
|
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP:
|
2015-11-25 07:15:29 +03:00
|
|
|
targetDims = 2;
|
2015-08-04 00:34:46 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_TEXTURE_3D:
|
2015-11-25 07:15:29 +03:00
|
|
|
case LOCAL_GL_TEXTURE_2D_ARRAY:
|
2015-08-04 00:34:46 +03:00
|
|
|
if (!webgl->IsWebGL2()) return false;
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
targetDims = 3;
|
2015-08-04 00:34:46 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
// Some funcs (like GenerateMipmap) doesn't know the dimension, so don't check
|
|
|
|
// it.
|
|
|
|
if (funcDims && targetDims != funcDims) return false;
|
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
*out = rawTexTarget;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
static bool IsValidTexImageTarget(WebGLContext* webgl, uint8_t funcDims,
|
|
|
|
GLenum rawTexImageTarget,
|
2015-08-04 00:34:46 +03:00
|
|
|
TexImageTarget* const out) {
|
2015-11-25 07:15:29 +03:00
|
|
|
uint8_t targetDims;
|
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
switch (rawTexImageTarget) {
|
|
|
|
case LOCAL_GL_TEXTURE_2D:
|
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
|
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
|
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
|
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
|
2015-11-25 07:15:29 +03:00
|
|
|
targetDims = 2;
|
2015-08-04 00:34:46 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LOCAL_GL_TEXTURE_3D:
|
2015-11-25 07:15:29 +03:00
|
|
|
case LOCAL_GL_TEXTURE_2D_ARRAY:
|
2015-08-04 00:34:46 +03:00
|
|
|
if (!webgl->IsWebGL2()) return false;
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
targetDims = 3;
|
2015-08-04 00:34:46 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
if (targetDims != funcDims) return false;
|
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
*out = rawTexImageTarget;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
bool ValidateTexTarget(WebGLContext* webgl, uint8_t funcDims,
|
2015-11-25 07:15:29 +03:00
|
|
|
GLenum rawTexTarget, TexTarget* const out_texTarget,
|
|
|
|
WebGLTexture** const out_tex) {
|
2015-08-04 00:34:46 +03:00
|
|
|
if (webgl->IsContextLost()) return false;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
TexTarget texTarget;
|
2015-11-25 07:15:29 +03:00
|
|
|
if (!IsValidTexTarget(webgl, funcDims, rawTexTarget, &texTarget)) {
|
2018-07-27 07:46:33 +03:00
|
|
|
webgl->ErrorInvalidEnumInfo("texTarget", rawTexTarget);
|
2015-08-04 00:34:46 +03:00
|
|
|
return false;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture* tex = webgl->ActiveBoundTextureForTarget(texTarget);
|
|
|
|
if (!tex) {
|
2018-07-27 07:46:33 +03:00
|
|
|
webgl->ErrorInvalidOperation("No texture is bound to this target.");
|
2015-08-04 00:34:46 +03:00
|
|
|
return false;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
*out_texTarget = texTarget;
|
|
|
|
*out_tex = tex;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
bool ValidateTexImageTarget(WebGLContext* webgl, uint8_t funcDims,
|
2015-11-25 07:15:29 +03:00
|
|
|
GLenum rawTexImageTarget,
|
|
|
|
TexImageTarget* const out_texImageTarget,
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture** const out_tex) {
|
|
|
|
if (webgl->IsContextLost()) return false;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
TexImageTarget texImageTarget;
|
2015-11-25 07:15:29 +03:00
|
|
|
if (!IsValidTexImageTarget(webgl, funcDims, rawTexImageTarget,
|
|
|
|
&texImageTarget)) {
|
2018-07-27 07:46:33 +03:00
|
|
|
webgl->ErrorInvalidEnumInfo("texImageTarget", rawTexImageTarget);
|
2015-08-04 00:34:46 +03:00
|
|
|
return false;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture* tex =
|
|
|
|
webgl->ActiveBoundTextureForTexImageTarget(texImageTarget);
|
|
|
|
if (!tex) {
|
2018-07-27 07:46:33 +03:00
|
|
|
webgl->ErrorInvalidOperation("No texture is bound to this target.");
|
2015-08-04 00:34:46 +03:00
|
|
|
return false;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
*out_texImageTarget = texImageTarget;
|
|
|
|
*out_tex = tex;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-02-26 01:05:29 +03:00
|
|
|
/*virtual*/
|
|
|
|
bool WebGLContext::IsTexParamValid(GLenum pname) const {
|
2015-08-04 00:34:46 +03:00
|
|
|
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:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case LOCAL_GL_TEXTURE_MAX_ANISOTROPY_EXT:
|
|
|
|
return IsExtensionEnabled(
|
|
|
|
WebGLExtensionID::EXT_texture_filter_anisotropic);
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// GL calls
|
|
|
|
|
|
|
|
void WebGLContext::BindTexture(GLenum rawTarget, WebGLTexture* newTex) {
|
2018-07-27 07:46:33 +03:00
|
|
|
const FuncScope funcScope(*this, "bindTexture");
|
2015-08-04 00:34:46 +03:00
|
|
|
if (IsContextLost()) return;
|
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
if (newTex && !ValidateObject("tex", *newTex)) return;
|
2015-08-04 00:34:46 +03:00
|
|
|
|
|
|
|
// Need to check rawTarget first before comparing against newTex->Target() as
|
|
|
|
// newTex->Target() returns a TexTarget, which will assert on invalid value.
|
|
|
|
WebGLRefPtr<WebGLTexture>* currentTexPtr = nullptr;
|
|
|
|
switch (rawTarget) {
|
2015-11-25 07:15:29 +03:00
|
|
|
case LOCAL_GL_TEXTURE_2D:
|
|
|
|
currentTexPtr = &mBound2DTextures[mActiveTexture];
|
|
|
|
break;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP:
|
|
|
|
currentTexPtr = &mBoundCubeMapTextures[mActiveTexture];
|
|
|
|
break;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
case LOCAL_GL_TEXTURE_3D:
|
2015-11-24 08:55:59 +03:00
|
|
|
if (IsWebGL2()) currentTexPtr = &mBound3DTextures[mActiveTexture];
|
2015-11-25 07:15:29 +03:00
|
|
|
break;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
case LOCAL_GL_TEXTURE_2D_ARRAY:
|
|
|
|
if (IsWebGL2()) currentTexPtr = &mBound2DArrayTextures[mActiveTexture];
|
|
|
|
break;
|
2015-11-24 06:27:13 +03:00
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
if (!currentTexPtr) {
|
2018-07-27 07:46:33 +03:00
|
|
|
ErrorInvalidEnumInfo("target", rawTarget);
|
2015-11-25 07:15:29 +03:00
|
|
|
return;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
const TexTarget texTarget(rawTarget);
|
2015-11-25 07:15:29 +03:00
|
|
|
if (newTex) {
|
|
|
|
if (!newTex->BindTexture(texTarget)) return;
|
|
|
|
} else {
|
2015-08-04 00:34:46 +03:00
|
|
|
gl->fBindTexture(texTarget.get(), 0);
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
*currentTexPtr = newTex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebGLContext::GenerateMipmap(GLenum rawTexTarget) {
|
2018-07-27 07:46:33 +03:00
|
|
|
const FuncScope funcScope(*this, "generateMipmap");
|
2015-11-25 07:15:29 +03:00
|
|
|
const uint8_t funcDims = 0;
|
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
TexTarget texTarget;
|
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexTarget(this, funcDims, rawTexTarget, &texTarget, &tex))
|
2015-08-04 00:34:46 +03:00
|
|
|
return;
|
|
|
|
|
2018-10-17 07:18:15 +03:00
|
|
|
tex->GenerateMipmap();
|
2015-08-04 00:34:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
JS::Value WebGLContext::GetTexParameter(GLenum rawTexTarget, GLenum pname) {
|
2018-07-27 07:46:33 +03:00
|
|
|
const FuncScope funcScope(*this, "getTexParameter");
|
2015-11-25 07:15:29 +03:00
|
|
|
const uint8_t funcDims = 0;
|
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
TexTarget texTarget;
|
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexTarget(this, funcDims, rawTexTarget, &texTarget, &tex))
|
2015-08-04 00:34:46 +03:00
|
|
|
return JS::NullValue();
|
|
|
|
|
|
|
|
if (!IsTexParamValid(pname)) {
|
2018-07-27 07:46:33 +03:00
|
|
|
ErrorInvalidEnumInfo("pname", pname);
|
2015-08-04 00:34:46 +03:00
|
|
|
return JS::NullValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
return tex->GetTexParameter(texTarget, pname);
|
|
|
|
}
|
|
|
|
|
2016-12-23 00:52:53 +03:00
|
|
|
void WebGLContext::TexParameter_base(GLenum rawTexTarget, GLenum pname,
|
|
|
|
const FloatOrInt& param) {
|
2018-07-27 07:46:33 +03:00
|
|
|
const FuncScope funcScope(*this, "texParameter");
|
2015-11-25 07:15:29 +03:00
|
|
|
const uint8_t funcDims = 0;
|
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
TexTarget texTarget;
|
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexTarget(this, funcDims, rawTexTarget, &texTarget, &tex))
|
2015-08-04 00:34:46 +03:00
|
|
|
return;
|
|
|
|
|
2016-12-23 00:52:53 +03:00
|
|
|
tex->TexParameter(texTarget, pname, param);
|
2015-08-04 00:34:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Uploads
|
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
void WebGLContext::CompressedTexImage(uint8_t funcDims, GLenum rawTarget,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLint level, GLenum internalFormat,
|
|
|
|
GLsizei width, GLsizei height,
|
|
|
|
GLsizei depth, GLint border,
|
2017-07-18 21:02:57 +03:00
|
|
|
const TexImageSource& src,
|
|
|
|
const Maybe<GLsizei>& expectedImageSize) {
|
2015-11-25 07:15:29 +03:00
|
|
|
TexImageTarget target;
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexImageTarget(this, funcDims, rawTarget, &target, &tex)) return;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
tex->CompressedTexImage(target, level, internalFormat, width, height, depth,
|
2017-07-18 21:02:57 +03:00
|
|
|
border, src, expectedImageSize);
|
2015-08-04 00:34:46 +03:00
|
|
|
}
|
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
void WebGLContext::CompressedTexSubImage(
|
2016-10-21 04:03:40 +03:00
|
|
|
uint8_t funcDims, GLenum rawTarget, GLint level, GLint xOffset,
|
|
|
|
GLint yOffset, GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
|
2017-07-18 21:02:57 +03:00
|
|
|
GLenum unpackFormat, const TexImageSource& src,
|
|
|
|
const Maybe<GLsizei>& expectedImageSize) {
|
2015-11-25 07:15:29 +03:00
|
|
|
TexImageTarget target;
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexImageTarget(this, funcDims, rawTarget, &target, &tex)) return;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
tex->CompressedTexSubImage(target, level, xOffset, yOffset, zOffset, width,
|
2017-07-18 21:02:57 +03:00
|
|
|
height, depth, unpackFormat, src,
|
|
|
|
expectedImageSize);
|
2015-08-04 00:34:46 +03:00
|
|
|
}
|
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
////
|
2015-08-04 00:34:46 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
void WebGLContext::CopyTexImage2D(GLenum rawTarget, GLint level,
|
|
|
|
GLenum internalFormat, GLint x, GLint y,
|
|
|
|
GLsizei width, GLsizei height, GLint border) {
|
2018-07-27 07:46:33 +03:00
|
|
|
const FuncScope funcScope(*this, "copyTexImage2D");
|
2015-11-25 07:15:29 +03:00
|
|
|
const uint8_t funcDims = 2;
|
|
|
|
|
|
|
|
TexImageTarget target;
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexImageTarget(this, funcDims, rawTarget, &target, &tex)) return;
|
2015-08-04 00:34:46 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
tex->CopyTexImage2D(target, level, internalFormat, x, y, width, height,
|
|
|
|
border);
|
2015-08-04 00:34:46 +03:00
|
|
|
}
|
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
void WebGLContext::CopyTexSubImage(uint8_t funcDims, GLenum rawTarget,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLint x, GLint y,
|
|
|
|
GLsizei width, GLsizei height) {
|
2015-11-25 07:15:29 +03:00
|
|
|
TexImageTarget target;
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexImageTarget(this, funcDims, rawTarget, &target, &tex)) return;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
tex->CopyTexSubImage(target, level, xOffset, yOffset, zOffset, x, y, width,
|
2016-10-21 04:03:40 +03:00
|
|
|
height);
|
2015-11-25 07:15:29 +03:00
|
|
|
}
|
2015-11-24 08:55:59 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
////
|
2015-08-04 00:34:46 +03:00
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
void WebGLContext::TexImage(uint8_t funcDims, GLenum rawTarget, GLint level,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLenum internalFormat, GLsizei width,
|
|
|
|
GLsizei height, GLsizei depth, GLint border,
|
|
|
|
GLenum unpackFormat, GLenum unpackType,
|
|
|
|
const TexImageSource& src) {
|
2015-11-25 07:15:29 +03:00
|
|
|
TexImageTarget target;
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexImageTarget(this, funcDims, rawTarget, &target, &tex)) return;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
const webgl::PackingInfo pi = {unpackFormat, unpackType};
|
2018-07-27 07:46:33 +03:00
|
|
|
tex->TexImage(target, level, internalFormat, width, height, depth, border, pi,
|
2016-10-21 04:03:40 +03:00
|
|
|
src);
|
2015-08-04 00:34:46 +03:00
|
|
|
}
|
|
|
|
|
2018-07-27 07:46:33 +03:00
|
|
|
void WebGLContext::TexSubImage(uint8_t funcDims, GLenum rawTarget, GLint level,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLint xOffset, GLint yOffset, GLint zOffset,
|
|
|
|
GLsizei width, GLsizei height, GLsizei depth,
|
|
|
|
GLenum unpackFormat, GLenum unpackType,
|
|
|
|
const TexImageSource& src) {
|
2015-11-25 07:15:29 +03:00
|
|
|
TexImageTarget target;
|
2015-08-04 00:34:46 +03:00
|
|
|
WebGLTexture* tex;
|
2018-07-27 07:46:33 +03:00
|
|
|
if (!ValidateTexImageTarget(this, funcDims, rawTarget, &target, &tex)) return;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
const webgl::PackingInfo pi = {unpackFormat, unpackType};
|
2018-07-27 07:46:33 +03:00
|
|
|
tex->TexSubImage(target, level, xOffset, yOffset, zOffset, width, height,
|
2016-10-21 04:03:40 +03:00
|
|
|
depth, pi, src);
|
2015-08-04 00:34:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mozilla
|