@@ -420,10 +420,13 @@ Platform headers / declarations
420420
421421 #define OPENGL_VERSION_MAJOR 4
422422 #define OPENGL_VERSION_MINOR 3
423- #define GLSL_VERSION "430 "
423+ #define GLSL_VERSION "310 es "
424424 #define SPIRV_VERSION "99"
425425 #define USE_SYNC_OBJECT 0 // 0 = GLsync, 1 = EGLSyncKHR, 2 = storage buffer
426426
427+ #define GRAPHICS_API_OPENGL_ES 1
428+
429+
427430 #if __STDC_VERSION__ >= 199901L
428431 #define _XOPEN_SOURCE 600
429432 #else
@@ -2053,8 +2056,6 @@ static bool ksGpuContext_CreateForSurface( ksGpuContext * context, const ksGpuDe
20532056
20542057 context->device = device;
20552058
2056- GlInitExtensions();
2057-
20582059 int glxErrorBase;
20592060 int glxEventBase;
20602061 if ( !glXQueryExtension( xDisplay, &glxErrorBase, &glxEventBase ) )
@@ -2121,10 +2122,11 @@ static bool ksGpuContext_CreateForSurface( ksGpuContext * context, const ksGpuDe
21212122 GLX_CONTEXT_MAJOR_VERSION_ARB, OPENGL_VERSION_MAJOR,
21222123 GLX_CONTEXT_MINOR_VERSION_ARB, OPENGL_VERSION_MINOR,
21232124 GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
2124- GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
2125+ // GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
21252126 0
21262127 };
21272128
2129+ glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC) GetExtension( "glXCreateContextAttribsARB" );
21282130 context->glxContext = glXCreateContextAttribsARB( xDisplay, // Display * dpy
21292131 context->glxFBConfig, // GLXFBConfig config
21302132 NULL, // GLXContext share_context
@@ -2625,6 +2627,12 @@ static void ksGpuContext_SetCurrent( ksGpuContext * context )
26252627 wglMakeCurrent( context->hDC, context->hGLRC );
26262628#elif defined( OS_LINUX_XLIB ) || defined( OS_LINUX_XCB_GLX )
26272629 glXMakeCurrent( context->xDisplay, context->glxDrawable, context->glxContext );
2630+ static int firstTime = 1;
2631+ if ( firstTime )
2632+ {
2633+ GlInitExtensions();
2634+ firstTime = 0;
2635+ }
26282636#elif defined( OS_LINUX_XCB )
26292637 xcb_glx_make_current_cookie_t glx_make_current_cookie = xcb_glx_make_current( context->connection, context->glxDrawable, context->glxContext, 0 );
26302638 xcb_glx_make_current_reply_t * glx_make_current_reply = xcb_glx_make_current_reply( context->connection, glx_make_current_cookie, NULL );
@@ -9769,9 +9777,13 @@ static const char barGraphComputeProgramGLSL[] =
97699777 "#version " GLSL_VERSION "\n"
97709778 GLSL_EXTENSIONS
97719779 "\n"
9780+ "#if __VERSION__ == 310\n"
9781+ "# define ES_HIGHP highp\n"
9782+ "#endif\n"
9783+ "\n"
97729784 "layout( local_size_x = " STRINGIFY( BARGRAPH_LOCAL_SIZE_X ) ", local_size_y = " STRINGIFY( BARGRAPH_LOCAL_SIZE_Y ) " ) in;\n"
97739785 "\n"
9774- "layout( rgba8, binding = 0 ) uniform writeonly " ES_HIGHP " image2D dest;\n"
9786+ "layout( rgba8, binding = 0 ) uniform writeonly ES_HIGHP image2D dest;\n"
97759787 "layout( std430, binding = 0 ) buffer barValueBuffer { float barValues[]; };\n"
97769788 "layout( std430, binding = 1 ) buffer barColorBuffer { vec4 barColors[]; };\n"
97779789 "uniform lowp vec4 backgroundColor;\n"
@@ -11004,10 +11016,14 @@ static const char timeWarpTransformComputeProgramGLSL[] =
1100411016 "#version " GLSL_VERSION "\n"
1100511017 GLSL_EXTENSIONS
1100611018 "\n"
11019+ "#if __VERSION__ == 310\n"
11020+ "# define ES_HIGHP highp\n"
11021+ "#endif\n"
11022+ "\n"
1100711023 "layout( local_size_x = " STRINGIFY( TRANSFORM_LOCAL_SIZE_X ) ", local_size_y = " STRINGIFY( TRANSFORM_LOCAL_SIZE_Y ) " ) in;\n"
1100811024 "\n"
11009- "layout( rgba16f, binding = 0 ) uniform writeonly " ES_HIGHP " image2D dst;\n"
11010- "layout( rgba32f, binding = 1 ) uniform readonly " ES_HIGHP " image2D src;\n"
11025+ "layout( rgba16f, binding = 0 ) uniform writeonly ES_HIGHP image2D dst;\n"
11026+ "layout( rgba32f, binding = 1 ) uniform readonly ES_HIGHP image2D src;\n"
1101111027 "uniform highp mat3x4 timeWarpStartTransform;\n"
1101211028 "uniform highp mat3x4 timeWarpEndTransform;\n"
1101311029 "uniform ivec2 dimensions;\n"
@@ -11065,13 +11081,17 @@ static const char timeWarpSpatialComputeProgramGLSL[] =
1106511081 "#version " GLSL_VERSION "\n"
1106611082 GLSL_EXTENSIONS
1106711083 "\n"
11084+ "#if __VERSION__ == 310\n"
11085+ "# define ES_HIGHP highp\n"
11086+ "#endif\n"
11087+ "\n"
1106811088 "layout( local_size_x = " STRINGIFY( SPATIAL_LOCAL_SIZE_X ) ", local_size_y = " STRINGIFY( SPATIAL_LOCAL_SIZE_Y ) " ) in;\n"
1106911089 "\n"
1107011090 "// imageScale = { eyeTilesWide / ( eyeTilesWide + 1 ) / eyePixelsWide,\n"
1107111091 "// eyeTilesHigh / ( eyeTilesHigh + 1 ) / eyePixelsHigh };\n"
1107211092 "// imageBias = { 0.5f / ( eyeTilesWide + 1 ),\n"
1107311093 "// 0.5f / ( eyeTilesHigh + 1 ) };\n"
11074- "layout( rgba8, binding = 0 ) uniform writeonly " ES_HIGHP " image2D dest;\n"
11094+ "layout( rgba8, binding = 0 ) uniform writeonly ES_HIGHP image2D dest;\n"
1107511095 "uniform highp sampler2DArray eyeImage;\n"
1107611096 "uniform highp sampler2D warpImageG;\n"
1107711097 "uniform highp vec2 imageScale;\n"
@@ -11110,13 +11130,17 @@ static const char timeWarpChromaticComputeProgramGLSL[] =
1111011130 "#version " GLSL_VERSION "\n"
1111111131 GLSL_EXTENSIONS
1111211132 "\n"
11133+ "#if __VERSION__ == 310\n"
11134+ "# define ES_HIGHP highp\n"
11135+ "#endif\n"
11136+ "\n"
1111311137 "layout( local_size_x = " STRINGIFY( CHROMATIC_LOCAL_SIZE_X ) ", local_size_y = " STRINGIFY( CHROMATIC_LOCAL_SIZE_Y ) " ) in;\n"
1111411138 "\n"
1111511139 "// imageScale = { eyeTilesWide / ( eyeTilesWide + 1 ) / eyePixelsWide,\n"
1111611140 "// eyeTilesHigh / ( eyeTilesHigh + 1 ) / eyePixelsHigh };\n"
1111711141 "// imageBias = { 0.5f / ( eyeTilesWide + 1 ),\n"
1111811142 "// 0.5f / ( eyeTilesHigh + 1 ) };\n"
11119- "layout( rgba8, binding = 0 ) uniform writeonly " ES_HIGHP " image2D dest;\n"
11143+ "layout( rgba8, binding = 0 ) uniform writeonly ES_HIGHP image2D dest;\n"
1112011144 "uniform highp sampler2DArray eyeImage;\n"
1112111145 "uniform highp sampler2D warpImageR;\n"
1112211146 "uniform highp sampler2D warpImageG;\n"
0 commit comments