2012-10-09 18:39:49 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
#include "WebGLActiveInfo.h"
|
|
|
|
|
|
|
|
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
2012-10-09 18:39:49 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
namespace mozilla {
|
2012-10-09 18:39:49 +00:00
|
|
|
|
2015-01-15 23:40:39 +00:00
|
|
|
static uint8_t
|
|
|
|
ElemSizeFromType(GLenum elemType)
|
2014-11-14 04:03:50 +00:00
|
|
|
{
|
2015-01-15 23:40:39 +00:00
|
|
|
switch (elemType) {
|
|
|
|
case LOCAL_GL_BOOL:
|
|
|
|
case LOCAL_GL_FLOAT:
|
|
|
|
case LOCAL_GL_INT:
|
2015-04-20 02:09:33 +00:00
|
|
|
case LOCAL_GL_UNSIGNED_INT:
|
2015-01-15 23:40:39 +00:00
|
|
|
case LOCAL_GL_SAMPLER_2D:
|
2015-04-20 02:09:33 +00:00
|
|
|
case LOCAL_GL_SAMPLER_3D:
|
|
|
|
case LOCAL_GL_SAMPLER_CUBE:
|
|
|
|
case LOCAL_GL_SAMPLER_2D_SHADOW:
|
2015-01-15 23:40:39 +00:00
|
|
|
case LOCAL_GL_SAMPLER_2D_ARRAY:
|
|
|
|
case LOCAL_GL_SAMPLER_2D_ARRAY_SHADOW:
|
|
|
|
case LOCAL_GL_SAMPLER_CUBE_SHADOW:
|
2015-04-20 02:09:33 +00:00
|
|
|
case LOCAL_GL_INT_SAMPLER_2D:
|
|
|
|
case LOCAL_GL_INT_SAMPLER_3D:
|
|
|
|
case LOCAL_GL_INT_SAMPLER_CUBE:
|
|
|
|
case LOCAL_GL_INT_SAMPLER_2D_ARRAY:
|
2015-01-15 23:40:39 +00:00
|
|
|
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D:
|
|
|
|
case LOCAL_GL_UNSIGNED_INT_SAMPLER_3D:
|
|
|
|
case LOCAL_GL_UNSIGNED_INT_SAMPLER_CUBE:
|
2015-03-18 03:30:52 +00:00
|
|
|
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
2015-01-15 23:40:39 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
case LOCAL_GL_BOOL_VEC2:
|
|
|
|
case LOCAL_GL_FLOAT_VEC2:
|
|
|
|
case LOCAL_GL_INT_VEC2:
|
2015-04-20 02:09:33 +00:00
|
|
|
case LOCAL_GL_UNSIGNED_INT_VEC2:
|
2015-01-15 23:40:39 +00:00
|
|
|
return 2;
|
|
|
|
|
|
|
|
case LOCAL_GL_BOOL_VEC3:
|
|
|
|
case LOCAL_GL_FLOAT_VEC3:
|
|
|
|
case LOCAL_GL_INT_VEC3:
|
2015-04-20 02:09:33 +00:00
|
|
|
case LOCAL_GL_UNSIGNED_INT_VEC3:
|
2015-01-15 23:40:39 +00:00
|
|
|
return 3;
|
|
|
|
|
|
|
|
case LOCAL_GL_BOOL_VEC4:
|
|
|
|
case LOCAL_GL_FLOAT_VEC4:
|
|
|
|
case LOCAL_GL_INT_VEC4:
|
2015-04-20 02:09:33 +00:00
|
|
|
case LOCAL_GL_UNSIGNED_INT_VEC4:
|
|
|
|
case LOCAL_GL_FLOAT_MAT2:
|
2015-01-15 23:40:39 +00:00
|
|
|
return 4;
|
|
|
|
|
|
|
|
case LOCAL_GL_FLOAT_MAT2x3:
|
|
|
|
case LOCAL_GL_FLOAT_MAT3x2:
|
|
|
|
return 6;
|
|
|
|
|
|
|
|
case LOCAL_GL_FLOAT_MAT2x4:
|
|
|
|
case LOCAL_GL_FLOAT_MAT4x2:
|
|
|
|
return 8;
|
|
|
|
|
|
|
|
case LOCAL_GL_FLOAT_MAT3:
|
|
|
|
return 9;
|
|
|
|
|
|
|
|
case LOCAL_GL_FLOAT_MAT3x4:
|
|
|
|
case LOCAL_GL_FLOAT_MAT4x3:
|
|
|
|
return 12;
|
|
|
|
|
|
|
|
case LOCAL_GL_FLOAT_MAT4:
|
|
|
|
return 16;
|
|
|
|
|
|
|
|
default:
|
|
|
|
MOZ_CRASH("Bad `elemType`.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WebGLActiveInfo::WebGLActiveInfo(WebGLContext* webgl, GLint elemCount, GLenum elemType,
|
|
|
|
bool isArray, const nsACString& baseUserName,
|
|
|
|
const nsACString& baseMappedName)
|
|
|
|
: mWebGL(webgl)
|
|
|
|
, mElemCount(elemCount)
|
|
|
|
, mElemType(elemType)
|
|
|
|
, mBaseUserName(baseUserName)
|
|
|
|
, mIsArray(isArray)
|
|
|
|
, mElemSize(ElemSizeFromType(elemType))
|
|
|
|
, mBaseMappedName(baseMappedName)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
WebGLActiveInfo::WrapObject(JSContext* js, JS::Handle<JSObject*> aGivenProto)
|
2015-01-15 23:40:39 +00:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
return dom::WebGLActiveInfoBinding::Wrap(js, this, aGivenProto);
|
2012-10-09 18:39:49 +00:00
|
|
|
}
|
2014-11-14 04:03:50 +00:00
|
|
|
|
2015-01-15 23:40:39 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLActiveInfo)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLActiveInfo, AddRef)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLActiveInfo, Release)
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
} // namespace mozilla
|