Bug 613350 - Pass 2 more WebGL draw-test - r=vladimir a=joe

This commit is contained in:
Benoit Jacob 2010-11-25 09:00:00 -05:00
parent 9a5d41bb65
commit cf89e4601d

View File

@ -1047,6 +1047,10 @@ WebGLContext::DrawArrays(GLenum mode, WebGLint first, WebGLsizei count)
if (first < 0 || count < 0)
return ErrorInvalidValue("DrawArrays: negative first or count");
// If count is 0, there's nothing to do.
if (count == 0)
return NS_OK;
// If there is no current program, this is silently ignored.
// Any checks below this depend on a program being available.
if (!mCurrentProgram)
@ -1060,10 +1064,6 @@ WebGLContext::DrawArrays(GLenum mode, WebGLint first, WebGLsizei count)
if (!ValidateBuffers(checked_firstPlusCount.value()))
return ErrorInvalidOperation("DrawArrays: bound vertex attribute buffers do not have sufficient size for given first and count");
// If count is 0, there's nothing to do.
if (count == 0)
return NS_OK;
MakeContextCurrent();
if (mBoundFramebuffer && !mBoundFramebuffer->CheckAndInitializeRenderbuffers())
@ -1091,6 +1091,10 @@ WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, Web
if (count < 0 || byteOffset < 0)
return ErrorInvalidValue("DrawElements: negative count or offset");
// If count is 0, there's nothing to do.
if (count == 0)
return NS_OK;
CheckedUint32 checked_byteCount;
if (type == LOCAL_GL_UNSIGNED_SHORT) {
@ -1143,10 +1147,6 @@ WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, Web
"size for given indices from the bound element array");
}
// If count is 0, there's nothing to do.
if (count == 0)
return NS_OK;
MakeContextCurrent();
if (mBoundFramebuffer && !mBoundFramebuffer->CheckAndInitializeRenderbuffers())