Bug 779611 - part 1 - port WebGLShaderPrecisionFormat to WebIDL bindings - r=bz

This commit is contained in:
Benoit Jacob 2012-10-03 17:13:05 -04:00
parent b76cc85271
commit 545b47b406
9 changed files with 44 additions and 55 deletions

View File

@ -1468,16 +1468,22 @@ WebGLUniformLocation::WrapObject(JSContext *cx, JSObject *scope)
return dom::WebGLUniformLocationBinding::Wrap(cx, scope, this);
}
// WebGLShaderPrecisionFormat
NS_INTERFACE_MAP_BEGIN(WebGLShaderPrecisionFormat)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(WebGLShaderPrecisionFormat)
NS_IMPL_RELEASE(WebGLShaderPrecisionFormat)
DOMCI_DATA(WebGLShaderPrecisionFormat, WebGLShaderPrecisionFormat)
JSObject*
WebGLShaderPrecisionFormat::WrapObject(JSContext *cx, JSObject *scope)
{
return dom::WebGLShaderPrecisionFormatBinding::Wrap(cx, scope, this);
}
NS_INTERFACE_MAP_BEGIN(WebGLShaderPrecisionFormat)
NS_INTERFACE_MAP_ENTRY(nsIWebGLShaderPrecisionFormat)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLShaderPrecisionFormat)
NS_INTERFACE_MAP_END
// WebGLActiveInfo
NS_IMPL_ADDREF(WebGLActiveInfo)
NS_IMPL_RELEASE(WebGLActiveInfo)
@ -1556,30 +1562,6 @@ WebGLActiveInfo::GetName(nsAString & aName)
return NS_OK;
}
/* readonly attribute WebGLint rangeMin */
NS_IMETHODIMP
WebGLShaderPrecisionFormat::GetRangeMin(WebGLint *aRangeMin)
{
*aRangeMin = mRangeMin;
return NS_OK;
}
/* readonly attribute WebGLint rangeMax */
NS_IMETHODIMP
WebGLShaderPrecisionFormat::GetRangeMax(WebGLint *aRangeMax)
{
*aRangeMax = mRangeMax;
return NS_OK;
}
/* readonly attribute WebGLint precision */
NS_IMETHODIMP
WebGLShaderPrecisionFormat::GetPrecision(WebGLint *aPrecision)
{
*aPrecision = mPrecision;
return NS_OK;
}
void
WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
{

View File

@ -3063,19 +3063,32 @@ protected:
};
class WebGLShaderPrecisionFormat MOZ_FINAL
: public nsIWebGLShaderPrecisionFormat
: public nsISupports
, public WebGLContextBoundObject
{
public:
WebGLShaderPrecisionFormat(WebGLint rangeMin, WebGLint rangeMax, WebGLint precision) :
WebGLShaderPrecisionFormat(WebGLContext *context, WebGLint rangeMin, WebGLint rangeMax, WebGLint precision) :
WebGLContextBoundObject(context),
mRangeMin(rangeMin),
mRangeMax(rangeMax),
mPrecision(precision)
{
}
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope);
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBGLSHADERPRECISIONFORMAT
// WebIDL WebGLShaderPrecisionFormat API
WebGLint RangeMin() const {
return mRangeMin;
}
WebGLint RangeMax() const {
return mRangeMax;
}
WebGLint Precision() const {
return mPrecision;
}
protected:
WebGLint mRangeMin;

View File

@ -4491,7 +4491,7 @@ WebGLContext::GetShaderPrecisionFormat(WebGLenum shadertype, WebGLenum precision
gl->fGetShaderPrecisionFormat(shadertype, precisiontype, range, &precision);
WebGLShaderPrecisionFormat *retShaderPrecisionFormat
= new WebGLShaderPrecisionFormat(range[0], range[1], precision);
= new WebGLShaderPrecisionFormat(this, range[0], range[1], precision);
NS_ADDREF(retShaderPrecisionFormat);
return retShaderPrecisionFormat;
}

View File

