aboutsummaryrefslogtreecommitdiff
path: root/src/library_gl.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library_gl.js')
-rw-r--r--src/library_gl.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 630f116c..afd36197 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -558,6 +558,7 @@ var LibraryGL = {
case 0x8DFA: // GL_SHADER_COMPILER
{{{ makeSetValue('p', '0', '1', 'i32') }}};
return;
+ case 0x8DF8: // GL_SHADER_BINARY_FORMATS
case 0x8DF9: // GL_NUM_SHADER_BINARY_FORMATS
{{{ makeSetValue('p', '0', '0', 'i32') }}};
return;
@@ -621,6 +622,27 @@ var LibraryGL = {
glGetFloatv__sig: 'vii',
glGetFloatv: function(name_, p) {
+ switch(name_) {
+ case 0x8DFA: // GL_SHADER_COMPILER
+ {{{ makeSetValue('p', '0', '1', 'float') }}};
+ return;
+ case 0x8DF8: // GL_SHADER_BINARY_FORMATS
+ GL.recordError(0x0500/*GL_INVALID_ENUM*/);
+#if GL_ASSERTIONS
+ Module.printErr('GL_INVALID_ENUM in glGetFloatv(GL_SHADER_BINARY_FORMATS): Invalid parameter type!');
+#endif
+ return;
+ case 0x8DF9: // GL_NUM_SHADER_BINARY_FORMATS
+ {{{ makeSetValue('p', '0', '0', 'float') }}};
+ return;
+ case 0x86A2: // GL_NUM_COMPRESSED_TEXTURE_FORMATS
+ // WebGL doesn't have GL_NUM_COMPRESSED_TEXTURE_FORMATS (it's obsolete since GL_COMPRESSED_TEXTURE_FORMATS returns a JS array that can be queried for length),
+ // so implement it ourselves to allow C++ GLES2 code get the length.
+ var formats = Module.ctx.getParameter(0x86A3 /*GL_COMPRESSED_TEXTURE_FORMATS*/);
+ {{{ makeSetValue('p', '0', 'formats.length', 'float') }}};
+ return;
+ }
+
var result = Module.ctx.getParameter(name_);
switch (typeof(result)) {
case "number":
@@ -674,6 +696,27 @@ var LibraryGL = {
glGetBooleanv__sig: 'vii',
glGetBooleanv: function(name_, p) {
+ switch(name_) {
+ case 0x8DFA: // GL_SHADER_COMPILER
+ {{{ makeSetValue('p', '0', '1', 'i8') }}};
+ return;
+ case 0x8DF8: // GL_SHADER_BINARY_FORMATS
+ GL.recordError(0x0500/*GL_INVALID_ENUM*/);
+#if GL_ASSERTIONS
+ Module.printErr('GL_INVALID_ENUM in glGetBooleanv(GL_SHADER_BINARY_FORMATS): Invalid parameter type!');
+#endif
+ return;
+ case 0x8DF9: // GL_NUM_SHADER_BINARY_FORMATS
+ {{{ makeSetValue('p', '0', '0', 'i8') }}};
+ return;
+ case 0x86A2: // GL_NUM_COMPRESSED_TEXTURE_FORMATS
+ // WebGL doesn't have GL_NUM_COMPRESSED_TEXTURE_FORMATS (it's obsolete since GL_COMPRESSED_TEXTURE_FORMATS returns a JS array that can be queried for length),
+ // so implement it ourselves to allow C++ GLES2 code get the length.
+ var hasCompressedFormats = Module.ctx.getParameter(0x86A3 /*GL_COMPRESSED_TEXTURE_FORMATS*/).length > 0 ? 1 : 0;
+ {{{ makeSetValue('p', '0', 'hasCompressedFormats', 'i8') }}};
+ return;
+ }
+
var result = Module.ctx.getParameter(name_);
switch (typeof(result)) {
case "number":