From 6eee3cca63274af17b44df2e0d8204c08bc1518e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Mon, 24 Feb 2014 21:44:12 -0800 Subject: [PATCH] Added shadow samplers and updated example 15-shadowmaps-simple to use them. --- examples/15-shadowmaps-simple/fs_sms_mesh.sc | 11 + .../15-shadowmaps-simple/fs_sms_mesh_pd.sc | 11 + .../15-shadowmaps-simple/fs_sms_shadow.sc | 11 + .../{fs_smsimple_draw.sc => fs_sms_shadow.sh} | 36 +- ...imple_packdepth.sc => fs_sms_shadow_pd.sc} | 1 - .../shadowmaps_simple.cpp | 71 ++-- .../{vs_smsimple_draw.sc => vs_sms_mesh.sc} | 0 .../15-shadowmaps-simple/vs_sms_shadow.sc | 13 + ...imple_packdepth.sc => vs_sms_shadow_pd.sc} | 0 examples/runtime/shaders/dx11/fs_sms_mesh.bin | Bin 0 -> 5655 bytes .../runtime/shaders/dx11/fs_sms_mesh_pd.bin | Bin 0 -> 6471 bytes .../runtime/shaders/dx11/fs_sms_shadow.bin | Bin 0 -> 462 bytes ...ple_packdepth.bin => fs_sms_shadow_pd.bin} | Bin .../runtime/shaders/dx11/fs_smsimple_draw.bin | Bin 9867 -> 0 bytes .../{vs_smsimple_draw.bin => vs_sms_mesh.bin} | Bin .../runtime/shaders/dx11/vs_sms_shadow.bin | Bin 0 -> 1128 bytes ...ple_packdepth.bin => vs_sms_shadow_pd.bin} | Bin examples/runtime/shaders/dx9/fs_sms_mesh.bin | Bin 0 -> 2446 bytes .../runtime/shaders/dx9/fs_sms_mesh_pd.bin | Bin 0 -> 3282 bytes .../runtime/shaders/dx9/fs_sms_shadow.bin | Bin 0 -> 149 bytes ...ple_packdepth.bin => fs_sms_shadow_pd.bin} | Bin .../runtime/shaders/dx9/fs_smsimple_draw.bin | Bin 5654 -> 0 bytes .../{vs_smsimple_draw.bin => vs_sms_mesh.bin} | Bin .../runtime/shaders/dx9/vs_sms_shadow.bin | Bin 0 -> 283 bytes ...ple_packdepth.bin => vs_sms_shadow_pd.bin} | Bin examples/runtime/shaders/gles/fs_sms_mesh.bin | Bin 0 -> 7574 bytes .../runtime/shaders/gles/fs_sms_mesh_pd.bin | Bin 0 -> 7795 bytes .../runtime/shaders/gles/fs_sms_shadow.bin | Bin 0 -> 70 bytes ...ple_packdepth.bin => fs_sms_shadow_pd.bin} | Bin .../runtime/shaders/gles/fs_smsimple_draw.bin | 389 ------------------ .../{vs_smsimple_draw.bin => vs_sms_mesh.bin} | Bin .../runtime/shaders/gles/vs_sms_shadow.bin | Bin 0 -> 196 bytes ...ple_packdepth.bin => vs_sms_shadow_pd.bin} | Bin examples/runtime/shaders/glsl/fs_sms_mesh.bin | Bin 0 -> 7543 bytes .../runtime/shaders/glsl/fs_sms_mesh_pd.bin | Bin 0 -> 7785 bytes .../runtime/shaders/glsl/fs_sms_shadow.bin | Bin 0 -> 70 bytes ...ple_packdepth.bin => fs_sms_shadow_pd.bin} | Bin .../runtime/shaders/glsl/fs_smsimple_draw.bin | 389 ------------------ .../{vs_smsimple_draw.bin => vs_sms_mesh.bin} | Bin .../runtime/shaders/glsl/vs_sms_shadow.bin | Bin 0 -> 196 bytes ...ple_packdepth.bin => vs_sms_shadow_pd.bin} | Bin src/bgfx_shader.sh | 16 +- src/renderer_d3d11.cpp | 27 +- src/renderer_d3d11.h | 8 +- src/renderer_gl.cpp | 21 +- src/renderer_gl.h | 2 + tools/shaderc/shaderc.cpp | 15 + 47 files changed, 178 insertions(+), 843 deletions(-) create mode 100644 examples/15-shadowmaps-simple/fs_sms_mesh.sc create mode 100644 examples/15-shadowmaps-simple/fs_sms_mesh_pd.sc create mode 100644 examples/15-shadowmaps-simple/fs_sms_shadow.sc rename examples/15-shadowmaps-simple/{fs_smsimple_draw.sc => fs_sms_shadow.sh} (80%) rename examples/15-shadowmaps-simple/{fs_smsimple_packdepth.sc => fs_sms_shadow_pd.sc} (99%) rename examples/15-shadowmaps-simple/{vs_smsimple_draw.sc => vs_sms_mesh.sc} (100%) create mode 100644 examples/15-shadowmaps-simple/vs_sms_shadow.sc rename examples/15-shadowmaps-simple/{vs_smsimple_packdepth.sc => vs_sms_shadow_pd.sc} (100%) create mode 100644 examples/runtime/shaders/dx11/fs_sms_mesh.bin create mode 100644 examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin create mode 100644 examples/runtime/shaders/dx11/fs_sms_shadow.bin rename examples/runtime/shaders/dx11/{fs_smsimple_packdepth.bin => fs_sms_shadow_pd.bin} (100%) delete mode 100644 examples/runtime/shaders/dx11/fs_smsimple_draw.bin rename examples/runtime/shaders/dx11/{vs_smsimple_draw.bin => vs_sms_mesh.bin} (100%) create mode 100644 examples/runtime/shaders/dx11/vs_sms_shadow.bin rename examples/runtime/shaders/dx11/{vs_smsimple_packdepth.bin => vs_sms_shadow_pd.bin} (100%) create mode 100644 examples/runtime/shaders/dx9/fs_sms_mesh.bin create mode 100644 examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin create mode 100644 examples/runtime/shaders/dx9/fs_sms_shadow.bin rename examples/runtime/shaders/dx9/{fs_smsimple_packdepth.bin => fs_sms_shadow_pd.bin} (100%) delete mode 100644 examples/runtime/shaders/dx9/fs_smsimple_draw.bin rename examples/runtime/shaders/dx9/{vs_smsimple_draw.bin => vs_sms_mesh.bin} (100%) create mode 100644 examples/runtime/shaders/dx9/vs_sms_shadow.bin rename examples/runtime/shaders/dx9/{vs_smsimple_packdepth.bin => vs_sms_shadow_pd.bin} (100%) create mode 100644 examples/runtime/shaders/gles/fs_sms_mesh.bin create mode 100644 examples/runtime/shaders/gles/fs_sms_mesh_pd.bin create mode 100644 examples/runtime/shaders/gles/fs_sms_shadow.bin rename examples/runtime/shaders/gles/{fs_smsimple_packdepth.bin => fs_sms_shadow_pd.bin} (100%) delete mode 100644 examples/runtime/shaders/gles/fs_smsimple_draw.bin rename examples/runtime/shaders/gles/{vs_smsimple_draw.bin => vs_sms_mesh.bin} (100%) create mode 100644 examples/runtime/shaders/gles/vs_sms_shadow.bin rename examples/runtime/shaders/gles/{vs_smsimple_packdepth.bin => vs_sms_shadow_pd.bin} (100%) create mode 100644 examples/runtime/shaders/glsl/fs_sms_mesh.bin create mode 100644 examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin create mode 100644 examples/runtime/shaders/glsl/fs_sms_shadow.bin rename examples/runtime/shaders/glsl/{fs_smsimple_packdepth.bin => fs_sms_shadow_pd.bin} (100%) delete mode 100644 examples/runtime/shaders/glsl/fs_smsimple_draw.bin rename examples/runtime/shaders/glsl/{vs_smsimple_draw.bin => vs_sms_mesh.bin} (100%) create mode 100644 examples/runtime/shaders/glsl/vs_sms_shadow.bin rename examples/runtime/shaders/glsl/{vs_smsimple_packdepth.bin => vs_sms_shadow_pd.bin} (100%) diff --git a/examples/15-shadowmaps-simple/fs_sms_mesh.sc b/examples/15-shadowmaps-simple/fs_sms_mesh.sc new file mode 100644 index 00000000..949af404 --- /dev/null +++ b/examples/15-shadowmaps-simple/fs_sms_mesh.sc @@ -0,0 +1,11 @@ +$input v_view, v_normal, v_shadowcoord + +/* + * Copyright 2013-2014 Dario Manesku. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include "../common/common.sh" + +#define SHADOW_PACKED_DEPTH 0 +#include "fs_sms_shadow.sh" diff --git a/examples/15-shadowmaps-simple/fs_sms_mesh_pd.sc b/examples/15-shadowmaps-simple/fs_sms_mesh_pd.sc new file mode 100644 index 00000000..ca27f46f --- /dev/null +++ b/examples/15-shadowmaps-simple/fs_sms_mesh_pd.sc @@ -0,0 +1,11 @@ +$input v_view, v_normal, v_shadowcoord + +/* + * Copyright 2013-2014 Dario Manesku. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include "../common/common.sh" + +#define SHADOW_PACKED_DEPTH 1 +#include "fs_sms_shadow.sh" diff --git a/examples/15-shadowmaps-simple/fs_sms_shadow.sc b/examples/15-shadowmaps-simple/fs_sms_shadow.sc new file mode 100644 index 00000000..5a9356d8 --- /dev/null +++ b/examples/15-shadowmaps-simple/fs_sms_shadow.sc @@ -0,0 +1,11 @@ +/* + * Copyright 2013-2014 Dario Manesku. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include "../common/common.sh" + +void main() +{ + gl_FragColor = vec4_splat(0.0); +} diff --git a/examples/15-shadowmaps-simple/fs_smsimple_draw.sc b/examples/15-shadowmaps-simple/fs_sms_shadow.sh similarity index 80% rename from examples/15-shadowmaps-simple/fs_smsimple_draw.sc rename to examples/15-shadowmaps-simple/fs_sms_shadow.sh index 7cf8c2fb..50c6d01c 100644 --- a/examples/15-shadowmaps-simple/fs_smsimple_draw.sc +++ b/examples/15-shadowmaps-simple/fs_sms_shadow.sh @@ -1,5 +1,3 @@ -$input v_view, v_normal, v_shadowcoord - /* * Copyright 2013-2014 Dario Manesku. All rights reserved. * License: http://www.opensource.org/licenses/BSD-2-Clause @@ -8,7 +6,13 @@ $input v_view, v_normal, v_shadowcoord #include "../common/common.sh" uniform vec4 u_lightPos; +#if SHADOW_PACKED_DEPTH SAMPLER2D(u_shadowMap, 4); +# define Sampler sampler2D +#else +SAMPLER2DSHADOW(u_shadowMap, 4); +# define Sampler sampler2DShadow +#endif // SHADOW_PACKED_DEPTH vec2 lit(vec3 _ld, vec3 _n, vec3 _vd, float _exp) { @@ -23,7 +27,17 @@ vec2 lit(vec3 _ld, vec3 _n, vec3 _vd, float _exp) return max(vec2(ndotl, spec), 0.0); } -float hardShadow(sampler2D _sampler, vec4 _shadowCoord, float _bias) +float hardShadow(Sampler _sampler, vec4 _shadowCoord, float _bias) +{ + vec3 texCoord = _shadowCoord.xyz/_shadowCoord.w; +#if SHADOW_PACKED_DEPTH + return step(texCoord.z-_bias, unpackRgbaToFloat(texture2D(_sampler, texCoord.xy) ) ); +#else + return shadow2D(_sampler, vec3(texCoord.xy, texCoord.z-_bias) ); +#endif // SHADOW_PACKED_DEPTH +} + +float PCF(Sampler _sampler, vec4 _shadowCoord, float _bias, vec2 _texelSize) { vec2 texCoord = _shadowCoord.xy/_shadowCoord.w; @@ -36,15 +50,6 @@ float hardShadow(sampler2D _sampler, vec4 _shadowCoord, float _bias) return 1.0; } - float receiver = (_shadowCoord.z-_bias)/_shadowCoord.w; - float occluder = unpackRgbaToFloat(texture2D(_sampler, texCoord) ); - - float visibility = step(receiver, occluder); - return visibility; -} - -float PCF(sampler2D _sampler, vec4 _shadowCoord, float _bias, vec2 _texelSize) -{ float result = 0.0; vec2 offset = _texelSize * _shadowCoord.w; @@ -73,8 +78,8 @@ float PCF(sampler2D _sampler, vec4 _shadowCoord, float _bias, vec2 _texelSize) void main() { - const float shadowMapBias = 0.005; - const vec3 color = vec3_splat(1.0); + float shadowMapBias = 0.005; + vec3 color = vec3_splat(1.0); vec3 v = v_view; vec3 vd = -normalize(v); @@ -91,6 +96,5 @@ void main() vec3 brdf = (lc.x + lc.y) * color * visibility; vec3 final = toGamma(abs(ambient + brdf) ); - gl_FragColor.xyz = final; - gl_FragColor.w = 1.0; + gl_FragColor = vec4(final, 1.0); } diff --git a/examples/15-shadowmaps-simple/fs_smsimple_packdepth.sc b/examples/15-shadowmaps-simple/fs_sms_shadow_pd.sc similarity index 99% rename from examples/15-shadowmaps-simple/fs_smsimple_packdepth.sc rename to examples/15-shadowmaps-simple/fs_sms_shadow_pd.sc index 5433f91b..86dc0391 100644 --- a/examples/15-shadowmaps-simple/fs_smsimple_packdepth.sc +++ b/examples/15-shadowmaps-simple/fs_sms_shadow_pd.sc @@ -12,4 +12,3 @@ void main() float depth = v_position.z/v_position.w * 0.5 + 0.5; gl_FragColor = packFloatToRgba(depth); } - diff --git a/examples/15-shadowmaps-simple/shadowmaps_simple.cpp b/examples/15-shadowmaps-simple/shadowmaps_simple.cpp index f81d3249..225b2e2c 100644 --- a/examples/15-shadowmaps-simple/shadowmaps_simple.cpp +++ b/examples/15-shadowmaps-simple/shadowmaps_simple.cpp @@ -462,10 +462,6 @@ int _main_(int /*_argc*/, char** /*_argv*/) bgfx::UniformHandle u_lightPos = bgfx::createUniform("u_lightPos", bgfx::UniformType::Uniform4fv); bgfx::UniformHandle u_lightMtx = bgfx::createUniform("u_lightMtx", bgfx::UniformType::Uniform4x4fv); - // Programs. - bgfx::ProgramHandle progPackDepth = loadProgram("vs_smsimple_packdepth", "fs_smsimple_packdepth"); - bgfx::ProgramHandle progDraw = loadProgram("vs_smsimple_draw", "fs_smsimple_draw"); - // Vertex declarations. bgfx::VertexDecl PosNormalDecl; PosNormalDecl.begin(); @@ -486,12 +482,41 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Render targets. uint16_t shadowMapSize = 512; - bgfx::TextureHandle fbtextures[] = + // Get renderer capabilities info. + //const bgfx::Caps* caps = bgfx::getCaps(); + // Shadow samplers are supported at least partially supported if texture + // compare less equal feature is supported. + bool shadowSamplerSupported = false; //0 != (caps->supported & BGFX_CAPS_TEXTURE_COMPARE_LEQUAL); + + bgfx::ProgramHandle progShadow; + bgfx::ProgramHandle progMesh; + + if (shadowSamplerSupported) { - bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT), - bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY), - }; - s_shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true); + // Depth textures and shadow samplers are supported. + progShadow = loadProgram("vs_sms_shadow", "fs_sms_shadow"); + progMesh = loadProgram("vs_sms_mesh", "fs_sms_mesh"); + + bgfx::TextureHandle fbtextures[] = + { + bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_COMPARE_LEQUAL), + }; + s_shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true); + } + else + { + // Depth textures and shadow samplers are not supported. Use float + // depth packing into color buffer instead. + progShadow = loadProgram("vs_sms_shadow_pd", "fs_sms_shadow_pd"); + progMesh = loadProgram("vs_sms_mesh", "fs_sms_mesh_pd"); + + bgfx::TextureHandle fbtextures[] = + { + bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_RT), + bgfx::createTexture2D(shadowMapSize, shadowMapSize, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY), + }; + s_shadowMapFB = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true); + } // Set view and projection matrices. float view[16]; @@ -527,7 +552,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Use debug font to print information about this example. bgfx::dbgTextClear(); bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/15-shadowmaps-simple"); - bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Shadow maps example."); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Shadow maps example (technique: %s).", shadowSamplerSupported ? "depth texture and shadow samplers" : "shadow depth packed into color texture"); bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); // Setup lights. @@ -569,11 +594,6 @@ int _main_(int /*_argc*/, char** /*_argv*/) ); // Define matrices. - float screenView[16]; - float screenProj[16]; - mtxIdentity(screenView); - mtxOrtho(screenProj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f); - float lightView[16]; float lightProj[16]; @@ -601,7 +621,6 @@ int _main_(int /*_argc*/, char** /*_argv*/) , BGFX_CLEAR_COLOR_BIT | BGFX_CLEAR_DEPTH_BIT , 0x303030ff, 1.0f, 0 ); - bgfx::submitMask(RENDER_SHADOW_PASS_BIT|RENDER_SCENE_PASS_BIT); // Render. float mtxShadow[16]; @@ -623,26 +642,26 @@ int _main_(int /*_argc*/, char** /*_argv*/) // Floor. mtxMul(lightMtx, mtxFloor, mtxShadow); bgfx::setUniform(u_lightMtx, lightMtx); - hplaneMesh.submit(RENDER_SCENE_PASS_ID, mtxFloor, progDraw); - hplaneMesh.submitShadow(RENDER_SHADOW_PASS_ID, mtxFloor, progPackDepth); + hplaneMesh.submit(RENDER_SCENE_PASS_ID, mtxFloor, progMesh); + hplaneMesh.submitShadow(RENDER_SHADOW_PASS_ID, mtxFloor, progShadow); // Bunny. mtxMul(lightMtx, mtxBunny, mtxShadow); bgfx::setUniform(u_lightMtx, lightMtx); - bunnyMesh.submit(RENDER_SCENE_PASS_ID, mtxBunny, progDraw); - bunnyMesh.submitShadow(RENDER_SHADOW_PASS_ID, mtxBunny, progPackDepth); + bunnyMesh.submit(RENDER_SCENE_PASS_ID, mtxBunny, progMesh); + bunnyMesh.submitShadow(RENDER_SHADOW_PASS_ID, mtxBunny, progShadow); // Hollow cube. mtxMul(lightMtx, mtxHollowcube, mtxShadow); bgfx::setUniform(u_lightMtx, lightMtx); - hollowcubeMesh.submit(RENDER_SCENE_PASS_ID, mtxHollowcube, progDraw); - hollowcubeMesh.submitShadow(RENDER_SHADOW_PASS_ID, mtxHollowcube, progPackDepth); + hollowcubeMesh.submit(RENDER_SCENE_PASS_ID, mtxHollowcube, progMesh); + hollowcubeMesh.submitShadow(RENDER_SHADOW_PASS_ID, mtxHollowcube, progShadow); // Cube. mtxMul(lightMtx, mtxCube, mtxShadow); bgfx::setUniform(u_lightMtx, lightMtx); - cubeMesh.submit(RENDER_SCENE_PASS_ID, mtxCube, progDraw); - cubeMesh.submitShadow(RENDER_SHADOW_PASS_ID, mtxCube, progPackDepth); + cubeMesh.submit(RENDER_SCENE_PASS_ID, mtxCube, progMesh); + cubeMesh.submitShadow(RENDER_SHADOW_PASS_ID, mtxCube, progShadow); // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. @@ -655,8 +674,8 @@ int _main_(int /*_argc*/, char** /*_argv*/) hollowcubeMesh.unload(); hplaneMesh.unload(); - bgfx::destroyProgram(progPackDepth); - bgfx::destroyProgram(progDraw); + bgfx::destroyProgram(progShadow); + bgfx::destroyProgram(progMesh); bgfx::destroyFrameBuffer(s_shadowMapFB); diff --git a/examples/15-shadowmaps-simple/vs_smsimple_draw.sc b/examples/15-shadowmaps-simple/vs_sms_mesh.sc similarity index 100% rename from examples/15-shadowmaps-simple/vs_smsimple_draw.sc rename to examples/15-shadowmaps-simple/vs_sms_mesh.sc diff --git a/examples/15-shadowmaps-simple/vs_sms_shadow.sc b/examples/15-shadowmaps-simple/vs_sms_shadow.sc new file mode 100644 index 00000000..681f3afb --- /dev/null +++ b/examples/15-shadowmaps-simple/vs_sms_shadow.sc @@ -0,0 +1,13 @@ +$input a_position + +/* + * Copyright 2013-2014 Dario Manesku. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include "../common/common.sh" + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); +} diff --git a/examples/15-shadowmaps-simple/vs_smsimple_packdepth.sc b/examples/15-shadowmaps-simple/vs_sms_shadow_pd.sc similarity index 100% rename from examples/15-shadowmaps-simple/vs_smsimple_packdepth.sc rename to examples/15-shadowmaps-simple/vs_sms_shadow_pd.sc diff --git a/examples/runtime/shaders/dx11/fs_sms_mesh.bin b/examples/runtime/shaders/dx11/fs_sms_mesh.bin new file mode 100644 index 0000000000000000000000000000000000000000..5abb7235a82cdcd28a133e9a55e1f181bcbf184c GIT binary patch literal 5655 zcmb7|O>9(E6vyvOVfrCLCE^EBnKUlc7_jvtfPB1uFhEi$nJJ_iO(`(gV#zeqR!nr! zG=!L#NZ7d11<`0sY7B7+CN{*432xlT(y%aH6T^xG|G)R{nZ9}RUWJp~ckesrf6hJs zd(XY|QK}rub z$8+=bs(bO^bnVo{^sHMV-eYRNsV#Tv;pLVO*zMnM`}Y;~=#u(>r7ub!s3G?~euK!I z)O(RP{o+dV0<+<+MY&h9_%{O>0`6_G7oyCd|4P%&~gyoFM0GX9R6v zikb)Uh7$@FAIF`r@jm7!vhl?9%;ZG5dR9@$%`bWw(<<5>nL1ss&DPG&6<;d9Ts$;f z87@{-Bh`9wuy%fCN+nXKI5JWmawE#+ zRpE$DE=4sH{1I|djM4t`!2_diX{mB(sQkkdQB9l^iFZV$^hFV<`&#YY4o!WsJLEU^ zjJlaT#~LS&q_KKcwSq zwl0s^DSX|J3kg5P>RdG4Vo{Nt`%0}88xzwoyH{g&5Re)`d%M{waW*3 zxP|>uW9-~NT~S_pe2(DAjhYm_WKq89=Dm!;@kQ#*KS|S z(HaCd-ck(_6PvB4hV6H~uAuy}m0pPWvKCeYw!hRF7)hgc$iZTE{q^k)YG={sYPtLQ zf~a5kwWN}Lt7yP-jvueKL6z&}u+lzdl7q@WTx!?vPMEp8#`dIk@O^bwFsgI{T zk0jUdtf-dh;Yu$F_kuB8>EU5qS<|FVkS4CwEEuc3Bv*@TT-$_AaNVttEnLCn13g+L zWeTzfp`%k>d9$<^W-SLSWz8oZsx z6sCITo}=$sGUmb5Jwn5nsneZ)0!qi?3svEtw;#?nQUkw9S{F7X*UYLvX0fzI@MxXc`3T+uVawoBFX*vGieMOF7*2)pP zq;WpTF|B4oUCKSvqdDM2j$q>JXg1Cv7;KUt>Z8v}!;mBX$#pbenHo8AhKUznN6s+1 ztTT*_J)zG9tDkYKQPL(z07kVKex7rN!CbOAQqC}Tt7~|)-us;6NFMeKv*%f7IICs` ze2!@~6St9X#Ic#HVX|t5xcEw%>N@SSDJw@?^Ryhz7T+t))wCam$;#1uEywU)P+h0p z51}sQF6Kb23qplzI>*{gg1wC^FD9q`0T=4iGqk4alc!(`=XzT5O$mN~q%{Kf!hcOASD_77c} zAG$0Xe)icB2GSl{Oynyi@%B?cmKgxeem(}<$1%dN>;V2rjkC0ePqS+$EhP8lk F+kZ+t&({C| literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin b/examples/runtime/shaders/dx11/fs_sms_mesh_pd.bin new file mode 100644 index 0000000000000000000000000000000000000000..fcba9c93e844c463f182ecf1448d9caf1b546f38 GIT binary patch literal 6471 zcmc(kPi&M$7{+J6LjNoXwL&S4!p3+|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`#6! zeJHZ3RzR2T+@&)eT^PDF_kMk^QoH@%K#2HwkMhRVsPuQGPCqW~J%0=19)g8fIrndO z?(E-L=Wl+=am=~%#=Qglx59KL=4|xbXj|~HpzVOP<%fHRXEpZ^DxE4A_q9u|WsLjY Ssm)8&vUrxt9?sw=vi|_bQ6d@u literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/dx11/fs_sms_shadow.bin b/examples/runtime/shaders/dx11/fs_sms_shadow.bin new file mode 100644 index 0000000000000000000000000000000000000000..7d1068629aecda34d2e37aa0b7a92c4f11522cf8 GIT binary patch literal 462 zcmZ<@_F!bd4mL2lL^wG!pZqlCa`esxvb_S%CCcUNL8>nK)d;o~Q0I>;B zJjlh>Eda@f z93aC|&&X2G($q-L*wE0BVfE_Op26;ZIzYW3`#FGE0f<2W#AgPx7#R40bZ}UFfPb)O zh^N0FgFg;EAmwO!LL7tKT|^tsVf_G&AP_ literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/dx11/fs_smsimple_packdepth.bin b/examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin similarity index 100% rename from examples/runtime/shaders/dx11/fs_smsimple_packdepth.bin rename to examples/runtime/shaders/dx11/fs_sms_shadow_pd.bin diff --git a/examples/runtime/shaders/dx11/fs_smsimple_draw.bin b/examples/runtime/shaders/dx11/fs_smsimple_draw.bin deleted file mode 100644 index 24df81546c6e46e1bc61a36f20b1b0496fd09298..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9867 zcmeI2PmI(>7RRf9zzj3)%7}l~C2r{8pSZ+;pzbcHObyI5Ljnxx9tmqSFlZ}7hRkFb z*4^yJbS5P0Nwe48JrFh_n~Vp&f(K$e;>Ck{F~N)ROpGTJ{Co;yD7t~%&y!Cb{%92h)xcxL+bV+#jnPu}m|8>qOK9veNh zbJxGWc>mld14Cb)zVNsECigvjPesFCdd#_1;!mr5mpS*=3gyKkRvu)sRm;x@2E&Ep9A?-k@f#t-)B|Ih_TSA!zYhT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8bH7i7`w+^8!!E zFqk*Rus(*EpWx_PY_ZYsdmUTmVc)JbKPk46Pr9DxPBL+Ih}Ao#%N= z_k2rlz=E##{$nlO-hbv-c)I7K{O)-B69@F;xDiwI@0{mFKHRFjAP${*!9Bk`FVIWx zdE!N0(3jrx^buz`c>%Y*-lulvRh8WH=%smqK6wF;F$_QR>PW~i@FTeuV^|+UZ12I* z9Se5>`i9@@^MW;UUMz+=xeJ&t^Qvx>dp>{D>u-g!w|y>??QmiXx45vj%&RJiEqbx< zZ?xyp&%COH48vl}oOW(lA49su7JXt1ey?K-W*XbbCtdFX%RjSOYwP)4Ak*@DK3{jq zZ#nTB4xKc%$TF`giLJevV&4;6^oa}H@`JYNXI>u(fx$hBUWyUpo1YAS>=wM?u!-3I z65nvFE%U09*s@R9XR+_oxWutF{mg4nLWW`cmN_kc*2fTwEgW5oE&7Jv>wU{S#5R7z zMLy}eZ?T`TX0zHo-?!c0aQR)WcU(c&d&9AoZf`jAD?Huv(b=`^4TpXlH}V2~d;+(; zpl#=E=Jk<~Vc^FU!}=IvK8B+^7VUY%?{!|VM)D%Qt65LxRo!NHb=mJN-D1mGkACJ= z<;36RP-~dK;nUdSbM%Q1oY)$M>1SRY30eGXkHi?($B;X*Eq;&NDE|iPxU0+F*gyB! z=4;Y=^L3Q`yNl(7{LwyBf68y~%$Ippx5>U`Pn7+ZcB9{0@K@$l-MOptd*DX@rpDO~ z-HN+f({%in#(9_iZJftlHo>`X;dWQviS2Fu4(s-Bu+Q`V33xj~T@uf@8 zZ|?H{Cem@}Z$AI^j^9duzFJ`Q1x(&}i$R7SXTT2qG}D+IndJYkj4GM<{~HkJ-T(8J Yb0gw<#{`rhj94*CBv5m_^RxTc_m32^ng9R* diff --git a/examples/runtime/shaders/dx11/vs_smsimple_draw.bin b/examples/runtime/shaders/dx11/vs_sms_mesh.bin similarity index 100% rename from examples/runtime/shaders/dx11/vs_smsimple_draw.bin rename to examples/runtime/shaders/dx11/vs_sms_mesh.bin diff --git a/examples/runtime/shaders/dx11/vs_sms_shadow.bin b/examples/runtime/shaders/dx11/vs_sms_shadow.bin new file mode 100644 index 0000000000000000000000000000000000000000..5e84b92085e16a889dfddadea4ff525ece1aefe5 GIT binary patch literal 1128 zcmb_bL2DCH5S}!vO+46Mgd!f^p$7#CB&}eeXtXg+pf+JQgbG3uldVbFx+P899Q_5g zdKE-OysU>FJa|-pL2uq9-u04`C+qiZ-b+f2HwWgunQy+CH~Zdf#mPqma>8XS5jl#_ z>{hq@rt4MO?tZD`Z^oq`vt-fAuHRjL(wP6;y!~V0>s<27w^wfltg&c`oZ}AdO^LjR z_Mso6B6jv(ZV5Jdc_{ZQP_cfW$a9exVoUTVNZ23n`4!K9RQGly2m*31Kx@#WI2J7> zO`g^ML+yLmiJirJz!mTel=4*b53$$aXP^{=zXbl8K#YsXTh0GK99Skq$NW#g`x?h5 zj_Mo(SLpjJ|2y#71pFuK1IHDI@(Vs?x4MVdvE4>jf`~*VGGdrm+3mTW=1C9*$NG!I z*99ef?J-A%C$P?F3{Kmplgx;$>w_4hUH7(Ib=%!QCHAJ9hIhZ+==eMSMps?6uc`d1 zv#Oj{z3Fz;vcI+6_F$wFsdOTJBb8W4CX;;gg0r%A9l5N+>sL@C7_m^Mr$tIdr%)~w z*O*iMM-FS4oEg|or8-J;@>%;BSOzC?mLK5Sa|a5R$O~u{sh!#3Bt1rKpoTVUwnV15 z-$aW8J#Cds!?>yO4Dl4k*TfBe0Q|hJo4Yv7nZ!E;@7-lxQ}Y1DOdlrK)Wz>5w{UGv X`A)eDoBt?#q;MvwMhtHJ|F-`DrRkHJ literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/dx11/vs_smsimple_packdepth.bin b/examples/runtime/shaders/dx11/vs_sms_shadow_pd.bin similarity index 100% rename from examples/runtime/shaders/dx11/vs_smsimple_packdepth.bin rename to examples/runtime/shaders/dx11/vs_sms_shadow_pd.bin diff --git a/examples/runtime/shaders/dx9/fs_sms_mesh.bin b/examples/runtime/shaders/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;UV^|Ckc zoKh}YN=}+6hAB8d(Hiz#PvMYn)R*>wq2ws8pN!^x=Iq;b1U85BE9R_?DKXDia)#PY qb)05&z1VdTQ-4iUu{u{61~uF`V2vsH;tA{He*}(W=7q^~vVQ^XJx+@N literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/dx9/fs_sms_shadow.bin b/examples/runtime/shaders/dx9/fs_sms_shadow.bin new file mode 100644 index 0000000000000000000000000000000000000000..bc17a1685dbf20a158cf7bc9f025b7f6975b805f GIT binary patch literal 149 zcmZ<@_F!ZHgAN7;=Kufy{TE|!4smpn0g5Su#DQX9X%NxKzyK02D2_LdH(>D1OfJeV z&QB{*&3MQv`WM3|VS5-t=h8;CY0eQ6l?;x*c|m`i_Pe!_uv z(?8HnKfs_}%ZO&tB3ebHi>Bu}@15&K31X<-j2`Ye&w0PjGiSb@o2!dX*m}C?$l&v} zt<5JJJ1fohs3YRY&r$L6{8!$P`8zk}&Wgw@G-57(IF^pcOZ+UL5rdnopz*km=7|sN zjBF9Wag;&cIGACtMhO{`s(<;@4%&35zgPW{5|i}l5& z)us9>d>(Dr=bO)3n_K8iHpV9#lUK$Y6Jujza!Vv|WW3fzR#{_kj<7c)iClV(b?7fwi~THT9XDqJ2%{z%K6L=RlJOKx80c zKM*HIecisqZWl+K#1BV|FM|I8*yM>PAB`j5lbWU4M~pP)Ja|MuDyEy~`Pd1JpX66*eILoNh`gP;DC*p_<(g*cuKI{$n zxxgZ{9R3`KtRHJi6J4ic=eQ0LiCGVGvCo=|8WoGI4RPf_Ir8NI@d}PuSHaN``U{8^ z^*B=ABH)?Lw;~6EOHrH{?vwi@*GIq&s!jwsdy{H+t-S>68p`U9~Ez< zcss0kE5Tc>y1&I`o(nap?r&vy3*=LEotC;zE8fcNH(w6%JypH;>Nf-5q5tl^7w;hz zZzZnNKt5OZw-UV7D&9)Hhv2)ux=u^%H)uxxoj27@7J9nLztldc5gpe)1Uk)0ZOI2l zEhX*KQU3f4P>oErCFmmNJj5wS2B^;@>_dlR4iiGBf=bDLg1L@rC@%FB+f>IH#ymBZ z1U5-bAJw`JPq|neb2j{6Xre>IPA=fFqCeaTOS4^G*`3;$M3+w;@ diff --git a/examples/runtime/shaders/dx9/vs_smsimple_draw.bin b/examples/runtime/shaders/dx9/vs_sms_mesh.bin similarity index 100% rename from examples/runtime/shaders/dx9/vs_smsimple_draw.bin rename to examples/runtime/shaders/dx9/vs_sms_mesh.bin diff --git a/examples/runtime/shaders/dx9/vs_sms_shadow.bin b/examples/runtime/shaders/dx9/vs_sms_shadow.bin new file mode 100644 index 0000000000000000000000000000000000000000..2402ba962d832aacf2234d98ba767fd9a460d3cb GIT binary patch literal 283 zcmWFw_F!ZH0!9Y@()ir`l+>KC%+&ILqWmmQpg0S|4+aM2fB*meS7vYyadeUastgAy z2a18Tf%puK3=9E4$^eL&fS3h{9e@}F(2QhY20|7f1X~G|FDs5WjyGWN%}g%JFV0UZ zQP2p|RPgW#_E8AVNK8pBQgF`CEy&CPGA#9sEcGl+jr5ES4GkIOAyzdoFz`=6Vn1L7 zx(q1Rz{v1q0Ruzm1fW}hh##m9#AlcQq#IyjOklB9U@@S(LHZtmznR=dlK@_qZosQa5ctn5P5K>t~ttG7kF?(NH_80KC+ zJ-;j#6#8w~)c5@jW^}W`%~#F6D*BzD_E9?A7*^0tWJmYeRdG{4sRCC{+r_juE2PoO6$1PF7x>&SG~`g~ZGTZO zP9Z}`snnoG`*_;m#R4%U=0_BzGWe+8sWpDl)<|fqJ*=hQ@@ZIaxJr+Y>F8*9ERY`w zrH-lZN zpSbB*5EZ7Tltme`|5BUXVH1bY1iQ`QAZ8EGB0Q=#N586W5!GZ$hbgfjiel4^)mhWk z<098VAJjKJ_EmZ2OlgAH-RJgEk8HPWwF-*cUad2h^KAL@h_p0mTTHZpNdz7OJs1jk zTP_`H20v-CZfEQ621HoZnezkL{-O-qQ`5naZrmT#n?Bdskn8B&GI;qYLrE1^Oy(iq zqEx1%BLRkVp%V=0G*#Krm}QBtOn_1^Uuec|w+MKFh3FBuVX;Sf%i!!GyO|ZZH0=VI z!mC_`Lx-6vY!eEXW?1#0NigQHYAVi&#AsiF#CBX`L%Lw=A)V(EyGUZsC3b0vgW-ql z)x5-2EOEBNoe6nqwO*8KxU3|Fx$nxeSmCv(@LE(@ch2gHQm?qeXH$g{z={~YPZY7{ zj?*alnJ$5ls7>T{3EdfzDXev(hIQMfLt{G@o#xKd#A#l`nyenR35-f@LU+#U6{h+} z#{MgrmbD3OnZg>zPbtg|r%~~93X^MsCZQ3dd|%Osb!SK}aSYs{5$jQN8zkn=(}c~5 z#ANkYVlPX~`KHMLBZ%m> zAk`%-H=Lbk9YP|7bGw9JTzjI9FgNfzG8sXC=@%?mHKQ&WWJIs3frCpmQ8_E&?3_#sVWCRl<(@&CP=jAya{K zyRefu=Te+=66YMZor^i=M9yJU6qs|)an8Aja|mDpr#a`i-P}Cq5Hb=N+P>nS!%pIy zOL5Ls!vE##PmpJEBobwXr zJolZCIp;;rVN_I@bIxP*o zhxzuHgYwXyj9WBLMzZ2;X52b2&gk({GZt#Fx15FA%njMh4Owg`93tfD>9DVyWxCAm z_{{BiY^PmjhL%3_Ayu@QcdGQ=nZ_@An-tCz!%;<7`Bh-d@yn9l!*vHU!yvtJIalG} zt^Rr_=v}?Rfk{c{FYOPKE$pDZR?yKHPW;}4GqU9~R&qQrap5!#2Wwpx>*z0~ntp1J aBCmHBpZ4|jhi2F8hxcQ&?q4S-zx@v{^`?RV literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin b/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin new file mode 100644 index 0000000000000000000000000000000000000000..e13152f0f094eb4e70feea3de7b025128855118e GIT binary patch literal 7795 zcmb_hT~F&c5Z!%S^;h^YU7(xzqaQ--%UxaFmzA!x`(EWjfUXLu+CqUV{`=01o!CyM zO(|BOop>&;m3W>%mg|Rnc{vE0H8gMT^P6&a zU6$*c=o=1sUKG2_!PDd77RI6-EuQ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(Tw_7tio1l+ZcLjd;(Ah@G9 zJk1dRhmLjZOMT+kiykbwKaLG*`v6-2##0qE!VdPqCNZ^s7#mm#umvc>Z48=)J^t)) zD~UPpBy8bS;9=ow?QUS*V-9*8?RpZ^(n&Bw?*}U$4q)(zBF8&Il@e3M$8kXk$+;ct zbiG_oVf_9uF0c~ds@dA(aDAkpFsPn{tDYS<)W6iO29`b6`uow2rm#Rc31H}GV8w$8 z94&COBb-csO6UhGAtpx=<6^xWOn*u)04o8e3X;cEUBUE=W%}eCQ29&fT2;yfs~%$w zF~Hcz@6D&A0I=er)NWNf)e$abP7eE_n}d}Q50T@Eaa{FsC-W)s9jpX+EF8R)%f{~R z<{d9^mU#I_S29%vNBSuUzkz^RMgt?n}8W*MOo%bvbw+41W0^ D2q%47 literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/gles/fs_sms_shadow.bin b/examples/runtime/shaders/gles/fs_sms_shadow.bin new file mode 100644 index 0000000000000000000000000000000000000000..d66f79aaf13a396a4adb9af04bfd5e8dfa958726 GIT binary patch literal 70 zcmZ<@_F!ZHg0lR~6ouTx%sd4RO|EJ#1%>pSc({2~Qgg|gIS6Ac4B104kv MLerY7mWzu40CJWPeE= 0.0)) - * - pow (max (0.0, dot (( - ((2.0 * tmpvar_3) * v_normal) - - tmpvar_2), -( - normalize(v_view) - ))), 1.0) - ) * 3.0) / 8.0); - lc_1 = max (tmpvar_4, 0.0); - lowp float result_5; - result_5 = 0.0; - vec2 tmpvar_6; - tmpvar_6 = (vec2(0.00195313, 0.00195313) * v_shadowcoord.w); - vec4 tmpvar_7; - tmpvar_7.zw = vec2(0.0, 0.0); - tmpvar_7.xy = (vec2(-1.5, -1.5) * tmpvar_6); - vec4 _shadowCoord_8; - _shadowCoord_8 = (v_shadowcoord + tmpvar_7); - lowp float tmpvar_9; - vec2 tmpvar_10; - tmpvar_10 = (_shadowCoord_8.xy / _shadowCoord_8.w); - bool tmpvar_11; - if (any(greaterThan (tmpvar_10, vec2(1.0, 1.0)))) { - tmpvar_11 = bool(1); - } else { - tmpvar_11 = any(lessThan (tmpvar_10, vec2(0.0, 0.0))); - }; - if (tmpvar_11) { - tmpvar_9 = 1.0; - } else { - tmpvar_9 = float((dot (texture2D (u_shadowMap, tmpvar_10), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_8.z - 0.005) - / _shadowCoord_8.w))); - }; - result_5 = tmpvar_9; - vec4 tmpvar_12; - tmpvar_12.zw = vec2(0.0, 0.0); - tmpvar_12.xy = (vec2(-1.5, -0.5) * tmpvar_6); - vec4 _shadowCoord_13; - _shadowCoord_13 = (v_shadowcoord + tmpvar_12); - lowp float tmpvar_14; - vec2 tmpvar_15; - tmpvar_15 = (_shadowCoord_13.xy / _shadowCoord_13.w); - bool tmpvar_16; - if (any(greaterThan (tmpvar_15, vec2(1.0, 1.0)))) { - tmpvar_16 = bool(1); - } else { - tmpvar_16 = any(lessThan (tmpvar_15, vec2(0.0, 0.0))); - }; - if (tmpvar_16) { - tmpvar_14 = 1.0; - } else { - tmpvar_14 = float((dot (texture2D (u_shadowMap, tmpvar_15), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_13.z - 0.005) - / _shadowCoord_13.w))); - }; - result_5 = (tmpvar_9 + tmpvar_14); - vec4 tmpvar_17; - tmpvar_17.zw = vec2(0.0, 0.0); - tmpvar_17.xy = (vec2(-1.5, 0.5) * tmpvar_6); - vec4 _shadowCoord_18; - _shadowCoord_18 = (v_shadowcoord + tmpvar_17); - lowp float tmpvar_19; - vec2 tmpvar_20; - tmpvar_20 = (_shadowCoord_18.xy / _shadowCoord_18.w); - bool tmpvar_21; - if (any(greaterThan (tmpvar_20, vec2(1.0, 1.0)))) { - tmpvar_21 = bool(1); - } else { - tmpvar_21 = any(lessThan (tmpvar_20, vec2(0.0, 0.0))); - }; - if (tmpvar_21) { - tmpvar_19 = 1.0; - } else { - tmpvar_19 = float((dot (texture2D (u_shadowMap, tmpvar_20), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_18.z - 0.005) - / _shadowCoord_18.w))); - }; - result_5 = (result_5 + tmpvar_19); - vec4 tmpvar_22; - tmpvar_22.zw = vec2(0.0, 0.0); - tmpvar_22.xy = (vec2(-1.5, 1.5) * tmpvar_6); - vec4 _shadowCoord_23; - _shadowCoord_23 = (v_shadowcoord + tmpvar_22); - lowp float tmpvar_24; - vec2 tmpvar_25; - tmpvar_25 = (_shadowCoord_23.xy / _shadowCoord_23.w); - bool tmpvar_26; - if (any(greaterThan (tmpvar_25, vec2(1.0, 1.0)))) { - tmpvar_26 = bool(1); - } else { - tmpvar_26 = any(lessThan (tmpvar_25, vec2(0.0, 0.0))); - }; - if (tmpvar_26) { - tmpvar_24 = 1.0; - } else { - tmpvar_24 = float((dot (texture2D (u_shadowMap, tmpvar_25), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_23.z - 0.005) - / _shadowCoord_23.w))); - }; - result_5 = (result_5 + tmpvar_24); - vec4 tmpvar_27; - tmpvar_27.zw = vec2(0.0, 0.0); - tmpvar_27.xy = (vec2(-0.5, -1.5) * tmpvar_6); - vec4 _shadowCoord_28; - _shadowCoord_28 = (v_shadowcoord + tmpvar_27); - lowp float tmpvar_29; - vec2 tmpvar_30; - tmpvar_30 = (_shadowCoord_28.xy / _shadowCoord_28.w); - bool tmpvar_31; - if (any(greaterThan (tmpvar_30, vec2(1.0, 1.0)))) { - tmpvar_31 = bool(1); - } else { - tmpvar_31 = any(lessThan (tmpvar_30, vec2(0.0, 0.0))); - }; - if (tmpvar_31) { - tmpvar_29 = 1.0; - } else { - tmpvar_29 = float((dot (texture2D (u_shadowMap, tmpvar_30), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_28.z - 0.005) - / _shadowCoord_28.w))); - }; - result_5 = (result_5 + tmpvar_29); - vec4 tmpvar_32; - tmpvar_32.zw = vec2(0.0, 0.0); - tmpvar_32.xy = (vec2(-0.5, -0.5) * tmpvar_6); - vec4 _shadowCoord_33; - _shadowCoord_33 = (v_shadowcoord + tmpvar_32); - lowp float tmpvar_34; - vec2 tmpvar_35; - tmpvar_35 = (_shadowCoord_33.xy / _shadowCoord_33.w); - bool tmpvar_36; - if (any(greaterThan (tmpvar_35, vec2(1.0, 1.0)))) { - tmpvar_36 = bool(1); - } else { - tmpvar_36 = any(lessThan (tmpvar_35, vec2(0.0, 0.0))); - }; - if (tmpvar_36) { - tmpvar_34 = 1.0; - } else { - tmpvar_34 = float((dot (texture2D (u_shadowMap, tmpvar_35), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_33.z - 0.005) - / _shadowCoord_33.w))); - }; - result_5 = (result_5 + tmpvar_34); - vec4 tmpvar_37; - tmpvar_37.zw = vec2(0.0, 0.0); - tmpvar_37.xy = (vec2(-0.5, 0.5) * tmpvar_6); - vec4 _shadowCoord_38; - _shadowCoord_38 = (v_shadowcoord + tmpvar_37); - lowp float tmpvar_39; - vec2 tmpvar_40; - tmpvar_40 = (_shadowCoord_38.xy / _shadowCoord_38.w); - bool tmpvar_41; - if (any(greaterThan (tmpvar_40, vec2(1.0, 1.0)))) { - tmpvar_41 = bool(1); - } else { - tmpvar_41 = any(lessThan (tmpvar_40, vec2(0.0, 0.0))); - }; - if (tmpvar_41) { - tmpvar_39 = 1.0; - } else { - tmpvar_39 = float((dot (texture2D (u_shadowMap, tmpvar_40), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_38.z - 0.005) - / _shadowCoord_38.w))); - }; - result_5 = (result_5 + tmpvar_39); - vec4 tmpvar_42; - tmpvar_42.zw = vec2(0.0, 0.0); - tmpvar_42.xy = (vec2(-0.5, 1.5) * tmpvar_6); - vec4 _shadowCoord_43; - _shadowCoord_43 = (v_shadowcoord + tmpvar_42); - lowp float tmpvar_44; - vec2 tmpvar_45; - tmpvar_45 = (_shadowCoord_43.xy / _shadowCoord_43.w); - bool tmpvar_46; - if (any(greaterThan (tmpvar_45, vec2(1.0, 1.0)))) { - tmpvar_46 = bool(1); - } else { - tmpvar_46 = any(lessThan (tmpvar_45, vec2(0.0, 0.0))); - }; - if (tmpvar_46) { - tmpvar_44 = 1.0; - } else { - tmpvar_44 = float((dot (texture2D (u_shadowMap, tmpvar_45), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_43.z - 0.005) - / _shadowCoord_43.w))); - }; - result_5 = (result_5 + tmpvar_44); - vec4 tmpvar_47; - tmpvar_47.zw = vec2(0.0, 0.0); - tmpvar_47.xy = (vec2(0.5, -1.5) * tmpvar_6); - vec4 _shadowCoord_48; - _shadowCoord_48 = (v_shadowcoord + tmpvar_47); - lowp float tmpvar_49; - vec2 tmpvar_50; - tmpvar_50 = (_shadowCoord_48.xy / _shadowCoord_48.w); - bool tmpvar_51; - if (any(greaterThan (tmpvar_50, vec2(1.0, 1.0)))) { - tmpvar_51 = bool(1); - } else { - tmpvar_51 = any(lessThan (tmpvar_50, vec2(0.0, 0.0))); - }; - if (tmpvar_51) { - tmpvar_49 = 1.0; - } else { - tmpvar_49 = float((dot (texture2D (u_shadowMap, tmpvar_50), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_48.z - 0.005) - / _shadowCoord_48.w))); - }; - result_5 = (result_5 + tmpvar_49); - vec4 tmpvar_52; - tmpvar_52.zw = vec2(0.0, 0.0); - tmpvar_52.xy = (vec2(0.5, -0.5) * tmpvar_6); - vec4 _shadowCoord_53; - _shadowCoord_53 = (v_shadowcoord + tmpvar_52); - lowp float tmpvar_54; - vec2 tmpvar_55; - tmpvar_55 = (_shadowCoord_53.xy / _shadowCoord_53.w); - bool tmpvar_56; - if (any(greaterThan (tmpvar_55, vec2(1.0, 1.0)))) { - tmpvar_56 = bool(1); - } else { - tmpvar_56 = any(lessThan (tmpvar_55, vec2(0.0, 0.0))); - }; - if (tmpvar_56) { - tmpvar_54 = 1.0; - } else { - tmpvar_54 = float((dot (texture2D (u_shadowMap, tmpvar_55), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_53.z - 0.005) - / _shadowCoord_53.w))); - }; - result_5 = (result_5 + tmpvar_54); - vec4 tmpvar_57; - tmpvar_57.zw = vec2(0.0, 0.0); - tmpvar_57.xy = (vec2(0.5, 0.5) * tmpvar_6); - vec4 _shadowCoord_58; - _shadowCoord_58 = (v_shadowcoord + tmpvar_57); - lowp float tmpvar_59; - vec2 tmpvar_60; - tmpvar_60 = (_shadowCoord_58.xy / _shadowCoord_58.w); - bool tmpvar_61; - if (any(greaterThan (tmpvar_60, vec2(1.0, 1.0)))) { - tmpvar_61 = bool(1); - } else { - tmpvar_61 = any(lessThan (tmpvar_60, vec2(0.0, 0.0))); - }; - if (tmpvar_61) { - tmpvar_59 = 1.0; - } else { - tmpvar_59 = float((dot (texture2D (u_shadowMap, tmpvar_60), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_58.z - 0.005) - / _shadowCoord_58.w))); - }; - result_5 = (result_5 + tmpvar_59); - vec4 tmpvar_62; - tmpvar_62.zw = vec2(0.0, 0.0); - tmpvar_62.xy = (vec2(0.5, 1.5) * tmpvar_6); - vec4 _shadowCoord_63; - _shadowCoord_63 = (v_shadowcoord + tmpvar_62); - lowp float tmpvar_64; - vec2 tmpvar_65; - tmpvar_65 = (_shadowCoord_63.xy / _shadowCoord_63.w); - bool tmpvar_66; - if (any(greaterThan (tmpvar_65, vec2(1.0, 1.0)))) { - tmpvar_66 = bool(1); - } else { - tmpvar_66 = any(lessThan (tmpvar_65, vec2(0.0, 0.0))); - }; - if (tmpvar_66) { - tmpvar_64 = 1.0; - } else { - tmpvar_64 = float((dot (texture2D (u_shadowMap, tmpvar_65), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_63.z - 0.005) - / _shadowCoord_63.w))); - }; - result_5 = (result_5 + tmpvar_64); - vec4 tmpvar_67; - tmpvar_67.zw = vec2(0.0, 0.0); - tmpvar_67.xy = (vec2(1.5, -1.5) * tmpvar_6); - vec4 _shadowCoord_68; - _shadowCoord_68 = (v_shadowcoord + tmpvar_67); - lowp float tmpvar_69; - vec2 tmpvar_70; - tmpvar_70 = (_shadowCoord_68.xy / _shadowCoord_68.w); - bool tmpvar_71; - if (any(greaterThan (tmpvar_70, vec2(1.0, 1.0)))) { - tmpvar_71 = bool(1); - } else { - tmpvar_71 = any(lessThan (tmpvar_70, vec2(0.0, 0.0))); - }; - if (tmpvar_71) { - tmpvar_69 = 1.0; - } else { - tmpvar_69 = float((dot (texture2D (u_shadowMap, tmpvar_70), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_68.z - 0.005) - / _shadowCoord_68.w))); - }; - result_5 = (result_5 + tmpvar_69); - vec4 tmpvar_72; - tmpvar_72.zw = vec2(0.0, 0.0); - tmpvar_72.xy = (vec2(1.5, -0.5) * tmpvar_6); - vec4 _shadowCoord_73; - _shadowCoord_73 = (v_shadowcoord + tmpvar_72); - lowp float tmpvar_74; - vec2 tmpvar_75; - tmpvar_75 = (_shadowCoord_73.xy / _shadowCoord_73.w); - bool tmpvar_76; - if (any(greaterThan (tmpvar_75, vec2(1.0, 1.0)))) { - tmpvar_76 = bool(1); - } else { - tmpvar_76 = any(lessThan (tmpvar_75, vec2(0.0, 0.0))); - }; - if (tmpvar_76) { - tmpvar_74 = 1.0; - } else { - tmpvar_74 = float((dot (texture2D (u_shadowMap, tmpvar_75), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_73.z - 0.005) - / _shadowCoord_73.w))); - }; - result_5 = (result_5 + tmpvar_74); - vec4 tmpvar_77; - tmpvar_77.zw = vec2(0.0, 0.0); - tmpvar_77.xy = (vec2(1.5, 0.5) * tmpvar_6); - vec4 _shadowCoord_78; - _shadowCoord_78 = (v_shadowcoord + tmpvar_77); - lowp float tmpvar_79; - vec2 tmpvar_80; - tmpvar_80 = (_shadowCoord_78.xy / _shadowCoord_78.w); - bool tmpvar_81; - if (any(greaterThan (tmpvar_80, vec2(1.0, 1.0)))) { - tmpvar_81 = bool(1); - } else { - tmpvar_81 = any(lessThan (tmpvar_80, vec2(0.0, 0.0))); - }; - if (tmpvar_81) { - tmpvar_79 = 1.0; - } else { - tmpvar_79 = float((dot (texture2D (u_shadowMap, tmpvar_80), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_78.z - 0.005) - / _shadowCoord_78.w))); - }; - result_5 = (result_5 + tmpvar_79); - vec4 tmpvar_82; - tmpvar_82.zw = vec2(0.0, 0.0); - tmpvar_82.xy = (vec2(1.5, 1.5) * tmpvar_6); - vec4 _shadowCoord_83; - _shadowCoord_83 = (v_shadowcoord + tmpvar_82); - lowp float tmpvar_84; - vec2 tmpvar_85; - tmpvar_85 = (_shadowCoord_83.xy / _shadowCoord_83.w); - bool tmpvar_86; - if (any(greaterThan (tmpvar_85, vec2(1.0, 1.0)))) { - tmpvar_86 = bool(1); - } else { - tmpvar_86 = any(lessThan (tmpvar_85, vec2(0.0, 0.0))); - }; - if (tmpvar_86) { - tmpvar_84 = 1.0; - } else { - tmpvar_84 = float((dot (texture2D (u_shadowMap, tmpvar_85), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_83.z - 0.005) - / _shadowCoord_83.w))); - }; - lowp float tmpvar_87; - tmpvar_87 = (result_5 + tmpvar_84); - result_5 = tmpvar_87; - gl_FragColor.xyz = pow (abs((vec3(0.1, 0.1, 0.1) + - (vec3((lc_1.x + lc_1.y)) * (tmpvar_87 / 16.0)) - )), vec3(0.454545, 0.454545, 0.454545)); - gl_FragColor.w = 1.0; -} - - \ No newline at end of file diff --git a/examples/runtime/shaders/gles/vs_smsimple_draw.bin b/examples/runtime/shaders/gles/vs_sms_mesh.bin similarity index 100% rename from examples/runtime/shaders/gles/vs_smsimple_draw.bin rename to examples/runtime/shaders/gles/vs_sms_mesh.bin diff --git a/examples/runtime/shaders/gles/vs_sms_shadow.bin b/examples/runtime/shaders/gles/vs_sms_shadow.bin new file mode 100644 index 0000000000000000000000000000000000000000..bb6aab4f3f68ea7feca923b16b7674171cc6e0db GIT binary patch literal 196 zcmWFw_F!ZHg2a-NqRgbyl2nDV)MR6Y#Q1{z;>?oF{5)%}(!9*H{Gwci+{6+Sh0^%k z{FKz3u*}r*fTH{?Yp$~V%oLzhW}bqECRa6=0!Y7!LP>5xSz=MVp*2td#?~uWuvIYB nGe8lmsH_5tB3q}Rke(AC0JR+`r-5drf)?CFO>3@NE-nTDfnq;2 literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/gles/vs_smsimple_packdepth.bin b/examples/runtime/shaders/gles/vs_sms_shadow_pd.bin similarity index 100% rename from examples/runtime/shaders/gles/vs_smsimple_packdepth.bin rename to examples/runtime/shaders/gles/vs_sms_shadow_pd.bin diff --git a/examples/runtime/shaders/glsl/fs_sms_mesh.bin b/examples/runtime/shaders/glsl/fs_sms_mesh.bin new file mode 100644 index 0000000000000000000000000000000000000000..453872ced28105094a1d4d5f14484d23325ae407 GIT binary patch literal 7543 zcmb7}TW{M&5QW>fLcd}ksm4~sy-|kYz9b0pQlLQkE- zNh3f)Er+wahjZp@xnI70{r!)J|Gqwz``7LLje6Q#8uhfkul9H4?tIo8wirI#mRHsD zWmWC3*gbmWX}ftopZ&PsUgKHHW7UuKZhLe4_)m4{ZXC+HhuvncKYt6k5K|}pyL>>( zYI~*b%I&?%=ChwOMQOC!U9R)<`iD`EcMn+9TGK##tuEAQRxf$`w#m9_7cZ}G^EriH z@2c{#eZce{HhB1|dQ@4v>611}hX=z7nu%=hIlFkllg*8OLc4gyjV#MBYcp?_wQ=gN z3$8@s@kbHKok* zko}k1><*hageKT+4hJ!Ncn#q#)j8T#HH#<)Q#wqE1yK~6uCLCD?j9Gp3i_b5>5VV* zGiP!WbZ)Nex7;(^qSh)XZd+cVPAq;(z91_lv$3G`wp6%Ng1sIW~a zoSSadohHGU-KwcL2NI)m2@>0WjdkgQt-ExdOY9dz( zORM&xT*G-GDa?JBpT!EVM1@zP!n$!*QWB+;AEdKc+CbCTJ2GG0OKHjaWB^FDigiX}o#ECqG3$)TI*f`6bJiKoIuo%D z0ZidE>kN0C8D||rB88`RVk5E6q*!Mp)*0?R6SK~Uti!0Ju;r|?oOLE*9RirbY1Ub8 zI6KZdg!B}CUn8~>>uid3R$`sy#e2N>MS>&jZtSs)L~Rqn4`{e)Y%Ai2w)1QQD?c~>^SNWGE{h~z)k|4 zOM%WxpmW@JE(VKj{h8X66aisbFL8npU!dH zxtMcK_AtX|GYLoC1=X{EDUgDhRzVk8XyvR9> ziVAbidCoZ>aSj1}g%OZy5}q5*k8=(oLxm>`EMd;4Fy|%AdG0$OW6q11!>A}Q$DHSw z^AY9{zywZX&U3%{am*oPDDc!STu7KJQke4+<_d1RBF0=HVh*E{zy-%#!7*1vm_tBc zU<3>+xcQ(F=+K-#&;i2na_}SiiGli)v;M4bhH^ZXIUb1QdX7Vn4{9XJBdR%@pl{x4 z^a;JBC&t6=6N8wbWDe@xV{h?IDtNOt4X1D&bFK<3o QyK3Kk3Zr%Zn$3RuACz3BJOBUy literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin b/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin new file mode 100644 index 0000000000000000000000000000000000000000..6ca76e3e4c1acc6f9864950cbf0d86e8105ff29a GIT binary patch literal 7785 zcmb_h+iv4F5N+QIe+3`qCQ&6`d_j=DY_Zsv0t>Y7hBi?W7fuw|&UKN0@63=ANoj1! zP7olGC~|msIA>-;e*Nd$ufIL~_wA`zzb@}@#8Y{x#M9!wTHh6`^HI>Op?Py#TvgAP zRkgl~zTuFkW%+zQdc0p=!&tPV#p7bNyt&8 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bl4Bw9IS+Rh#XIh<7$vQnNNxDU?sp~;oyB-K5=(9?|6Yj zw=s3`M*k2sFDYL6xVtCch-Kh~plikA$0orG9|dZD_=Ee*6S@IR vUm;*NcS45l3T=czE85@>nrc7Ui`JXf;_JG&`BJT_HK1rvosZr}qhJ09u!(t= literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/glsl/fs_sms_shadow.bin b/examples/runtime/shaders/glsl/fs_sms_shadow.bin new file mode 100644 index 0000000000000000000000000000000000000000..d66f79aaf13a396a4adb9af04bfd5e8dfa958726 GIT binary patch literal 70 zcmZ<@_F!ZHg0lR~6ouTx%sd4RO|EJ#1%>pSc({2~Qgg|gIS6Ac4B104kv MLerY7mWzu40CJWPeE= 0.0)) - * - pow (max (0.0, dot (( - ((2.0 * tmpvar_3) * v_normal) - - tmpvar_2), -( - normalize(v_view) - ))), 1.0) - ) * 3.0) / 8.0); - lc_1 = max (tmpvar_4, 0.0); - float result_5; - result_5 = 0.0; - vec2 tmpvar_6; - tmpvar_6 = (vec2(0.00195313, 0.00195313) * v_shadowcoord.w); - vec4 tmpvar_7; - tmpvar_7.zw = vec2(0.0, 0.0); - tmpvar_7.xy = (vec2(-1.5, -1.5) * tmpvar_6); - vec4 _shadowCoord_8; - _shadowCoord_8 = (v_shadowcoord + tmpvar_7); - float tmpvar_9; - vec2 tmpvar_10; - tmpvar_10 = (_shadowCoord_8.xy / _shadowCoord_8.w); - bool tmpvar_11; - if (any(greaterThan (tmpvar_10, vec2(1.0, 1.0)))) { - tmpvar_11 = bool(1); - } else { - tmpvar_11 = any(lessThan (tmpvar_10, vec2(0.0, 0.0))); - }; - if (tmpvar_11) { - tmpvar_9 = 1.0; - } else { - tmpvar_9 = float((dot (texture2D (u_shadowMap, tmpvar_10), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_8.z - 0.005) - / _shadowCoord_8.w))); - }; - result_5 = tmpvar_9; - vec4 tmpvar_12; - tmpvar_12.zw = vec2(0.0, 0.0); - tmpvar_12.xy = (vec2(-1.5, -0.5) * tmpvar_6); - vec4 _shadowCoord_13; - _shadowCoord_13 = (v_shadowcoord + tmpvar_12); - float tmpvar_14; - vec2 tmpvar_15; - tmpvar_15 = (_shadowCoord_13.xy / _shadowCoord_13.w); - bool tmpvar_16; - if (any(greaterThan (tmpvar_15, vec2(1.0, 1.0)))) { - tmpvar_16 = bool(1); - } else { - tmpvar_16 = any(lessThan (tmpvar_15, vec2(0.0, 0.0))); - }; - if (tmpvar_16) { - tmpvar_14 = 1.0; - } else { - tmpvar_14 = float((dot (texture2D (u_shadowMap, tmpvar_15), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_13.z - 0.005) - / _shadowCoord_13.w))); - }; - result_5 = (tmpvar_9 + tmpvar_14); - vec4 tmpvar_17; - tmpvar_17.zw = vec2(0.0, 0.0); - tmpvar_17.xy = (vec2(-1.5, 0.5) * tmpvar_6); - vec4 _shadowCoord_18; - _shadowCoord_18 = (v_shadowcoord + tmpvar_17); - float tmpvar_19; - vec2 tmpvar_20; - tmpvar_20 = (_shadowCoord_18.xy / _shadowCoord_18.w); - bool tmpvar_21; - if (any(greaterThan (tmpvar_20, vec2(1.0, 1.0)))) { - tmpvar_21 = bool(1); - } else { - tmpvar_21 = any(lessThan (tmpvar_20, vec2(0.0, 0.0))); - }; - if (tmpvar_21) { - tmpvar_19 = 1.0; - } else { - tmpvar_19 = float((dot (texture2D (u_shadowMap, tmpvar_20), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_18.z - 0.005) - / _shadowCoord_18.w))); - }; - result_5 = (result_5 + tmpvar_19); - vec4 tmpvar_22; - tmpvar_22.zw = vec2(0.0, 0.0); - tmpvar_22.xy = (vec2(-1.5, 1.5) * tmpvar_6); - vec4 _shadowCoord_23; - _shadowCoord_23 = (v_shadowcoord + tmpvar_22); - float tmpvar_24; - vec2 tmpvar_25; - tmpvar_25 = (_shadowCoord_23.xy / _shadowCoord_23.w); - bool tmpvar_26; - if (any(greaterThan (tmpvar_25, vec2(1.0, 1.0)))) { - tmpvar_26 = bool(1); - } else { - tmpvar_26 = any(lessThan (tmpvar_25, vec2(0.0, 0.0))); - }; - if (tmpvar_26) { - tmpvar_24 = 1.0; - } else { - tmpvar_24 = float((dot (texture2D (u_shadowMap, tmpvar_25), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_23.z - 0.005) - / _shadowCoord_23.w))); - }; - result_5 = (result_5 + tmpvar_24); - vec4 tmpvar_27; - tmpvar_27.zw = vec2(0.0, 0.0); - tmpvar_27.xy = (vec2(-0.5, -1.5) * tmpvar_6); - vec4 _shadowCoord_28; - _shadowCoord_28 = (v_shadowcoord + tmpvar_27); - float tmpvar_29; - vec2 tmpvar_30; - tmpvar_30 = (_shadowCoord_28.xy / _shadowCoord_28.w); - bool tmpvar_31; - if (any(greaterThan (tmpvar_30, vec2(1.0, 1.0)))) { - tmpvar_31 = bool(1); - } else { - tmpvar_31 = any(lessThan (tmpvar_30, vec2(0.0, 0.0))); - }; - if (tmpvar_31) { - tmpvar_29 = 1.0; - } else { - tmpvar_29 = float((dot (texture2D (u_shadowMap, tmpvar_30), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_28.z - 0.005) - / _shadowCoord_28.w))); - }; - result_5 = (result_5 + tmpvar_29); - vec4 tmpvar_32; - tmpvar_32.zw = vec2(0.0, 0.0); - tmpvar_32.xy = (vec2(-0.5, -0.5) * tmpvar_6); - vec4 _shadowCoord_33; - _shadowCoord_33 = (v_shadowcoord + tmpvar_32); - float tmpvar_34; - vec2 tmpvar_35; - tmpvar_35 = (_shadowCoord_33.xy / _shadowCoord_33.w); - bool tmpvar_36; - if (any(greaterThan (tmpvar_35, vec2(1.0, 1.0)))) { - tmpvar_36 = bool(1); - } else { - tmpvar_36 = any(lessThan (tmpvar_35, vec2(0.0, 0.0))); - }; - if (tmpvar_36) { - tmpvar_34 = 1.0; - } else { - tmpvar_34 = float((dot (texture2D (u_shadowMap, tmpvar_35), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_33.z - 0.005) - / _shadowCoord_33.w))); - }; - result_5 = (result_5 + tmpvar_34); - vec4 tmpvar_37; - tmpvar_37.zw = vec2(0.0, 0.0); - tmpvar_37.xy = (vec2(-0.5, 0.5) * tmpvar_6); - vec4 _shadowCoord_38; - _shadowCoord_38 = (v_shadowcoord + tmpvar_37); - float tmpvar_39; - vec2 tmpvar_40; - tmpvar_40 = (_shadowCoord_38.xy / _shadowCoord_38.w); - bool tmpvar_41; - if (any(greaterThan (tmpvar_40, vec2(1.0, 1.0)))) { - tmpvar_41 = bool(1); - } else { - tmpvar_41 = any(lessThan (tmpvar_40, vec2(0.0, 0.0))); - }; - if (tmpvar_41) { - tmpvar_39 = 1.0; - } else { - tmpvar_39 = float((dot (texture2D (u_shadowMap, tmpvar_40), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_38.z - 0.005) - / _shadowCoord_38.w))); - }; - result_5 = (result_5 + tmpvar_39); - vec4 tmpvar_42; - tmpvar_42.zw = vec2(0.0, 0.0); - tmpvar_42.xy = (vec2(-0.5, 1.5) * tmpvar_6); - vec4 _shadowCoord_43; - _shadowCoord_43 = (v_shadowcoord + tmpvar_42); - float tmpvar_44; - vec2 tmpvar_45; - tmpvar_45 = (_shadowCoord_43.xy / _shadowCoord_43.w); - bool tmpvar_46; - if (any(greaterThan (tmpvar_45, vec2(1.0, 1.0)))) { - tmpvar_46 = bool(1); - } else { - tmpvar_46 = any(lessThan (tmpvar_45, vec2(0.0, 0.0))); - }; - if (tmpvar_46) { - tmpvar_44 = 1.0; - } else { - tmpvar_44 = float((dot (texture2D (u_shadowMap, tmpvar_45), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_43.z - 0.005) - / _shadowCoord_43.w))); - }; - result_5 = (result_5 + tmpvar_44); - vec4 tmpvar_47; - tmpvar_47.zw = vec2(0.0, 0.0); - tmpvar_47.xy = (vec2(0.5, -1.5) * tmpvar_6); - vec4 _shadowCoord_48; - _shadowCoord_48 = (v_shadowcoord + tmpvar_47); - float tmpvar_49; - vec2 tmpvar_50; - tmpvar_50 = (_shadowCoord_48.xy / _shadowCoord_48.w); - bool tmpvar_51; - if (any(greaterThan (tmpvar_50, vec2(1.0, 1.0)))) { - tmpvar_51 = bool(1); - } else { - tmpvar_51 = any(lessThan (tmpvar_50, vec2(0.0, 0.0))); - }; - if (tmpvar_51) { - tmpvar_49 = 1.0; - } else { - tmpvar_49 = float((dot (texture2D (u_shadowMap, tmpvar_50), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_48.z - 0.005) - / _shadowCoord_48.w))); - }; - result_5 = (result_5 + tmpvar_49); - vec4 tmpvar_52; - tmpvar_52.zw = vec2(0.0, 0.0); - tmpvar_52.xy = (vec2(0.5, -0.5) * tmpvar_6); - vec4 _shadowCoord_53; - _shadowCoord_53 = (v_shadowcoord + tmpvar_52); - float tmpvar_54; - vec2 tmpvar_55; - tmpvar_55 = (_shadowCoord_53.xy / _shadowCoord_53.w); - bool tmpvar_56; - if (any(greaterThan (tmpvar_55, vec2(1.0, 1.0)))) { - tmpvar_56 = bool(1); - } else { - tmpvar_56 = any(lessThan (tmpvar_55, vec2(0.0, 0.0))); - }; - if (tmpvar_56) { - tmpvar_54 = 1.0; - } else { - tmpvar_54 = float((dot (texture2D (u_shadowMap, tmpvar_55), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_53.z - 0.005) - / _shadowCoord_53.w))); - }; - result_5 = (result_5 + tmpvar_54); - vec4 tmpvar_57; - tmpvar_57.zw = vec2(0.0, 0.0); - tmpvar_57.xy = (vec2(0.5, 0.5) * tmpvar_6); - vec4 _shadowCoord_58; - _shadowCoord_58 = (v_shadowcoord + tmpvar_57); - float tmpvar_59; - vec2 tmpvar_60; - tmpvar_60 = (_shadowCoord_58.xy / _shadowCoord_58.w); - bool tmpvar_61; - if (any(greaterThan (tmpvar_60, vec2(1.0, 1.0)))) { - tmpvar_61 = bool(1); - } else { - tmpvar_61 = any(lessThan (tmpvar_60, vec2(0.0, 0.0))); - }; - if (tmpvar_61) { - tmpvar_59 = 1.0; - } else { - tmpvar_59 = float((dot (texture2D (u_shadowMap, tmpvar_60), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_58.z - 0.005) - / _shadowCoord_58.w))); - }; - result_5 = (result_5 + tmpvar_59); - vec4 tmpvar_62; - tmpvar_62.zw = vec2(0.0, 0.0); - tmpvar_62.xy = (vec2(0.5, 1.5) * tmpvar_6); - vec4 _shadowCoord_63; - _shadowCoord_63 = (v_shadowcoord + tmpvar_62); - float tmpvar_64; - vec2 tmpvar_65; - tmpvar_65 = (_shadowCoord_63.xy / _shadowCoord_63.w); - bool tmpvar_66; - if (any(greaterThan (tmpvar_65, vec2(1.0, 1.0)))) { - tmpvar_66 = bool(1); - } else { - tmpvar_66 = any(lessThan (tmpvar_65, vec2(0.0, 0.0))); - }; - if (tmpvar_66) { - tmpvar_64 = 1.0; - } else { - tmpvar_64 = float((dot (texture2D (u_shadowMap, tmpvar_65), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_63.z - 0.005) - / _shadowCoord_63.w))); - }; - result_5 = (result_5 + tmpvar_64); - vec4 tmpvar_67; - tmpvar_67.zw = vec2(0.0, 0.0); - tmpvar_67.xy = (vec2(1.5, -1.5) * tmpvar_6); - vec4 _shadowCoord_68; - _shadowCoord_68 = (v_shadowcoord + tmpvar_67); - float tmpvar_69; - vec2 tmpvar_70; - tmpvar_70 = (_shadowCoord_68.xy / _shadowCoord_68.w); - bool tmpvar_71; - if (any(greaterThan (tmpvar_70, vec2(1.0, 1.0)))) { - tmpvar_71 = bool(1); - } else { - tmpvar_71 = any(lessThan (tmpvar_70, vec2(0.0, 0.0))); - }; - if (tmpvar_71) { - tmpvar_69 = 1.0; - } else { - tmpvar_69 = float((dot (texture2D (u_shadowMap, tmpvar_70), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_68.z - 0.005) - / _shadowCoord_68.w))); - }; - result_5 = (result_5 + tmpvar_69); - vec4 tmpvar_72; - tmpvar_72.zw = vec2(0.0, 0.0); - tmpvar_72.xy = (vec2(1.5, -0.5) * tmpvar_6); - vec4 _shadowCoord_73; - _shadowCoord_73 = (v_shadowcoord + tmpvar_72); - float tmpvar_74; - vec2 tmpvar_75; - tmpvar_75 = (_shadowCoord_73.xy / _shadowCoord_73.w); - bool tmpvar_76; - if (any(greaterThan (tmpvar_75, vec2(1.0, 1.0)))) { - tmpvar_76 = bool(1); - } else { - tmpvar_76 = any(lessThan (tmpvar_75, vec2(0.0, 0.0))); - }; - if (tmpvar_76) { - tmpvar_74 = 1.0; - } else { - tmpvar_74 = float((dot (texture2D (u_shadowMap, tmpvar_75), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_73.z - 0.005) - / _shadowCoord_73.w))); - }; - result_5 = (result_5 + tmpvar_74); - vec4 tmpvar_77; - tmpvar_77.zw = vec2(0.0, 0.0); - tmpvar_77.xy = (vec2(1.5, 0.5) * tmpvar_6); - vec4 _shadowCoord_78; - _shadowCoord_78 = (v_shadowcoord + tmpvar_77); - float tmpvar_79; - vec2 tmpvar_80; - tmpvar_80 = (_shadowCoord_78.xy / _shadowCoord_78.w); - bool tmpvar_81; - if (any(greaterThan (tmpvar_80, vec2(1.0, 1.0)))) { - tmpvar_81 = bool(1); - } else { - tmpvar_81 = any(lessThan (tmpvar_80, vec2(0.0, 0.0))); - }; - if (tmpvar_81) { - tmpvar_79 = 1.0; - } else { - tmpvar_79 = float((dot (texture2D (u_shadowMap, tmpvar_80), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_78.z - 0.005) - / _shadowCoord_78.w))); - }; - result_5 = (result_5 + tmpvar_79); - vec4 tmpvar_82; - tmpvar_82.zw = vec2(0.0, 0.0); - tmpvar_82.xy = (vec2(1.5, 1.5) * tmpvar_6); - vec4 _shadowCoord_83; - _shadowCoord_83 = (v_shadowcoord + tmpvar_82); - float tmpvar_84; - vec2 tmpvar_85; - tmpvar_85 = (_shadowCoord_83.xy / _shadowCoord_83.w); - bool tmpvar_86; - if (any(greaterThan (tmpvar_85, vec2(1.0, 1.0)))) { - tmpvar_86 = bool(1); - } else { - tmpvar_86 = any(lessThan (tmpvar_85, vec2(0.0, 0.0))); - }; - if (tmpvar_86) { - tmpvar_84 = 1.0; - } else { - tmpvar_84 = float((dot (texture2D (u_shadowMap, tmpvar_85), vec4(5.96046e-008, 1.52588e-005, 0.00390625, 1.0)) >= ( - (_shadowCoord_83.z - 0.005) - / _shadowCoord_83.w))); - }; - float tmpvar_87; - tmpvar_87 = (result_5 + tmpvar_84); - result_5 = tmpvar_87; - gl_FragColor.xyz = pow (abs((vec3(0.1, 0.1, 0.1) + - (vec3((lc_1.x + lc_1.y)) * (tmpvar_87 / 16.0)) - )), vec3(0.454545, 0.454545, 0.454545)); - gl_FragColor.w = 1.0; -} - - \ No newline at end of file diff --git a/examples/runtime/shaders/glsl/vs_smsimple_draw.bin b/examples/runtime/shaders/glsl/vs_sms_mesh.bin similarity index 100% rename from examples/runtime/shaders/glsl/vs_smsimple_draw.bin rename to examples/runtime/shaders/glsl/vs_sms_mesh.bin diff --git a/examples/runtime/shaders/glsl/vs_sms_shadow.bin b/examples/runtime/shaders/glsl/vs_sms_shadow.bin new file mode 100644 index 0000000000000000000000000000000000000000..bb6aab4f3f68ea7feca923b16b7674171cc6e0db GIT binary patch literal 196 zcmWFw_F!ZHg2a-NqRgbyl2nDV)MR6Y#Q1{z;>?oF{5)%}(!9*H{Gwci+{6+Sh0^%k z{FKz3u*}r*fTH{?Yp$~V%oLzhW}bqECRa6=0!Y7!LP>5xSz=MVp*2td#?~uWuvIYB nGe8lmsH_5tB3q}Rke(AC0JR+`r-5drf)?CFO>3@NE-nTDfnq;2 literal 0 HcmV?d00001 diff --git a/examples/runtime/shaders/glsl/vs_smsimple_packdepth.bin b/examples/runtime/shaders/glsl/vs_sms_shadow_pd.bin similarity index 100% rename from examples/runtime/shaders/glsl/vs_smsimple_packdepth.bin rename to examples/runtime/shaders/glsl/vs_sms_shadow_pd.bin diff --git a/src/bgfx_shader.sh b/src/bgfx_shader.sh index 39e96909..a9bad18d 100644 --- a/src/bgfx_shader.sh +++ b/src/bgfx_shader.sh @@ -55,13 +55,13 @@ struct BgfxSampler2DShadow float bgfxShadow2D(BgfxSampler2DShadow _sampler, vec3 _coord) { - return _sampler.m_texture.SampleCmp(_sampler.m_sampler, _coord.xy, _coord.z); + return _sampler.m_texture.SampleCmp(_sampler.m_sampler, _coord.xy, _coord.z * 2.0 - 1.0); } float bgfxShadow2DProj(BgfxSampler2DShadow _sampler, vec4 _coord) { vec3 coord = _coord.xyz * rcp(_coord.w); - return _sampler.m_texture.SampleCmp(_sampler.m_sampler, coord.xy, coord.z); + return _sampler.m_texture.SampleCmp(_sampler.m_sampler, coord.xy, coord.z * 2.0 - 1.0); } struct BgfxSampler3D @@ -144,15 +144,23 @@ vec4 bgfxTexture2DProj(sampler2D _sampler, vec4 _coord) float bgfxShadow2D(sampler2DShadow _sampler, vec3 _coord) { +#if 0 float occluder = tex2D(_sampler, _coord.xy).x; - return step(_coord.z, occluder); + return step(_coord.z * 2.0 - 1.0, occluder); +#else + return tex2Dproj(_sampler, vec4(_coord.xy, _coord.z * 2.0 - 1.0, 1.0) ).x; +#endif // 0 } float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord) { +#if 0 vec3 coord = _coord.xyz * rcp(_coord.w); float occluder = tex2D(_sampler, coord.xy).x; - return step(coord.z, occluder); + return step(coord.z * 2.0 - 1.0, occluder); +#else + return tex2Dproj(_sampler, _coord).x; +#endif // 0 } # define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg) diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index e3ecbbd0..8e010ecc 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -1510,8 +1510,15 @@ namespace bgfx s_renderCtx->m_currentProgram = &program; deviceCtx->VSSetShader( (ID3D11VertexShader*)program.m_vsh->m_ptr, NULL, 0); deviceCtx->VSSetConstantBuffers(0, 0, NULL); - deviceCtx->PSSetShader( (ID3D11PixelShader*)program.m_fsh->m_ptr, NULL, 0); - deviceCtx->PSSetConstantBuffers(0, 0, NULL); + if (NULL != s_renderCtx->m_currentColor) + { + deviceCtx->PSSetShader( (ID3D11PixelShader*)program.m_fsh->m_ptr, NULL, 0); + deviceCtx->PSSetConstantBuffers(0, 0, NULL); + } + else + { + deviceCtx->PSSetShader(NULL, NULL, 0); + } VertexBuffer& vb = s_renderCtx->m_vertexBuffers[m_vb->handle.idx]; VertexDecl& vertexDecl = s_renderCtx->m_vertexDecls[m_vb->decl.idx]; @@ -2418,8 +2425,8 @@ namespace bgfx { s_renderCtx->m_currentProgram = NULL; - deviceCtx->VSSetShader(NULL, 0, 0); - deviceCtx->PSSetShader(NULL, 0, 0); + deviceCtx->VSSetShader(NULL, NULL, 0); + deviceCtx->PSSetShader(NULL, NULL, 0); } else { @@ -2429,8 +2436,16 @@ namespace bgfx deviceCtx->VSSetShader( (ID3D11VertexShader*)program.m_vsh->m_ptr, NULL, 0); deviceCtx->VSSetConstantBuffers(0, 1, &program.m_vsh->m_buffer); - deviceCtx->PSSetShader( (ID3D11PixelShader*)program.m_fsh->m_ptr, NULL, 0); - deviceCtx->PSSetConstantBuffers(0, 1, &program.m_fsh->m_buffer); + if (NULL != s_renderCtx->m_currentColor) + { + const Shader* fsh = program.m_fsh; + deviceCtx->PSSetShader( (ID3D11PixelShader*)fsh->m_ptr, NULL, 0); + deviceCtx->PSSetConstantBuffers(0, 1, &fsh->m_buffer); + } + else + { + deviceCtx->PSSetShader(NULL, NULL, 0); + } } programChanged = diff --git a/src/renderer_d3d11.h b/src/renderer_d3d11.h index 0aec6ea2..c0de07a2 100644 --- a/src/renderer_d3d11.h +++ b/src/renderer_d3d11.h @@ -203,13 +203,13 @@ namespace bgfx { BX_CHECK(NULL != _vsh.m_ptr, "Vertex shader doesn't exist."); m_vsh = &_vsh; + memcpy(&m_predefined[0], _vsh.m_predefined, _vsh.m_numPredefined*sizeof(PredefinedUniform) ); + m_numPredefined = _vsh.m_numPredefined; BX_CHECK(NULL != _fsh.m_ptr, "Fragment shader doesn't exist."); m_fsh = &_fsh; - - memcpy(&m_predefined[0], _vsh.m_predefined, _vsh.m_numPredefined*sizeof(PredefinedUniform) ); - memcpy(&m_predefined[_vsh.m_numPredefined], _fsh.m_predefined, _fsh.m_numPredefined*sizeof(PredefinedUniform) ); - m_numPredefined = _vsh.m_numPredefined + _fsh.m_numPredefined; + memcpy(&m_predefined[m_numPredefined], _fsh.m_predefined, _fsh.m_numPredefined*sizeof(PredefinedUniform) ); + m_numPredefined += _fsh.m_numPredefined; } void destroy() diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 54549b18..bab965db 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -2086,6 +2086,9 @@ namespace bgfx writeString(&writer, "#define varying in\n"); writeString(&writer, "#define texture2D texture\n"); writeString(&writer, "#define texture2DLod textureLod\n"); + writeString(&writer, "#define texture2DProj textureProj\n"); + writeString(&writer, "#define shadow2D(_sampler, _coord) vec2(textureProj(_sampler, vec4(_coord, 1.0) ) )\n"); + writeString(&writer, "#define shadow2DProj(_sampler, _coord) vec2(textureProj(_sampler, _coord) ) )\n"); writeString(&writer, "#define texture3D texture\n"); writeString(&writer, "#define texture3DLod textureLod\n"); writeString(&writer, "#define textureCube texture\n"); @@ -2143,7 +2146,7 @@ namespace bgfx void FrameBuffer::create(uint8_t _num, const TextureHandle* _handles) { GL_CHECK(glGenFramebuffers(1, &m_fbo[0]) ); - GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[0]) ); + GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo[0]) ); bool needResolve = false; @@ -2172,7 +2175,7 @@ namespace bgfx if (0 != texture.m_rbo) { - GL_CHECK(glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER + GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER , attachment , GL_RENDERBUFFER , texture.m_rbo @@ -2180,7 +2183,7 @@ namespace bgfx } else { - GL_CHECK(glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER + GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER , attachment , texture.m_target , texture.m_id @@ -2192,15 +2195,15 @@ namespace bgfx } } - BX_CHECK(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) + BX_CHECK(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER) , "glCheckFramebufferStatus failed 0x%08x" - , glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) + , glCheckFramebufferStatus(GL_FRAMEBUFFER) ); if (needResolve) { GL_CHECK(glGenFramebuffers(1, &m_fbo[1]) ); - GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[1]) ); + GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo[1]) ); for (uint32_t ii = 0, colorIdx = 0; ii < _num; ++ii) { @@ -2219,7 +2222,7 @@ namespace bgfx else { ++colorIdx; - GL_CHECK(glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER + GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER , attachment , texture.m_target , texture.m_id @@ -2832,6 +2835,7 @@ namespace bgfx ; s_renderCtx->m_depthTextureSupport = !!(BGFX_CONFIG_RENDERER_OPENGL|BGFX_CONFIG_RENDERER_OPENGLES3) + || s_extension[Extension::ANGLE_depth_texture].m_supported || s_extension[Extension::CHROMIUM_depth_texture].m_supported || s_extension[Extension::GOOGLE_depth_texture].m_supported || s_extension[Extension::OES_depth_texture].m_supported @@ -3044,7 +3048,8 @@ namespace bgfx void Context::rendererCreateProgram(ProgramHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh) { - s_renderCtx->m_program[_handle.idx].create(s_renderCtx->m_vertexShaders[_vsh.idx], s_renderCtx->m_fragmentShaders[_fsh.idx]); + Shader dummyFragmentShader; + s_renderCtx->m_program[_handle.idx].create(s_renderCtx->m_vertexShaders[_vsh.idx], isValid(_fsh) ? s_renderCtx->m_fragmentShaders[_fsh.idx] : dummyFragmentShader); } void Context::rendererDestroyProgram(FragmentShaderHandle _handle) diff --git a/src/renderer_gl.h b/src/renderer_gl.h index 8ca1b7f6..4c43a812 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -611,6 +611,8 @@ namespace bgfx { Shader() : m_id(0) + , m_type(0) + , m_hash(0) { } diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index e9a56166..460ae346 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -1847,6 +1847,16 @@ int main(int _argc, const char* _argv[]) "#define ivec4 vec4\n" ); + if (0 == gles) + { + // bgfx shadow2D/Proj behave like EXT_shadow_samplers + // not as GLSL language 1.2 specs shadow2D/Proj. + preprocessor.writef( + "#define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord).x\n" + "#define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord).x\n" + ); + } + for (InOut::const_iterator it = shaderInputs.begin(), itEnd = shaderInputs.end(); it != itEnd; ++it) { VaryingMap::const_iterator varyingIt = varyingMap.find(*it); @@ -2132,6 +2142,11 @@ int main(int _argc, const char* _argv[]) bx::stringPrintf(code, "#version %s\n", profile); int32_t version = atoi(profile); + bx::stringPrintf(code + , "#define bgfxShadow2D shadow2D\n" + "#define bgfxShadow2DProj shadow2DProj\n" + ); + if (hasTextureLod && 130 > version) {