Skip to content

Commit

Permalink
fix: enable the extension clip_cull_distance for mobile, the game cra…
Browse files Browse the repository at this point in the history
…sh if hardware clip planes distance is used
  • Loading branch information
emawind84 committed Mar 19, 2024
1 parent 5694fee commit a516a85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/common/rendering/gl/gl_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *

#ifdef __MOBILE__
vp_comb << "#version 310 es\n";
if (gl.flags & ~RFL_NO_CLIP_PLANES)
vp_comb << "#extension GL_EXT_clip_cull_distance : enable\n";
#else
if ((gl.flags & RFL_SHADER_STORAGE_BUFFER) && screen->allowSSBO())
vp_comb << "#version 430 core\n";
Expand Down
3 changes: 2 additions & 1 deletion src/common/rendering/gl_load/gl_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ void gl_LoadExtensions()

#ifdef __MOBILE__
gl_version = 3.31;
gl.flags |= RFL_NO_CLIP_PLANES;
gl.flags |= RFL_INVALIDATE_BUFFER;
gl.flags |= RFL_SHADER_STORAGE_BUFFER;
if (!CheckExtension("GL_EXT_clip_cull_distance")) gl.flags |= RFL_NO_CLIP_PLANES;
#endif
// Don't even start if it's lower than 2.0 or no framebuffers are available (The framebuffer extension is needed for glGenerateMipmapsEXT!)
if (gl_version < 3.3f)
Expand All @@ -160,6 +160,7 @@ void gl_LoadExtensions()
// first test for optional features
if (CheckExtension("GL_ARB_texture_compression")) gl.flags |= RFL_TEXTURE_COMPRESSION;
if (CheckExtension("GL_EXT_texture_compression_s3tc")) gl.flags |= RFL_TEXTURE_COMPRESSION_S3TC;
if (CheckExtension("GL_EXT_clip_cull_distance")) gl.flags &= ~RFL_NO_CLIP_PLANES;

if (gl_version < 4.f)
{
Expand Down

0 comments on commit a516a85

Please sign in to comment.