From e071c4e3f0dc29ed20cc537a570e70eb0fbb7d2b Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 25 Jan 2013 13:40:38 -0500 Subject: [PATCH] Bug 832576 - Fix perf regression in WebGL uniform setters - r=jgilbert --- content/canvas/src/WebGLContextValidate.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/content/canvas/src/WebGLContextValidate.cpp b/content/canvas/src/WebGLContextValidate.cpp index 3b7a9821ec07..eaf8683b5d52 100644 --- a/content/canvas/src/WebGLContextValidate.cpp +++ b/content/canvas/src/WebGLContextValidate.cpp @@ -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;