@ -1570,8 +1570,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(WebGLUniformLocation,
nsNewDOMBindingNoWrapperCacheSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WebGLShaderPrecisionFormat, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WebGLActiveInfo, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WebGLExtension, WebGLExtensionSH,
@ -4260,10 +4258,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLRenderbuffer)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(WebGLShaderPrecisionFormat, nsIWebGLShaderPrecisionFormat)
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLShaderPrecisionFormat)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(WebGLUniformLocation, nsIWebGLUniformLocation)
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLUniformLocation)
DOM_CLASSINFO_MAP_END

View File

@ -454,7 +454,6 @@ DOMCI_CLASS(WebGLShader)
DOMCI_CLASS(WebGLFramebuffer)
DOMCI_CLASS(WebGLRenderbuffer)
DOMCI_CLASS(WebGLUniformLocation)
DOMCI_CLASS(WebGLShaderPrecisionFormat)
DOMCI_CLASS(WebGLActiveInfo)
DOMCI_CLASS(WebGLExtension)
DOMCI_CLASS(WebGLExtensionStandardDerivatives)

View File

@ -356,6 +356,12 @@ DOMInterfaces = {
'wrapperCache': False
},
'WebGLShaderPrecisionFormat': {
'nativeType': 'mozilla::WebGLShaderPrecisionFormat',
'headerFile': 'WebGLContext.h',
'wrapperCache': False
},
'XMLHttpRequest': [
{
'nativeType': 'nsXMLHttpRequest',
@ -550,9 +556,6 @@ addExternalIface('WebGLRenderbuffer', nativeType='mozilla::WebGLRenderbuffer',
headerFile='WebGLContext.h')
addExternalIface('WebGLShader', nativeType='mozilla::WebGLShader',
headerFile='WebGLContext.h')
addExternalIface('WebGLShaderPrecisionFormat',
nativeType='mozilla::WebGLShaderPrecisionFormat',
headerFile='WebGLContext.h')
addExternalIface('WebGLTexture', nativeType='mozilla::WebGLTexture',
headerFile='WebGLContext.h')
addExternalIface('Window')

View File

@ -95,14 +95,6 @@ interface nsIWebGLActiveInfo : nsISupports
readonly attribute DOMString name;
};
[scriptable, builtinclass, uuid(76265e93-2e8f-40ca-b25b-eea5995e9641)]
interface nsIWebGLShaderPrecisionFormat : nsISupports
{
readonly attribute WebGLint rangeMin;
readonly attribute WebGLint rangeMax;
readonly attribute WebGLint precision;
};
[scriptable, builtinclass, uuid(d38b0467-623e-4c82-9140-5f14a3bd1bad)]
interface nsIWebGLUniformLocation : nsISupports
{

View File

@ -70,7 +70,11 @@ interface WebGLUniformLocation {
interface WebGLActiveInfo;
interface WebGLShaderPrecisionFormat;
interface WebGLShaderPrecisionFormat {
readonly attribute GLint rangeMin;
readonly attribute GLint rangeMax;
readonly attribute GLint precision;
};
interface WebGLRenderingContext {
@ -602,7 +606,10 @@ interface WebGLRenderingContext {
DOMString? getProgramInfoLog(WebGLProgram? program);
any getRenderbufferParameter(GLenum target, GLenum pname);
any getShaderParameter(WebGLShader? shader, GLenum pname);
[Creator]
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
DOMString? getShaderInfoLog(WebGLShader? shader);
DOMString? getShaderSource(WebGLShader? shader);

View File

@ -468,7 +468,6 @@ irregularFilenames = {
'nsIWebGLShaderArray': 'nsIDOMWebGLRenderingContext',
'nsIWebGLFramebuffer': 'nsIDOMWebGLRenderingContext',
'nsIWebGLRenderbuffer': 'nsIDOMWebGLRenderingContext',
'nsIWebGLShaderPrecisionFormat' : 'nsIDOMWebGLRenderingContext',
'nsIWebGLActiveInfo': 'nsIDOMWebGLRenderingContext',
'nsIWebGLUniformLocation': 'nsIDOMWebGLRenderingContext',
'nsIWebGLExtension': 'nsIDOMWebGLRenderingContext',