diff --git a/src/bgfx_shader.sh b/src/bgfx_shader.sh index 2ece605a1..e98ac3c80 100644 --- a/src/bgfx_shader.sh +++ b/src/bgfx_shader.sh @@ -812,7 +812,7 @@ float mtxGetElement(mat4 _mtx, int _column, int _row) #endif // BGFX_SHADER_LANGUAGE_GLSL } -#if !BX_SHADER_LANGUAGE_DXIL +#if !BGFX_SHADER_LANGUAGE_DXIL float select(bool _cond, float _true, float _false) { return _cond ? _true : _false; } vec2 select(bool _cond, vec2 _true, vec2 _false) { return _cond ? _true : _false; } vec3 select(bool _cond, vec3 _true, vec3 _false) { return _cond ? _true : _false; } @@ -820,6 +820,12 @@ vec4 select(bool _cond, vec4 _true, vec4 _false) { return _cond ? _true : _f vec2 select(bvec2 _cond, vec2 _true, vec2 _false) { return (vec2(_cond) * _true) + (vec2(not(_cond) ) * _false); } vec3 select(bvec3 _cond, vec3 _true, vec3 _false) { return (vec3(_cond) * _true) + (vec3(not(_cond) ) * _false); } vec4 select(bvec4 _cond, vec4 _true, vec4 _false) { return (vec4(_cond) * _true) + (vec4(not(_cond) ) * _false); } +# if BGFX_SHADER_LANGUAGE_GLSL >= 130 \ + || BGFX_SHADER_LANGUAGE_HLSL \ + || BGFX_SHADER_LANGUAGE_PSSL \ + || BGFX_SHADER_LANGUAGE_SPIRV \ + || BGFX_SHADER_LANGUAGE_METAL \ + || BGFX_SHADER_LANGUAGE_WGSL int select(bool _cond, int _true, int _false) { return _cond ? _true : _false; } ivec2 select(bool _cond, ivec2 _true, ivec2 _false) { return _cond ? _true : _false; } ivec3 select(bool _cond, ivec3 _true, ivec3 _false) { return _cond ? _true : _false; } @@ -834,7 +840,8 @@ uvec4 select(bool _cond, uvec4 _true, uvec4 _false) { return _cond ? _true : _f uvec2 select(bvec2 _cond, uvec2 _true, uvec2 _false) { return (uvec2(_cond) * _true) + (uvec2(not(_cond) ) * _false); } uvec3 select(bvec3 _cond, uvec3 _true, uvec3 _false) { return (uvec3(_cond) * _true) + (uvec3(not(_cond) ) * _false); } uvec4 select(bvec4 _cond, uvec4 _true, uvec4 _false) { return (uvec4(_cond) * _true) + (uvec4(not(_cond) ) * _false); } -#endif // !BX_SHADER_LANGUAGE_DXIL +# endif // BGFX_SHADER_LANGUAGE_* +#endif // !BGFX_SHADER_LANGUAGE_DXIL uniform vec4 u_viewRect; uniform vec4 u_viewTexel;