зеркало из https://github.com/mozilla/gecko-dev.git
backout b13c1d8d2cda / bug 747619 for build failure (-Werror)
This commit is contained in:
Родитель
1519eb1059
Коммит
f739bcc07c
|
@ -4164,7 +4164,7 @@ GetFloat32Array(JSContext* aCx, const JS::Value& aValue)
|
|||
return ErrorInvalidOperation("%s: This uniform location is obsolete since the program has been relinked", info); \
|
||||
GLint location = location_object->Location();
|
||||
|
||||
#define SIMPLE_ARRAY_METHOD_UNIFORM(name, expectedElemSize, arrayType, ptrType) \
|
||||
#define SIMPLE_ARRAY_METHOD_UNIFORM(name, cnt, arrayType, ptrType) \
|
||||
NS_IMETHODIMP \
|
||||
WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue, \
|
||||
JSContext* aCx) \
|
||||
|
@ -4180,39 +4180,40 @@ WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue,
|
|||
\
|
||||
nsIWebGLUniformLocation* ploc = aLocation; \
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
int uniformElemSize = location_object->ElementSize(); \
|
||||
if (expectedElemSize != uniformElemSize) { \
|
||||
int elementSize = location_object->ElementSize(); \
|
||||
if (cnt != elementSize) { \
|
||||
return ErrorInvalidOperation( \
|
||||
#name ": this function expected a uniform of element size %d," \
|
||||
" got a uniform of element size %d", \
|
||||
expectedElemSize, \
|
||||
uniformElemSize); \
|
||||
cnt, \
|
||||
elementSize); \
|
||||
} \
|
||||
PRUint32 arrayLength = JS_GetTypedArrayLength(wa, aCx); \
|
||||
const WebGLUniformInfo& info = location_object->Info(); \
|
||||
if (arrayLength == 0 || \
|
||||
arrayLength % expectedElemSize) \
|
||||
PRUint32 expectedArrayLength = cnt * info.arraySize; \
|
||||
if (arrayLength < expectedArrayLength || \
|
||||
(arrayLength % cnt)) \
|
||||
{ \
|
||||
return ErrorInvalidValue("%s: expected an array of length a multiple of" \
|
||||
" %d, got an array of length %d", \
|
||||
" %d and at least %d, got an array of length %d", \
|
||||
#name, \
|
||||
expectedElemSize, \
|
||||
cnt, \
|
||||
expectedArrayLength, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (!info.isArray && \
|
||||
arrayLength != expectedElemSize) { \
|
||||
arrayLength > expectedArrayLength) { \
|
||||
return ErrorInvalidOperation("%s: expected an array of length exactly %d" \
|
||||
" (since this uniform is not an array uniform)," \
|
||||
" got an array of length %d", \
|
||||
" got an array of length %d", \
|
||||
#name, \
|
||||
expectedElemSize, \
|
||||
expectedArrayLength, \
|
||||
arrayLength); \
|
||||
} \
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
PRUint32 numElementsToUpload = NS_MIN(info.arraySize, arrayLength/expectedElemSize); \
|
||||
gl->f##name(location, numElementsToUpload, \
|
||||
static_cast<ptrType*>(JS_GetArrayBufferViewData(wa, aCx))); \
|
||||
gl->f##name(location, info.arraySize, \
|
||||
static_cast<ptrType*>(JS_GetArrayBufferViewData(wa, aCx))); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
|
@ -4221,7 +4222,6 @@ NS_IMETHODIMP
|
|||
WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose, \
|
||||
const JS::Value& aValue, JSContext* aCx) \
|
||||
{ \
|
||||
int expectedElemSize = (dim)*(dim); \
|
||||
JSObject* wa = GetFloat32Array(aCx, aValue); \
|
||||
if (!wa) { \
|
||||
return NS_ERROR_FAILURE; \
|
||||
|
@ -4236,32 +4236,34 @@ WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,
|
|||
if (!wa || !JS_IsFloat32Array(wa, aCx)) { \
|
||||
return ErrorInvalidValue(#name ": array must be of Float32 type"); \
|
||||
} \
|
||||
int uniformElemSize = location_object->ElementSize(); \
|
||||
if (expectedElemSize != uniformElemSize) { \
|
||||
int elementSize = location_object->ElementSize(); \
|
||||
if (dim*dim != elementSize) { \
|
||||
return ErrorInvalidOperation( \
|
||||
#name ": this function expected a uniform of element size %d," \
|
||||
" got a uniform of element size %d", \
|
||||
expectedElemSize, \
|
||||
uniformElemSize); \
|
||||
dim*dim, \
|
||||
elementSize); \
|
||||
} \
|
||||
PRUint32 arrayLength = JS_GetTypedArrayLength(wa, aCx); \
|
||||
const WebGLUniformInfo& info = location_object->Info(); \
|
||||
if (arrayLength == 0 || \
|
||||
arrayLength % expectedElemSize) \
|
||||
PRUint32 expectedArrayLength = dim * dim * info.arraySize; \
|
||||
if (arrayLength < expectedArrayLength || \
|
||||
(arrayLength % (dim*dim))) \
|
||||
{ \
|
||||
return ErrorInvalidValue("%s: expected an array of length a multiple of" \
|
||||
" %d, got an array of length %d", \
|
||||
" %d and at least %d, got an array of length %d", \
|
||||
#name, \
|
||||
expectedElemSize, \
|
||||
dim*dim, \
|
||||
expectedArrayLength, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (!info.isArray && \
|
||||
arrayLength != expectedElemSize) { \
|
||||
if (!info.isArray && \
|
||||
arrayLength > expectedArrayLength) { \
|
||||
return ErrorInvalidOperation("%s: expected an array of length exactly %d" \
|
||||
" (since this uniform is not an array uniform)," \
|
||||
" got an array of length %d", \
|
||||
#name, \
|
||||
expectedElemSize, \
|
||||
expectedArrayLength, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (aTranspose) { \
|
||||
|
@ -4270,8 +4272,7 @@ WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,
|
|||
} \
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
PRUint32 numElementsToUpload = NS_MIN(info.arraySize, arrayLength/(expectedElemSize)); \
|
||||
gl->f##name(location, numElementsToUpload, false, \
|
||||
gl->f##name(location, info.arraySize, false, \
|
||||
static_cast<WebGLfloat*>(JS_GetArrayBufferViewData(wa, aCx))); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче