bug 894007 - WebGLContext::getParameter(GL_MAX_TEXTURE_SIZE) should be a power of two - r=jgilbert

This commit is contained in:
Guillaume Abadie 2013-07-30 11:07:04 -04:00
parent 8d86b320b1
commit fc19fe386a

View File

@ -881,6 +881,18 @@ bool WebGLContext::ValidateStencilParamsForDrawCall()
return true;
}
static inline int32_t floorPOT(int32_t x)
{
MOZ_ASSERT(x > 0);
int32_t pot = 1;
while (pot < 0x40000000) {
if (x < pot*2)
break;
pot *= 2;
}
return pot;
}
bool
WebGLContext::InitAndValidateGL()
{
@ -960,6 +972,9 @@ WebGLContext::InitAndValidateGL()
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &mGLMaxVertexTextureImageUnits);
}
mGLMaxTextureSize = floorPOT(mGLMaxTextureSize);
mGLMaxRenderbufferSize = floorPOT(mGLMaxRenderbufferSize);
if (MinCapabilityMode()) {
mGLMaxFragmentUniformVectors = MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS;
mGLMaxVertexUniformVectors = MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS;