Add necessary GLES fixes and missing JS functions
This commit is contained in:
parent
b3d73e7b4b
commit
281fe94089
2 changed files with 27 additions and 1 deletions
|
|
@ -803,10 +803,12 @@ namespace gl
|
||||||
if (!internal::glGetQueryiv) return false;
|
if (!internal::glGetQueryiv) return false;
|
||||||
internal::glGetQueryObjectuiv = reinterpret_cast<void (*)(GLuint , GLenum , GLuint *)>(internal::get_proc_address("glGetQueryObjectuiv"));
|
internal::glGetQueryObjectuiv = reinterpret_cast<void (*)(GLuint , GLenum , GLuint *)>(internal::get_proc_address("glGetQueryObjectuiv"));
|
||||||
if (!internal::glGetQueryObjectuiv) return false;
|
if (!internal::glGetQueryObjectuiv) return false;
|
||||||
|
#if !defined(__EMSCRIPTEN__)
|
||||||
internal::glUnmapBuffer = reinterpret_cast<GLboolean (*)(GLenum )>(internal::get_proc_address("glUnmapBuffer"));
|
internal::glUnmapBuffer = reinterpret_cast<GLboolean (*)(GLenum )>(internal::get_proc_address("glUnmapBuffer"));
|
||||||
if (!internal::glUnmapBuffer) return false;
|
if (!internal::glUnmapBuffer) return false;
|
||||||
internal::glGetBufferPointerv = reinterpret_cast<void (*)(GLenum , GLenum , void **)>(internal::get_proc_address("glGetBufferPointerv"));
|
internal::glGetBufferPointerv = reinterpret_cast<void (*)(GLenum , GLenum , void **)>(internal::get_proc_address("glGetBufferPointerv"));
|
||||||
if (!internal::glGetBufferPointerv) return false;
|
if (!internal::glGetBufferPointerv) return false;
|
||||||
|
#endif
|
||||||
internal::glDrawBuffers = reinterpret_cast<void (*)(GLsizei , const GLenum *)>(internal::get_proc_address("glDrawBuffers"));
|
internal::glDrawBuffers = reinterpret_cast<void (*)(GLsizei , const GLenum *)>(internal::get_proc_address("glDrawBuffers"));
|
||||||
if (!internal::glDrawBuffers) return false;
|
if (!internal::glDrawBuffers) return false;
|
||||||
internal::glUniformMatrix2x3fv = reinterpret_cast<void (*)(GLint , GLsizei , GLboolean , const GLfloat *)>(internal::get_proc_address("glUniformMatrix2x3fv"));
|
internal::glUniformMatrix2x3fv = reinterpret_cast<void (*)(GLint , GLsizei , GLboolean , const GLfloat *)>(internal::get_proc_address("glUniformMatrix2x3fv"));
|
||||||
|
|
@ -827,10 +829,12 @@ namespace gl
|
||||||
if (!internal::glRenderbufferStorageMultisample) return false;
|
if (!internal::glRenderbufferStorageMultisample) return false;
|
||||||
internal::glFramebufferTextureLayer = reinterpret_cast<void (*)(GLenum , GLenum , GLuint , GLint , GLint )>(internal::get_proc_address("glFramebufferTextureLayer"));
|
internal::glFramebufferTextureLayer = reinterpret_cast<void (*)(GLenum , GLenum , GLuint , GLint , GLint )>(internal::get_proc_address("glFramebufferTextureLayer"));
|
||||||
if (!internal::glFramebufferTextureLayer) return false;
|
if (!internal::glFramebufferTextureLayer) return false;
|
||||||
|
#if !defined(__EMSCRIPTEN__)
|
||||||
internal::glMapBufferRange = reinterpret_cast<void *(*)(GLenum , GLintptr , GLsizeiptr , GLbitfield )>(internal::get_proc_address("glMapBufferRange"));
|
internal::glMapBufferRange = reinterpret_cast<void *(*)(GLenum , GLintptr , GLsizeiptr , GLbitfield )>(internal::get_proc_address("glMapBufferRange"));
|
||||||
if (!internal::glMapBufferRange) return false;
|
if (!internal::glMapBufferRange) return false;
|
||||||
internal::glFlushMappedBufferRange = reinterpret_cast<void (*)(GLenum , GLintptr , GLsizeiptr )>(internal::get_proc_address("glFlushMappedBufferRange"));
|
internal::glFlushMappedBufferRange = reinterpret_cast<void (*)(GLenum , GLintptr , GLsizeiptr )>(internal::get_proc_address("glFlushMappedBufferRange"));
|
||||||
if (!internal::glFlushMappedBufferRange) return false;
|
if (!internal::glFlushMappedBufferRange) return false;
|
||||||
|
#endif
|
||||||
internal::glBindVertexArray = reinterpret_cast<void (*)(GLuint )>(internal::get_proc_address("glBindVertexArray"));
|
internal::glBindVertexArray = reinterpret_cast<void (*)(GLuint )>(internal::get_proc_address("glBindVertexArray"));
|
||||||
if (!internal::glBindVertexArray) return false;
|
if (!internal::glBindVertexArray) return false;
|
||||||
internal::glDeleteVertexArrays = reinterpret_cast<void (*)(GLsizei , const GLuint *)>(internal::get_proc_address("glDeleteVertexArrays"));
|
internal::glDeleteVertexArrays = reinterpret_cast<void (*)(GLsizei , const GLuint *)>(internal::get_proc_address("glDeleteVertexArrays"));
|
||||||
|
|
@ -984,6 +988,10 @@ namespace gl
|
||||||
internal::glGetInternalformativ = reinterpret_cast<void (*)(GLenum , GLenum , GLenum , GLsizei , GLint *)>(internal::get_proc_address("glGetInternalformativ"));
|
internal::glGetInternalformativ = reinterpret_cast<void (*)(GLenum , GLenum , GLenum , GLsizei , GLint *)>(internal::get_proc_address("glGetInternalformativ"));
|
||||||
if (!internal::glGetInternalformativ) return false;
|
if (!internal::glGetInternalformativ) return false;
|
||||||
|
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// OpenGL ES 3.1
|
// OpenGL ES 3.1
|
||||||
|
|
||||||
internal::glDispatchCompute = reinterpret_cast<void (*)(GLuint , GLuint , GLuint )>(internal::get_proc_address("glDispatchCompute"));
|
internal::glDispatchCompute = reinterpret_cast<void (*)(GLuint , GLuint , GLuint )>(internal::get_proc_address("glDispatchCompute"));
|
||||||
|
|
@ -1259,7 +1267,13 @@ namespace gl
|
||||||
|
|
||||||
int major_version(){ return 3; }
|
int major_version(){ return 3; }
|
||||||
|
|
||||||
int minor_version(){ return 2; }
|
int minor_version(){
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
return 2;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool has_extension(const char * name){ return extensions.contains(name); }
|
bool has_extension(const char * name){ return extensions.contains(name); }
|
||||||
|
|
||||||
|
|
@ -1269,6 +1283,16 @@ namespace gl
|
||||||
|
|
||||||
const char * shader_prefix()
|
const char * shader_prefix()
|
||||||
{
|
{
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
return R"(#version 300 es
|
||||||
|
|
||||||
|
precision highp int;
|
||||||
|
precision highp float;
|
||||||
|
precision highp sampler2D;
|
||||||
|
precision highp usampler2D;
|
||||||
|
|
||||||
|
)";
|
||||||
|
#else
|
||||||
return R"(#version 320 es
|
return R"(#version 320 es
|
||||||
|
|
||||||
precision highp int;
|
precision highp int;
|
||||||
|
|
@ -1277,6 +1301,7 @@ precision highp sampler2D;
|
||||||
precision highp usampler2D;
|
precision highp usampler2D;
|
||||||
|
|
||||||
)";
|
)";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sys
|
} // namespace sys
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ if(PSEMEK_PACKAGE_MODE)
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL Emscripten)
|
if(CMAKE_SYSTEM_NAME STREQUAL Emscripten)
|
||||||
list(APPEND PSEMEK_PACKAGE_LINK_FLAGS_RAW "-sMIN_WEBGL_VERSION=2" "-sNO_DISABLE_EXCEPTION_CATCHING")
|
list(APPEND PSEMEK_PACKAGE_LINK_FLAGS_RAW "-sMIN_WEBGL_VERSION=2" "-sNO_DISABLE_EXCEPTION_CATCHING")
|
||||||
|
list(APPEND PSEMEK_PACKAGE_LINK_FLAGS_RAW "-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='$autoResumeAudioContext','$dynCall'")
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
list(APPEND PSEMEK_PACKAGE_LINK_FLAGS_RAW "-g")
|
list(APPEND PSEMEK_PACKAGE_LINK_FLAGS_RAW "-g")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue