зеркало из https://github.com/mozilla/gecko-dev.git
Bug 924600 - WebGL.getUniform should not throw - r=jgilbert
This commit is contained in:
Родитель
a4aaf958e7
Коммит
617a91c62b
|
@ -371,7 +371,7 @@ public:
|
|||
return GetTexParameter(target, pname);
|
||||
}
|
||||
JS::Value GetUniform(JSContext* cx, WebGLProgram *prog,
|
||||
WebGLUniformLocation *location, ErrorResult& rv);
|
||||
WebGLUniformLocation *location);
|
||||
already_AddRefed<WebGLUniformLocation>
|
||||
GetUniformLocation(WebGLProgram *prog, const nsAString& name);
|
||||
void Hint(GLenum target, GLenum mode);
|
||||
|
|
|
@ -1807,7 +1807,7 @@ WebGLContext::GetTexParameter(GLenum target, GLenum pname)
|
|||
|
||||
JS::Value
|
||||
WebGLContext::GetUniform(JSContext* cx, WebGLProgram *prog,
|
||||
WebGLUniformLocation *location, ErrorResult& rv)
|
||||
WebGLUniformLocation *location)
|
||||
{
|
||||
if (IsContextLost())
|
||||
return JS::NullValue();
|
||||
|
@ -1876,20 +1876,20 @@ WebGLContext::GetUniform(JSContext* cx, WebGLProgram *prog,
|
|||
}
|
||||
|
||||
if (index == uniforms) {
|
||||
rv.Throw(NS_ERROR_FAILURE); // XXX GL error? shouldn't happen.
|
||||
GenerateWarning("getUniform: internal error: hit an OpenGL driver bug");
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
GLenum baseType;
|
||||
GLint unitSize;
|
||||
if (!BaseTypeAndSizeFromUniformType(uniformType, &baseType, &unitSize)) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
GenerateWarning("getUniform: internal error: unknown uniform type 0x%x", uniformType);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
// this should never happen
|
||||
if (unitSize > 16) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
GenerateWarning("getUniform: internal error: unexpected uniform unit size %d", unitSize);
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
|
@ -1901,7 +1901,7 @@ WebGLContext::GetUniform(JSContext* cx, WebGLProgram *prog,
|
|||
} else {
|
||||
JSObject* obj = Float32Array::Create(cx, this, unitSize, fv);
|
||||
if (!obj) {
|
||||
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
ErrorOutOfMemory("getUniform: out of memory");
|
||||
}
|
||||
return JS::ObjectOrNullValue(obj);
|
||||
}
|
||||
|
@ -1913,7 +1913,7 @@ WebGLContext::GetUniform(JSContext* cx, WebGLProgram *prog,
|
|||
} else {
|
||||
JSObject* obj = Int32Array::Create(cx, this, unitSize, iv);
|
||||
if (!obj) {
|
||||
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
ErrorOutOfMemory("getUniform: out of memory");
|
||||
}
|
||||
return JS::ObjectOrNullValue(obj);
|
||||
}
|
||||
|
@ -1928,7 +1928,7 @@ WebGLContext::GetUniform(JSContext* cx, WebGLProgram *prog,
|
|||
uv[k] = JS::BooleanValue(iv[k] ? true : false);
|
||||
JSObject* obj = JS_NewArrayObject(cx, unitSize, uv);
|
||||
if (!obj) {
|
||||
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
ErrorOutOfMemory("getUniform: out of memory");
|
||||
}
|
||||
return JS::ObjectOrNullValue(obj);
|
||||
}
|
||||
|
|
|
@ -621,7 +621,6 @@ interface WebGLRenderingContext {
|
|||
|
||||
any getTexParameter(GLenum target, GLenum pname);
|
||||
|
||||
[Throws]
|
||||
any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
|
||||
|
||||
[NewObject]
|
||||
|
|
Загрузка…
Ссылка в новой задаче