Debian Codegraph @

platform/web/js/libs/library_godot_webgl2.js

raw symbols SCIP
1 /**************************************************************************/
2 /* library_godot_webgl2.js */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 const GodotWebGL2 = {
32 $GodotWebGL2__deps: ['$GL', '$GodotRuntime'],
33 $GodotWebGL2: {},
34
35 // This is implemented as "glGetBufferSubData" in new emscripten versions.
36 // Since we have to support older (pre 2.0.17) emscripten versions, we add this wrapper function instead.
37 godot_webgl2_glGetBufferSubData__proxy: 'sync',
38 godot_webgl2_glGetBufferSubData__sig: 'vippp',
39 godot_webgl2_glGetBufferSubData__deps: ['$GL', 'emscripten_webgl_get_current_context'],
40 godot_webgl2_glGetBufferSubData: function (target, offset, size, data) {
41 const gl_context_handle = _emscripten_webgl_get_current_context();
42 const gl = GL.getContext(gl_context_handle);
43 if (gl) {
44 gl.GLctx['getBufferSubData'](target, offset, HEAPU8, data, size);
45 }
46 },
47
48 godot_webgl2_glFramebufferTextureMultiviewOVR__deps: ['emscripten_webgl_get_current_context'],
49 godot_webgl2_glFramebufferTextureMultiviewOVR__proxy: 'sync',
50 godot_webgl2_glFramebufferTextureMultiviewOVR__sig: 'viiiiii',
51 godot_webgl2_glFramebufferTextureMultiviewOVR: function (target, attachment, texture, level, base_view_index, num_views) {
52 const context = GL.currentContext;
53 if (typeof context.multiviewExt === 'undefined') {
54 const /** OVR_multiview2 */ ext = context.GLctx.getExtension('OVR_multiview2');
55 if (!ext) {
56 GodotRuntime.error('Trying to call glFramebufferTextureMultiviewOVR() without the OVR_multiview2 extension');
57 return;
58 }
59 context.multiviewExt = ext;
60 }
61 const /** OVR_multiview2 */ ext = context.multiviewExt;
62 ext.framebufferTextureMultiviewOVR(target, attachment, GL.textures[texture], level, base_view_index, num_views);
63 },
64
65 godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR__deps: ['emscripten_webgl_get_current_context'],
66 godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR__proxy: 'sync',
67 godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR__sig: 'viiiiiii',
68 godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR: function (target, attachment, texture, level, samples, base_view_index, num_views) {
69 const context = GL.currentContext;
70 if (typeof context.oculusMultiviewExt === 'undefined') {
71 const /** OCULUS_multiview */ ext = context.GLctx.getExtension('OCULUS_multiview');
72 if (!ext) {
73 GodotRuntime.error('Trying to call glFramebufferTextureMultisampleMultiviewOVR() without the OCULUS_multiview extension');
74 return;
75 }
76 context.oculusMultiviewExt = ext;
77 }
78 const /** OCULUS_multiview */ ext = context.oculusMultiviewExt;
79 ext.framebufferTextureMultisampleMultiviewOVR(target, attachment, GL.textures[texture], level, samples, base_view_index, num_views);
80 },
81 };
82
83 autoAddDeps(GodotWebGL2, '$GodotWebGL2');
84 mergeInto(LibraryManager.library, GodotWebGL2);