diff --git a/src/cache.h b/src/cache.h index 9e0999c..ad0b757 100644 --- a/src/cache.h +++ b/src/cache.h @@ -99,7 +99,9 @@ struct ShaderCache { compile(Core::passWater, Shader::WATER_SIMULATE, fx, RS_COLOR_WRITE); compile(Core::passWater, Shader::WATER_DROP, fx, RS_COLOR_WRITE); compile(Core::passWater, Shader::WATER_RAYS, fx, RS_COLOR_WRITE | RS_DEPTH_TEST); - compile(Core::passWater, Shader::WATER_CAUSTICS, fx, RS_COLOR_WRITE); + if (Core::support.derivatives) { + compile(Core::passWater, Shader::WATER_CAUSTICS, fx, RS_COLOR_WRITE); + } compile(Core::passWater, Shader::WATER_COMPOSE, fx, RS_COLOR_WRITE | RS_DEPTH_TEST); } diff --git a/src/core.h b/src/core.h index 21de80e..aaafaf3 100644 --- a/src/core.h +++ b/src/core.h @@ -195,6 +195,7 @@ namespace Core { bool depthTexture; bool shadowSampler; bool discardFrame; + bool derivatives; bool texNPOT; bool tex3D; bool texRG; @@ -258,6 +259,8 @@ namespace Core { #else if (value > LOW && !(support.texFloat || support.texHalf)) value = LOW; + if (value > MEDIUM && !support.derivatives) + value = MEDIUM; water = value; #endif } diff --git a/src/gapi_gl.h b/src/gapi_gl.h index ad373a4..38675cf 100644 --- a/src/gapi_gl.h +++ b/src/gapi_gl.h @@ -63,7 +63,7 @@ #define GL_GLEXT_PROTOTYPES 1 #include #include -#endif + #endif #elif defined(_OS_RPI) || defined(_OS_CLOVER) #include @@ -1142,9 +1142,11 @@ namespace GAPI { support.texNPOT = GLES3 || extSupport(ext, "_texture_npot") || extSupport(ext, "_texture_non_power_of_two"); support.texRG = GLES3 || extSupport(ext, "_texture_rg "); // hope that isn't last extension in string ;) #ifdef _GAPI_GLES - support.tex3D = GLES3; + support.derivatives = GLES3 || _GL_OES_standard_derivatives; + support.tex3D = GLES3; #else - support.tex3D = glTexImage3D != NULL; + support.derivatives = true; + support.tex3D = glTexImage3D != NULL; #endif support.texBorder = extSupport(ext, "_texture_border_clamp"); support.maxAniso = extSupport(ext, "_texture_filter_anisotropic"); @@ -1153,9 +1155,15 @@ namespace GAPI { support.texFloatLinear = support.colorFloat || extSupport(ext, "GL_ARB_texture_float") || extSupport(ext, "_texture_float_linear"); support.texFloat = support.texFloatLinear || extSupport(ext, "_texture_float"); support.texHalfLinear = support.colorHalf || extSupport(ext, "GL_ARB_texture_float") || extSupport(ext, "_texture_half_float_linear") || extSupport(ext, "_color_buffer_half_float"); + support.texHalf = support.texHalfLinear || extSupport(ext, "_texture_half_float"); support.clipDist = false; // TODO + #ifdef SDL2_GLES + support.shaderBinary = false; // TODO + support.VAO = false; // TODO + support.shadowSampler = false; // TODO + #endif #ifdef PROFILE support.profMarker = extSupport(ext, "_KHR_debug"); @@ -1240,7 +1248,7 @@ namespace GAPI { strcat(GLSL_HEADER_FRAG, "#extension GL_OES_standard_derivatives : enable\n"); } if (support.shadowSampler) { - strcat(GLSL_HEADER_FRAG, "precision lowp sampler2DShadow;\n"); + strcat(GLSL_HEADER_FRAG, "#define sampler2DShadow lowp sampler2DShadow\n"); } strcat(GLSL_HEADER_FRAG, "precision lowp int;\n" "precision highp float;\n"