зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1313541 - Texture impl. - r=ethlin
MozReview-Commit-ID: DEyr93aD3IF
This commit is contained in:
Родитель
bce071555d
Коммит
b9f6f1e47e
|
@ -157,14 +157,6 @@ public:
|
|||
////////////////
|
||||
// Texture PBOs
|
||||
|
||||
void TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum unpackFormat,
|
||||
GLenum unpackType, WebGLsizeiptr offset, ErrorResult&);
|
||||
|
||||
void TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
||||
GLsizei width, GLsizei height, GLenum unpackFormat,
|
||||
GLenum unpackType, WebGLsizeiptr offset, ErrorResult&);
|
||||
|
||||
void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
|
||||
GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
|
||||
GLenum unpackType, WebGLsizeiptr offset);
|
||||
|
@ -174,46 +166,6 @@ public:
|
|||
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
|
||||
ErrorResult&);
|
||||
|
||||
////////////////
|
||||
// WebGL1 overloads
|
||||
|
||||
void
|
||||
TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat, GLsizei width,
|
||||
GLsizei height, GLint border, GLenum unpackFormat, GLenum unpackType,
|
||||
const dom::Nullable<dom::ArrayBufferView>& pixels, ErrorResult& out_rv)
|
||||
{
|
||||
WebGLContext::TexImage2D(texImageTarget, level, internalFormat, width, height,
|
||||
border, unpackFormat, unpackType, pixels, out_rv);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLenum unpackFormat, GLenum unpackType, const T& any, ErrorResult& out_rv)
|
||||
{
|
||||
WebGLContext::TexImage2D(texImageTarget, level, internalFormat, unpackFormat,
|
||||
unpackType, any, out_rv);
|
||||
}
|
||||
|
||||
void
|
||||
TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
||||
GLsizei width, GLsizei height, GLenum unpackFormat, GLenum unpackType,
|
||||
const dom::ArrayBufferView& view, ErrorResult&)
|
||||
{
|
||||
WebGLContext::TexSubImage2D(texImageTarget, level, xOffset, yOffset, width,
|
||||
height, unpackFormat, unpackType, view);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void
|
||||
TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
||||
GLenum unpackFormat, GLenum unpackType, const T& any,
|
||||
ErrorResult& out_rv)
|
||||
{
|
||||
WebGLContext::TexSubImage2D(texImageTarget, level, xOffset, yOffset, unpackFormat,
|
||||
unpackType, any, out_rv);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Programs and shaders - WebGL2ContextPrograms.cpp
|
||||
GLint GetFragDataLocation(WebGLProgram* program, const nsAString& name);
|
||||
|
|
|
@ -45,7 +45,7 @@ void
|
|||
WebGL2Context::TexImage3D(GLenum rawTexImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLsizei depth, GLint border,
|
||||
GLenum unpackFormat, GLenum unpackType,
|
||||
const dom::ArrayBufferView>* srcView, GLuint srcElemOffset)
|
||||
const dom::ArrayBufferView* srcView, GLuint srcElemOffset)
|
||||
{
|
||||
const char funcName[] = "texImage3D";
|
||||
const uint8_t funcDims = 3;
|
||||
|
@ -64,7 +64,7 @@ WebGL2Context::TexImage3D(GLenum rawTexImageTarget, GLint level, GLenum internal
|
|||
const GLint zOffset = 0;
|
||||
tex->TexOrSubImage(isSubImage, funcName, target, level, internalFormat, xOffset,
|
||||
yOffset, zOffset, width, height, depth, border, unpackFormat,
|
||||
unpackType, view, srcElemOffset);
|
||||
unpackType, srcView, srcElemOffset);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -158,7 +158,7 @@ WebGL2Context::CompressedTexImage3D(GLenum rawTexImageTarget, GLint level,
|
|||
}
|
||||
|
||||
tex->CompressedTexImage(funcName, target, level, internalFormat, width, height, depth,
|
||||
border, view, srcElemOffset);
|
||||
border, srcView, srcElemOffset);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -181,7 +181,7 @@ WebGL2Context::CompressedTexSubImage3D(GLenum rawTexImageTarget, GLint level,
|
|||
}
|
||||
|
||||
tex->CompressedTexSubImage(funcName, target, level, xOffset, yOffset, zOffset, width,
|
||||
height, depth, sizedUnpackFormat, view, srcElemOffset);
|
||||
height, depth, sizedUnpackFormat, srcView, srcElemOffset);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -207,10 +207,10 @@ WebGL2Context::CopyTexSubImage3D(GLenum rawTexImageTarget, GLint level, GLint xO
|
|||
////////////////////
|
||||
|
||||
void
|
||||
WebGL2Context::TexImage2D(GLenum rawTexImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border,
|
||||
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
|
||||
ErrorResult&)
|
||||
WebGLContext::TexImage2D(GLenum rawTexImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border,
|
||||
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
|
||||
ErrorResult&)
|
||||
{
|
||||
const char funcName[] = "texImage2D";
|
||||
const uint8_t funcDims = 2;
|
||||
|
@ -234,10 +234,10 @@ WebGL2Context::TexImage2D(GLenum rawTexImageTarget, GLint level, GLenum internal
|
|||
}
|
||||
|
||||
void
|
||||
WebGL2Context::TexSubImage2D(GLenum rawTexImageTarget, GLint level, GLint xOffset,
|
||||
GLint yOffset, GLsizei width, GLsizei height,
|
||||
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
|
||||
ErrorResult&)
|
||||
WebGLContext::TexSubImage2D(GLenum rawTexImageTarget, GLint level, GLint xOffset,
|
||||
GLint yOffset, GLsizei width, GLsizei height,
|
||||
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
|
||||
ErrorResult&)
|
||||
{
|
||||
const char funcName[] = "texSubImage2D";
|
||||
const uint8_t funcDims = 2;
|
||||
|
|
|
@ -870,10 +870,11 @@ protected:
|
|||
public:
|
||||
void CompressedTexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border,
|
||||
const dom::ArrayBufferView& view);
|
||||
const dom::ArrayBufferView& view, GLuint srcElemOffset = 0);
|
||||
void CompressedTexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset,
|
||||
GLint yOffset, GLsizei width, GLsizei height,
|
||||
GLenum unpackFormat, const dom::ArrayBufferView& view);
|
||||
GLenum unpackFormat, const dom::ArrayBufferView& view,
|
||||
GLuint srcElemOffset = 0);
|
||||
|
||||
void CopyTexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
|
@ -887,44 +888,56 @@ public:
|
|||
GLsizei width, GLsizei height, GLint border, GLenum unpackFormat,
|
||||
GLenum unpackType,
|
||||
const dom::Nullable<dom::ArrayBufferView>& maybeView,
|
||||
ErrorResult& out_error)
|
||||
ErrorResult&)
|
||||
{
|
||||
if (IsContextLost())
|
||||
return;
|
||||
const dom::ArrayBufferView* view = nullptr;
|
||||
if (!maybeView.IsNull()) {
|
||||
view = &(maybeView.Value());
|
||||
}
|
||||
|
||||
TexImage2D(texImageTarget, level, internalFormat, width, height, border,
|
||||
unpackFormat, unpackType, maybeView, 0, out_error);
|
||||
unpackFormat, unpackType, view, 0);
|
||||
}
|
||||
|
||||
void TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum unpackFormat,
|
||||
GLenum unpackType,
|
||||
const dom::Nullable<dom::ArrayBufferView>& maybeSrc,
|
||||
GLuint srcElemOffset, ErrorResult&);
|
||||
GLenum unpackType, const dom::ArrayBufferView& srcView,
|
||||
GLuint srcElemOffset, ErrorResult&)
|
||||
{
|
||||
TexImage2D(texImageTarget, level, internalFormat, width, height, border,
|
||||
unpackFormat, unpackType, &srcView, srcElemOffset);
|
||||
}
|
||||
|
||||
protected:
|
||||
void TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum unpackFormat,
|
||||
GLenum unpackType, const dom::ArrayBufferView* srcView,
|
||||
GLuint srcElemOffset);
|
||||
|
||||
public:
|
||||
void TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLenum unpackFormat, GLenum unpackType,
|
||||
const dom::ImageData& imageData, ErrorResult& out_error);
|
||||
public:
|
||||
void TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLenum unpackFormat, GLenum unpackType, const dom::Element& elem,
|
||||
ErrorResult& out_error);
|
||||
void TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum unpackFormat,
|
||||
GLenum unpackType, WebGLsizeiptr offset, ErrorResult&);
|
||||
|
||||
////
|
||||
|
||||
protected:
|
||||
void TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
||||
GLsizei width, GLsizei height, GLenum unpackFormat,
|
||||
GLenum unpackType, const dom::ArrayBufferView& view);
|
||||
void TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
||||
GLenum unpackFormat, GLenum unpackType,
|
||||
const dom::ImageData& imageData, ErrorResult& out_error);
|
||||
public:
|
||||
void TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
||||
GLenum unpackFormat, GLenum unpackType, const dom::Element& elem,
|
||||
ErrorResult& out_error);
|
||||
|
||||
void TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
||||
GLsizei width, GLsizei height, GLenum unpackFormat,
|
||||
GLenum unpackType, WebGLsizeiptr offset, ErrorResult&);
|
||||
|
||||
////////////////
|
||||
// dom::ImageData
|
||||
|
||||
|
@ -973,7 +986,7 @@ public:
|
|||
return ErrorInvalidValue("%s: `data` must not be null.", funcName);
|
||||
|
||||
TexSubImage2D(texImageTarget, level, xOffset, yOffset, width, height,
|
||||
unpackFormat, unpackType, maybeView.Value(), 0, out_error);
|
||||
unpackFormat, unpackType, maybeSrc.Value(), 0, out_error);
|
||||
}
|
||||
|
||||
void TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
||||
|
|
|
@ -327,9 +327,8 @@ WebGLContext::TexParameter_base(GLenum rawTexTarget, GLenum pname, GLint* maybeI
|
|||
void
|
||||
WebGLContext::TexImage2D(GLenum rawTexImageTarget, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum unpackFormat,
|
||||
GLenum unpackType,
|
||||
const dom::Nullable<dom::ArrayBufferView>& maybeView,
|
||||
ErrorResult&)
|
||||
GLenum unpackType, const dom::ArrayBufferView* maybeView,
|
||||
GLuint elemOffset)
|
||||
{
|
||||
const char funcName[] = "texImage2D";
|
||||
const uint8_t funcDims = 2;
|
||||
|
@ -342,11 +341,6 @@ WebGLContext::TexImage2D(GLenum rawTexImageTarget, GLint level, GLenum internalF
|
|||
return;
|
||||
}
|
||||
|
||||
const dom::ArrayBufferView* view = nullptr;
|
||||
if (!maybeView.IsNull()) {
|
||||
view = &maybeView.Value();
|
||||
}
|
||||
|
||||
const bool isSubImage = false;
|
||||
const GLint xOffset = 0;
|
||||
const GLint yOffset = 0;
|
||||
|
@ -354,7 +348,7 @@ WebGLContext::TexImage2D(GLenum rawTexImageTarget, GLint level, GLenum internalF
|
|||
const GLsizei depth = 1;
|
||||
tex->TexOrSubImage(isSubImage, funcName, target, level, internalFormat, xOffset,
|
||||
yOffset, zOffset, width, height, depth, border, unpackFormat,
|
||||
unpackType, view);
|
||||
unpackType, maybeView, elemOffset);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -412,7 +406,8 @@ void
|
|||
WebGLContext::TexSubImage2D(GLenum rawTexImageTarget, GLint level, GLint xOffset,
|
||||
GLint yOffset, GLsizei width, GLsizei height,
|
||||
GLenum unpackFormat, GLenum unpackType,
|
||||
const dom::ArrayBufferView& view)
|
||||
const dom::ArrayBufferView& view, GLuint elemOffset,
|
||||
ErrorResult&)
|
||||
{
|
||||
const char funcName[] = "texSubImage2D";
|
||||
const uint8_t funcDims = 2;
|
||||
|
@ -432,7 +427,7 @@ WebGLContext::TexSubImage2D(GLenum rawTexImageTarget, GLint level, GLint xOffset
|
|||
const GLint border = 0;
|
||||
tex->TexOrSubImage(isSubImage, funcName, target, level, internalFormat, xOffset,
|
||||
yOffset, zOffset, width, height, depth, border, unpackFormat,
|
||||
unpackType, &view);
|
||||
unpackType, &view, elemOffset);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -487,8 +482,8 @@ WebGLContext::TexSubImage2D(GLenum rawTexImageTarget, GLint level, GLint xOffset
|
|||
void
|
||||
WebGLContext::CompressedTexImage2D(GLenum rawTexImageTarget, GLint level,
|
||||
GLenum internalFormat, GLsizei width, GLsizei height,
|
||||
GLint border,
|
||||
const dom::ArrayBufferView& view)
|
||||
GLint border, const dom::ArrayBufferView& srcView,
|
||||
GLuint srcElemOffset)
|
||||
{
|
||||
const char funcName[] = "compressedTexImage2D";
|
||||
const uint8_t funcDims = 2;
|
||||
|
@ -502,16 +497,16 @@ WebGLContext::CompressedTexImage2D(GLenum rawTexImageTarget, GLint level,
|
|||
}
|
||||
|
||||
const GLsizei depth = 1;
|
||||
|
||||
tex->CompressedTexImage(funcName, target, level, internalFormat, width, height, depth,
|
||||
border, view);
|
||||
border, srcView, srcElemOffset);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::CompressedTexSubImage2D(GLenum rawTexImageTarget, GLint level,
|
||||
GLint xOffset, GLint yOffset, GLsizei width,
|
||||
GLsizei height, GLenum sizedUnpackFormat,
|
||||
const dom::ArrayBufferView& view)
|
||||
const dom::ArrayBufferView& srcView,
|
||||
GLuint srcElemOffset)
|
||||
{
|
||||
const char funcName[] = "compressedTexSubImage2D";
|
||||
const uint8_t funcDims = 2;
|
||||
|
@ -526,9 +521,8 @@ WebGLContext::CompressedTexSubImage2D(GLenum rawTexImageTarget, GLint level,
|
|||
|
||||
const GLint zOffset = 0;
|
||||
const GLsizei depth = 1;
|
||||
|
||||
tex->CompressedTexSubImage(funcName, target, level, xOffset, yOffset, zOffset, width,
|
||||
height, depth, sizedUnpackFormat, view);
|
||||
height, depth, sizedUnpackFormat, srcView, srcElemOffset);
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
|
|
|
@ -268,7 +268,7 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
|
|||
}
|
||||
|
||||
if (!mContext->ValidateArrayBufferView(funcName, *srcView, srcElemOffset, 0,
|
||||
&bytes, &byteCount))
|
||||
const_cast<uint8_t**>(&bytes), &byteCount))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1494,10 +1494,10 @@ WebGLTexture::CompressedTexImage(const char* funcName, TexImageTarget target, GL
|
|||
////////////////////////////////////
|
||||
// Get source info
|
||||
|
||||
uint8_t* bytes;
|
||||
const uint8_t* bytes;
|
||||
size_t byteLen;
|
||||
if (!mContext->ValidateArrayBufferView(funcName, srcView, srcElemOffset, 0, &bytes,
|
||||
&byteLen))
|
||||
if (!mContext->ValidateArrayBufferView(funcName, srcView, srcElemOffset, 0,
|
||||
const_cast<uint8_t**>(&bytes), &byteLen))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1598,10 +1598,10 @@ WebGLTexture::CompressedTexSubImage(const char* funcName, TexImageTarget target,
|
|||
////////////////////////////////////
|
||||
// Get source info
|
||||
|
||||
uint8_t* bytes;
|
||||
const uint8_t* bytes;
|
||||
size_t byteLen;
|
||||
if (!mContext->ValidateArrayBufferView(funcName, srcView, srcElemOffset, 0, &bytes,
|
||||
&byteLen))
|
||||
if (!mContext->ValidateArrayBufferView(funcName, srcView, srcElemOffset, 0,
|
||||
const_cast<uint8_t**>(&bytes), &byteLen))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче