Lines Matching refs:runtime
36 void installConstants(jsi::Runtime &runtime, jsi::Object &gl);
37 void installWebGLMethods(jsi::Runtime &runtime, jsi::Object &gl);
38 void installWebGL2Methods(jsi::Runtime &runtime, jsi::Object &gl);
40 void createWebGLRenderer(jsi::Runtime &runtime, EXGLContext *ctx, glesContext viewport, jsi::Object… in createWebGLRenderer() argument
41 ensurePrototypes(runtime); in createWebGLRenderer()
44 runtime, EXWebGLClass::WebGL2RenderingContext, {static_cast<double>(ctx->ctxId)}) in createWebGLRenderer()
45 .asObject(runtime) in createWebGLRenderer()
47 runtime, EXWebGLClass::WebGLRenderingContext, {static_cast<double>(ctx->ctxId)}) in createWebGLRenderer()
48 .asObject(runtime); in createWebGLRenderer()
50 gl.setProperty(runtime, "drawingBufferWidth", viewport.viewportWidth); in createWebGLRenderer()
51 gl.setProperty(runtime, "drawingBufferHeight", viewport.viewportHeight); in createWebGLRenderer()
52 gl.setProperty(runtime, "supportsWebGL2", ctx->supportsWebGL2); in createWebGLRenderer()
53 gl.setProperty(runtime, "contextId", static_cast<double>(ctx->ctxId)); in createWebGLRenderer()
55 jsi::Value jsContextMap = global.getProperty(runtime, EXGLContextsMapPropertyName); in createWebGLRenderer()
57 global.setProperty(runtime, EXGLContextsMapPropertyName, jsi::Object(runtime)); in createWebGLRenderer()
59 global.getProperty(runtime, EXGLContextsMapPropertyName) in createWebGLRenderer()
60 .asObject(runtime) in createWebGLRenderer()
61 .setProperty(runtime, jsi::PropNameID::forUtf8(runtime, std::to_string(ctx->ctxId)), gl); in createWebGLRenderer()
67 jsi::Runtime &runtime, in createWebGLObject() argument
70 jsi::Object webglObject = runtime.global() in createWebGLObject()
71 .getProperty(runtime, jsi::PropNameID::forUtf8(runtime, getConstructorName(webglClass))) in createWebGLObject()
72 .asObject(runtime) in createWebGLObject()
73 .asFunction(runtime) in createWebGLObject()
74 .callAsConstructor(runtime, {}) in createWebGLObject()
75 .asObject(runtime); in createWebGLObject()
76 jsi::Value id = args.size() > 0 ? jsi::Value(runtime, *args.begin()) : jsi::Value::undefined(); in createWebGLObject()
77 webglObject.setProperty(runtime, "id", id); in createWebGLObject()
121 jsi::Runtime &runtime, in attachClass() argument
124 jsi::PropNameID name = jsi::PropNameID::forUtf8(runtime, getConstructorName(webglClass)); in attachClass()
139 void jsClassExtend(jsi::Runtime &runtime, jsi::Object &baseClass, jsi::PropNameID derivedProp) { in jsClassExtend() argument
140 jsi::PropNameID prototype = jsi::PropNameID::forUtf8(runtime, "prototype"); in jsClassExtend()
141 jsi::Object objectClass = runtime.global().getPropertyAsObject(runtime, "Object"); in jsClassExtend()
142 jsi::Function createMethod = objectClass.getPropertyAsFunction(runtime, "create"); in jsClassExtend()
143 jsi::Function definePropertyMethod = objectClass.getPropertyAsFunction(runtime, "defineProperty"); in jsClassExtend()
144 jsi::Object derivedClass = runtime.global().getProperty(runtime, derivedProp).asObject(runtime); in jsClassExtend()
148 runtime, in jsClassExtend()
150 createMethod.callWithThis(runtime, objectClass, {baseClass.getProperty(runtime, prototype)})); in jsClassExtend()
152 jsi::Object propertyOptions(runtime); in jsClassExtend()
153 propertyOptions.setProperty(runtime, "value", derivedClass); in jsClassExtend()
154 propertyOptions.setProperty(runtime, "enumerable", false); in jsClassExtend()
155 propertyOptions.setProperty(runtime, "configurable", true); in jsClassExtend()
156 propertyOptions.setProperty(runtime, "writable", true); in jsClassExtend()
160 runtime, in jsClassExtend()
163 derivedClass.getProperty(runtime, prototype), in jsClassExtend()
164 jsi::String::createFromUtf8(runtime, "constructor"), in jsClassExtend()
169 void ensurePrototypes(jsi::Runtime &runtime) { in ensurePrototypes() argument
170 if (runtime.global().hasProperty(runtime, "WebGLRenderingContext")) { in ensurePrototypes()
173 runtime.global().setProperty(runtime, "__EXGLConstructorReady", true); in ensurePrototypes()
176 runtime.evaluateJavaScript(evalBuffer, "expo-gl"); in ensurePrototypes()
178 auto inheritFromJsObject = [&runtime](EXWebGLClass classEnum) { in ensurePrototypes()
179 auto objectClass = runtime.global().getPropertyAsObject(runtime, "Object"); in ensurePrototypes()
181 runtime, objectClass, jsi::PropNameID::forUtf8(runtime, getConstructorName(classEnum))); in ensurePrototypes()
188 runtime.global() in ensurePrototypes()
189 ….getProperty(runtime, jsi::PropNameID::forUtf8(runtime, getConstructorName(EXWebGLClass::WebGLRend… in ensurePrototypes()
190 .asObject(runtime) in ensurePrototypes()
191 .getPropertyAsObject(runtime, "prototype"); in ensurePrototypes()
192 installConstants(runtime, prototype); in ensurePrototypes()
193 installWebGLMethods(runtime, prototype); in ensurePrototypes()
200 runtime.global() in ensurePrototypes()
201 ….getProperty(runtime, jsi::PropNameID::forUtf8(runtime, getConstructorName(EXWebGLClass::WebGL2Ren… in ensurePrototypes()
202 .asObject(runtime) in ensurePrototypes()
203 .getPropertyAsObject(runtime, "prototype"); in ensurePrototypes()
204 installConstants(runtime, prototype); in ensurePrototypes()
205 installWebGL2Methods(runtime, prototype); in ensurePrototypes()
212 runtime.global() in ensurePrototypes()
214 runtime, in ensurePrototypes()
215 jsi::PropNameID::forUtf8(runtime, getConstructorName(EXWebGLClass::WebGLObject))) in ensurePrototypes()
216 .asObject(runtime); in ensurePrototypes()
217 auto inheritFromWebGLObject = [&runtime, &webglObjectClass](EXWebGLClass classEnum) { in ensurePrototypes()
219 runtime, in ensurePrototypes()
221 jsi::PropNameID::forUtf8(runtime, getConstructorName(classEnum))); in ensurePrototypes()
240 void installConstants(jsi::Runtime &runtime, jsi::Object &gl) { in installConstants() argument
241 #define GL_CONSTANT(name) gl.setProperty(runtime, #name, static_cast<double>(GL_##name)); in installConstants()
246 void installWebGLMethods(jsi::Runtime &runtime, jsi::Object &gl) { in installWebGLMethods() argument
247 #define NATIVE_METHOD(name) setFunctionOnObject(runtime, gl, #name, method::glNativeMethod_##name); in installWebGLMethods()
255 void installWebGL2Methods(jsi::Runtime &runtime, jsi::Object &gl) { in installWebGL2Methods() argument
256 #define CREATE_METHOD(name) setFunctionOnObject(runtime, gl, #name, method::glNativeMethod_##name); in installWebGL2Methods()