зеркало из https://github.com/mozilla/pjs.git
Bug 635666 - part 3/3 - WebGL crash [@mozilla::WebGLContext::CopyTexSubImage2D] - r=jrmuizel, a=joe
This commit is contained in:
Родитель
abd1b0385b
Коммит
eef61f8409
|
@ -882,6 +882,12 @@ public:
|
|||
return const_cast<WebGLTexture*>(this)->ImageInfoAt(level, face);
|
||||
}
|
||||
|
||||
PRBool HasImageInfoAt(size_t level, size_t face) const {
|
||||
return level <= mMaxLevelWithCustomImages &&
|
||||
face < mFacesCount &&
|
||||
ImageInfoAt(level, 0).mIsDefined;
|
||||
}
|
||||
|
||||
static size_t FaceForTarget(WebGLenum target) {
|
||||
return target == LOCAL_GL_TEXTURE_2D ? 0 : target - LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X;
|
||||
}
|
||||
|
|
|
@ -809,6 +809,9 @@ WebGLContext::CopyTexSubImage2D(WebGLenum target,
|
|||
return ErrorInvalidOperation("copyTexSubImage2D: no texture bound to this target");
|
||||
|
||||
WebGLint face = WebGLTexture::FaceForTarget(target);
|
||||
if (!tex->HasImageInfoAt(level, face))
|
||||
return ErrorInvalidOperation("copyTexSubImage2D: to texture image previously defined for this level and face");
|
||||
|
||||
WebGLsizei texWidth = tex->ImageInfoAt(level, face).mWidth;
|
||||
WebGLsizei texHeight = tex->ImageInfoAt(level, face).mHeight;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче