зеркало из https://github.com/mozilla/pjs.git
Bug 721230 - Implement a compressed texture support stub for WebGL conformance. r=bjacob
This commit is contained in:
Родитель
b59de70db9
Коммит
3d8da72979
|
@ -223,6 +223,107 @@ nsIDOMWebGLRenderingContext_BufferSubData(JSContext *cx, uintN argc, jsval *vp)
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CompressedTexImage2D takes:
|
||||||
|
* CompressedTexImage2D(uint, int, uint, int, int, int, ArrayBufferView)
|
||||||
|
*/
|
||||||
|
static JSBool
|
||||||
|
nsIDOMWebGLRenderingContext_CompressedTexImage2D(JSContext *cx, uintN argc, jsval *vp)
|
||||||
|
{
|
||||||
|
XPC_QS_ASSERT_CONTEXT_OK(cx);
|
||||||
|
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||||
|
if (!obj)
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
nsIDOMWebGLRenderingContext *self;
|
||||||
|
xpc_qsSelfRef selfref;
|
||||||
|
JS::AutoValueRooter tvr(cx);
|
||||||
|
if (!xpc_qsUnwrapThis(cx, obj, nsnull, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
if (argc != 7)
|
||||||
|
return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
|
||||||
|
|
||||||
|
jsval *argv = JS_ARGV(cx, vp);
|
||||||
|
|
||||||
|
GET_UINT32_ARG(argv0, 0);
|
||||||
|
GET_INT32_ARG(argv1, 1);
|
||||||
|
GET_UINT32_ARG(argv2, 2);
|
||||||
|
GET_INT32_ARG(argv3, 3);
|
||||||
|
GET_INT32_ARG(argv4, 4);
|
||||||
|
GET_INT32_ARG(argv5, 5);
|
||||||
|
|
||||||
|
if (!JSVAL_IS_PRIMITIVE(argv[6])) {
|
||||||
|
JSObject* argv6 = JSVAL_TO_OBJECT(argv[6]);
|
||||||
|
if (js_IsTypedArray(argv6)) {
|
||||||
|
rv = self->CompressedTexImage2D_array(argv0, argv1, argv2, argv3, argv4, argv5,
|
||||||
|
js::TypedArray::getTypedArray(argv6));
|
||||||
|
} else {
|
||||||
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 6);
|
||||||
|
return JS_FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xpc_qsThrow(cx, NS_ERROR_FAILURE);
|
||||||
|
return JS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*vp = JSVAL_VOID;
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CompressedTexSubImage2D takes:
|
||||||
|
* CompressedTexSubImage2D(uint, int, int, int, int, int, uint, ArrayBufferView)
|
||||||
|
*/
|
||||||
|
static JSBool
|
||||||
|
nsIDOMWebGLRenderingContext_CompressedTexSubImage2D(JSContext *cx, uintN argc, jsval *vp)
|
||||||
|
{
|
||||||
|
XPC_QS_ASSERT_CONTEXT_OK(cx);
|
||||||
|
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||||
|
if (!obj)
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
nsIDOMWebGLRenderingContext *self;
|
||||||
|
xpc_qsSelfRef selfref;
|
||||||
|
JS::AutoValueRooter tvr(cx);
|
||||||
|
if (!xpc_qsUnwrapThis(cx, obj, nsnull, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
if (argc != 7)
|
||||||
|
return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
|
||||||
|
|
||||||
|
jsval *argv = JS_ARGV(cx, vp);
|
||||||
|
|
||||||
|
GET_UINT32_ARG(argv0, 0);
|
||||||
|
GET_INT32_ARG(argv1, 1);
|
||||||
|
GET_INT32_ARG(argv2, 2);
|
||||||
|
GET_INT32_ARG(argv3, 3);
|
||||||
|
GET_INT32_ARG(argv4, 4);
|
||||||
|
GET_INT32_ARG(argv5, 5);
|
||||||
|
GET_UINT32_ARG(argv6, 6);
|
||||||
|
|
||||||
|
if (!JSVAL_IS_PRIMITIVE(argv[7])) {
|
||||||
|
JSObject* argv7 = JSVAL_TO_OBJECT(argv[7]);
|
||||||
|
if (js_IsTypedArray(argv7)) {
|
||||||
|
rv = self->CompressedTexSubImage2D_array(argv0, argv1, argv2, argv3, argv4, argv5,
|
||||||
|
argv6, js::TypedArray::getTypedArray(argv7));
|
||||||
|
} else {
|
||||||
|
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 7);
|
||||||
|
return JS_FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xpc_qsThrow(cx, NS_ERROR_FAILURE);
|
||||||
|
return JS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*vp = JSVAL_VOID;
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ReadPixels takes:
|
* ReadPixels takes:
|
||||||
* ReadPixels(int, int, int, int, uint, uint, ArrayBufferView)
|
* ReadPixels(int, int, int, int, uint, uint, ArrayBufferView)
|
||||||
|
|
|
@ -2191,7 +2191,7 @@ WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval)
|
||||||
wrval->SetAsInt32(0);
|
wrval->SetAsInt32(0);
|
||||||
break;
|
break;
|
||||||
case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS:
|
case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS:
|
||||||
wrval->SetAsEmpty(); // the spec says we must return null
|
wrval->SetAsEmptyArray();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// unsigned int. here we may have to return very large values like 2^32-1 that can't be represented as
|
// unsigned int. here we may have to return very large values like 2^32-1 that can't be represented as
|
||||||
|
@ -4459,6 +4459,51 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
WebGLContext::CompressedTexImage2D(PRInt32)
|
||||||
|
{
|
||||||
|
NS_RUNTIMEABORT("CompressedTexImage2D(PRInt32) should never be called");
|
||||||
|
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
WebGLContext::CompressedTexImage2D_array(WebGLenum target, WebGLint level, WebGLenum internalformat,
|
||||||
|
WebGLsizei width, WebGLsizei height, WebGLint border,
|
||||||
|
JSObject *pixels)
|
||||||
|
{
|
||||||
|
if (!IsContextStable())
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
|
WebGLTexture *tex = activeBoundTextureForTarget(target);
|
||||||
|
if (!tex)
|
||||||
|
return ErrorInvalidOperation("compressedTexImage2D: no texture is bound to this target");
|
||||||
|
|
||||||
|
return ErrorInvalidEnum("compressedTexImage2D: compressed textures are not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
WebGLContext::CompressedTexSubImage2D(PRInt32)
|
||||||
|
{
|
||||||
|
NS_RUNTIMEABORT("CompressedTexSubImage2D(PRInt32) should never be called");
|
||||||
|
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
WebGLContext::CompressedTexSubImage2D_array(WebGLenum target, WebGLint level, WebGLint xoffset,
|
||||||
|
WebGLint yoffset, WebGLsizei width, WebGLsizei height,
|
||||||
|
WebGLenum format, JSObject *pixels)
|
||||||
|
{
|
||||||
|
if (!IsContextStable())
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
|
WebGLTexture *tex = activeBoundTextureForTarget(target);
|
||||||
|
if (!tex)
|
||||||
|
return ErrorInvalidOperation("compressedTexSubImage2D: no texture is bound to this target");
|
||||||
|
|
||||||
|
return ErrorInvalidEnum("compressedTexSubImage2D: compressed textures are not supported");
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
WebGLContext::GetShaderParameter(nsIWebGLShader *sobj, WebGLenum pname, nsIVariant **retval)
|
WebGLContext::GetShaderParameter(nsIWebGLShader *sobj, WebGLenum pname, nsIVariant **retval)
|
||||||
|
|
|
@ -168,7 +168,7 @@ interface nsIWebGLExtensionLoseContext : nsIWebGLExtension
|
||||||
void restoreContext();
|
void restoreContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
[scriptable, builtinclass, uuid(ef15ae85-4670-4dc4-848d-51ca81e8397a)]
|
[scriptable, builtinclass, uuid(f000afac-11b3-4c06-a35f-8db411f1cf54)]
|
||||||
interface nsIDOMWebGLRenderingContext : nsISupports
|
interface nsIDOMWebGLRenderingContext : nsISupports
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -632,6 +632,16 @@ interface nsIDOMWebGLRenderingContext : nsISupports
|
||||||
void colorMask(in WebGLboolean red, in WebGLboolean green, in WebGLboolean blue, in WebGLboolean alpha);
|
void colorMask(in WebGLboolean red, in WebGLboolean green, in WebGLboolean blue, in WebGLboolean alpha);
|
||||||
void compileShader([optional] in nsIWebGLShader shader);
|
void compileShader([optional] in nsIWebGLShader shader);
|
||||||
|
|
||||||
|
void compressedTexImage2D([optional] in long dummy);
|
||||||
|
[noscript] void compressedTexImage2D_array(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||||
|
in WebGLsizei width, in WebGLsizei height, in WebGLint border,
|
||||||
|
in WebGLJSObjectPtr pixels);
|
||||||
|
|
||||||
|
void compressedTexSubImage2D([optional] in long dummy);
|
||||||
|
[noscript] void compressedTexSubImage2D_array(in WebGLenum target, in WebGLint level, in WebGLint xoffset,
|
||||||
|
in WebGLint yoffset, in WebGLsizei width, in WebGLsizei height,
|
||||||
|
in WebGLenum format, in WebGLJSObjectPtr pixels);
|
||||||
|
|
||||||
void copyTexImage2D(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
void copyTexImage2D(in WebGLenum target, in WebGLint level, in WebGLenum internalformat,
|
||||||
in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height, in WebGLint border);
|
in WebGLint x, in WebGLint y, in WebGLsizei width, in WebGLsizei height, in WebGLint border);
|
||||||
void copyTexSubImage2D(in WebGLenum target, in WebGLint level, in WebGLint xoffset, in WebGLint yoffset,
|
void copyTexSubImage2D(in WebGLenum target, in WebGLint level, in WebGLint xoffset, in WebGLint yoffset,
|
||||||
|
|
|
@ -978,6 +978,8 @@ customMethodCalls = {
|
||||||
'nsIDOMWebGLRenderingContext_ReadPixels': CUSTOM_QS,
|
'nsIDOMWebGLRenderingContext_ReadPixels': CUSTOM_QS,
|
||||||
'nsIDOMWebGLRenderingContext_TexImage2D': CUSTOM_QS,
|
'nsIDOMWebGLRenderingContext_TexImage2D': CUSTOM_QS,
|
||||||
'nsIDOMWebGLRenderingContext_TexSubImage2D': CUSTOM_QS,
|
'nsIDOMWebGLRenderingContext_TexSubImage2D': CUSTOM_QS,
|
||||||
|
'nsIDOMWebGLRenderingContext_CompressedTexImage2D': CUSTOM_QS,
|
||||||
|
'nsIDOMWebGLRenderingContext_CompressedTexSubImage2D': CUSTOM_QS,
|
||||||
'nsIDOMWebGLRenderingContext_Uniform1iv': CUSTOM_QS_TN,
|
'nsIDOMWebGLRenderingContext_Uniform1iv': CUSTOM_QS_TN,
|
||||||
'nsIDOMWebGLRenderingContext_Uniform2iv': CUSTOM_QS_TN,
|
'nsIDOMWebGLRenderingContext_Uniform2iv': CUSTOM_QS_TN,
|
||||||
'nsIDOMWebGLRenderingContext_Uniform3iv': CUSTOM_QS_TN,
|
'nsIDOMWebGLRenderingContext_Uniform3iv': CUSTOM_QS_TN,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче