mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-20 16:31:57 +09:00
[Feat] (GL): apply glClipControl on both backends and advertise ARB_clip_control
This commit is contained in:
@@ -661,6 +661,7 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
INIT_GLES_FUNC(glMapBufferOES)
|
||||
INIT_GLES_FUNC_OPTIONAL(glPolygonModeNV)
|
||||
INIT_GLES_FUNC_OPTIONAL(glPolygonModeANGLE)
|
||||
INIT_GLES_FUNC_OPTIONAL(glClipControlEXT)
|
||||
INIT_GLES_FUNC_OPTIONAL(glColorMaskiEXT)
|
||||
INIT_GLES_FUNC_OPTIONAL(glColorMaskiOES)
|
||||
// Extension-only multi-draw entry points. eglGetProcAddress may legally return a
|
||||
@@ -1124,6 +1125,7 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
// comes out false, so a stub pointer counting as support would silently break the draws.
|
||||
Bool hasBaseInstanceExtension = false;
|
||||
Bool hasTessellationShaderExtension = false;
|
||||
Bool hasClipControlExtension = false;
|
||||
for (GLint i = 0; i < extCount; ++i) {
|
||||
const char* extension = (const char*)glesFuncs.glGetStringi(GL_EXTENSIONS, i);
|
||||
if (extension) {
|
||||
@@ -1215,6 +1217,9 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
if (std::strcmp(extension, "GL_EXT_clip_cull_distance") == 0) {
|
||||
caps.SupportsClipDistance = true;
|
||||
}
|
||||
if (std::strcmp(extension, "GL_EXT_clip_control") == 0) {
|
||||
hasClipControlExtension = true;
|
||||
}
|
||||
if (std::strcmp(extension, "GL_OES_viewport_array") == 0) {
|
||||
caps.SupportsViewportArray = true;
|
||||
}
|
||||
@@ -1287,6 +1292,9 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
glesFuncs.glDrawElementsBaseVertex != nullptr;
|
||||
caps.SupportsTessellationShader = (esAtLeast32 || (esAtLeast31 && hasTessellationShaderExtension)) &&
|
||||
glesFuncs.glPatchParameteri != nullptr;
|
||||
// The string AND the pointer: eglGetProcAddress may hand back a stub for a name the
|
||||
// driver does not implement.
|
||||
caps.SupportsClipControl = hasClipControlExtension && glesFuncs.glClipControlEXT != nullptr;
|
||||
caps.SupportsComputeShader = esAtLeast31 && glesFuncs.glDispatchCompute != nullptr &&
|
||||
glesFuncs.glMemoryBarrier != nullptr &&
|
||||
glesFuncs.glCreateShader != nullptr &&
|
||||
@@ -1319,6 +1327,7 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
MGLOG_I(" base instance (EXT_base_instance; emulated by attribute offsets when absent): %s",
|
||||
caps.SupportsBaseInstance ? "yes" : "no");
|
||||
MGLOG_I(" clip distances (EXT_clip_cull_distance): %s", caps.SupportsClipDistance ? "yes" : "no");
|
||||
MGLOG_I(" clip control (EXT_clip_control): %s", caps.SupportsClipControl ? "yes" : "no");
|
||||
MGLOG_I(" viewport array (OES_viewport_array; gl_ViewportIndex collapses to viewport 0 when absent): %s",
|
||||
caps.SupportsViewportArray ? "yes" : "no");
|
||||
{
|
||||
|
||||
@@ -650,6 +650,8 @@ namespace MobileGL {
|
||||
// Extension aliases for glPolygonMode (GLES core has none) and indexed glColorMaski.
|
||||
GL_FUNC_TYPEDEF(void, glPolygonModeNV, GLenum face, GLenum mode)
|
||||
GL_FUNC_TYPEDEF(void, glPolygonModeANGLE, GLenum face, GLenum mode)
|
||||
// GL_EXT_clip_control (ES has no core glClipControl).
|
||||
GL_FUNC_TYPEDEF(void, glClipControlEXT, GLenum origin, GLenum depth)
|
||||
GL_FUNC_TYPEDEF(void, glColorMaskiEXT, GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
|
||||
GL_FUNC_TYPEDEF(void, glColorMaskiOES, GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
|
||||
|
||||
@@ -1066,6 +1068,7 @@ namespace MobileGL {
|
||||
GL_FUNC_DECL(glMapBufferOES)
|
||||
GL_FUNC_DECL(glPolygonModeNV)
|
||||
GL_FUNC_DECL(glPolygonModeANGLE)
|
||||
GL_FUNC_DECL(glClipControlEXT)
|
||||
GL_FUNC_DECL(glColorMaskiEXT)
|
||||
GL_FUNC_DECL(glColorMaskiOES)
|
||||
|
||||
@@ -1117,6 +1120,9 @@ namespace MobileGL {
|
||||
// Tessellation stages: ES 3.2 core, or GL_EXT_tessellation_shader on 3.1, with
|
||||
// glPatchParameteri resolved either way.
|
||||
Bool SupportsTessellationShader = false;
|
||||
// GL_EXT_clip_control advertised and glClipControlEXT resolved: the driver applies a
|
||||
// clip-space origin and depth mode, so the application's glClipControl is forwarded.
|
||||
Bool SupportsClipControl = false;
|
||||
// GL_EXT_texture_view / GL_OES_texture_view: two ES texture names sharing one
|
||||
// storage, i.e. the only way DirectGLES can answer glTextureView at all. ES never
|
||||
// made this core - not even in 3.2 - so unlike every other capability here there is
|
||||
|
||||
Reference in New Issue
Block a user