Bug 1306112 - Inline singly-used ValidateDataRanges. - r=ethlin

MozReview-Commit-ID: EmnhpsHMgu7
This commit is contained in:
Jeff Gilbert (:jgilbert) 2016-09-28 14:18:23 -07:00
Родитель 97bf74701f
Коммит 07cf1bd20c
3 изменённых файлов: 12 добавлений и 26 удалений

Просмотреть файл

@ -64,10 +64,18 @@ WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
return;
}
if (readBuffer == writeBuffer &&
!ValidateDataRanges(readOffset, writeOffset, size, funcName))
{
return;
if (readBuffer == writeBuffer) {
MOZ_ASSERT((CheckedInt<WebGLsizeiptr>(readOffset) + size).isValid());
MOZ_ASSERT((CheckedInt<WebGLsizeiptr>(writeOffset) + size).isValid());
const bool separate = (readOffset + size < writeOffset ||
writeOffset + size < readOffset);
if (!separate) {
ErrorInvalidValue("%s: ranges [readOffset, readOffset + size) and"
" [writeOffset, writeOffset + size) overlap",
funcName);
return;
}
}
const auto& readType = readBuffer->Content();

Просмотреть файл

@ -1499,7 +1499,6 @@ protected:
bool ValidateBlendFuncSrcEnum(GLenum mode, const char* info);
bool ValidateBlendFuncEnumsCompatibility(GLenum sfactor, GLenum dfactor,
const char* info);
bool ValidateDataRanges(WebGLintptr readOffset, WebGLintptr writeOffset, WebGLsizeiptr size, const char* info);
bool ValidateComparisonEnum(GLenum target, const char* info);
bool ValidateStencilOpEnum(GLenum action, const char* info);
bool ValidateFaceEnum(GLenum face, const char* info);

Просмотреть файл

@ -122,27 +122,6 @@ WebGLContext::ValidateBlendFuncEnumsCompatibility(GLenum sfactor,
return true;
}
/**
* Check data ranges [readOffset, readOffset + size] and [writeOffset,
* writeOffset + size] for overlap.
*
* It is assumed that offset and size have already been validated.
*/
bool
WebGLContext::ValidateDataRanges(WebGLintptr readOffset, WebGLintptr writeOffset, WebGLsizeiptr size, const char* info)
{
MOZ_ASSERT((CheckedInt<WebGLsizeiptr>(readOffset) + size).isValid());
MOZ_ASSERT((CheckedInt<WebGLsizeiptr>(writeOffset) + size).isValid());
bool separate = (readOffset + size < writeOffset || writeOffset + size < readOffset);
if (!separate) {
ErrorInvalidValue("%s: ranges [readOffset, readOffset + size) and [writeOffset, "
"writeOffset + size) overlap", info);
}
return separate;
}
bool
WebGLContext::ValidateComparisonEnum(GLenum target, const char* info)
{