diff --git a/examples/33-pom/fs_pom.sc b/examples/33-pom/fs_pom.sc index 805a2f8c8..4c1cb6b05 100644 --- a/examples/33-pom/fs_pom.sc +++ b/examples/33-pom/fs_pom.sc @@ -60,15 +60,6 @@ vec2 parallax_uv(vec2 uv, vec3 view_dir) } } -vec2 texture2DBc4(sampler2D _sampler, vec2 _uv) -{ -#if BGFX_SHADER_LANGUAGE_HLSL && BGFX_SHADER_LANGUAGE_HLSL <= 3 - return texture2D(_sampler, _uv).yx; -#else - return texture2D(_sampler, _uv).xy; -#endif -} - void main() { vec3 light_dir = normalize(v_ts_light_pos - v_ts_frag_pos); @@ -97,7 +88,7 @@ void main() } else { - normal.xy = texture2DBc4(s_texNormal, uv) * 2.0 - 1.0; + normal.xy = texture2DBc5(s_texNormal, uv) * 2.0 - 1.0; normal.z = sqrt(1.0 - dot(normal.xy, normal.xy) ); } diff --git a/examples/common/shaderlib.sh b/examples/common/shaderlib.sh index 5871aaf5c..a890edba3 100644 --- a/examples/common/shaderlib.sh +++ b/examples/common/shaderlib.sh @@ -383,4 +383,13 @@ vec3 fixCubeLookup(vec3 _v, float _lod, float _topLevelCubeSize) return _v; } +vec2 texture2DBc5(sampler2D _sampler, vec2 _uv) +{ +#if BGFX_SHADER_LANGUAGE_HLSL && BGFX_SHADER_LANGUAGE_HLSL <= 3 + return texture2D(_sampler, _uv).yx; +#else + return texture2D(_sampler, _uv).xy; +#endif +} + #endif // __SHADERLIB_SH__