1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Fix shader compilation errors in GLSL ES

-Added missing precisions
-Removed explicit floats
-Explicit cast get_texture_size to vec2
This commit is contained in:
oddMLan 2020-05-07 06:52:14 -07:00 committed by Sergey Lipskiy
parent 8b5509bb8f
commit 2b42e02e69

View File

@ -368,12 +368,12 @@ namespace glsl {
" \n"
"mediump vec2 norm2denorm(sampler2D tex, mediump vec2 uv) \n"
"{ \n"
" return uv * get_texture_size(tex) - 0.5f; \n"
" return uv * vec2(get_texture_size(tex)) - 0.5; \n"
"} \n"
" \n"
"mediump vec2 denorm2norm(sampler2D tex, mediump vec2 denorm_uv) \n"
"{ \n"
" return (denorm_uv + 0.5f) / get_texture_size(tex); \n"
" return (denorm_uv + 0.5) / vec2(get_texture_size(tex)); \n"
"} \n"
" \n"
"mediump vec4 hybridFilter(sampler2D tex, mediump vec2 uv) \n"
@ -398,21 +398,21 @@ namespace glsl {
" \n"
" // Here, fwidth() is used to estimte how much denorm_uv changes per fragment.\n"
" // But we divide it by 2, since fwidth() is adding abs(dx) + abs(dy). \n"
" mediump vec2 fragment_size = fwidth(denorm_uv) / 2.0f; \n"
" mediump vec2 fragment_size = fwidth(denorm_uv) / 2.0; \n"
" \n"
" // Only do this if fragment is smaller than 1 texel. \n"
" if (fragment_size.s < 1.0f) { \n"
" if (fragment_size.s < 1.0) { \n"
" // don't make the transition more than one fragment (+/- 0.5 fragment) \n"
" float radius = min(fragment_size.s, 0.5f); \n"
" ratio.s = smoothstep(0.5f - radius, \n"
" 0.5f + radius, \n"
" mediump float radius = min(fragment_size.s, 0.5); \n"
" ratio.s = smoothstep(0.5 - radius, \n"
" 0.5 + radius, \n"
" ratio.s); \n"
" } \n"
" if (fragment_size.t < 1.0f) { \n"
" if (fragment_size.t < 1.0) { \n"
" // don't make the transition more than one fragment (+/- 0.5 fragment) \n"
" float radius = min(fragment_size.t, 0.5f); \n"
" ratio.t = smoothstep(0.5f - radius, \n"
" 0.5f + radius, \n"
" mediump float radius = min(fragment_size.t, 0.5); \n"
" ratio.t = smoothstep(0.5 - radius, \n"
" 0.5 + radius, \n"
" ratio.t); \n"
" } \n"
" \n"