Bug 832576 - Fix perf regression in WebGL uniform setters - r=jgilbert

This commit is contained in:
Benoit Jacob 2013-01-25 13:40:38 -05:00
Родитель 9db0edfdc3
Коммит b4eec88979
1 изменённых файлов: 5 добавлений и 14 удалений

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

@ -707,10 +707,7 @@ WebGLContext::ValidateUniformArraySetter(const char* name, uint32_t expectedElem
{
if (!IsContextStable())
return false;
nsCString nameString(name);
nsCString suffix = NS_LITERAL_CSTRING(": location");
nsCString concatenated = nameString + suffix;
if (!ValidateUniformLocation(concatenated.get(), location_object))
if (!ValidateUniformLocation(name, location_object))
return false;
location = location_object->Location();
uint32_t uniformElemSize = location_object->ElementSize();
@ -721,7 +718,6 @@ WebGLContext::ValidateUniformArraySetter(const char* name, uint32_t expectedElem
uniformElemSize);
return false;
}
const WebGLUniformInfo& info = location_object->Info();
if (arrayLength == 0 ||
arrayLength % expectedElemSize)
{
@ -731,6 +727,7 @@ WebGLContext::ValidateUniformArraySetter(const char* name, uint32_t expectedElem
arrayLength);
return false;
}
const WebGLUniformInfo& info = location_object->Info();
if (!info.isArray &&
arrayLength != expectedElemSize) {
ErrorInvalidOperation("%s: expected an array of length exactly"
@ -753,10 +750,7 @@ WebGLContext::ValidateUniformMatrixArraySetter(const char* name, int dim, WebGLU
uint32_t expectedElemSize = (dim)*(dim);
if (!IsContextStable())
return false;
nsCString nameString(name);
nsCString suffix = NS_LITERAL_CSTRING(": location");
nsCString concatenated = nameString + suffix;
if (!ValidateUniformLocation(concatenated.get(), location_object))
if (!ValidateUniformLocation(name, location_object))
return false;
location = location_object->Location();
uint32_t uniformElemSize = location_object->ElementSize();
@ -767,7 +761,6 @@ WebGLContext::ValidateUniformMatrixArraySetter(const char* name, int dim, WebGLU
uniformElemSize);
return false;
}
const WebGLUniformInfo& info = location_object->Info();
if (arrayLength == 0 ||
arrayLength % expectedElemSize)
{
@ -777,6 +770,7 @@ WebGLContext::ValidateUniformMatrixArraySetter(const char* name, int dim, WebGLU
arrayLength);
return false;
}
const WebGLUniformInfo& info = location_object->Info();
if (!info.isArray &&
arrayLength != expectedElemSize) {
ErrorInvalidOperation("%s: expected an array of length exactly"
@ -801,10 +795,7 @@ WebGLContext::ValidateUniformSetter(const char* name, WebGLUniformLocation *loca
{
if (!IsContextStable())
return false;
nsCString nameString(name);
nsCString suffix = NS_LITERAL_CSTRING(": location");
nsCString concatenated = nameString + suffix;
if (!ValidateUniformLocation(concatenated.get(), location_object))
if (!ValidateUniformLocation(name, location_object))
return false;
location = location_object->Location();
return true;