From 834c79da2cf06a687af648da1162f2ae5afa01fa Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Tue, 9 Aug 2022 11:16:55 -0700 Subject: [PATCH] Set the version of the BC3 shaders to 310 es The shaders are compatible with GLSL ES version 310. Require the GL_ARB_ES3_1_compatibility extension and change the version directives accordingly so that we get validation from the GL implementation. --- bin/Data/bc1.glsl | 2 +- bin/Data/bc1_dither.glsl | 2 +- bin/Data/bc4.glsl | 2 +- bin/Data/etc2_rgba_stitch.glsl | 2 +- src/PlatformGL.cpp | 8 ++++++++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/Data/bc1.glsl b/bin/Data/bc1.glsl index 51e82c9..e796602 100644 --- a/bin/Data/bc1.glsl +++ b/bin/Data/bc1.glsl @@ -1,4 +1,4 @@ -#version 430 core +#version 310 es #if defined(GL_ES) && GL_ES == 1 // Desktop GLSL allows the const keyword for either compile-time or diff --git a/bin/Data/bc1_dither.glsl b/bin/Data/bc1_dither.glsl index 4ca239f..f4c011f 100644 --- a/bin/Data/bc1_dither.glsl +++ b/bin/Data/bc1_dither.glsl @@ -1,4 +1,4 @@ -#version 430 core +#version 310 es #define BC1_DITHER #include "bc1.glsl" diff --git a/bin/Data/bc4.glsl b/bin/Data/bc4.glsl index 7cd6cbf..70bc599 100644 --- a/bin/Data/bc4.glsl +++ b/bin/Data/bc4.glsl @@ -1,4 +1,4 @@ -#version 430 core +#version 310 es #if defined(GL_ES) && GL_ES == 1 // Desktop GLSL allows the const keyword for either compile-time or diff --git a/bin/Data/etc2_rgba_stitch.glsl b/bin/Data/etc2_rgba_stitch.glsl index 33b0923..d06d0f2 100644 --- a/bin/Data/etc2_rgba_stitch.glsl +++ b/bin/Data/etc2_rgba_stitch.glsl @@ -2,7 +2,7 @@ // This compute shader merely stitches them together to form the final result // It's also used by RG11 driver to stitch two R11 into one RG11 -#version 430 core +#version 310 es // #include "/media/matias/Datos/SyntaxHighlightingMisc.h" diff --git a/src/PlatformGL.cpp b/src/PlatformGL.cpp index 96ffa00..b91b8ac 100644 --- a/src/PlatformGL.cpp +++ b/src/PlatformGL.cpp @@ -69,12 +69,20 @@ namespace betsy g_glContext = SDL_GL_CreateContext( g_sdlWindow ); + const SDL_bool has_required_extensions = SDL_GL_ExtensionSupported( "GL_ARB_ES3_1_compatibility" ); + if( !g_glContext ) { fprintf( stderr, "GL Context creation failed.\n" ); SDL_Quit(); abort(); } + else if ( has_required_extensions == SDL_FALSE ) + { + fprintf( stderr, "GL Context lacks required extensions.\n" ); + SDL_Quit(); + abort(); + } else { printf( "GL Context creation suceeded.\n" );