From 7304a3144f58fc20192a9bb940a211e75b29ac3a Mon Sep 17 00:00:00 2001 From: Cedric Guillemet <1312968+CedricGuillemet@users.noreply.github.com> Date: Fri, 7 Mar 2025 16:38:13 +0100 Subject: [PATCH 01/24] nanovg Compositor --- Apps/Playground/Scripts/experience.js | 111 +++++++++++++- .../Babylon/Graphics/FrameBuffer.h | 2 +- Polyfills/Canvas/Source/Canvas.cpp | 56 +++++-- Polyfills/Canvas/Source/Context.cpp | 13 +- .../Canvas/Source/Shaders/dx11/fs_fspass.h | 54 +++++++ .../Canvas/Source/Shaders/dx11/vs_fspass.h | 34 +++++ .../Canvas/Source/Shaders/essl/fs_fspass.h | 35 +++++ .../Canvas/Source/Shaders/essl/vs_fspass.h | 33 +++++ Polyfills/Canvas/Source/Shaders/fs_fspass.sc | 39 +++++ .../Canvas/Source/Shaders/glsl/fs_fspass.h | 33 +++++ .../Canvas/Source/Shaders/glsl/vs_fspass.h | 30 ++++ .../Canvas/Source/Shaders/metal/fs_fspass.h | 62 ++++++++ .../Canvas/Source/Shaders/metal/vs_fspass.h | 52 +++++++ .../Canvas/Source/Shaders/spirv/fs_fspass.h | 89 +++++++++++ .../Canvas/Source/Shaders/spirv/vs_fspass.h | 63 ++++++++ Polyfills/Canvas/Source/Shaders/vs_fspass.sc | 24 +++ Polyfills/Canvas/Source/nanovg_babylon.cpp | 140 +++++++++++++++++- Polyfills/Canvas/Source/nanovg_babylon.h | 2 +- 18 files changed, 851 insertions(+), 21 deletions(-) create mode 100644 Polyfills/Canvas/Source/Shaders/dx11/fs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/dx11/vs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/essl/fs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/essl/vs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/fs_fspass.sc create mode 100644 Polyfills/Canvas/Source/Shaders/glsl/fs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/glsl/vs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/metal/fs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/metal/vs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/spirv/fs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/spirv/vs_fspass.h create mode 100644 Polyfills/Canvas/Source/Shaders/vs_fspass.sc diff --git a/Apps/Playground/Scripts/experience.js b/Apps/Playground/Scripts/experience.js index aaa0b47bc..5c0b55dbf 100644 --- a/Apps/Playground/Scripts/experience.js +++ b/Apps/Playground/Scripts/experience.js @@ -21,7 +21,7 @@ const imageTracking = false; const readPixels = false; function CreateBoxAsync(scene) { - BABYLON.Mesh.CreateBox("box1", 0.2, scene); + //BABYLON.Mesh.CreateBox("box1", 0.2, scene); return Promise.resolve(); } @@ -64,6 +64,115 @@ CreateBoxAsync(scene).then(function () { //BABYLON.SceneLoader.AppendAsync("https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/ClearCoatTest/glTF/ClearCoatTest.gltf").then(function () { BABYLON.Tools.Log("Loaded"); + + var textureGround; + + BABYLON.Tools.LoadFile("https://raw.githubusercontent.com/CedricGuillemet/dump/master/droidsans.ttf", (data) => { + _native.Canvas.loadTTFAsync("droidsans", data).then(function () { + var ground = BABYLON.MeshBuilder.CreateGround("ground1", { width: 0.5, height: 0.5, subdivisions: 2 }, scene); + ground.rotation.x = -Math.PI * 0.5; + ground.rotation.y = Math.PI; + + var texSize = 512; + var dynamicTexture = new BABYLON.DynamicTexture("dynamic texture", texSize, scene); + + var materialGround = new BABYLON.StandardMaterial("Mat", scene); + materialGround.diffuseTexture = dynamicTexture; + ground.material = materialGround; + materialGround.backFaceCulling = false; + dynamicTexture.clear(); + var context = dynamicTexture.getContext(); + + var t = 0; + scene.onBeforeRenderObservable.add(() => { + // animated shape + /*context.save(); + context.fillStyle = "DarkRed"; + context.fillRect(0, 0, texSize, texSize); + const left = 0; + const top = texSize - (texSize * 0.25); + const width = 0.25 * texSize; + const height = 0.25 * texSize; + const offsetU = ((Math.sin(t) * 0.5) + 0.5) * (texSize - (texSize * 0.25)); + const offsetV = ((Math.sin(t) * 0.5) + 0.5) * (-texSize + (texSize * 0.25)); + const rectangleU = width * 0.5 + left; + const rectangleV = height * 0.5 + top; + context.translate(rectangleU + offsetU, rectangleV + offsetV); + context.rotate(t); + context.fillStyle = "DarkOrange"; + context.transform(1, t, 0.8, 1, 0, 0); + context.fillRect(-width * 0.5, -height * 0.5, width, height); + context.restore(); + */ + context.fillStyle = "DarkRed"; + context.fillRect(0, 0, texSize, texSize); + // curve + context.beginPath(); + context.moveTo(75 * 2, 25 * 2); + context.quadraticCurveTo(25 * 2, 25 * 2, 25 * 2, 62.5 * 2); + context.quadraticCurveTo(25 * 2, 100 * 2, 50 * 2, 100 * 2); + context.quadraticCurveTo(50 * 2, 120 * 2, 30 * 2, 125 * 2); + context.quadraticCurveTo(60 * 2, 120 * 2, 65 * 2, 100 * 2); + context.quadraticCurveTo(125 * 2, 100 * 2, 125 * 2, 62.5 * 2); + context.quadraticCurveTo(125 * 2, 25 * 2, 75 * 2, 25 * 2); + context.fillStyle = "blue"; + context.fill(); + + // text + var fontSize = 8 + (Math.sin(t) * 0.5 + 0.5) * 200; + var font = `bold ${fontSize}px monospace`; + dynamicTexture.drawText("BabylonNative", Math.cos(t) * 100, 246, font, "White", null, true, true); + /* + // Draw guides + context.strokeStyle = "#09f"; + context.beginPath(); + context.moveTo(10, 10); + context.lineTo(140, 10); + context.moveTo(10, 140); + context.lineTo(140, 140); + context.stroke(); + + // Draw lines + context.strokeStyle = "black"; + ["butt", "round", "square"].forEach((lineCap, i) => { + context.lineWidth = 15; + context.lineCap = lineCap; + context.beginPath(); + context.moveTo(25 + i * 50, 10); + context.lineTo(25 + i * 50, 140); + context.stroke(); + }); + + // line join + context.lineWidth = 10; + var offset = 200; + ["round", "bevel", "miter"].forEach((join, i) => { + context.lineJoin = join; + context.beginPath(); + context.moveTo(-5 + offset, 15 + i * 40); + context.lineTo(35 + offset, 55 + i * 40); + context.lineTo(75 + offset, 15 + i * 40); + context.lineTo(115 + offset, 55 + i * 40); + context.lineTo(155 + offset, 15 + i * 40); + context.stroke(); + }); + + // gradient. BEWARE: it will be recreated each frame + let gradient = context.createLinearGradient(0, 0, 200, 0); + gradient.addColorStop(0, "green"); + gradient.addColorStop(0.7, "white"); + gradient.addColorStop(1, "pink"); + context.fillStyle = gradient; + context.fillRect(10, 310, 400, 100); + */ + // tick update + dynamicTexture.update(); + t += 0.01; + }); + + }); + }, undefined, undefined, true); + // This creates and positions a free camera (non-mesh) scene.createDefaultCamera(true, true, true); scene.activeCamera.alpha += Math.PI; diff --git a/Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h b/Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h index 6f9f4cda4..cfb461efc 100644 --- a/Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h +++ b/Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h @@ -46,7 +46,7 @@ namespace Babylon::Graphics bool HasDepth() const { return m_hasDepth; } bool HasStencil() const { return m_hasStencil; } - private: + public: Rect GetBgfxScissor(float x, float y, float width, float height) const; void SetBgfxViewPortAndScissor(bgfx::Encoder& encoder, const Rect& viewPort, const Rect& scissor); diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index 03d9eb02f..ecaaa17ba 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -11,6 +11,9 @@ namespace constexpr auto JS_CANVAS_NAME = "_CanvasImpl"; } +bgfx::FrameBufferHandle hackTextBuffer{ bgfx::kInvalidHandle }; +Babylon::Graphics::FrameBuffer* hackFrameBuffer; + namespace Babylon::Polyfills::Internal { static constexpr auto JS_CONSTRUCTOR_NAME = "Canvas"; @@ -114,25 +117,50 @@ namespace Babylon::Polyfills::Internal { if (m_dirty) { - std::array textures{ - bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), - bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT)}; - - std::array attachments{}; - for (size_t idx = 0; idx < attachments.size(); ++idx) { - attachments[idx].init(textures[idx]); + std::array textures{ + bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), + bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT) }; + + std::array attachments{}; + for (size_t idx = 0; idx < attachments.size(); ++idx) + { + attachments[idx].init(textures[idx]); + } + auto handle = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); + assert(handle.idx != bgfx::kInvalidHandle); + m_frameBuffer = std::make_unique(m_graphicsContext, handle, m_width, m_height, false, false, false); + m_dirty = false; + + if (m_texture) + { + m_texture.reset(); + } } - auto handle = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); - assert(handle.idx != bgfx::kInvalidHandle); - m_frameBuffer = std::make_unique(m_graphicsContext, handle, m_width, m_height, false, false, false); - m_dirty = false; - if (m_texture) + // HACK { - m_texture.reset(); + int width(256), height(256); + std::array textures{ + bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), + bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT) }; + + std::array attachments{}; + for (size_t idx = 0; idx < attachments.size(); ++idx) + { + attachments[idx].init(textures[idx]); + } + hackTextBuffer = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); + + //gl->encoder->setfr + //hackViewId = gl->frameBuffer->m_deviceContext.AcquireNewViewId(*gl->encoder); + + hackFrameBuffer = new Babylon::Graphics::FrameBuffer(m_graphicsContext, hackTextBuffer, width, height, false, false, false); + if (m_texture) + { + m_texture.reset(); + } } - return true; } return false; diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 8e9a97e87..b8fee9b79 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -27,6 +27,9 @@ #include "ImageData.h" #include "Colors.h" +extern bgfx::FrameBufferHandle hackTextBuffer; +extern Babylon::Graphics::FrameBuffer* hackFrameBuffer; + /* Most of these context methods are preliminary work. They are currenbly not tested properly. */ @@ -409,10 +412,18 @@ namespace Babylon::Polyfills::Internal const auto width = m_canvas->GetWidth(); const auto height = m_canvas->GetHeight(); + + bgfx::Encoder* encoder2 = m_update.GetUpdateToken().GetEncoder(); + hackFrameBuffer->Bind(*encoder2); + + + hackFrameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); nvgBeginFrame(m_nvg, float(width), float(height), 1.0f); - nvgSetFrameBufferAndEncoder(m_nvg, frameBuffer, encoder); + nvgSetFrameBufferAndEncoder(m_nvg, frameBuffer, encoder, encoder2); nvgEndFrame(m_nvg); frameBuffer.Unbind(*encoder); + + hackFrameBuffer->Unbind(*encoder2); m_dirty = false; }).then(arcana::inline_scheduler, *m_cancellationSource, [this, cancellationSource{m_cancellationSource}](const arcana::expected& result) { if (!cancellationSource->cancelled() && result.has_error()) diff --git a/Polyfills/Canvas/Source/Shaders/dx11/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/dx11/fs_fspass.h new file mode 100644 index 000000000..fbc5fd0e6 --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/dx11/fs_fspass.h @@ -0,0 +1,54 @@ +static const uint8_t fs_fspass_dx11[810] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, // _tex0..........s + 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x02, // _tex0........... + 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x14, 0x89, 0x71, 0xf1, 0xdb, 0x3a, 0xa1, 0x16, 0x97, 0x4f, // ..DXBC..q..:...O + 0x18, 0xbb, 0x2f, 0xc8, 0xa6, 0x3d, 0x01, 0x00, 0x00, 0x00, 0xf4, 0x02, 0x00, 0x00, 0x03, 0x00, // ../..=.......... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNh...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x5c, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, // N.TEXCOORD....OS + 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. + 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0x1c, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x87, 0x00, // ..SHEX....P..... + 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ..j...Z....`.... + 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X....p......UU + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xc2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, // ..b...........e. + 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x05, 0x00, // ... ......h..... + 0x00, 0x00, 0x36, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ..6............@ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, // ..6............@ + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x30, 0x00, 0x00, 0x01, 0x21, 0x00, 0x00, 0x07, 0x22, 0x00, // ......0...!...". + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, // ...............@ + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x03, 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x2b, 0x00, 0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, // ..+..."......... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x00, 0x10, 0x00, 0x03, 0x00, // ......6......... + 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x22, 0x00, // ..F.......6...". + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x30, 0x00, // .......@......0. + 0x00, 0x01, 0x21, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!...B......... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, // .......@........ + 0x04, 0x03, 0x2a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x05, 0x12, 0x00, // ..*.......+..... + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, // ..............2. + 0x00, 0x0c, 0xc2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x04, 0x10, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@............ + 0x80, 0x3b, 0x00, 0x00, 0x80, 0x3b, 0xa6, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, // .;...;........E. + 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x04, 0x00, // ......CU........ + 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, // ..........F~.... + 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf2, 0x00, // ...`............ + 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x0e, // ......F.......F. + 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x01, 0x00, // .........."..... + 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x00, // ...........@.... + 0x00, 0x00, 0x16, 0x00, 0x00, 0x01, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......6......... + 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x07, 0x12, 0x00, // ..F............. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, // ...............@ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x01, 0x38, 0x00, 0x00, 0x0a, 0xf2, 0x20, // ..........8.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ......F........@ + 0x00, 0x00, 0x88, 0x45, 0x4a, 0x3c, 0x88, 0x45, 0x4a, 0x3c, 0x88, 0x45, 0x4a, 0x3c, 0x88, 0x45, // ...EJ<.EJ<.EJ<.E + 0x4a, 0x3c, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // J<>....... +}; diff --git a/Polyfills/Canvas/Source/Shaders/dx11/vs_fspass.h b/Polyfills/Canvas/Source/Shaders/dx11/vs_fspass.h new file mode 100644 index 000000000..38842b67a --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/dx11/vs_fspass.h @@ -0,0 +1,34 @@ +static const uint8_t vs_fspass_dx11[494] = +{ + 0x56, 0x53, 0x48, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0xd4, 0x01, // VSH............. + 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x2d, 0x40, 0xc0, 0xce, 0x39, 0x67, 0x5a, 0x73, 0x8a, 0xa9, // ..DXBC-@..9gZs.. + 0xd5, 0x79, 0x02, 0xcf, 0x9d, 0xb2, 0x01, 0x00, 0x00, 0x00, 0xd4, 0x01, 0x00, 0x00, 0x03, 0x00, // .y.............. + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, // GNL...........8. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......A......... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x50, 0x4f, // ..............PO + 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, // SITION.TEXCOORD. + 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGNh......... + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, // ..P............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x0c, // ................ + 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, // ..........SV_POS + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, // ITION.TEXCOORD.. + 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0xdc, 0x00, 0x00, 0x00, 0x50, 0x00, 0x01, 0x00, 0x37, 0x00, // ..SHEX....P...7. + 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x00, 0x00, // ..j..._...2..... + 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..g.... ........ + 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...2 ......e. + 0x00, 0x03, 0xc2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0f, 0x32, 0x20, // ... ......2...2 + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ......F........@ + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....@@..@@...... + 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, // ...@............ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x08, 0xc2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......6.... .... + 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@............ + 0x00, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x32, 0x00, 0x00, 0x0f, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, // .?...?2.... .... + 0x00, 0x00, 0x46, 0x14, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, // ..F........@.... + 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0xc0, 0xbf, 0x02, 0x40, // .?...?...?.....@ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // .............?.. + 0x80, 0x3f, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, // .?>........... +}; diff --git a/Polyfills/Canvas/Source/Shaders/essl/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/essl/fs_fspass.h new file mode 100644 index 000000000..2e432b68f --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/essl/fs_fspass.h @@ -0,0 +1,35 @@ +static const uint8_t fs_fspass_essl[512] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, 0x01, // _tex............ + 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // ..varying highp + 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // vec2 v_texcoord0 + 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ;.uniform sample + 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // r2D s_tex;.void + 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, // main ().{. lowp + 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // vec4 color_2;. + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, // color_2 = vec4( + 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, // 0.0, 0.0, 0.0, 0 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x68, 0x69, 0x67, 0x68, // .0);. for (high + 0x70, 0x20, 0x69, 0x6e, 0x74, 0x20, 0x79, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x20, // p int y_1 = -4; + 0x79, 0x5f, 0x31, 0x20, 0x3c, 0x20, 0x35, 0x3b, 0x20, 0x79, 0x5f, 0x31, 0x2b, 0x2b, 0x29, 0x20, // y_1 < 5; y_1++) + 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x68, 0x69, 0x67, 0x68, 0x70, // {. for (highp + 0x20, 0x69, 0x6e, 0x74, 0x20, 0x78, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x20, 0x78, // int x_3 = -4; x + 0x5f, 0x33, 0x20, 0x3c, 0x20, 0x35, 0x3b, 0x20, 0x78, 0x5f, 0x33, 0x2b, 0x2b, 0x29, 0x20, 0x7b, // _3 < 5; x_3++) { + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // . highp vec + 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 2 tmpvar_4;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x66, // tmpvar_4.x = f + 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x78, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // loat(x_3);. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x6c, // tmpvar_4.y = fl + 0x6f, 0x61, 0x74, 0x28, 0x79, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // oat(y_1);. + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_2 = (color + 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, // _2 + texture2D ( + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // s_tex, (v_texcoo + 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, // rd0 + (tmpvar_4 + 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x33, 0x39, 0x30, 0x36, 0x32, 0x35, 0x29, 0x29, 0x29, 0x29, // * 0.00390625)))) + 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // ;. };. };. + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_2 = (color + 0x5f, 0x32, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38, 0x29, // _2 * 0.01234568) + 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ;. gl_FragColor + 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = color_2;.}... +}; diff --git a/Polyfills/Canvas/Source/Shaders/essl/vs_fspass.h b/Polyfills/Canvas/Source/Shaders/essl/vs_fspass.h new file mode 100644 index 000000000..9e5f9354e --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/essl/vs_fspass.h @@ -0,0 +1,33 @@ +static const uint8_t vs_fspass_essl[480] = +{ + 0x56, 0x53, 0x48, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0xcd, 0x01, // VSH............. + 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, // ..attribute high + 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // p vec2 a_positio + 0x6e, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // n;.varying highp + 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // vec2 v_position + 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // ;.varying highp + 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // vec2 v_texcoord0 + 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, // ;.void main ().{ + 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, // . v_position = + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, // a_position;. hi + 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // ghp vec2 tmpvar_ + 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // 1;. tmpvar_1 = + 0x28, 0x28, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2a, 0x20, 0x33, // ((a_position * 3 + 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, // .0) - vec2(0.0, + 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, // 1.0));. highp v + 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_2;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // tmpvar_2.x = tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // var_1.x;. tmpva + 0x72, 0x5f, 0x32, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x74, // r_2.y = (1.0 - t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, // mpvar_1.y);. v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x74, 0x6d, // texcoord0 = ((tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2b, 0x20, // pvar_2 * 0.5) + + 0x76, 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x3b, // vec2(0.5, 0.0)); + 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, // . highp vec4 tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_3;. tmpvar + 0x5f, 0x33, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, 0x35, // _3.zw = vec2(0.5 + 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // , 1.0);. tmpvar + 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // _3.xy = tmpvar_1 + 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // ;. gl_Position + 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = tmpvar_3;.}... +}; diff --git a/Polyfills/Canvas/Source/Shaders/fs_fspass.sc b/Polyfills/Canvas/Source/Shaders/fs_fspass.sc new file mode 100644 index 000000000..ee52459cc --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/fs_fspass.sc @@ -0,0 +1,39 @@ +$input v_position, v_texcoord0 + +#include "./common.sh" + +#define EDGE_AA 1 + +uniform mat3 u_scissorMat; +uniform mat3 u_paintMat; +uniform vec4 u_innerCol; +uniform vec4 u_outerCol; +uniform vec4 u_scissorExtScale; +uniform vec4 u_extentRadius; +uniform vec4 u_params; + +SAMPLER2D(s_tex, 0); + +#define u_scissorExt (u_scissorExtScale.xy) +#define u_scissorScale (u_scissorExtScale.zw) +#define u_extent (u_extentRadius.xy) +#define u_radius (u_extentRadius.z) +#define u_feather (u_params.x) +#define u_strokeMult (u_params.y) +#define u_texType (u_params.z) +#define u_type (u_params.w) + +void main() +{ + vec4 color = vec4(0.,0.,0.,0.);//texture2D(s_tex, v_texcoord0); + for (int y = -4;y < 5; y++) + { + for (int x = -4;x < 5; x++) + { + color += texture2D(s_tex, v_texcoord0 + vec2(x,y) * (1./256.)); + } + } + + color *= 1./81.; + gl_FragColor = color;// * vec4(1.,0.5,0.25,1.); +} diff --git a/Polyfills/Canvas/Source/Shaders/glsl/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/glsl/fs_fspass.h new file mode 100644 index 000000000..7e5714d28 --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/glsl/fs_fspass.h @@ -0,0 +1,33 @@ +static const uint8_t fs_fspass_glsl[476] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x01, // _tex............ + 0x00, 0x00, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ..in vec2 v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, // oord0;.uniform s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, // ampler2D s_tex;. + 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // void main ().{. + 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // vec4 color_2;. + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, // color_2 = vec4( + 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, // 0.0, 0.0, 0.0, 0 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, // .0);. for (int + 0x79, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x20, 0x79, 0x5f, 0x31, 0x20, 0x3c, 0x20, // y_1 = -4; y_1 < + 0x35, 0x3b, 0x20, 0x79, 0x5f, 0x31, 0x2b, 0x2b, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 5; y_1++) {. + 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, 0x78, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x2d, // for (int x_3 = - + 0x34, 0x3b, 0x20, 0x78, 0x5f, 0x33, 0x20, 0x3c, 0x20, 0x35, 0x3b, 0x20, 0x78, 0x5f, 0x33, 0x2b, // 4; x_3 < 5; x_3+ + 0x2b, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // +) {. vec2 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_4;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, // tmpvar_4.x = flo + 0x61, 0x74, 0x28, 0x78, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, // at(x_3);. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, // mpvar_4.y = floa + 0x74, 0x28, 0x79, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // t(y_1);. co + 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // lor_2 = (color_2 + 0x20, 0x2b, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // + texture (s_te + 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // x, (v_texcoord0 + 0x2b, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x2a, 0x20, 0x30, 0x2e, // + (tmpvar_4 * 0. + 0x30, 0x30, 0x33, 0x39, 0x30, 0x36, 0x32, 0x35, 0x29, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 00390625))));. + 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // };. };. colo + 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2a, // r_2 = (color_2 * + 0x20, 0x30, 0x2e, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.01234568);. + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x63, // gl_FragColor = c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // olor_2;.}... +}; diff --git a/Polyfills/Canvas/Source/Shaders/glsl/vs_fspass.h b/Polyfills/Canvas/Source/Shaders/glsl/vs_fspass.h new file mode 100644 index 000000000..de5b90fdb --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/glsl/vs_fspass.h @@ -0,0 +1,30 @@ +static const uint8_t vs_fspass_glsl[429] = +{ + 0x56, 0x53, 0x48, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x9a, 0x01, // VSH............. + 0x00, 0x00, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // ..in vec2 a_posi + 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x6f, 0x75, 0x74, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, // tion;.out vec2 v + 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x6f, 0x75, 0x74, 0x20, 0x76, // _position;.out v + 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, // ec2 v_texcoord0; + 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, // .void main ().{. + 0x20, 0x20, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x61, // v_position = a + 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, // _position;. vec + 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // 2 tmpvar_1;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x61, 0x5f, 0x70, 0x6f, 0x73, // pvar_1 = ((a_pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x76, // ition * 3.0) - v + 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, // ec2(0.0, 1.0));. + 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, // vec2 tmpvar_2; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x20, 0x3d, 0x20, // . tmpvar_2.x = + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // tmpvar_1.x;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, // pvar_2.y = (1.0 + 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x3b, 0x0a, 0x20, // - tmpvar_1.y);. + 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x28, // v_texcoord0 = ( + 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, // (tmpvar_2 * 0.5) + 0x20, 0x2b, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x30, 0x2e, 0x30, // + vec2(0.5, 0.0 + 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ));. vec4 tmpva + 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, // r_3;. tmpvar_3. + 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x31, // zw = vec2(0.5, 1 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, // .0);. tmpvar_3. + 0x78, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // xy = tmpvar_1;. + 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, // gl_Position = t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mpvar_3;.}... +}; diff --git a/Polyfills/Canvas/Source/Shaders/metal/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/metal/fs_fspass.h new file mode 100644 index 000000000..faaed7aef --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/metal/fs_fspass.h @@ -0,0 +1,62 @@ +static const uint8_t fs_fspass_mtl[932] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0c, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x11, 0x01, 0xff, 0xff, 0x01, // _texSampler..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, // ......s_texTextu + 0x72, 0x65, 0x11, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, // re...........s_t + 0x65, 0x78, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x03, 0x00, 0x00, // ex..........P... + 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x5f, // #include .#include + 0x20, 0x3c, 0x73, 0x69, 0x6d, 0x64, 0x2f, 0x73, 0x69, 0x6d, 0x64, 0x2e, 0x68, 0x3e, 0x0a, 0x0a, // .. + 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, // using namespace + 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // metal;..struct x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x0a, 0x7b, // latMtlMain_out.{ + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, // . float4 bgfx + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, // _FragData0 [[col + 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, // or(0)]];.};..str + 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, // uct xlatMtlMain_ + 0x69, 0x6e, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, // in.{. float2 + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x75, 0x73, // v_texcoord0 [[us + 0x65, 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, // er(locn1)]];.};. + 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // .fragment xlatMt + 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // lMain_out xlatMt + 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, // lMain(xlatMtlMai + 0x6e, 0x5f, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, // n_in in [[stage_ + 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, // in]], texture2d< + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x20, 0x5b, 0x5b, 0x74, // float> s_tex [[t + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, // exture(0)]], sam + 0x70, 0x6c, 0x65, 0x72, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, // pler s_texSample + 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, // r [[sampler(0)]] + 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // ).{. xlatMtlM + 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, // ain_out out = {} + 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x20, 0x5f, 0x32, 0x32, 0x31, 0x3b, 0x0a, // ;. int _221;. + 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x32, 0x32, 0x32, 0x3b, // float4 _222; + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x32, 0x32, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, // . _222 = floa + 0x74, 0x34, 0x28, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x32, // t4(0.0);. _22 + 0x31, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // 1 = -4;. floa + 0x74, 0x34, 0x20, 0x5f, 0x32, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, // t4 _225;. for + 0x20, 0x28, 0x3b, 0x20, 0x5f, 0x32, 0x32, 0x31, 0x20, 0x3c, 0x20, 0x35, 0x3b, 0x20, 0x5f, 0x32, // (; _221 < 5; _2 + 0x32, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x32, 0x32, 0x35, 0x2c, 0x20, 0x5f, 0x32, 0x32, 0x31, 0x2b, // 22 = _225, _221+ + 0x2b, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // +). {. + 0x20, 0x5f, 0x32, 0x32, 0x35, 0x20, 0x3d, 0x20, 0x5f, 0x32, 0x32, 0x32, 0x3b, 0x0a, 0x20, 0x20, // _225 = _222;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, 0x5f, // for (int _ + 0x32, 0x32, 0x33, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x20, 0x5f, 0x32, 0x32, 0x33, 0x20, 0x3c, // 223 = -4; _223 < + 0x20, 0x35, 0x3b, 0x20, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, // 5; ). {. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x32, 0x35, // _225 + 0x20, 0x2b, 0x3d, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // += s_tex.sample + 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, // (s_texSampler, ( + 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, // in.v_texcoord0 + + 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x5f, // (float2(float(_ + 0x32, 0x32, 0x33, 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x5f, 0x32, 0x32, 0x31, // 223), float(_221 + 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x33, 0x39, 0x30, 0x36, 0x32, 0x35, 0x29, // )) * 0.00390625) + 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ));. + 0x5f, 0x32, 0x32, 0x33, 0x2b, 0x2b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _223++;. + 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, // continue;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, // }. }. + 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // out.bgfx_FragD + 0x61, 0x74, 0x61, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x32, 0x32, 0x32, 0x20, 0x2a, 0x20, 0x30, 0x2e, // ata0 = _222 * 0. + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x39, 0x31, 0x30, 0x34, 0x33, 0x32, 0x38, 0x31, // 0123456791043281 + 0x35, 0x35, 0x35, 0x31, 0x37, 0x35, 0x37, 0x38, 0x31, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 55517578125;. + 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // return out;.}.. + 0x00, 0x00, 0x20, 0x00, // .. . +}; diff --git a/Polyfills/Canvas/Source/Shaders/metal/vs_fspass.h b/Polyfills/Canvas/Source/Shaders/metal/vs_fspass.h new file mode 100644 index 000000000..0e2a624a7 --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/metal/vs_fspass.h @@ -0,0 +1,52 @@ +static const uint8_t vs_fspass_mtl[770] = +{ + 0x56, 0x53, 0x48, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0xe8, 0x02, // VSH............. + 0x00, 0x00, 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65, 0x74, 0x61, // ..#include .#inclu + 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69, 0x6d, 0x64, 0x2f, 0x73, 0x69, 0x6d, 0x64, 0x2e, 0x68, 0x3e, // de + 0x0a, 0x0a, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, // e metal;..struct + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, // xlatMtlMain_out + 0x0a, 0x7b, 0x0a, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x6d, // .{..float bgfx_m + 0x65, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x20, 0x5b, // etal_pointSize [ + 0x5b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5d, 0x5d, 0x20, 0x3d, 0x20, // [point_size]] = + 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x5f, 0x65, // 1;. float2 _e + 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, // ntryPointOutput_ + 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x75, 0x73, 0x65, // v_position [[use + 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // r(locn0)]];. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, // float2 _entryPoi + 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // ntOutput_v_texco + 0x6f, 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, // ord0 [[user(locn + 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // 1)]];. float4 + 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, // gl_Position [[p + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, // osition]];.};..s + 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, // truct xlatMtlMai + 0x6e, 0x5f, 0x69, 0x6e, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // n_in.{. float + 0x32, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, // 2 a_position [[a + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, // ttribute(0)]];.} + 0x3b, 0x0a, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // ;..vertex xlatMt + 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // lMain_out xlatMt + 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, // lMain(xlatMtlMai + 0x6e, 0x5f, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, // n_in in [[stage_ + 0x69, 0x6e, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, // in]]).{. xlat + 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, // MtlMain_out out + 0x3d, 0x20, 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // = {};. float2 + 0x20, 0x5f, 0x31, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x69, 0x6e, 0x2e, 0x61, 0x5f, 0x70, 0x6f, // _113 = (in.a_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, // sition * 3.0) - + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, // float2(0.0, 1.0) + 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // ;. out.gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x5f, // ition = float4(_ + 0x31, 0x31, 0x33, 0x2c, 0x20, 0x30, 0x2e, 0x35, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // 113, 0.5, 1.0);. + 0x20, 0x20, 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // out._entryPo + 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, // intOutput_v_posi + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // tion = in.a_posi + 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x5f, 0x65, // tion;. out._e + 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, // ntryPointOutput_ + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x28, 0x66, // v_texcoord0 = (f + 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x5f, 0x31, 0x31, 0x33, 0x2e, 0x78, 0x2c, 0x20, 0x31, 0x2e, // loat2(_113.x, 1. + 0x30, 0x20, 0x2d, 0x20, 0x5f, 0x31, 0x31, 0x33, 0x2e, 0x79, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, // 0 - _113.y) * 0. + 0x35, 0x29, 0x20, 0x2b, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x35, 0x2c, // 5) + float2(0.5, + 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, // 0.0);. retur + 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x02, 0x01, 0x00, 0x10, 0x00, // n out;.}........ + 0x00, 0x00, // .. +}; diff --git a/Polyfills/Canvas/Source/Shaders/spirv/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/spirv/fs_fspass.h new file mode 100644 index 000000000..94e255adf --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/spirv/fs_fspass.h @@ -0,0 +1,89 @@ +static const uint8_t fs_fspass_spv[1374] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x22, 0x00, 0x38, 0x05, // _tex0.......".8. + 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00, 0xe5, 0x00, // ....#........... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, // ................ + 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, // ......GLSL.std.4 + 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // 50.............. + 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x10, 0x00, // in....v......... + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x23, 0x00, 0x00, 0x00, 0x73, 0x5f, // in........#...s_ + 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // texSampler...... + 0x06, 0x00, 0x26, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, // ..&...s_texTextu + 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x76, 0x00, 0x00, 0x00, 0x76, 0x5f, // re........v...v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x83, 0x00, // texcoord0....... + 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, // ..bgfx_FragData0 + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x12, 0x00, // ..G...#...!..... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...#..."..... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, // ..G...&...!..... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...&..."..... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, // ..G...v......... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x83, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G............. + 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, // ..........!..... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, // ................ + 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, // ...... ......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ + 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, // .."...........;. + 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .."...#....... . + 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..%...........;. + 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, // ..%...&......... + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..)... .......+. + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, // ..)...*......... + 0x03, 0x00, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..2.......+..... + 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x0d, 0x00, // ..=.......,..... + 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..A...=...=...=. + 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x44, 0x00, // ..=...+...)...D. + 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x4b, 0x00, // ......+...)...K. + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x00, 0x02, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..........L...+. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3b, 0x2b, 0x00, // .............;+. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x88, 0x45, 0x4a, 0x3c, 0x20, 0x00, // ......i....EJ< . + 0x04, 0x00, 0x72, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..r...........;. + 0x04, 0x00, 0x72, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ..r...v....... . + 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. + 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..............6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, // ..........=..... + 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, // ..$...#...=..... + 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, // ..'...&...=..... + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xae, 0x00, // ..w...v......... + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xae, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, // ................ + 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xe4, 0x00, // ......A......... + 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x29, 0x00, 0x00, 0x00, 0xe0, 0x00, // ..........)..... + 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0xc8, 0x00, // ..D............. + 0x00, 0x00, 0xb1, 0x00, 0x05, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xe0, 0x00, // ......L......... + 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xc8, 0x00, // ..K............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xb2, 0x00, // ................ + 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xb2, 0x00, 0x00, 0x00, 0xf9, 0x00, // ................ + 0x02, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xf5, 0x00, // ................ + 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xb2, 0x00, // ................ + 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x29, 0x00, // ..............). + 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0xb2, 0x00, 0x00, 0x00, 0xc6, 0x00, // ......D......... + 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x05, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xb6, 0x00, // ..........L..... + 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0xc7, 0x00, // ......K......... + 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xb6, 0x00, // ................ + 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xb7, 0x00, // ................ + 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xe2, 0x00, // ..o............. + 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xe0, 0x00, // ..o............. + 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0xba, 0x00, // ..P............. + 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xbe, 0x00, // ................ + 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, // ................ + 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x56, 0x00, // ......w.......V. + 0x05, 0x00, 0x32, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, // ..2.......'...$. + 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0xd9, 0x00, // ..W............. + 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc3, 0x00, // ................ + 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x80, 0x00, 0x05, 0x00, 0x29, 0x00, // ..............). + 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0xf9, 0x00, // ..........*..... + 0x02, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc7, 0x00, 0x00, 0x00, 0xf9, 0x00, // ................ + 0x02, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x80, 0x00, // ................ + 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x2a, 0x00, // ..)...........*. + 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xae, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xcb, 0x00, // ................ + 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xcd, 0x00, 0x00, 0x00, 0xe1, 0x00, // ................ + 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x83, 0x00, 0x00, 0x00, 0xcd, 0x00, // ..i...>......... + 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ......8....... +}; diff --git a/Polyfills/Canvas/Source/Shaders/spirv/vs_fspass.h b/Polyfills/Canvas/Source/Shaders/spirv/vs_fspass.h new file mode 100644 index 000000000..ced9913fe --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/spirv/vs_fspass.h @@ -0,0 +1,63 @@ +static const uint8_t vs_fspass_spv[954] = +{ + 0x56, 0x53, 0x48, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0xa0, 0x03, // VSH............. + 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x82, 0x00, // ....#........... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, // ................ + 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, // ......GLSL.std.4 + 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // 50.............. + 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x4d, 0x00, // in....=...I...M. + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, // ..P............. + 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // ......=...a_posi + 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x49, 0x00, 0x00, 0x00, 0x40, 0x65, // tion......I...@e + 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, // ntryPointOutput. + 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, // gl_Position..... + 0x0a, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, // ..M...@entryPoin + 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // tOutput.v_positi + 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x50, 0x00, 0x00, 0x00, 0x40, 0x65, // on........P...@e + 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, // ntryPointOutput. + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, // v_texcoord0...G. + 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..=...........G. + 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..I...........G. + 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..M...........G. + 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, // ..P............. + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ......!......... + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, // .......... ..... + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ + 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x2b, 0x00, // ............@@+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2c, 0x00, // .............?,. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1f, 0x00, // ...... ......... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+.......,..... + 0x00, 0x3f, 0x2c, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x2c, 0x00, // .?,...........,. + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, // ...... ...<..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......;...<...=. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, // ...... ...H..... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x49, 0x00, // ......;...H...I. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, // ...... ...L..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4d, 0x00, // ......;...L...M. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x50, 0x00, // ......;...L...P. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ......6......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..=.......>...=. + 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..........s...>. + 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x74, 0x00, // ..............t. + 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, // ..s... ...Q..... + 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..v...t.......Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, // ......x...t..... + 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x1f, 0x00, // ..........y..... + 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x7a, 0x00, // ..x...P.......z. + 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x07, 0x00, // ..v...y......... + 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x81, 0x00, // ..{...z...,..... + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x2e, 0x00, // ......|...{..... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x74, 0x00, // ..Q...........t. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x80, 0x00, // ......Q......... + 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x09, 0x00, // ..t.......P..... + 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x2c, 0x00, // ..............,. + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x49, 0x00, 0x00, 0x00, 0x81, 0x00, // ......>...I..... + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..>...M...>...>. + 0x03, 0x00, 0x50, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..P...|.......8. + 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, // .......... +}; diff --git a/Polyfills/Canvas/Source/Shaders/vs_fspass.sc b/Polyfills/Canvas/Source/Shaders/vs_fspass.sc new file mode 100644 index 000000000..751312665 --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/vs_fspass.sc @@ -0,0 +1,24 @@ +$input a_position, a_texcoord0 +$output v_position, v_texcoord0 + +#include "./common.sh" + +#define NEED_HALF_TEXEL (BGFX_SHADER_LANGUAGE_HLSL < 400) + +uniform vec4 u_viewSize; + +#if NEED_HALF_TEXEL +uniform vec4 u_halfTexel; +#endif // NEED_HALF_TEXEL + +void main() +{ +#if !NEED_HALF_TEXEL + const vec4 u_halfTexel = vec4_splat(0.0); +#endif // !NEED_HALF_TEXEL + + v_position = a_position; + vec2 uv = a_position.xy*3. - vec2(0.,1); + v_texcoord0 = vec2(uv.x, 1.-uv.y) * 0.5 + vec2(0.5,0.); + gl_Position = vec4(uv, 0.5, 1.0); +} diff --git a/Polyfills/Canvas/Source/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg_babylon.cpp index c56c83e3d..c4809d995 100644 --- a/Polyfills/Canvas/Source/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg_babylon.cpp @@ -36,7 +36,7 @@ #include #include - +#include BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244) // warning C4244: '=' : conversion from '' to '', possible loss of data #include "Shaders/dx11/vs_nanovg_fill.h" @@ -50,14 +50,109 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244) // warning C4244: '=' : conversion from #include "Shaders/spirv/vs_nanovg_fill.h" #include "Shaders/spirv/fs_nanovg_fill.h" +#include "Shaders/dx11/vs_fspass.h" +#include "Shaders/dx11/fs_fspass.h" +#include "Shaders/metal/vs_fspass.h" +#include "Shaders/metal/fs_fspass.h" +#include "Shaders/glsl/vs_fspass.h" +#include "Shaders/glsl/fs_fspass.h" +#include "Shaders/essl/vs_fspass.h" +#include "Shaders/essl/fs_fspass.h" +#include "Shaders/spirv/vs_fspass.h" +#include "Shaders/spirv/fs_fspass.h" + + +struct PosTexCoord0Vertex +{ + float m_x; + float m_y; + float m_z; + float m_u; + float m_v; + + static void init() + { + ms_layout + .begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) + .end(); + } + + static bgfx::VertexLayout ms_layout; +}; + +bgfx::VertexLayout PosTexCoord0Vertex::ms_layout; + +void screenSpaceQuad(bgfx::Encoder* encoder, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) +{ + if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout)) + { + bgfx::TransientVertexBuffer vb; + bgfx::allocTransientVertexBuffer(&vb, 3, PosTexCoord0Vertex::ms_layout); + PosTexCoord0Vertex* vertex = (PosTexCoord0Vertex*)vb.data; + + const float minx = -_width; + const float maxx = _width; + const float miny = 0.0f; + const float maxy = _height * 2.0f; + + const float minu = -1.0f; + const float maxu = 1.0f; + + const float zz = 0.0f; + + float minv = 0.0f; + float maxv = 2.0f; + + if (_originBottomLeft) + { + float temp = minv; + minv = maxv; + maxv = temp; + + minv -= 1.0f; + maxv -= 1.0f; + } + + vertex[0].m_x = minx; + vertex[0].m_y = miny; + vertex[0].m_z = zz; + vertex[0].m_u = minu; + vertex[0].m_v = minv; + + vertex[1].m_x = maxx; + vertex[1].m_y = miny; + vertex[1].m_z = zz; + vertex[1].m_u = maxu; + vertex[1].m_v = minv; + + vertex[2].m_x = maxx; + vertex[2].m_y = maxy; + vertex[2].m_z = zz; + vertex[2].m_u = maxu; + vertex[2].m_v = maxv; + + //bgfx::setVertexBuffer(0, &vb); + encoder->setVertexBuffer(0, &vb); + } +} + + static const bgfx::EmbeddedShader s_embeddedShadersBabylon[] = { BGFX_EMBEDDED_SHADER(vs_nanovg_fill), BGFX_EMBEDDED_SHADER(fs_nanovg_fill), + BGFX_EMBEDDED_SHADER(vs_fspass), + BGFX_EMBEDDED_SHADER(fs_fspass), + BGFX_EMBEDDED_SHADER_END() }; +extern bgfx::FrameBufferHandle hackTextBuffer; +extern Babylon::Graphics::FrameBuffer* hackFrameBuffer; + namespace { static bgfx::VertexLayout s_nvgLayout; @@ -146,6 +241,7 @@ namespace bx::AllocatorI* allocator; bgfx::ProgramHandle prog; + bgfx::ProgramHandle fsprog; bgfx::UniformHandle u_scissorMat; bgfx::UniformHandle u_paintMat; bgfx::UniformHandle u_innerCol; @@ -165,6 +261,7 @@ namespace bgfx::TransientVertexBuffer tvb; Babylon::Graphics::FrameBuffer* frameBuffer; bgfx::Encoder* encoder; + bgfx::Encoder* encoder2; struct GLNVGtexture* textures; float view[2]; @@ -705,12 +802,39 @@ namespace { if (3 <= call->vertexCount) { + + + + // draw to target + nvgRenderSetUniforms(gl, call->uniformOffset, call->image); + + gl->encoder2->setState(gl->state); + gl->encoder2->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); + gl->encoder2->setTexture(0, gl->s_tex, gl->th); + //gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + hackFrameBuffer->Submit(*gl->encoder2, gl->prog, BGFX_DISCARD_ALL); + + + // render to canvas + nvgRenderSetUniforms(gl, call->uniformOffset, call->image); + + gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A/*gl->state*/ + | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) + | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); + //gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); + + + gl->encoder->setTexture(0, gl->s_tex, bgfx::getTexture(hackFrameBuffer->Handle())); + bool s_originBottomLeft = bgfx::getCaps()->originBottomLeft; + screenSpaceQuad(gl->encoder, s_originBottomLeft); + gl->frameBuffer->Submit(*gl->encoder, gl->fsprog, BGFX_DISCARD_ALL);; + /* nvgRenderSetUniforms(gl, call->uniformOffset, call->image); gl->encoder->setState(gl->state); gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL);*/ } } @@ -765,6 +889,15 @@ namespace , bgfx::createEmbeddedShader(s_embeddedShadersBabylon, type, "fs_nanovg_fill") , true ); + + gl->fsprog = bgfx::createProgram( + bgfx::createEmbeddedShader(s_embeddedShadersBabylon, type, "vs_fspass") + , bgfx::createEmbeddedShader(s_embeddedShadersBabylon, type, "fs_fspass") + , true + ); + + // Vertex layout + PosTexCoord0Vertex::init(); } if (gl->ncalls > 0) @@ -1153,10 +1286,11 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) return NULL; } -void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder) +void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder, bgfx::Encoder* encoder2) { struct GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(_ctx)->userPtr; gl->encoder = encoder; + gl->encoder2 = encoder2; gl->frameBuffer = &frameBuffer; } diff --git a/Polyfills/Canvas/Source/nanovg_babylon.h b/Polyfills/Canvas/Source/nanovg_babylon.h index 8b7800490..3995e71e5 100644 --- a/Polyfills/Canvas/Source/nanovg_babylon.h +++ b/Polyfills/Canvas/Source/nanovg_babylon.h @@ -21,7 +21,7 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator); /// NVGcontext* nvgCreate(int32_t _edgeaa); -void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder); +void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder, bgfx::Encoder* encoder2); /// void nvgDelete(NVGcontext* _ctx); From 05ddd44bd84a48880f31906fcceae41034152b42 Mon Sep 17 00:00:00 2001 From: Cedric Guillemet <1312968+CedricGuillemet@users.noreply.github.com> Date: Fri, 7 Mar 2025 17:24:32 +0100 Subject: [PATCH 02/24] method visibility --- Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h b/Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h index cfb461efc..6f9f4cda4 100644 --- a/Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h +++ b/Core/Graphics/InternalInclude/Babylon/Graphics/FrameBuffer.h @@ -46,7 +46,7 @@ namespace Babylon::Graphics bool HasDepth() const { return m_hasDepth; } bool HasStencil() const { return m_hasStencil; } - public: + private: Rect GetBgfxScissor(float x, float y, float width, float height) const; void SetBgfxViewPortAndScissor(bgfx::Encoder& encoder, const Rect& viewPort, const Rect& scissor); From 09aa481bdfc15f035ad1bc2e42a5d897d062321e Mon Sep 17 00:00:00 2001 From: Cedric Guillemet <1312968+CedricGuillemet@users.noreply.github.com> Date: Fri, 7 Mar 2025 17:30:18 +0100 Subject: [PATCH 03/24] a bit of clean up --- Polyfills/Canvas/Source/Canvas.cpp | 3 --- Polyfills/Canvas/Source/Context.cpp | 1 - Polyfills/Canvas/Source/nanovg_babylon.cpp | 12 ++---------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index ecaaa17ba..274501b35 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -152,9 +152,6 @@ namespace Babylon::Polyfills::Internal } hackTextBuffer = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); - //gl->encoder->setfr - //hackViewId = gl->frameBuffer->m_deviceContext.AcquireNewViewId(*gl->encoder); - hackFrameBuffer = new Babylon::Graphics::FrameBuffer(m_graphicsContext, hackTextBuffer, width, height, false, false, false); if (m_texture) { diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index b8fee9b79..062e8eebf 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -27,7 +27,6 @@ #include "ImageData.h" #include "Colors.h" -extern bgfx::FrameBufferHandle hackTextBuffer; extern Babylon::Graphics::FrameBuffer* hackFrameBuffer; /* diff --git a/Polyfills/Canvas/Source/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg_babylon.cpp index c4809d995..87f84e991 100644 --- a/Polyfills/Canvas/Source/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg_babylon.cpp @@ -150,7 +150,6 @@ static const bgfx::EmbeddedShader s_embeddedShadersBabylon[] = BGFX_EMBEDDED_SHADER_END() }; -extern bgfx::FrameBufferHandle hackTextBuffer; extern Babylon::Graphics::FrameBuffer* hackFrameBuffer; namespace @@ -802,27 +801,20 @@ namespace { if (3 <= call->vertexCount) { - - - - // draw to target + // render to target nvgRenderSetUniforms(gl, call->uniformOffset, call->image); gl->encoder2->setState(gl->state); gl->encoder2->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); gl->encoder2->setTexture(0, gl->s_tex, gl->th); - //gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); hackFrameBuffer->Submit(*gl->encoder2, gl->prog, BGFX_DISCARD_ALL); - // render to canvas nvgRenderSetUniforms(gl, call->uniformOffset, call->image); - gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A/*gl->state*/ + gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); - //gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); - gl->encoder->setTexture(0, gl->s_tex, bgfx::getTexture(hackFrameBuffer->Handle())); bool s_originBottomLeft = bgfx::getCaps()->originBottomLeft; From 2aacc5e16e5699b1c14aa9ebb86c0afedf437079 Mon Sep 17 00:00:00 2001 From: Cedric Guillemet <1312968+CedricGuillemet@users.noreply.github.com> Date: Tue, 11 Mar 2025 10:49:27 +0100 Subject: [PATCH 04/24] remove 2nd encoder --- Polyfills/Canvas/Source/Context.cpp | 7 +++---- Polyfills/Canvas/Source/nanovg_babylon.cpp | 12 +++++------- Polyfills/Canvas/Source/nanovg_babylon.h | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 062e8eebf..ccd1c5140 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -412,17 +412,16 @@ namespace Babylon::Polyfills::Internal const auto height = m_canvas->GetHeight(); - bgfx::Encoder* encoder2 = m_update.GetUpdateToken().GetEncoder(); - hackFrameBuffer->Bind(*encoder2); + hackFrameBuffer->Bind(*encoder); hackFrameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); nvgBeginFrame(m_nvg, float(width), float(height), 1.0f); - nvgSetFrameBufferAndEncoder(m_nvg, frameBuffer, encoder, encoder2); + nvgSetFrameBufferAndEncoder(m_nvg, frameBuffer, encoder); nvgEndFrame(m_nvg); frameBuffer.Unbind(*encoder); - hackFrameBuffer->Unbind(*encoder2); + hackFrameBuffer->Unbind(*encoder); m_dirty = false; }).then(arcana::inline_scheduler, *m_cancellationSource, [this, cancellationSource{m_cancellationSource}](const arcana::expected& result) { if (!cancellationSource->cancelled() && result.has_error()) diff --git a/Polyfills/Canvas/Source/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg_babylon.cpp index 87f84e991..50b202ee9 100644 --- a/Polyfills/Canvas/Source/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg_babylon.cpp @@ -260,7 +260,6 @@ namespace bgfx::TransientVertexBuffer tvb; Babylon::Graphics::FrameBuffer* frameBuffer; bgfx::Encoder* encoder; - bgfx::Encoder* encoder2; struct GLNVGtexture* textures; float view[2]; @@ -804,10 +803,10 @@ namespace // render to target nvgRenderSetUniforms(gl, call->uniformOffset, call->image); - gl->encoder2->setState(gl->state); - gl->encoder2->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); - gl->encoder2->setTexture(0, gl->s_tex, gl->th); - hackFrameBuffer->Submit(*gl->encoder2, gl->prog, BGFX_DISCARD_ALL); + gl->encoder->setState(gl->state); + gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); + gl->encoder->setTexture(0, gl->s_tex, gl->th); + hackFrameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); // render to canvas nvgRenderSetUniforms(gl, call->uniformOffset, call->image); @@ -1278,11 +1277,10 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) return NULL; } -void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder, bgfx::Encoder* encoder2) +void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder) { struct GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(_ctx)->userPtr; gl->encoder = encoder; - gl->encoder2 = encoder2; gl->frameBuffer = &frameBuffer; } diff --git a/Polyfills/Canvas/Source/nanovg_babylon.h b/Polyfills/Canvas/Source/nanovg_babylon.h index 3995e71e5..8b7800490 100644 --- a/Polyfills/Canvas/Source/nanovg_babylon.h +++ b/Polyfills/Canvas/Source/nanovg_babylon.h @@ -21,7 +21,7 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator); /// NVGcontext* nvgCreate(int32_t _edgeaa); -void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder, bgfx::Encoder* encoder2); +void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder); /// void nvgDelete(NVGcontext* _ctx); From d1223cb72c1fd91bbb5c40ef9f6c9936cf7ac22d Mon Sep 17 00:00:00 2001 From: Cedric Guillemet <1312968+CedricGuillemet@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:03:28 +0100 Subject: [PATCH 05/24] filter stack PoC --- Polyfills/Canvas/CMakeLists.txt | 2 + Polyfills/Canvas/Source/Context.cpp | 18 ++++- Polyfills/Canvas/Source/Context.h | 4 ++ Polyfills/Canvas/Source/nanovg/nanovg.cpp | 11 ++- Polyfills/Canvas/Source/nanovg/nanovg.h | 4 +- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 15 +++- .../Source/nanovg/nanovg_filterstack.cpp | 21 ++++++ .../Canvas/Source/nanovg/nanovg_filterstack.h | 68 +++++++++++++++++++ 8 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp create mode 100644 Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h diff --git a/Polyfills/Canvas/CMakeLists.txt b/Polyfills/Canvas/CMakeLists.txt index e5b74059c..bed490d43 100644 --- a/Polyfills/Canvas/CMakeLists.txt +++ b/Polyfills/Canvas/CMakeLists.txt @@ -113,6 +113,8 @@ set(SOURCES "Source/nanovg/nanovg.h" "Source/nanovg/nanovg_babylon.cpp" "Source/nanovg/nanovg_babylon.h" + "Source/nanovg/nanovg_filterstack.cpp" + "Source/nanovg/nanovg_filterstack.h" ) file(GLOB SHADERS "Source/Shaders/*.sc" "Source/Shaders/*.sh") diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index e5d94bfc7..38a2fad84 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -82,6 +82,7 @@ namespace Babylon::Polyfills::Internal InstanceAccessor("lineCap", &Context::GetLineCap, &Context::SetLineCap), InstanceAccessor("lineJoin", &Context::GetLineJoin, &Context::SetLineJoin), InstanceAccessor("miterLimit", &Context::GetMiterLimit, &Context::SetMiterLimit), + InstanceAccessor("filter", &Context::GetFilter, &Context::SetFilter), InstanceAccessor("font", &Context::GetFont, &Context::SetFont), InstanceAccessor("letterSpacing", &Context::GetLetterSpacing, &Context::SetLetterSpacing), InstanceAccessor("strokeStyle", &Context::GetStrokeStyle, &Context::SetStrokeStyle), @@ -188,7 +189,12 @@ namespace Babylon::Polyfills::Internal nvgRect(*m_nvg, left, top, width, height); BindFillStyle(info, left, top, width, height); - + if (m_filter.length()) + { + nanovg_filterstack filterStack; + filterStack.ParseString(m_filter); + nvgFilterStack(*m_nvg, filterStack); + } nvgFill(*m_nvg); SetDirty(); } @@ -847,6 +853,16 @@ namespace Babylon::Polyfills::Internal SetDirty(); } + Napi::Value Context::GetFilter(const Napi::CallbackInfo& info) + { + return Napi::Value::From(Env(), m_filter); + } + + void Context::SetFilter(const Napi::CallbackInfo& info, const Napi::Value& value) + { + m_filter = value.As().Utf8Value(); + } + Napi::Value Context::GetFont(const Napi::CallbackInfo& info) { return Napi::Value::From(Env(), m_font); diff --git a/Polyfills/Canvas/Source/Context.h b/Polyfills/Canvas/Source/Context.h index f314ca724..1def6b6ca 100644 --- a/Polyfills/Canvas/Source/Context.h +++ b/Polyfills/Canvas/Source/Context.h @@ -4,6 +4,7 @@ #include #include #include "Image.h" +#include "nanovg/nanovg_filterstack.h" struct NVGcontext; @@ -66,6 +67,8 @@ namespace Babylon::Polyfills::Internal void SetLineJoin(const Napi::CallbackInfo&, const Napi::Value& value); Napi::Value GetMiterLimit(const Napi::CallbackInfo&); void SetMiterLimit(const Napi::CallbackInfo&, const Napi::Value& value); + Napi::Value GetFilter(const Napi::CallbackInfo& info); + void SetFilter(const Napi::CallbackInfo& info, const Napi::Value& value); Napi::Value GetFont(const Napi::CallbackInfo&); void SetFont(const Napi::CallbackInfo&, const Napi::Value& value); Napi::Value GetLetterSpacing(const Napi::CallbackInfo&); @@ -94,6 +97,7 @@ namespace Babylon::Polyfills::Internal std::string m_strokeStyle{}; std::string m_lineCap{}; // 'butt', 'round', 'square' std::string m_lineJoin{}; // 'round', 'bevel', 'miter' + std::string m_filter{}; float m_miterLimit{0.f}; float m_lineWidth{0.f}; float m_globalAlpha{1.f}; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg.cpp b/Polyfills/Canvas/Source/nanovg/nanovg.cpp index 67c0cfa52..1ae6887e2 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg.cpp @@ -24,6 +24,7 @@ #include "nanovg.h" #include +#include "nanovg_filterstack.h" BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4701) // error C4701: potentially uninitialized local variable 'cint' used // -Wunused-function and 4505 must be file scope, can't be disabled between push/pop. @@ -94,6 +95,7 @@ struct NVGstate { float fontBlur; int textAlign; int fontId; + nanovg_filterstack m_filterStack; }; typedef struct NVGstate NVGstate; @@ -674,6 +676,7 @@ void nvgReset(NVGcontext* ctx) state->fontBlur = 0.0f; state->textAlign = NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE; state->fontId = 0; + state->m_filterStack.Clear(); } // State setting @@ -792,6 +795,12 @@ void nvgFillColor(NVGcontext* ctx, NVGcolor color) nvg__setPaintColor(&state->fill, color); } +void nvgFilterStack(NVGcontext* ctx, nanovg_filterstack& filterStack) +{ + NVGstate* state = nvg__getState(ctx); + state->m_filterStack = filterStack; +} + void nvgFillPaint(NVGcontext* ctx, NVGpaint paint) { NVGstate* state = nvg__getState(ctx); @@ -2218,7 +2227,7 @@ void nvgFill(NVGcontext* ctx) fillPaint.image2 = 0; ctx->params.renderFill(ctx->params.userPtr, &fillPaint, state->compositeOperation, &state->scissor, ctx->fringeWidth, - ctx->cache->bounds, ctx->cache->paths, ctx->cache->npaths); + ctx->cache->bounds, ctx->cache->paths, ctx->cache->npaths, state->m_filterStack); // Count triangles for (i = 0; i < ctx->cache->npaths; i++) { diff --git a/Polyfills/Canvas/Source/nanovg/nanovg.h b/Polyfills/Canvas/Source/nanovg/nanovg.h index 8703237bb..ca8678cd5 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg.h @@ -30,6 +30,7 @@ extern "C" { #pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union #endif +class nanovg_filterstack; typedef struct NVGcontext NVGcontext; struct NVGcolor { @@ -609,6 +610,7 @@ void nvgTextMetrics(NVGcontext* ctx, float* ascender, float* descender, float* l // Words longer than the max width are slit at nearest character (i.e. no hyphenation). int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, float breakRowWidth, NVGtextRow* rows, int maxRows); +void nvgFilterStack(NVGcontext* ctx, nanovg_filterstack& filterStack); // // Internal Render API // @@ -653,7 +655,7 @@ struct NVGparams { void (*renderViewport)(void* uptr, float width, float height, float devicePixelRatio); void (*renderCancel)(void* uptr); void (*renderFlush)(void* uptr); - void (*renderFill)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths); + void (*renderFill)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths, nanovg_filterstack& filterStack); void (*renderStroke)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths); void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, const NVGvertex* verts, int nverts); void (*renderDelete)(void* uptr); diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 82351f23a..ecc459205 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -60,7 +60,7 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244) // warning C4244: '=' : conversion from #include "Shaders/essl/fs_fspass.h" #include "Shaders/spirv/vs_fspass.h" #include "Shaders/spirv/fs_fspass.h" - +#include "nanovg_filterstack.h" struct PosTexCoord0Vertex { @@ -205,6 +205,7 @@ namespace int vertexCount; int uniformOffset; GLNVGblend blendFunc; + nanovg_filterstack filterStack; }; struct GLNVGpath @@ -848,6 +849,7 @@ namespace { if (3 <= call->vertexCount) { + /* nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); gl->encoder->setState(gl->state); @@ -866,6 +868,15 @@ namespace bool s_originBottomLeft = bgfx::getCaps()->originBottomLeft; screenSpaceQuad(gl->encoder, s_originBottomLeft); gl->frameBuffer->Submit(*gl->encoder, gl->fsprog, BGFX_DISCARD_ALL);; + */ + call->filterStack.Render([gl, call]() { + nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); + + gl->encoder->setState(gl->state); + gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); + gl->encoder->setTexture(0, gl->s_tex, gl->th); + gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + }); /* nvgRenderSetUniforms(gl, call->uniformOffset, call->image); @@ -1079,6 +1090,7 @@ namespace , const float* bounds , const NVGpath* paths , int npaths + , nanovg_filterstack& filterStack ) { struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; @@ -1094,6 +1106,7 @@ namespace call->image = paint->image; call->image2 = paint->image2; call->blendFunc = glnvg__blendCompositeOperation(compositeOperation); + call->filterStack = filterStack; if (npaths == 1 && paths[0].convex) { diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp new file mode 100644 index 000000000..0ef5248f3 --- /dev/null +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -0,0 +1,21 @@ +#include "nanovg_filterstack.h" + + +void nanovg_filterstack::Render(std::function element) +{ + if (stackElements.empty()) + { + // no filter + element(); + } + else + { + for (int i = 0; i < stackElements.size(); i++) + { + // get new render target + // bind it + // render element to it + } + // composite to canvas at the end + } +} \ No newline at end of file diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h new file mode 100644 index 000000000..705369419 --- /dev/null +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h @@ -0,0 +1,68 @@ +#pragma once +#include +#include +#include "Babylon/Graphics/FrameBuffer.h" + +class nanovg_filterstack +{ +public: + nanovg_filterstack() + { + // create shaders used by the different elements + } + + void AddSepia(float strength) + { + SepiaElement sepia{ strength }; + stackElements.push_back({ sepia }); + } + void AddContrast(float strength) { } + void AddBlur(int horizontal, int vertical) { } + + void Render(std::function element); + void ParseString(const std::string& string) + { + // use regex to parse filter string and add filters accordingly + } + + void SetSize(int width, int height) + { + // flush pool + // keep size for new pool item creation + } + void AddDropShadow() + { + // break down shadow as blur + color + } + void Clear() { stackElements.clear(); } +protected: + + struct SepiaElement + { + float strength; + }; + struct Contrast + { + float strength; + }; + struct Blur + { + int horizontal, vertical; + }; + struct StackElement + { + union + { + SepiaElement sepiaElement; + Contrast contrastElement; + Blur blurElement; + }; + }; + std::vector stackElements; + + Babylon::Graphics::FrameBuffer* GetTransientTarget() + { + // return a framebuffer that will be reused later as a texture or for another element + return {}; + } +}; \ No newline at end of file From 36fc8561a88f63eae12e4ab81ce6802f39bc2552 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Thu, 20 Mar 2025 19:20:34 +1100 Subject: [PATCH 06/24] parse filter string with regex, wire up glnvg__stroke --- Polyfills/Canvas/Source/Context.cpp | 7 ++- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 18 +++++++ .../Source/nanovg/nanovg_filterstack.cpp | 49 +++++++++++++++++++ .../Canvas/Source/nanovg/nanovg_filterstack.h | 11 ++--- 4 files changed, 76 insertions(+), 9 deletions(-) diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 38a2fad84..deb996cb2 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -860,7 +860,12 @@ namespace Babylon::Polyfills::Internal void Context::SetFilter(const Napi::CallbackInfo& info, const Napi::Value& value) { - m_filter = value.As().Utf8Value(); + std::string filterString = value.As().Utf8Value(); + // Keep existing filter if the new one is invalid + if (nanovg_filterstack::ValidString(filterString)) + { + m_filter = filterString; + } } Napi::Value Context::GetFont(const Napi::CallbackInfo& info) diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index ecc459205..acf4a9301 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -827,6 +827,7 @@ namespace static void glnvg__stroke(struct GLNVGcontext* gl, struct GLNVGcall* call) { + /* struct GLNVGpath* paths = &gl->paths[call->pathOffset]; int npaths = call->pathCount, i; @@ -843,6 +844,23 @@ namespace gl->encoder->setTexture(1, gl->s_tex2, gl->th2); gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); } + */ + + call->filterStack.Render([gl, call]() { + // Draw Strokes + struct GLNVGpath* paths = &gl->paths[call->pathOffset]; + int npaths = call->pathCount, i; + for (i = 0; i < npaths; i++) + { + nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); + + gl->encoder->setState(gl->state | BGFX_STATE_PT_TRISTRIP ); + gl->encoder->setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); + gl->encoder->setTexture(0, gl->s_tex, gl->th); + gl->encoder->setTexture(1, gl->s_tex2, gl->th2); + gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + } + }); } static void glnvg__triangles(struct GLNVGcontext* gl, struct GLNVGcall* call) diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index 0ef5248f3..ed094a614 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -1,5 +1,51 @@ #include "nanovg_filterstack.h" +#include +std::regex blurRegex(R"(blur\((\d*\.?\d+)(px|rem)?\)|blur\(\))"); + +nanovg_filterstack::nanovg_filterstack() +{ + // create shaders used by the different elements + // TODO: do I have to pass gl into here? +} + +bool nanovg_filterstack::ValidString(const std::string& string) +{ + std::smatch match; + return std::regex_match(string, match, blurRegex); +} + +void nanovg_filterstack::ParseString(const std::string& string) +{ + stackElements.clear(); + + std::smatch match; + if (std::regex_match(string, match, blurRegex)) + { + if ( match.size() > 1 && match[1].matched) + { + int radius = std::stoi(match[1].str()); + std::string unit = match[2].matched ? match[2].str() : "px"; + std::transform(unit.begin(), unit.end(), unit.begin(), ::tolower); + + if (unit != "px") + { + // TODO: convert non-px radius + } + + StackElement element = {}; + element.blurElement = {radius, radius}; + stackElements.push_back(element); + } + else + { + // defaults to blur(0) + StackElement element = {}; + element.blurElement = {0, 0}; + stackElements.push_back(element); + } + } +} void nanovg_filterstack::Render(std::function element) { @@ -10,6 +56,9 @@ void nanovg_filterstack::Render(std::function element) } else { + // TODO: move over Cedric's glnvg__triangles hacks from nanovg_babylon.cpp + // TODO: Instead of hackyFrameBuffer, implement render target manager + // TODO: may need to pass down gl + call from glnvg__triangles + glnvg__stroke? for (int i = 0; i < stackElements.size(); i++) { // get new render target diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h index 705369419..78878a764 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h @@ -6,10 +6,7 @@ class nanovg_filterstack { public: - nanovg_filterstack() - { - // create shaders used by the different elements - } + nanovg_filterstack(); void AddSepia(float strength) { @@ -20,10 +17,8 @@ class nanovg_filterstack void AddBlur(int horizontal, int vertical) { } void Render(std::function element); - void ParseString(const std::string& string) - { - // use regex to parse filter string and add filters accordingly - } + void ParseString(const std::string& string); + static bool ValidString(const std::string& string); void SetSize(int width, int height) { From da979cded24c885912f009fedeff8509d3050031 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Sat, 22 Mar 2025 18:59:36 +1100 Subject: [PATCH 07/24] add basic framebuffer management --- Polyfills/Canvas/Source/Canvas.cpp | 105 ++++++++++++++---- Polyfills/Canvas/Source/Canvas.h | 15 ++- Polyfills/Canvas/Source/Context.cpp | 47 ++++++-- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 19 +++- .../Canvas/Source/nanovg/nanovg_babylon.h | 8 ++ .../Source/nanovg/nanovg_filterstack.cpp | 7 +- 6 files changed, 168 insertions(+), 33 deletions(-) diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index 5a5ef30bd..af4bc51ff 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -8,14 +8,13 @@ #include "Colors.h" #include "Gradient.h" +const int POOL_SIZE = 3; + namespace { constexpr auto JS_CANVAS_NAME = "_CanvasImpl"; } -bgfx::FrameBufferHandle hackTextBuffer{ bgfx::kInvalidHandle }; -Babylon::Graphics::FrameBuffer* hackFrameBuffer; - namespace Babylon::Polyfills::Internal { static constexpr auto JS_CONSTRUCTOR_NAME = "Canvas"; @@ -115,10 +114,85 @@ namespace Babylon::Polyfills::Internal } } + void NativeCanvas::PoolInit(int size) + { + for (int i = 0; i < size; ++i) + { + + bgfx::FrameBufferHandle TextBuffer{ bgfx::kInvalidHandle }; + Graphics::FrameBuffer* FrameBuffer; + + int width(256), height(256); + std::array textures{ + bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), + bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT) }; + + std::array attachments{}; + for (size_t idx = 0; idx < attachments.size(); ++idx) + { + attachments[idx].init(textures[idx]); + } + TextBuffer = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); + + FrameBuffer = new Graphics::FrameBuffer(m_graphicsContext, TextBuffer, width, height, false, false, false); + // TODO: confirm why m_texture is reset, esp for pool framebuffers + if (m_texture) + { + m_texture.reset(); + } + mPoolBuffers.push_back({FrameBuffer, true}); + } + } + + void NativeCanvas::PoolClear() + { + for (auto& buffer : mPoolBuffers) + { + if (buffer.frameBuffer) + { + // buffer.frameBuffer->Dispose(); // TODO: do we need to Dispose() before delete? + delete buffer.frameBuffer; + buffer.frameBuffer = nullptr; + } + } + mPoolBuffers.clear(); + } + + Graphics::FrameBuffer* NativeCanvas::PoolAcquire() + { + for (auto& buffer : mPoolBuffers) + { + if (buffer.isAvailable) + { + buffer.isAvailable = false; + return buffer.frameBuffer; + } + } + } + + void NativeCanvas::PoolRelease(Graphics::FrameBuffer* frameBuffer) + { + for (auto& buffer : mPoolBuffers) + { + if (buffer.frameBuffer == frameBuffer) + { + // TODO: clear framebuffer? + buffer.isAvailable = true; + return; + } + } + } + + // NOTE: I'm keeping UpdateRenderTarget around for the primary framebuffer. Pool is only for multi-pass rendering. + // NOTE2: UpdateRenderTarget gets called from Context::DeferredFlushFrame (which in turn gets called on SetDirty ie. per rendered frame) + // NOTE: Canvas::m_dirty is only set when the width or height changes. NOT every frame! We'll of course need to do the same for pool buffers. + // MAKE COMMENT: to say only defined new framebuffers on size change bool NativeCanvas::UpdateRenderTarget() { if (m_dirty) { + // TODO: Can delete this whole block if we decide to use pool for primary framebuffer + // TODO2: probably want to reuse the clear code for both primary & pool fbs? { std::array textures{ bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), @@ -139,27 +213,13 @@ namespace Babylon::Polyfills::Internal m_texture.reset(); } } - - // HACK + // NOTE: This is called width / height has changed. m_dirty is set by width/height change in constructor. So this is also initialization + // NOTE2: anyway, whats important is that UpdateRenderTarget is the trigger for defining new framebuffers. on init, and on size change { - int width(256), height(256); - std::array textures{ - bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), - bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT) }; - - std::array attachments{}; - for (size_t idx = 0; idx < attachments.size(); ++idx) - { - attachments[idx].init(textures[idx]); - } - hackTextBuffer = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); - - hackFrameBuffer = new Babylon::Graphics::FrameBuffer(m_graphicsContext, hackTextBuffer, width, height, false, false, false); - if (m_texture) - { - m_texture.reset(); - } + PoolClear(); + PoolInit(POOL_SIZE); } + return true; } return false; @@ -188,6 +248,7 @@ namespace Babylon::Polyfills::Internal { m_frameBuffer.reset(); m_texture.reset(); + PoolClear(); // TODO: confirm we want to do this? } void NativeCanvas::Dispose(const Napi::CallbackInfo& /*info*/) diff --git a/Polyfills/Canvas/Source/Canvas.h b/Polyfills/Canvas/Source/Canvas.h index bff15bd52..a59c80ae1 100644 --- a/Polyfills/Canvas/Source/Canvas.h +++ b/Polyfills/Canvas/Source/Canvas.h @@ -66,7 +66,20 @@ namespace Babylon::Polyfills::Internal // returns true if frameBuffer size has changed bool UpdateRenderTarget(); - Babylon::Graphics::FrameBuffer& GetFrameBuffer() { return *m_frameBuffer; } + Graphics::FrameBuffer& GetFrameBuffer() { return *m_frameBuffer; } + + // render target management + // NOTE: In the same manner than main frame buffer methods live in Canvas.cpp, pool management is also Canvas.cpp + struct PoolBuffer + { + Graphics::FrameBuffer* frameBuffer; + bool isAvailable; + }; + std::vector mPoolBuffers; + void NativeCanvas::PoolInit(int nBuffers); + void NativeCanvas::PoolClear(); + Graphics::FrameBuffer* NativeCanvas::PoolAcquire(); + void NativeCanvas::PoolRelease(Graphics::FrameBuffer* frameBuffer); Graphics::DeviceContext& GetGraphicsContext() { diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index deb996cb2..075bfff50 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -30,8 +30,6 @@ #include "LineCaps.h" #include "Gradient.h" -extern Babylon::Graphics::FrameBuffer* hackFrameBuffer; - /* Most of these context methods are preliminary work. They are currenbly not tested properly. */ @@ -120,6 +118,19 @@ namespace Babylon::Polyfills::Internal { m_fonts[font.first] = nvgCreateFontMem(*m_nvg, font.first.c_str(), font.second.data(), static_cast(font.second.size()), 0); } + + // TODO: check is capturing 'this' ok? Its be reference right? + std::function acquire = [this]() -> Babylon::Graphics::FrameBuffer* { + return this->m_canvas->PoolAcquire(); + }; + std::function release = [this](Babylon::Graphics::FrameBuffer* frameBuffer) -> void { + this->m_canvas->PoolRelease(frameBuffer); + }; + // TODO: Confirm that pool is initilalized before nanovg_babylon.cpp calls acquire + nvgSetTargetManager({ + acquire, + release + }); } Context::~Context() @@ -174,6 +185,8 @@ namespace Babylon::Polyfills::Internal } } + // TODO: figure out how a params.renderCreateFrameBuffer from nanovg_babylon.cpp would ultimated then call Canvas::RequestRenderTarget + void Context::FillRect(const Napi::CallbackInfo& info) { auto left = info[0].As().FloatValue(); @@ -189,11 +202,12 @@ namespace Babylon::Polyfills::Internal nvgRect(*m_nvg, left, top, width, height); BindFillStyle(info, left, top, width, height); + // TODO: also do this for other FillX methods if (m_filter.length()) { nanovg_filterstack filterStack; filterStack.ParseString(m_filter); - nvgFilterStack(*m_nvg, filterStack); + nvgFilterStack(*m_nvg, filterStack); // sets filterStack on nanovg } nvgFill(*m_nvg); SetDirty(); @@ -578,11 +592,12 @@ namespace Babylon::Polyfills::Internal } } + // TODO: should we still keep primary frame? so alongside FrameBufferPool... void Context::DeferredFlushFrame() { // on some systems (Ubuntu), the framebuffer contains garbage. // Unlike other systems where it's cleared. - bool needClear = m_canvas->UpdateRenderTarget(); + bool needClear = m_canvas->UpdateRenderTarget(); // NOTE: this will recreate framebuffers IFF size changes. Otherwise, reuses previous arcana::make_task(m_update.Scheduler(), *m_cancellationSource, [this, needClear, cancellationSource{m_cancellationSource}]() { return arcana::make_task(m_runtimeScheduler, *m_cancellationSource, [this, needClear, updateToken{m_update.GetUpdateToken()}, cancellationSource{m_cancellationSource}]() { @@ -599,16 +614,34 @@ namespace Babylon::Polyfills::Internal const auto height = m_canvas->GetHeight(); - hackFrameBuffer->Bind(*encoder); + // TODO: Consider how filters framebuffer plays into this Context.cpp loop.. Should we be replacing GetFrameBuffer() with like GetFrameBufferManager()? + // NOTE: I think encoder might be how stuff from Context.cpp gets passed to nanovg_babylon.cpp, then nanovg.cpp + // NOTE2: almost certainly as a result of Bind(), then nvgSetFrameBufferAndEncoder (which we own in nanovg_babylon.cpp) + // NOTE3: seems like you can bind multiple framebuffers so same encoder. bind probably needs to happen as part of render target mgmt? + // NOTE4: probably fine because its all just for a single frame anyway... + // SOLUTION: would it make sense to just iterate through pool and bind to encoder? + // This would happen every frame. FB won't always be re-created, but not sure if encoder is?! + for (auto& buffer : m_canvas->mPoolBuffers) + { + // sanity check no buffers should have been acquired yet + assert(buffer.isAvailable == true); + buffer.frameBuffer->Bind(*encoder); + buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); + } - hackFrameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); nvgBeginFrame(*m_nvg, float(width), float(height), 1.0f); nvgSetFrameBufferAndEncoder(*m_nvg, frameBuffer, encoder); nvgEndFrame(*m_nvg); frameBuffer.Unbind(*encoder); - hackFrameBuffer->Unbind(*encoder); + for (auto& buffer : m_canvas->mPoolBuffers) + { + // sanity check no unreleased buffers + assert(buffer.isAvailable == true); + buffer.frameBuffer->Unbind(*encoder); + } + m_dirty = false; }).then(arcana::inline_scheduler, *m_cancellationSource, [this, cancellationSource{m_cancellationSource}](const arcana::expected& result) { if (!cancellationSource->cancelled() && result.has_error()) diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index acf4a9301..7199b8a16 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -62,6 +62,9 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244) // warning C4244: '=' : conversion from #include "Shaders/spirv/fs_fspass.h" #include "nanovg_filterstack.h" +// TODO: define this somewhere less hacky +FrameBufferPool mPool; + struct PosTexCoord0Vertex { float m_x; @@ -150,8 +153,6 @@ static const bgfx::EmbeddedShader s_embeddedShadersBabylon[] = BGFX_EMBEDDED_SHADER_END() }; -extern Babylon::Graphics::FrameBuffer* hackFrameBuffer; - namespace { static bgfx::VertexLayout s_nvgLayout; @@ -272,6 +273,7 @@ namespace bgfx::TransientVertexBuffer tvb; Babylon::Graphics::FrameBuffer* frameBuffer; + // TODO: instead of frameBuffer, TargetManager? bgfx::Encoder* encoder; struct GLNVGtexture* textures; @@ -867,6 +869,13 @@ namespace { if (3 <= call->vertexCount) { + // TODO (cedric): nanovg should query a new framebuffer and discard it when not needed anymore. repeat that each frame. I would start with that + // NOTE: we have access to mPool here, so can acquire + // NOTE: if i use bgfx transient buffer, i don't need to release it + + // HACK: Sanity check that we can create FrameBuffers in Canvas.cpp, and access them in nanovg_babylon.cpp + Babylon::Graphics::FrameBuffer* acquiredFrameBuffer = mPool.acquire(); + /* nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); @@ -1358,7 +1367,13 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) return NULL; } +void nvgSetTargetManager(FrameBufferPool pool) +{ + mPool = pool; +} +// TODO: I think need to pass down render target manager into this.. (instead of frameBuffer) +// TODO2: For now, can pass render target manager, then set gl->frameBuffer immediately.. account for cleanup later in Context.cpp void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder) { struct GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(_ctx)->userPtr; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h index 8b7800490..7b0a56e13 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h @@ -6,6 +6,7 @@ #ifndef NANOVG_BABYLON_H_HEADER_GUARD #define NANOVG_BABYLON_H_HEADER_GUARD +#include #include #include namespace bx @@ -21,6 +22,13 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator); /// NVGcontext* nvgCreate(int32_t _edgeaa); +struct FrameBufferPool +{ + std::function acquire; + std::function release; +}; +FrameBufferPool mPool; +inline void nvgSetTargetManager(FrameBufferPool pool) { mPool = pool; }; void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder); /// diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index ed094a614..63d7284ae 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -2,6 +2,7 @@ #include std::regex blurRegex(R"(blur\((\d*\.?\d+)(px|rem)?\)|blur\(\))"); +std::regex noneRegex(R"(^\s*none\s*$)"); nanovg_filterstack::nanovg_filterstack() { @@ -12,7 +13,7 @@ nanovg_filterstack::nanovg_filterstack() bool nanovg_filterstack::ValidString(const std::string& string) { std::smatch match; - return std::regex_match(string, match, blurRegex); + return std::regex_match(string, match, noneRegex) || std::regex_match(string, match, blurRegex); } void nanovg_filterstack::ParseString(const std::string& string) @@ -59,6 +60,10 @@ void nanovg_filterstack::Render(std::function element) // TODO: move over Cedric's glnvg__triangles hacks from nanovg_babylon.cpp // TODO: Instead of hackyFrameBuffer, implement render target manager // TODO: may need to pass down gl + call from glnvg__triangles + glnvg__stroke? + + + // NOTE: fine to encapsulate hackFrambuffer in a target manager first. + // NOTE: basically hackframebuffer manager needs to be accessble from here in nanovg_filterstack.cpp for (int i = 0; i < stackElements.size(); i++) { // get new render target From d63e3bb8b2c84f1a2ed58cd55dec827dbb2dd32e Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Sun, 23 Mar 2025 23:27:59 +1100 Subject: [PATCH 08/24] Multi-pass rendering --- Apps/Playground/Scripts/experience.js | 20 ++- Polyfills/Canvas/Source/Canvas.cpp | 13 +- Polyfills/Canvas/Source/Canvas.h | 6 +- Polyfills/Canvas/Source/Context.cpp | 34 ++--- Polyfills/Canvas/Source/nanovg/nanovg.cpp | 7 +- Polyfills/Canvas/Source/nanovg/nanovg.h | 4 +- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 117 +++++++++++------- .../Canvas/Source/nanovg/nanovg_babylon.h | 4 +- .../Source/nanovg/nanovg_filterstack.cpp | 107 ++++++++++++++-- .../Canvas/Source/nanovg/nanovg_filterstack.h | 33 +++-- 10 files changed, 247 insertions(+), 98 deletions(-) diff --git a/Apps/Playground/Scripts/experience.js b/Apps/Playground/Scripts/experience.js index b33f63805..7623aed18 100644 --- a/Apps/Playground/Scripts/experience.js +++ b/Apps/Playground/Scripts/experience.js @@ -96,6 +96,7 @@ CreateBoxAsync(scene).then(function () { var t = 0; scene.onBeforeRenderObservable.add(() => { + // animated shape context.save(); context.fillStyle = "DarkRed"; @@ -114,6 +115,7 @@ CreateBoxAsync(scene).then(function () { context.transform(1, t, 0.8, 1, 0, 0); context.fillRect(-width * 0.5, -height * 0.5, width, height); context.restore(); + // curve context.beginPath(); context.moveTo(75 * 2, 25 * 2); @@ -147,6 +149,15 @@ CreateBoxAsync(scene).then(function () { context.lineTo(140, 140); context.stroke(); + context.filter = "blur(5px)"; + + // filter blur text + context.fillStyle = "White"; + context.font = `bold ${50}px monospace`; + context.fillText("BLUR TEST BLUR TEST", 100, 246); + + context.filter = "none"; + // Draw lines context.strokeStyle = "black"; ["butt", "round", "square"].forEach((lineCap, i) => { @@ -158,6 +169,8 @@ CreateBoxAsync(scene).then(function () { context.stroke(); }); + context.filter = "blur(5px)"; + // line join context.lineWidth = 10; var offset = 200; @@ -172,6 +185,8 @@ CreateBoxAsync(scene).then(function () { context.stroke(); }); + context.filter = "none"; + // rect with gradient context.fillStyle = gradient; context.fillRect(10, 310, 400, 60); @@ -181,7 +196,6 @@ CreateBoxAsync(scene).then(function () { context.font = "bold 60px monospace"; context.fillText("Gradient Text!", 10, 420); - context.lineWidth = 5; // Rounded rectangle with zero radius (specified as a number) context.strokeStyle = "red"; @@ -189,12 +203,16 @@ CreateBoxAsync(scene).then(function () { context.roundRect(10, 220, 150, 100, 0); context.stroke(); + context.filter = "blur(5px)"; + // Rounded rectangle with 40px radius (single element list) context.strokeStyle = "blue"; context.beginPath(); context.roundRect(10, 220, 150, 100, [40]); context.stroke(); + context.filter = "none"; + // Rounded rectangle with 2 different radii context.strokeStyle = "orange"; context.beginPath(); diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index af4bc51ff..a7eae79bf 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -168,6 +168,8 @@ namespace Babylon::Polyfills::Internal return buffer.frameBuffer; } } + // TODO: If no buffers available, pool wasn't large enough. Should it automatically resize? + throw std::runtime_error{"No available frame buffer in pool"}; } void NativeCanvas::PoolRelease(Graphics::FrameBuffer* frameBuffer) @@ -176,23 +178,19 @@ namespace Babylon::Polyfills::Internal { if (buffer.frameBuffer == frameBuffer) { - // TODO: clear framebuffer? + // TODO: clear framebuffer? i think has to be done in nanovg_babylon.cpp / nanovg_filterstack.cpp before releasing back to pool buffer.isAvailable = true; return; } } } - // NOTE: I'm keeping UpdateRenderTarget around for the primary framebuffer. Pool is only for multi-pass rendering. - // NOTE2: UpdateRenderTarget gets called from Context::DeferredFlushFrame (which in turn gets called on SetDirty ie. per rendered frame) - // NOTE: Canvas::m_dirty is only set when the width or height changes. NOT every frame! We'll of course need to do the same for pool buffers. - // MAKE COMMENT: to say only defined new framebuffers on size change + // NOTE: This only runs when canvas size changes (inc. init?). It'll trigger re-creation of framebuffers bool NativeCanvas::UpdateRenderTarget() { if (m_dirty) { // TODO: Can delete this whole block if we decide to use pool for primary framebuffer - // TODO2: probably want to reuse the clear code for both primary & pool fbs? { std::array textures{ bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), @@ -213,13 +211,10 @@ namespace Babylon::Polyfills::Internal m_texture.reset(); } } - // NOTE: This is called width / height has changed. m_dirty is set by width/height change in constructor. So this is also initialization - // NOTE2: anyway, whats important is that UpdateRenderTarget is the trigger for defining new framebuffers. on init, and on size change { PoolClear(); PoolInit(POOL_SIZE); } - return true; } return false; diff --git a/Polyfills/Canvas/Source/Canvas.h b/Polyfills/Canvas/Source/Canvas.h index a59c80ae1..2d025563c 100644 --- a/Polyfills/Canvas/Source/Canvas.h +++ b/Polyfills/Canvas/Source/Canvas.h @@ -66,10 +66,8 @@ namespace Babylon::Polyfills::Internal // returns true if frameBuffer size has changed bool UpdateRenderTarget(); - Graphics::FrameBuffer& GetFrameBuffer() { return *m_frameBuffer; } + Babylon::Graphics::FrameBuffer& GetFrameBuffer() { return *m_frameBuffer; } - // render target management - // NOTE: In the same manner than main frame buffer methods live in Canvas.cpp, pool management is also Canvas.cpp struct PoolBuffer { Graphics::FrameBuffer* frameBuffer; @@ -78,7 +76,7 @@ namespace Babylon::Polyfills::Internal std::vector mPoolBuffers; void NativeCanvas::PoolInit(int nBuffers); void NativeCanvas::PoolClear(); - Graphics::FrameBuffer* NativeCanvas::PoolAcquire(); + Babylon::Graphics::FrameBuffer* NativeCanvas::PoolAcquire(); void NativeCanvas::PoolRelease(Graphics::FrameBuffer* frameBuffer); Graphics::DeviceContext& GetGraphicsContext() diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 075bfff50..8199fe066 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -202,13 +202,14 @@ namespace Babylon::Polyfills::Internal nvgRect(*m_nvg, left, top, width, height); BindFillStyle(info, left, top, width, height); - // TODO: also do this for other FillX methods + if (m_filter.length()) { nanovg_filterstack filterStack; filterStack.ParseString(m_filter); nvgFilterStack(*m_nvg, filterStack); // sets filterStack on nanovg } + nvgFill(*m_nvg); SetDirty(); } @@ -512,6 +513,13 @@ namespace Babylon::Polyfills::Internal } } + if (m_filter.length()) + { + nanovg_filterstack filterStack; + filterStack.ParseString(m_filter); + nvgFilterStack(*m_nvg, filterStack); // sets filterStack on nanovg + } + nvgStroke(*m_nvg); SetDirty(); } @@ -578,6 +586,13 @@ namespace Babylon::Polyfills::Internal { BindFillStyle(info, 0.f, 0.f, x, y); + if (m_filter.length()) + { + nanovg_filterstack filterStack; + filterStack.ParseString(m_filter); + nvgFilterStack(*m_nvg, filterStack); // sets filterStack on nanovg + } + nvgText(*m_nvg, x, y, text.c_str(), nullptr); SetDirty(); } @@ -592,7 +607,7 @@ namespace Babylon::Polyfills::Internal } } - // TODO: should we still keep primary frame? so alongside FrameBufferPool... + // NOTE: Currently, we keep primary frame seperate. Should it come from pool? void Context::DeferredFlushFrame() { // on some systems (Ubuntu), the framebuffer contains garbage. @@ -613,21 +628,12 @@ namespace Babylon::Polyfills::Internal const auto width = m_canvas->GetWidth(); const auto height = m_canvas->GetHeight(); - - // TODO: Consider how filters framebuffer plays into this Context.cpp loop.. Should we be replacing GetFrameBuffer() with like GetFrameBufferManager()? - // NOTE: I think encoder might be how stuff from Context.cpp gets passed to nanovg_babylon.cpp, then nanovg.cpp - // NOTE2: almost certainly as a result of Bind(), then nvgSetFrameBufferAndEncoder (which we own in nanovg_babylon.cpp) - // NOTE3: seems like you can bind multiple framebuffers so same encoder. bind probably needs to happen as part of render target mgmt? - // NOTE4: probably fine because its all just for a single frame anyway... - - // SOLUTION: would it make sense to just iterate through pool and bind to encoder? - // This would happen every frame. FB won't always be re-created, but not sure if encoder is?! for (auto& buffer : m_canvas->mPoolBuffers) { // sanity check no buffers should have been acquired yet assert(buffer.isAvailable == true); - buffer.frameBuffer->Bind(*encoder); - buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); + // buffer.frameBuffer->Bind(*encoder); // TODO: remove this, should be done in Acquire + // buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); // TODO: confirm that this not necessary because of ScreenSpaceQuad?? } nvgBeginFrame(*m_nvg, float(width), float(height), 1.0f); @@ -639,7 +645,7 @@ namespace Babylon::Polyfills::Internal { // sanity check no unreleased buffers assert(buffer.isAvailable == true); - buffer.frameBuffer->Unbind(*encoder); + // buffer.frameBuffer->Unbind(*encoder); // TODO: remove this after I implement Bind / Unbind as part of acquire/release } m_dirty = false; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg.cpp b/Polyfills/Canvas/Source/nanovg/nanovg.cpp index 1ae6887e2..4cb23d258 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg.cpp @@ -676,7 +676,7 @@ void nvgReset(NVGcontext* ctx) state->fontBlur = 0.0f; state->textAlign = NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE; state->fontId = 0; - state->m_filterStack.Clear(); + state->m_filterStack.Clear(); // NOTE: does it make sense to .Clear()? or is it better to set to null } // State setting @@ -795,6 +795,7 @@ void nvgFillColor(NVGcontext* ctx, NVGcolor color) nvg__setPaintColor(&state->fill, color); } +// should be set before a draw (eg. stroke, fill). a copy of filter stack is attached to the draw call for drawing filters void nvgFilterStack(NVGcontext* ctx, nanovg_filterstack& filterStack) { NVGstate* state = nvg__getState(ctx); @@ -2270,7 +2271,7 @@ void nvgStroke(NVGcontext* ctx) nvg__expandStroke(ctx, strokeWidth*0.5f, 0.0f, state->lineCap, state->lineJoin, state->miterLimit); ctx->params.renderStroke(ctx->params.userPtr, &strokePaint, state->compositeOperation, &state->scissor, ctx->fringeWidth, - strokeWidth, ctx->cache->paths, ctx->cache->npaths); + strokeWidth, ctx->cache->paths, ctx->cache->npaths, state->m_filterStack); // Count triangles for (i = 0; i < ctx->cache->npaths; i++) { @@ -2421,7 +2422,7 @@ static void nvg__renderText(NVGcontext* ctx, NVGpaint* paint, NVGvertex* verts, paint->innerColor.a *= state->alpha; paint->outerColor.a *= state->alpha; - ctx->params.renderTriangles(ctx->params.userPtr, paint, state->compositeOperation, &state->scissor, verts, nverts); + ctx->params.renderTriangles(ctx->params.userPtr, paint, state->compositeOperation, &state->scissor, verts, nverts, state->m_filterStack); ctx->drawCallCount++; ctx->textTriCount += nverts/3; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg.h b/Polyfills/Canvas/Source/nanovg/nanovg.h index ca8678cd5..9aaf1e387 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg.h @@ -656,8 +656,8 @@ struct NVGparams { void (*renderCancel)(void* uptr); void (*renderFlush)(void* uptr); void (*renderFill)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths, nanovg_filterstack& filterStack); - void (*renderStroke)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths); - void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, const NVGvertex* verts, int nverts); + void (*renderStroke)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths, nanovg_filterstack& filterStack); + void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, const NVGvertex* verts, int nverts, nanovg_filterstack& filterStack); void (*renderDelete)(void* uptr); }; typedef struct NVGparams NVGparams; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 7199b8a16..3ab706334 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -50,16 +50,6 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244) // warning C4244: '=' : conversion from #include "Shaders/spirv/vs_nanovg_fill.h" #include "Shaders/spirv/fs_nanovg_fill.h" -#include "Shaders/dx11/vs_fspass.h" -#include "Shaders/dx11/fs_fspass.h" -#include "Shaders/metal/vs_fspass.h" -#include "Shaders/metal/fs_fspass.h" -#include "Shaders/glsl/vs_fspass.h" -#include "Shaders/glsl/fs_fspass.h" -#include "Shaders/essl/vs_fspass.h" -#include "Shaders/essl/fs_fspass.h" -#include "Shaders/spirv/vs_fspass.h" -#include "Shaders/spirv/fs_fspass.h" #include "nanovg_filterstack.h" // TODO: define this somewhere less hacky @@ -147,9 +137,6 @@ static const bgfx::EmbeddedShader s_embeddedShadersBabylon[] = BGFX_EMBEDDED_SHADER(vs_nanovg_fill), BGFX_EMBEDDED_SHADER(fs_nanovg_fill), - BGFX_EMBEDDED_SHADER(vs_fspass), - BGFX_EMBEDDED_SHADER(fs_fspass), - BGFX_EMBEDDED_SHADER_END() }; @@ -250,7 +237,6 @@ namespace bx::AllocatorI* allocator; bgfx::ProgramHandle prog; - bgfx::ProgramHandle fsprog; bgfx::UniformHandle u_scissorMat; bgfx::UniformHandle u_paintMat; bgfx::UniformHandle u_innerCol; @@ -273,7 +259,6 @@ namespace bgfx::TransientVertexBuffer tvb; Babylon::Graphics::FrameBuffer* frameBuffer; - // TODO: instead of frameBuffer, TargetManager? bgfx::Encoder* encoder; struct GLNVGtexture* textures; @@ -848,7 +833,8 @@ namespace } */ - call->filterStack.Render([gl, call]() { + bgfx::ProgramHandle firstProg = gl->prog; + std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { // Draw Strokes struct GLNVGpath* paths = &gl->paths[call->pathOffset]; int npaths = call->pathCount, i; @@ -860,22 +846,40 @@ namespace gl->encoder->setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); gl->encoder->setTexture(0, gl->s_tex, gl->th); gl->encoder->setTexture(1, gl->s_tex2, gl->th2); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); } - }); + }; + std::function filterPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *inBuffer, Babylon::Graphics::FrameBuffer *outBuffer) { + nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); + // TODO: Do we need to tack on BGFX_STATE_PT_TRISTRIP? + gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A + | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) + | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); + gl->encoder->setTexture(0, gl->s_tex, bgfx::getTexture(inBuffer->Handle())); + bool s_originBottomLeft = bgfx::getCaps()->originBottomLeft; + screenSpaceQuad(gl->encoder, s_originBottomLeft); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + }; + Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; + + std::function acquire = [&]() -> Babylon::Graphics::FrameBuffer* { + Babylon::Graphics::FrameBuffer *frameBuffer = mPool.acquire(); + frameBuffer->Bind(*gl->encoder); + return frameBuffer; + }; + + std::function release = [&](Babylon::Graphics::FrameBuffer* frameBuffer) { + frameBuffer->Unbind(*gl->encoder); + mPool.release(frameBuffer); + }; + + call->filterStack.Render(firstProg, firstPass, filterPass, finalFrameBuffer, acquire, release); } static void glnvg__triangles(struct GLNVGcontext* gl, struct GLNVGcall* call) { if (3 <= call->vertexCount) { - // TODO (cedric): nanovg should query a new framebuffer and discard it when not needed anymore. repeat that each frame. I would start with that - // NOTE: we have access to mPool here, so can acquire - // NOTE: if i use bgfx transient buffer, i don't need to release it - - // HACK: Sanity check that we can create FrameBuffers in Canvas.cpp, and access them in nanovg_babylon.cpp - Babylon::Graphics::FrameBuffer* acquiredFrameBuffer = mPool.acquire(); - /* nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); @@ -896,21 +900,48 @@ namespace screenSpaceQuad(gl->encoder, s_originBottomLeft); gl->frameBuffer->Submit(*gl->encoder, gl->fsprog, BGFX_DISCARD_ALL);; */ - call->filterStack.Render([gl, call]() { - nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); - - gl->encoder->setState(gl->state); - gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); - gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); - }); + /* nvgRenderSetUniforms(gl, call->uniformOffset, call->image); gl->encoder->setState(gl->state); gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL);*/ + gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + */ + + bgfx::ProgramHandle firstProg = gl->prog; + std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { + nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); + gl->encoder->setState(gl->state); + gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); + gl->encoder->setTexture(0, gl->s_tex, gl->th); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + }; + std::function filterPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *inBuffer, Babylon::Graphics::FrameBuffer *outBuffer) { + nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); + gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A + | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) + | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); + gl->encoder->setTexture(0, gl->s_tex, bgfx::getTexture(inBuffer->Handle())); + bool s_originBottomLeft = bgfx::getCaps()->originBottomLeft; + screenSpaceQuad(gl->encoder, s_originBottomLeft); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + }; + Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; + + std::function acquire = [&]() -> Babylon::Graphics::FrameBuffer* { + Babylon::Graphics::FrameBuffer *frameBuffer = mPool.acquire(); + frameBuffer->Bind(*gl->encoder); + return frameBuffer; + }; + + std::function release = [&](Babylon::Graphics::FrameBuffer* frameBuffer) { + frameBuffer->Unbind(*gl->encoder); + mPool.release(frameBuffer); + }; + + call->filterStack.Render(firstProg, firstPass, filterPass, finalFrameBuffer, acquire, release); } } @@ -957,6 +988,7 @@ namespace { struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; //gl->frameBuffer->SetViewPort(gl->encoder, 0.f, 0.f, gl->view[0], gl->view[1]); + // NOTE: I'm not sure why we need to re-define fill in every nvgRenderFlush if (!gl->prog.idx) { bgfx::RendererType::Enum type = bgfx::getRendererType(); @@ -966,12 +998,6 @@ namespace , true ); - gl->fsprog = bgfx::createProgram( - bgfx::createEmbeddedShader(s_embeddedShadersBabylon, type, "vs_fspass") - , bgfx::createEmbeddedShader(s_embeddedShadersBabylon, type, "fs_fspass") - , true - ); - // Vertex layout PosTexCoord0Vertex::init(); } @@ -995,6 +1021,8 @@ namespace for (uint32_t ii = 0, num = gl->ncalls; ii < num; ++ii) { struct GLNVGcall* call = &gl->calls[ii]; + nanovg_filterstack fs = call->filterStack; + const GLNVGblend* blend = &call->blendFunc; gl->state = BGFX_STATE_BLEND_FUNC_SEPARATE(blend->srcRGB, blend->dstRGB, blend->srcAlpha, blend->dstAlpha) | BGFX_STATE_WRITE_RGB @@ -1206,6 +1234,7 @@ namespace , float strokeWidth , const struct NVGpath* paths , int npaths + , nanovg_filterstack& filterStack ) { struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; @@ -1219,6 +1248,7 @@ namespace call->image = paint->image; call->image2 = paint->image2; call->blendFunc = glnvg__blendCompositeOperation(compositeOperation); + call->filterStack = filterStack; // Allocate vertices for all the paths. maxverts = glnvg__maxVertCount(paths, npaths); @@ -1244,7 +1274,7 @@ namespace } static void nvgRenderTriangles(void* _userPtr, struct NVGpaint* paint, NVGcompositeOperationState compositeOperation, struct NVGscissor* scissor, - const struct NVGvertex* verts, int nverts) + const struct NVGvertex* verts, int nverts, nanovg_filterstack& filterStack) { struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; struct GLNVGcall* call = glnvg__allocCall(gl); @@ -1254,6 +1284,7 @@ namespace call->image = paint->image; call->image2 = paint->image2; call->blendFunc = glnvg__blendCompositeOperation(compositeOperation); + call->filterStack = filterStack; // Allocate vertices for all the paths. call->vertexOffset = glnvg__allocVerts(gl, nverts); @@ -1367,13 +1398,13 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) return NULL; } +// TODO: remove this, move to nvgSetFrameBufferAndEncoder void nvgSetTargetManager(FrameBufferPool pool) { mPool = pool; } -// TODO: I think need to pass down render target manager into this.. (instead of frameBuffer) -// TODO2: For now, can pass render target manager, then set gl->frameBuffer immediately.. account for cleanup later in Context.cpp +// TODO: Might make sense to pass frame buffer pool here. That way we can Bind/Unbind from encoder in acquire/release. void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder) { struct GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(_ctx)->userPtr; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h index 7b0a56e13..bbb9cb631 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h @@ -27,8 +27,8 @@ struct FrameBufferPool std::function acquire; std::function release; }; -FrameBufferPool mPool; -inline void nvgSetTargetManager(FrameBufferPool pool) { mPool = pool; }; + +void nvgSetTargetManager(FrameBufferPool pool); void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder); /// diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index 63d7284ae..8a550baa0 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -1,13 +1,44 @@ #include "nanovg_filterstack.h" #include +#include + +#include +#include std::regex blurRegex(R"(blur\((\d*\.?\d+)(px|rem)?\)|blur\(\))"); std::regex noneRegex(R"(^\s*none\s*$)"); +// TODO: move fspass code from nanovg_babylon.cpp into nanovg_filterstack.cpp +#include "Shaders/dx11/vs_fspass.h" +#include "Shaders/dx11/fs_fspass.h" +#include "Shaders/metal/vs_fspass.h" +#include "Shaders/metal/fs_fspass.h" +#include "Shaders/glsl/vs_fspass.h" +#include "Shaders/glsl/fs_fspass.h" +#include "Shaders/essl/vs_fspass.h" +#include "Shaders/essl/fs_fspass.h" +#include "Shaders/spirv/vs_fspass.h" +#include "Shaders/spirv/fs_fspass.h" + +static const bgfx::EmbeddedShader s_embeddedShadersFilterStack[] = +{ + BGFX_EMBEDDED_SHADER(vs_fspass), + BGFX_EMBEDDED_SHADER(fs_fspass), + BGFX_EMBEDDED_SHADER_END() +}; + +bgfx::ProgramHandle blurProg; + nanovg_filterstack::nanovg_filterstack() { // create shaders used by the different elements - // TODO: do I have to pass gl into here? + // TODO: Implement seperable blur + bgfx::RendererType::Enum type = bgfx::getRendererType(); + blurProg = bgfx::createProgram( + bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") + , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_fspass") + , true + ); } bool nanovg_filterstack::ValidString(const std::string& string) @@ -35,6 +66,7 @@ void nanovg_filterstack::ParseString(const std::string& string) } StackElement element = {}; + element.type = SE_BLUR; element.blurElement = {radius, radius}; stackElements.push_back(element); } @@ -42,6 +74,7 @@ void nanovg_filterstack::ParseString(const std::string& string) { // defaults to blur(0) StackElement element = {}; + element.type = SE_BLUR; element.blurElement = {0, 0}; stackElements.push_back(element); } @@ -49,27 +82,75 @@ void nanovg_filterstack::ParseString(const std::string& string) } void nanovg_filterstack::Render(std::function element) +{ + element(); +} + +void nanovg_filterstack::Render( + bgfx::ProgramHandle firstProg, + std::function firstPass, + std::function filterPass, + Babylon::Graphics::FrameBuffer* finalFrameBuffer, + std::function acquire, + std::function release +) { if (stackElements.empty()) { - // no filter - element(); + // no filter, render straight into final framebuffer + firstPass(firstProg, finalFrameBuffer); // TODO: filterPass(firstProg, nullptr, finalFrameBuffer); } else { - // TODO: move over Cedric's glnvg__triangles hacks from nanovg_babylon.cpp - // TODO: Instead of hackyFrameBuffer, implement render target manager - // TODO: may need to pass down gl + call from glnvg__triangles + glnvg__stroke? + Babylon::Graphics::FrameBuffer* prevBuf = nullptr; + Babylon::Graphics::FrameBuffer* nextBuf = acquire(); + bgfx::ProgramHandle lastProg = firstProg; // TODO: should be able to just rely on this for single pass cases + // first pass + firstPass(firstProg, nextBuf); + prevBuf = nextBuf; + nextBuf = nullptr; - // NOTE: fine to encapsulate hackFrambuffer in a target manager first. - // NOTE: basically hackframebuffer manager needs to be accessble from here in nanovg_filterstack.cpp - for (int i = 0; i < stackElements.size(); i++) + int i = 0; + for (auto& element : stackElements) { - // get new render target - // bind it - // render element to it + assert(prevBuf != nullptr); + assert(nextBuf == nullptr); + + const bool last = (i == stackElements.size() - 1); + + if (element.type == SE_BLUR) + { + if (last) + { + lastProg = blurProg; + break; + } + + // HACK: temporary single pass (unseparated) + nextBuf = acquire(); + filterPass(blurProg, prevBuf, nextBuf); + release(prevBuf); + prevBuf = nextBuf; + nextBuf = nullptr; + + // TODO: seperable blur filter (1x vertical, 1x horizontal) + /* + // TODO: vec2 direction uniforms change + nextBuf = acquire(); + filterPass(seperateBlurProg, prevBuf, nextBuf); + release(prevBuf); + prevBuf = nextBuf; + nextBuf = nullptr; + */ + } + i++; } - // composite to canvas at the end + + assert(prevBuf != nullptr); + assert(nextBuf == nullptr); + + filterPass(lastProg, prevBuf, finalFrameBuffer); + release(prevBuf); } } \ No newline at end of file diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h index 78878a764..5ac7e1f87 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h @@ -8,18 +8,27 @@ class nanovg_filterstack public: nanovg_filterstack(); - void AddSepia(float strength) - { - SepiaElement sepia{ strength }; - stackElements.push_back({ sepia }); - } - void AddContrast(float strength) { } - void AddBlur(int horizontal, int vertical) { } + // TODO: not necessary? + void AddSepia(float strength) {} + void AddContrast(float strength) {} + void AddBlur(int horizontal, int vertical) {} + void Render( + bgfx::ProgramHandle firstProg, + std::function firstPass, + std::function filterPass, + Babylon::Graphics::FrameBuffer* finalFrameBuffer, + std::function acquire, + std::function release + ); + + // HACK: remove this once I implement for both text + shapes... void Render(std::function element); + void ParseString(const std::string& string); static bool ValidString(const std::string& string); + // NOTE: This currently happens in Context.cpp void SetSize(int width, int height) { // flush pool @@ -32,6 +41,13 @@ class nanovg_filterstack void Clear() { stackElements.clear(); } protected: + enum StackElementTypes + { + SE_SEPIA = 0, + SE_CONTRAST = 1, + SE_BLUR = 2, + }; + struct SepiaElement { float strength; @@ -46,6 +62,7 @@ class nanovg_filterstack }; struct StackElement { + StackElementTypes type; union { SepiaElement sepiaElement; @@ -53,8 +70,10 @@ class nanovg_filterstack Blur blurElement; }; }; + std::vector stackElements; + // NOTE: Does it make sense to have this called here? Or find just to pass std::function from nanovg_babylon.cpp Babylon::Graphics::FrameBuffer* GetTransientTarget() { // return a framebuffer that will be reused later as a texture or for another element From b66f2f9d2bad65c5e814bb4177dcf6ba4a4ebe9c Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Tue, 25 Mar 2025 21:01:02 +1100 Subject: [PATCH 09/24] Move bind/unbind into Context.cpp acquire/release --- Polyfills/Canvas/Source/Context.cpp | 57 ++++++++++--------- Polyfills/Canvas/Source/Context.h | 1 + .../Canvas/Source/nanovg/nanovg_babylon.cpp | 32 +++-------- 3 files changed, 38 insertions(+), 52 deletions(-) diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 8199fe066..51192544b 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -118,19 +118,6 @@ namespace Babylon::Polyfills::Internal { m_fonts[font.first] = nvgCreateFontMem(*m_nvg, font.first.c_str(), font.second.data(), static_cast(font.second.size()), 0); } - - // TODO: check is capturing 'this' ok? Its be reference right? - std::function acquire = [this]() -> Babylon::Graphics::FrameBuffer* { - return this->m_canvas->PoolAcquire(); - }; - std::function release = [this](Babylon::Graphics::FrameBuffer* frameBuffer) -> void { - this->m_canvas->PoolRelease(frameBuffer); - }; - // TODO: Confirm that pool is initilalized before nanovg_babylon.cpp calls acquire - nvgSetTargetManager({ - acquire, - release - }); } Context::~Context() @@ -185,7 +172,15 @@ namespace Babylon::Polyfills::Internal } } - // TODO: figure out how a params.renderCreateFrameBuffer from nanovg_babylon.cpp would ultimated then call Canvas::RequestRenderTarget + void Context::SetFilterStack() + { + if (m_filter.length()) + { + nanovg_filterstack filterStack; + filterStack.ParseString(m_filter); + nvgFilterStack(*m_nvg, filterStack); // sets filterStack on nanovg + } + } void Context::FillRect(const Napi::CallbackInfo& info) { @@ -203,13 +198,7 @@ namespace Babylon::Polyfills::Internal BindFillStyle(info, left, top, width, height); - if (m_filter.length()) - { - nanovg_filterstack filterStack; - filterStack.ParseString(m_filter); - nvgFilterStack(*m_nvg, filterStack); // sets filterStack on nanovg - } - + SetFilterStack(); nvgFill(*m_nvg); SetDirty(); } @@ -270,6 +259,7 @@ namespace Babylon::Polyfills::Internal void Context::Fill(const Napi::CallbackInfo&) { + SetFilterStack(); nvgFill(*m_nvg); SetDirty(); } @@ -438,6 +428,7 @@ namespace Babylon::Polyfills::Internal const auto height = info[3].As().FloatValue(); nvgRect(*m_nvg, left, top, width, height); + SetFilterStack(); nvgStroke(*m_nvg); SetDirty(); } @@ -513,13 +504,7 @@ namespace Babylon::Polyfills::Internal } } - if (m_filter.length()) - { - nanovg_filterstack filterStack; - filterStack.ParseString(m_filter); - nvgFilterStack(*m_nvg, filterStack); // sets filterStack on nanovg - } - + SetFilterStack(); nvgStroke(*m_nvg); SetDirty(); } @@ -635,9 +620,22 @@ namespace Babylon::Polyfills::Internal // buffer.frameBuffer->Bind(*encoder); // TODO: remove this, should be done in Acquire // buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); // TODO: confirm that this not necessary because of ScreenSpaceQuad?? } + std::function acquire = [this, encoder]() -> Babylon::Graphics::FrameBuffer* { + Babylon::Graphics::FrameBuffer *frameBuffer = this->m_canvas->PoolAcquire(); + frameBuffer->Bind(*encoder); + return frameBuffer; + }; + std::function release = [this, encoder](Babylon::Graphics::FrameBuffer* frameBuffer) -> void { + frameBuffer->Unbind(*encoder); + this->m_canvas->PoolRelease(frameBuffer); + }; nvgBeginFrame(*m_nvg, float(width), float(height), 1.0f); nvgSetFrameBufferAndEncoder(*m_nvg, frameBuffer, encoder); + nvgSetTargetManager({ + acquire, + release + }); nvgEndFrame(*m_nvg); frameBuffer.Unbind(*encoder); @@ -708,6 +706,7 @@ namespace Babylon::Polyfills::Internal nvgRect(*m_nvg, dx, dy, width, height); nvgFillPaint(*m_nvg, imagePaint); + SetFilterStack(); nvgFill(*m_nvg); SetDirty(); } @@ -727,6 +726,7 @@ namespace Babylon::Polyfills::Internal nvgRect(*m_nvg, dx, dy, dWidth, dHeight); nvgFillPaint(*m_nvg, imagePaint); + SetFilterStack(); nvgFill(*m_nvg); SetDirty(); } @@ -752,6 +752,7 @@ namespace Babylon::Polyfills::Internal nvgRect(*m_nvg, dx, dy, dWidth, dHeight); nvgFillPaint(*m_nvg, imagePaint); + SetFilterStack(); nvgFill(*m_nvg); SetDirty(); } diff --git a/Polyfills/Canvas/Source/Context.h b/Polyfills/Canvas/Source/Context.h index 1def6b6ca..9ac7157b1 100644 --- a/Polyfills/Canvas/Source/Context.h +++ b/Polyfills/Canvas/Source/Context.h @@ -123,6 +123,7 @@ namespace Babylon::Polyfills::Internal std::unordered_map m_nvgImageIndices; void BindFillStyle(const Napi::CallbackInfo& info, float left, float top, float width, float height); void FlushGraphicResources() override; + void SetFilterStack(); friend class Canvas; }; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 3ab706334..4d5189aa1 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -862,18 +862,7 @@ namespace }; Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; - std::function acquire = [&]() -> Babylon::Graphics::FrameBuffer* { - Babylon::Graphics::FrameBuffer *frameBuffer = mPool.acquire(); - frameBuffer->Bind(*gl->encoder); - return frameBuffer; - }; - - std::function release = [&](Babylon::Graphics::FrameBuffer* frameBuffer) { - frameBuffer->Unbind(*gl->encoder); - mPool.release(frameBuffer); - }; - - call->filterStack.Render(firstProg, firstPass, filterPass, finalFrameBuffer, acquire, release); + call->filterStack.Render(firstProg, firstPass, filterPass, finalFrameBuffer, mPool.acquire, mPool.release); } static void glnvg__triangles(struct GLNVGcontext* gl, struct GLNVGcall* call) @@ -910,6 +899,10 @@ namespace gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); */ + // TODO: will need to implement some kinda callback function to set uniforms + // float direction[4] = { 0.f, 0.f, 0.f, 0.f }; + // gl->encoder->setUniform(gl->u_direction, direction); + bgfx::ProgramHandle firstProg = gl->prog; std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); @@ -930,18 +923,7 @@ namespace }; Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; - std::function acquire = [&]() -> Babylon::Graphics::FrameBuffer* { - Babylon::Graphics::FrameBuffer *frameBuffer = mPool.acquire(); - frameBuffer->Bind(*gl->encoder); - return frameBuffer; - }; - - std::function release = [&](Babylon::Graphics::FrameBuffer* frameBuffer) { - frameBuffer->Unbind(*gl->encoder); - mPool.release(frameBuffer); - }; - - call->filterStack.Render(firstProg, firstPass, filterPass, finalFrameBuffer, acquire, release); + call->filterStack.Render(firstProg, firstPass, filterPass, finalFrameBuffer, mPool.acquire, mPool.release); } } @@ -1349,6 +1331,7 @@ namespace } // namespace +// NOTE: This is called from Context constructor. Uniforms get defined when Context created NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) { if (NULL == _allocator) @@ -1384,6 +1367,7 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) gl->allocator = _allocator; gl->edgeAntiAlias = _edgeaa; + // NOTE: this calls back out to nvgRenderCreate to initialize uniforms ctx = nvgCreateInternal(¶ms); if (ctx == NULL) goto error; From d21d7da232e779ad970d37ca96582ab0ff627d4b Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Wed, 26 Mar 2025 00:56:06 +1100 Subject: [PATCH 10/24] WIP - filterstack uniform handling, separated gaussian blur --- .../Canvas/Source/Shaders/fs_gaussblur.sc | 31 ++++++++ .../Canvas/Source/nanovg/nanovg_babylon.cpp | 13 +++- .../Source/nanovg/nanovg_filterstack.cpp | 78 ++++++++++++------- .../Canvas/Source/nanovg/nanovg_filterstack.h | 11 +++ 4 files changed, 104 insertions(+), 29 deletions(-) create mode 100644 Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc diff --git a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc new file mode 100644 index 000000000..9723c85ab --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc @@ -0,0 +1,31 @@ +$input v_position, v_texcoord0 + +#include "./common.sh" + +uniform vec4 u_direction; + +SAMPLER2D(s_tex, 0); + +void main() +{ + // 13-tap weights + float weights[7]; + weights[0] = 0.184944; // center + weights[1] = 0.168506; + weights[2] = 0.127323; + weights[3] = 0.080657; + weights[4] = 0.041667; + weights[5] = 0.016028; + weights[6] = 0.004432; + + vec4 color = vec4(0.,0.,0.,0.); + + // Sample and accumulate weighted colors + for (int i = -6; i <= 6; i++) + { + vec2 offset = u_direction.xy * float(i); + color += weights[abs(i)] * texture2D(s_tex, v_texcoord0 + offset); + } + + gl_FragColor = color; +} diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 4d5189aa1..a2fb7bd50 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -834,6 +834,10 @@ namespace */ bgfx::ProgramHandle firstProg = gl->prog; + std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { + // DEBUG: do we need a guard for setting uniform? bgfx.cpp:3725 is asserting + gl->encoder->setUniform(u, value); + }; std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { // Draw Strokes struct GLNVGpath* paths = &gl->paths[call->pathOffset]; @@ -851,7 +855,6 @@ namespace }; std::function filterPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *inBuffer, Babylon::Graphics::FrameBuffer *outBuffer) { nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); - // TODO: Do we need to tack on BGFX_STATE_PT_TRISTRIP? gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); @@ -862,7 +865,7 @@ namespace }; Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; - call->filterStack.Render(firstProg, firstPass, filterPass, finalFrameBuffer, mPool.acquire, mPool.release); + call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, mPool.acquire, mPool.release); } static void glnvg__triangles(struct GLNVGcontext* gl, struct GLNVGcall* call) @@ -904,6 +907,10 @@ namespace // gl->encoder->setUniform(gl->u_direction, direction); bgfx::ProgramHandle firstProg = gl->prog; + std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { + // DEBUG: do we need a guard for setting uniform? bgfx.cpp:3725 is asserting + gl->encoder->setUniform(u, value); + }; std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); gl->encoder->setState(gl->state); @@ -923,7 +930,7 @@ namespace }; Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; - call->filterStack.Render(firstProg, firstPass, filterPass, finalFrameBuffer, mPool.acquire, mPool.release); + call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, mPool.acquire, mPool.release); } } diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index 8a550baa0..54a384ae8 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -8,6 +8,8 @@ std::regex blurRegex(R"(blur\((\d*\.?\d+)(px|rem)?\)|blur\(\))"); std::regex noneRegex(R"(^\s*none\s*$)"); +#define BLUR_ITERATIONS 3 + // TODO: move fspass code from nanovg_babylon.cpp into nanovg_filterstack.cpp #include "Shaders/dx11/vs_fspass.h" #include "Shaders/dx11/fs_fspass.h" @@ -20,25 +22,46 @@ std::regex noneRegex(R"(^\s*none\s*$)"); #include "Shaders/spirv/vs_fspass.h" #include "Shaders/spirv/fs_fspass.h" +#include "Shaders/dx11/fs_gaussblur.h" +#include "Shaders/metal/fs_gaussblur.h" +#include "Shaders/glsl/fs_gaussblur.h" +#include "Shaders/essl/fs_gaussblur.h" +#include "Shaders/spirv/fs_gaussblur.h" + static const bgfx::EmbeddedShader s_embeddedShadersFilterStack[] = { BGFX_EMBEDDED_SHADER(vs_fspass), BGFX_EMBEDDED_SHADER(fs_fspass), + BGFX_EMBEDDED_SHADER(fs_gaussblur), BGFX_EMBEDDED_SHADER_END() }; -bgfx::ProgramHandle blurProg; - +// TODO: check if its OK to share uniforms + programs across all instances of nanovg_filterstack nanovg_filterstack::nanovg_filterstack() { // create shaders used by the different elements - // TODO: Implement seperable blur bgfx::RendererType::Enum type = bgfx::getRendererType(); - blurProg = bgfx::createProgram( + fspassProg = bgfx::createProgram( bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_fspass") , true ); + blurProg = bgfx::createProgram( + bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") + , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_gaussblur") + , true + ); + + m_uniforms = {}; + m_uniforms.u_direction = bgfx::createUniform("u_direction", bgfx::UniformType::Vec4); +} + +// TODO: Do we need to bgfx::destroy everything? +// NOTE: Seems like nanovg_babylon.cpp reuses uniforms across entire nanovg Canvas. But re-creates programs for every draw? +nanovg_filterstack::~nanovg_filterstack() +{ + //bgfx::destroy(blurProg); + //bgfx::destroy(m_uniforms.u_direction); } bool nanovg_filterstack::ValidString(const std::string& string) @@ -65,18 +88,17 @@ void nanovg_filterstack::ParseString(const std::string& string) // TODO: convert non-px radius } - StackElement element = {}; - element.type = SE_BLUR; - element.blurElement = {radius, radius}; - stackElements.push_back(element); + for (int i = 0; i < BLUR_ITERATIONS; i++) + { + StackElement element = {}; + element.type = SE_BLUR; + element.blurElement = {radius, radius}; + stackElements.push_back(element); + } } else { - // defaults to blur(0) - StackElement element = {}; - element.type = SE_BLUR; - element.blurElement = {0, 0}; - stackElements.push_back(element); + // defaults to blur(0), which is no blur } } } @@ -88,6 +110,7 @@ void nanovg_filterstack::Render(std::function element) void nanovg_filterstack::Render( bgfx::ProgramHandle firstProg, + std::function setUniform, std::function firstPass, std::function filterPass, Babylon::Graphics::FrameBuffer* finalFrameBuffer, @@ -98,13 +121,15 @@ void nanovg_filterstack::Render( if (stackElements.empty()) { // no filter, render straight into final framebuffer - firstPass(firstProg, finalFrameBuffer); // TODO: filterPass(firstProg, nullptr, finalFrameBuffer); + firstPass(firstProg, finalFrameBuffer); } else { + assert(stackElements.size() > 0); + Babylon::Graphics::FrameBuffer* prevBuf = nullptr; Babylon::Graphics::FrameBuffer* nextBuf = acquire(); - bgfx::ProgramHandle lastProg = firstProg; // TODO: should be able to just rely on this for single pass cases + bgfx::ProgramHandle lastProg = firstProg; // first pass firstPass(firstProg, nextBuf); @@ -121,28 +146,29 @@ void nanovg_filterstack::Render( if (element.type == SE_BLUR) { - if (last) - { - lastProg = blurProg; - break; - } + // Horizontal Pass + float horizontal[4] = {1.f, 0.f, 0.f, 0.f}; + setUniform(m_uniforms.u_direction, horizontal); - // HACK: temporary single pass (unseparated) nextBuf = acquire(); filterPass(blurProg, prevBuf, nextBuf); release(prevBuf); prevBuf = nextBuf; nextBuf = nullptr; - // TODO: seperable blur filter (1x vertical, 1x horizontal) - /* - // TODO: vec2 direction uniforms change + // Vertical Pass + float vertical[4] = {0.f, 1.f, 0.f, 0.f}; + setUniform(m_uniforms.u_direction, vertical); + if (last) + { + lastProg = blurProg; + break; // last pass will write to finalFrameBuffer + } nextBuf = acquire(); - filterPass(seperateBlurProg, prevBuf, nextBuf); + filterPass(blurProg, prevBuf, nextBuf); release(prevBuf); prevBuf = nextBuf; nextBuf = nullptr; - */ } i++; } diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h index 5ac7e1f87..acf3da8fb 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h @@ -7,6 +7,7 @@ class nanovg_filterstack { public: nanovg_filterstack(); + ~nanovg_filterstack(); // TODO: not necessary? void AddSepia(float strength) {} @@ -15,6 +16,7 @@ class nanovg_filterstack void Render( bgfx::ProgramHandle firstProg, + std::function setUniform, std::function firstPass, std::function filterPass, Babylon::Graphics::FrameBuffer* finalFrameBuffer, @@ -73,6 +75,15 @@ class nanovg_filterstack std::vector stackElements; + bgfx::ProgramHandle fspassProg; + bgfx::ProgramHandle blurProg; + + struct Uniforms + { + bgfx::UniformHandle u_direction; + } uniforms; + Uniforms m_uniforms; + // NOTE: Does it make sense to have this called here? Or find just to pass std::function from nanovg_babylon.cpp Babylon::Graphics::FrameBuffer* GetTransientTarget() { From 93e1af1cb2ce80de5490a47ae6b37c56284c0261 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Wed, 26 Mar 2025 21:10:46 +1100 Subject: [PATCH 11/24] fixed - working filterstack uniform+program handling --- Polyfills/Canvas/Source/Canvas.cpp | 7 +++- Polyfills/Canvas/Source/Context.cpp | 3 ++ .../Canvas/Source/nanovg/nanovg_babylon.cpp | 2 +- .../Source/nanovg/nanovg_filterstack.cpp | 39 ++++++++++--------- .../Canvas/Source/nanovg/nanovg_filterstack.h | 19 +++++---- 5 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index a7eae79bf..0306c4845 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -150,7 +150,10 @@ namespace Babylon::Polyfills::Internal { if (buffer.frameBuffer) { - // buffer.frameBuffer->Dispose(); // TODO: do we need to Dispose() before delete? + // TODO: Dispose? + //buffer.frameBuffer->Dispose(); + //free(buffer.frameBuffer); + delete buffer.frameBuffer; buffer.frameBuffer = nullptr; } @@ -178,7 +181,7 @@ namespace Babylon::Polyfills::Internal { if (buffer.frameBuffer == frameBuffer) { - // TODO: clear framebuffer? i think has to be done in nanovg_babylon.cpp / nanovg_filterstack.cpp before releasing back to pool + // TODO: clear framebuffer? buffer.isAvailable = true; return; } diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 51192544b..5f14b1fa0 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -613,6 +613,7 @@ namespace Babylon::Polyfills::Internal const auto width = m_canvas->GetWidth(); const auto height = m_canvas->GetHeight(); + nanovg_filterstack::InitBgfx(); // HACK: should this even be a static on nanovg_filterstack? for (auto& buffer : m_canvas->mPoolBuffers) { // sanity check no buffers should have been acquired yet @@ -645,6 +646,8 @@ namespace Babylon::Polyfills::Internal assert(buffer.isAvailable == true); // buffer.frameBuffer->Unbind(*encoder); // TODO: remove this after I implement Bind / Unbind as part of acquire/release } + // Currently, we're reusing filterstack same progs + uniforms across all calls between frames + nanovg_filterstack::DisposeBgfx(); // HACK: should this even be a static on nanovg_filterstack? m_dirty = false; }).then(arcana::inline_scheduler, *m_cancellationSource, [this, cancellationSource{m_cancellationSource}](const arcana::expected& result) { diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index a2fb7bd50..1438cdd2d 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -1010,7 +1010,7 @@ namespace for (uint32_t ii = 0, num = gl->ncalls; ii < num; ++ii) { struct GLNVGcall* call = &gl->calls[ii]; - nanovg_filterstack fs = call->filterStack; + nanovg_filterstack fs = call->filterStack; // CHECK: did we want to do something with this? const GLNVGblend* blend = &call->blendFunc; gl->state = BGFX_STATE_BLEND_FUNC_SEPARATE(blend->srcRGB, blend->dstRGB, blend->srcAlpha, blend->dstAlpha) diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index 54a384ae8..9f0a9f7df 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -36,32 +36,33 @@ static const bgfx::EmbeddedShader s_embeddedShadersFilterStack[] = BGFX_EMBEDDED_SHADER_END() }; -// TODO: check if its OK to share uniforms + programs across all instances of nanovg_filterstack nanovg_filterstack::nanovg_filterstack() { +} + +void nanovg_filterstack::InitBgfx() +{ + m_uniforms.u_direction = bgfx::createUniform("u_direction", bgfx::UniformType::Vec4); + // create shaders used by the different elements bgfx::RendererType::Enum type = bgfx::getRendererType(); - fspassProg = bgfx::createProgram( - bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") - , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_fspass") - , true - ); - blurProg = bgfx::createProgram( - bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") - , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_gaussblur") - , true - ); - - m_uniforms = {}; - m_uniforms.u_direction = bgfx::createUniform("u_direction", bgfx::UniformType::Vec4); + fspassProg = bgfx::createProgram( + bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") + , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_fspass") + , true + ); + blurProg = bgfx::createProgram( + bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") + , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_gaussblur") + , true + ); } -// TODO: Do we need to bgfx::destroy everything? -// NOTE: Seems like nanovg_babylon.cpp reuses uniforms across entire nanovg Canvas. But re-creates programs for every draw? -nanovg_filterstack::~nanovg_filterstack() +void nanovg_filterstack::DisposeBgfx() { - //bgfx::destroy(blurProg); - //bgfx::destroy(m_uniforms.u_direction); + bgfx::destroy(fspassProg); + bgfx::destroy(blurProg); + bgfx::destroy(m_uniforms.u_direction); } bool nanovg_filterstack::ValidString(const std::string& string) diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h index acf3da8fb..d31078892 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h @@ -7,7 +7,15 @@ class nanovg_filterstack { public: nanovg_filterstack(); - ~nanovg_filterstack(); + + static void InitBgfx(); + static void DisposeBgfx(); + inline static bgfx::ProgramHandle fspassProg; + inline static bgfx::ProgramHandle blurProg; + inline struct Uniforms + { + bgfx::UniformHandle u_direction; + } static m_uniforms; // TODO: not necessary? void AddSepia(float strength) {} @@ -75,15 +83,6 @@ class nanovg_filterstack std::vector stackElements; - bgfx::ProgramHandle fspassProg; - bgfx::ProgramHandle blurProg; - - struct Uniforms - { - bgfx::UniformHandle u_direction; - } uniforms; - Uniforms m_uniforms; - // NOTE: Does it make sense to have this called here? Or find just to pass std::function from nanovg_babylon.cpp Babylon::Graphics::FrameBuffer* GetTransientTarget() { From b64e17a2b1e7bb7b6d5a74e7d52824f9ed04520e Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Wed, 26 Mar 2025 23:11:58 +1100 Subject: [PATCH 12/24] wire up radius/strength to blur filter, support alpha blur --- Apps/Playground/Scripts/experience.js | 12 +------ .../Canvas/Source/Shaders/fs_gaussblur.sc | 35 +++++++++++-------- .../Source/nanovg/nanovg_filterstack.cpp | 8 +++-- .../Canvas/Source/nanovg/nanovg_filterstack.h | 3 +- 4 files changed, 28 insertions(+), 30 deletions(-) diff --git a/Apps/Playground/Scripts/experience.js b/Apps/Playground/Scripts/experience.js index 7623aed18..366ef9faf 100644 --- a/Apps/Playground/Scripts/experience.js +++ b/Apps/Playground/Scripts/experience.js @@ -149,13 +149,11 @@ CreateBoxAsync(scene).then(function () { context.lineTo(140, 140); context.stroke(); - context.filter = "blur(5px)"; - // filter blur text + context.filter = "blur(1.5px)"; context.fillStyle = "White"; context.font = `bold ${50}px monospace`; context.fillText("BLUR TEST BLUR TEST", 100, 246); - context.filter = "none"; // Draw lines @@ -169,8 +167,6 @@ CreateBoxAsync(scene).then(function () { context.stroke(); }); - context.filter = "blur(5px)"; - // line join context.lineWidth = 10; var offset = 200; @@ -185,8 +181,6 @@ CreateBoxAsync(scene).then(function () { context.stroke(); }); - context.filter = "none"; - // rect with gradient context.fillStyle = gradient; context.fillRect(10, 310, 400, 60); @@ -203,16 +197,12 @@ CreateBoxAsync(scene).then(function () { context.roundRect(10, 220, 150, 100, 0); context.stroke(); - context.filter = "blur(5px)"; - // Rounded rectangle with 40px radius (single element list) context.strokeStyle = "blue"; context.beginPath(); context.roundRect(10, 220, 150, 100, [40]); context.stroke(); - context.filter = "none"; - // Rounded rectangle with 2 different radii context.strokeStyle = "orange"; context.beginPath(); diff --git a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc index 9723c85ab..78e315484 100644 --- a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc +++ b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc @@ -2,7 +2,7 @@ $input v_position, v_texcoord0 #include "./common.sh" -uniform vec4 u_direction; +uniform vec4 u_direction; // vec4 (x, y, unused, unused) SAMPLER2D(s_tex, 0); @@ -10,22 +10,27 @@ void main() { // 13-tap weights float weights[7]; - weights[0] = 0.184944; // center - weights[1] = 0.168506; - weights[2] = 0.127323; - weights[3] = 0.080657; - weights[4] = 0.041667; - weights[5] = 0.016028; - weights[6] = 0.004432; - - vec4 color = vec4(0.,0.,0.,0.); - - // Sample and accumulate weighted colors - for (int i = -6; i <= 6; i++) + weights[0] = 0.227027; // center + weights[1] = 0.1945946; + weights[2] = 0.1216216; + weights[3] = 0.054054; + weights[4] = 0.016216; + weights[5] = 0.004629; + weights[6] = 0.000823; + + vec4 color = texture2D(s_tex, v_texcoord0) * weights[0]; // center pixel weighted + float alpha = color.a; + + for (int i = 1; i <= 6; i++) { vec2 offset = u_direction.xy * float(i); - color += weights[abs(i)] * texture2D(s_tex, v_texcoord0 + offset); + + vec4 sample1 = texture2D(s_tex, v_texcoord0 + offset) * weights[i]; + vec4 sample2 = texture2D(s_tex, v_texcoord0 - offset) * weights[i]; + + color.rgb += sample1.rgb + sample2.rgb; // Sum RGB values + alpha += sample1.a * weights[i] + sample2.a * weights[i]; // Sum alpha values } - gl_FragColor = color; + gl_FragColor = vec4(color.rgb, alpha); // Combine blurred color and alpha } diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index 9f0a9f7df..0e0534b96 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -42,6 +42,7 @@ nanovg_filterstack::nanovg_filterstack() void nanovg_filterstack::InitBgfx() { + m_uniforms.u_strength = bgfx::createUniform("u_strength", bgfx::UniformType::Vec4); m_uniforms.u_direction = bgfx::createUniform("u_direction", bgfx::UniformType::Vec4); // create shaders used by the different elements @@ -60,9 +61,10 @@ void nanovg_filterstack::InitBgfx() void nanovg_filterstack::DisposeBgfx() { + bgfx::destroy(m_uniforms.u_strength); + bgfx::destroy(m_uniforms.u_direction); bgfx::destroy(fspassProg); bgfx::destroy(blurProg); - bgfx::destroy(m_uniforms.u_direction); } bool nanovg_filterstack::ValidString(const std::string& string) @@ -148,7 +150,7 @@ void nanovg_filterstack::Render( if (element.type == SE_BLUR) { // Horizontal Pass - float horizontal[4] = {1.f, 0.f, 0.f, 0.f}; + float horizontal[4] = {element.blurElement.horizontal * 1.f, 0.f, 0.f, 0.f}; // scale by element.blurElement.horizontal setUniform(m_uniforms.u_direction, horizontal); nextBuf = acquire(); @@ -158,7 +160,7 @@ void nanovg_filterstack::Render( nextBuf = nullptr; // Vertical Pass - float vertical[4] = {0.f, 1.f, 0.f, 0.f}; + float vertical[4] = {0.f, element.blurElement.vertical * 1.f, 0.f, 0.f}; // scale by element.blurElement.vertical setUniform(m_uniforms.u_direction, vertical); if (last) { diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h index d31078892..d82401c1f 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h @@ -14,6 +14,7 @@ class nanovg_filterstack inline static bgfx::ProgramHandle blurProg; inline struct Uniforms { + bgfx::UniformHandle u_strength; bgfx::UniformHandle u_direction; } static m_uniforms; @@ -68,7 +69,7 @@ class nanovg_filterstack }; struct Blur { - int horizontal, vertical; + int horizontal, vertical; // blur strength (in px) }; struct StackElement { From 19b6d523175a1e052d47be7f6b37d405d35cc016 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Thu, 27 Mar 2025 01:17:19 +1100 Subject: [PATCH 13/24] clean up comments --- Apps/Playground/Scripts/experience.js | 1 - Polyfills/Canvas/Source/Canvas.cpp | 8 +++----- Polyfills/Canvas/Source/Context.cpp | 13 +++++-------- Polyfills/Canvas/Source/nanovg/nanovg.cpp | 2 +- Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp | 7 +++---- .../Canvas/Source/nanovg/nanovg_filterstack.cpp | 1 - Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h | 6 +----- 7 files changed, 13 insertions(+), 25 deletions(-) diff --git a/Apps/Playground/Scripts/experience.js b/Apps/Playground/Scripts/experience.js index 366ef9faf..d64e46786 100644 --- a/Apps/Playground/Scripts/experience.js +++ b/Apps/Playground/Scripts/experience.js @@ -96,7 +96,6 @@ CreateBoxAsync(scene).then(function () { var t = 0; scene.onBeforeRenderObservable.add(() => { - // animated shape context.save(); context.fillStyle = "DarkRed"; diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index 0306c4845..fc0b9219f 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -150,10 +150,9 @@ namespace Babylon::Polyfills::Internal { if (buffer.frameBuffer) { - // TODO: Dispose? + // TODO: cleanup framebuffers //buffer.frameBuffer->Dispose(); //free(buffer.frameBuffer); - delete buffer.frameBuffer; buffer.frameBuffer = nullptr; } @@ -188,12 +187,11 @@ namespace Babylon::Polyfills::Internal } } - // NOTE: This only runs when canvas size changes (inc. init?). It'll trigger re-creation of framebuffers bool NativeCanvas::UpdateRenderTarget() { + // updates when canvas size changes if (m_dirty) { - // TODO: Can delete this whole block if we decide to use pool for primary framebuffer { std::array textures{ bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), @@ -246,7 +244,7 @@ namespace Babylon::Polyfills::Internal { m_frameBuffer.reset(); m_texture.reset(); - PoolClear(); // TODO: confirm we want to do this? + PoolClear(); } void NativeCanvas::Dispose(const Napi::CallbackInfo& /*info*/) diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 5f14b1fa0..6a383658d 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -592,12 +592,11 @@ namespace Babylon::Polyfills::Internal } } - // NOTE: Currently, we keep primary frame seperate. Should it come from pool? void Context::DeferredFlushFrame() { // on some systems (Ubuntu), the framebuffer contains garbage. // Unlike other systems where it's cleared. - bool needClear = m_canvas->UpdateRenderTarget(); // NOTE: this will recreate framebuffers IFF size changes. Otherwise, reuses previous + bool needClear = m_canvas->UpdateRenderTarget(); arcana::make_task(m_update.Scheduler(), *m_cancellationSource, [this, needClear, cancellationSource{m_cancellationSource}]() { return arcana::make_task(m_runtimeScheduler, *m_cancellationSource, [this, needClear, updateToken{m_update.GetUpdateToken()}, cancellationSource{m_cancellationSource}]() { @@ -613,13 +612,13 @@ namespace Babylon::Polyfills::Internal const auto width = m_canvas->GetWidth(); const auto height = m_canvas->GetHeight(); - nanovg_filterstack::InitBgfx(); // HACK: should this even be a static on nanovg_filterstack? + // we reuse progs + uniforms across calls between frames + nanovg_filterstack::InitBgfx(); for (auto& buffer : m_canvas->mPoolBuffers) { // sanity check no buffers should have been acquired yet assert(buffer.isAvailable == true); - // buffer.frameBuffer->Bind(*encoder); // TODO: remove this, should be done in Acquire - // buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); // TODO: confirm that this not necessary because of ScreenSpaceQuad?? + // buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); // TODO: confirm that this not necessary because of ScreenSpaceQuad } std::function acquire = [this, encoder]() -> Babylon::Graphics::FrameBuffer* { Babylon::Graphics::FrameBuffer *frameBuffer = this->m_canvas->PoolAcquire(); @@ -644,10 +643,8 @@ namespace Babylon::Polyfills::Internal { // sanity check no unreleased buffers assert(buffer.isAvailable == true); - // buffer.frameBuffer->Unbind(*encoder); // TODO: remove this after I implement Bind / Unbind as part of acquire/release } - // Currently, we're reusing filterstack same progs + uniforms across all calls between frames - nanovg_filterstack::DisposeBgfx(); // HACK: should this even be a static on nanovg_filterstack? + nanovg_filterstack::DisposeBgfx(); m_dirty = false; }).then(arcana::inline_scheduler, *m_cancellationSource, [this, cancellationSource{m_cancellationSource}](const arcana::expected& result) { diff --git a/Polyfills/Canvas/Source/nanovg/nanovg.cpp b/Polyfills/Canvas/Source/nanovg/nanovg.cpp index 4cb23d258..4baf6d80a 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg.cpp @@ -676,7 +676,7 @@ void nvgReset(NVGcontext* ctx) state->fontBlur = 0.0f; state->textAlign = NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE; state->fontId = 0; - state->m_filterStack.Clear(); // NOTE: does it make sense to .Clear()? or is it better to set to null + state->m_filterStack.Clear(); } // State setting diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 1438cdd2d..646cf4642 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -52,8 +52,8 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244) // warning C4244: '=' : conversion from #include "nanovg_filterstack.h" -// TODO: define this somewhere less hacky -FrameBufferPool mPool; +// TODO: figure out why nanovg_babylon.h included more than once +FrameBufferPool mPool; // TODO: move this into nanovg_babylon.h struct PosTexCoord0Vertex { @@ -1389,13 +1389,12 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) return NULL; } -// TODO: remove this, move to nvgSetFrameBufferAndEncoder + void nvgSetTargetManager(FrameBufferPool pool) { mPool = pool; } -// TODO: Might make sense to pass frame buffer pool here. That way we can Bind/Unbind from encoder in acquire/release. void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder) { struct GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(_ctx)->userPtr; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index 0e0534b96..9a5ea90db 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -10,7 +10,6 @@ std::regex noneRegex(R"(^\s*none\s*$)"); #define BLUR_ITERATIONS 3 -// TODO: move fspass code from nanovg_babylon.cpp into nanovg_filterstack.cpp #include "Shaders/dx11/vs_fspass.h" #include "Shaders/dx11/fs_fspass.h" #include "Shaders/metal/vs_fspass.h" diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h index d82401c1f..e84796b02 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h @@ -18,7 +18,6 @@ class nanovg_filterstack bgfx::UniformHandle u_direction; } static m_uniforms; - // TODO: not necessary? void AddSepia(float strength) {} void AddContrast(float strength) {} void AddBlur(int horizontal, int vertical) {} @@ -32,8 +31,6 @@ class nanovg_filterstack std::function acquire, std::function release ); - - // HACK: remove this once I implement for both text + shapes... void Render(std::function element); void ParseString(const std::string& string); @@ -81,10 +78,9 @@ class nanovg_filterstack Blur blurElement; }; }; - std::vector stackElements; - // NOTE: Does it make sense to have this called here? Or find just to pass std::function from nanovg_babylon.cpp + // DISCUSS: Should we get transient target here? Or fine to have the std::function passed down from nanovg_babylon.cpp Babylon::Graphics::FrameBuffer* GetTransientTarget() { // return a framebuffer that will be reused later as a texture or for another element From 13a3b8eb0e46a4a2e454b41d16ddb06c155cf338 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Mon, 31 Mar 2025 10:32:24 +1100 Subject: [PATCH 14/24] move FrameBufferPool into own class --- Polyfills/Canvas/CMakeLists.txt | 2 + Polyfills/Canvas/Source/Canvas.cpp | 80 +----------------- Polyfills/Canvas/Source/Canvas.h | 14 +--- Polyfills/Canvas/Source/Context.cpp | 13 ++- Polyfills/Canvas/Source/FrameBufferPool.cpp | 81 +++++++++++++++++++ Polyfills/Canvas/Source/FrameBufferPool.h | 30 +++++++ .../Canvas/Source/Shaders/fs_gaussblur.sc | 1 + .../Canvas/Source/nanovg/nanovg_babylon.cpp | 13 ++- .../Canvas/Source/nanovg/nanovg_babylon.h | 4 +- 9 files changed, 134 insertions(+), 104 deletions(-) create mode 100644 Polyfills/Canvas/Source/FrameBufferPool.cpp create mode 100644 Polyfills/Canvas/Source/FrameBufferPool.h diff --git a/Polyfills/Canvas/CMakeLists.txt b/Polyfills/Canvas/CMakeLists.txt index bed490d43..3c304dc7b 100644 --- a/Polyfills/Canvas/CMakeLists.txt +++ b/Polyfills/Canvas/CMakeLists.txt @@ -95,6 +95,8 @@ set(SOURCES "Source/Canvas.cpp" "Source/Canvas.h" "Source/Colors.h" + "Source/FrameBufferPool.cpp" + "Source/FrameBufferPool.h" "Source/Image.cpp" "Source/Image.h" "Source/ImageData.cpp" diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index fc0b9219f..a352c4c2a 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -114,79 +114,6 @@ namespace Babylon::Polyfills::Internal } } - void NativeCanvas::PoolInit(int size) - { - for (int i = 0; i < size; ++i) - { - - bgfx::FrameBufferHandle TextBuffer{ bgfx::kInvalidHandle }; - Graphics::FrameBuffer* FrameBuffer; - - int width(256), height(256); - std::array textures{ - bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), - bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT) }; - - std::array attachments{}; - for (size_t idx = 0; idx < attachments.size(); ++idx) - { - attachments[idx].init(textures[idx]); - } - TextBuffer = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); - - FrameBuffer = new Graphics::FrameBuffer(m_graphicsContext, TextBuffer, width, height, false, false, false); - // TODO: confirm why m_texture is reset, esp for pool framebuffers - if (m_texture) - { - m_texture.reset(); - } - mPoolBuffers.push_back({FrameBuffer, true}); - } - } - - void NativeCanvas::PoolClear() - { - for (auto& buffer : mPoolBuffers) - { - if (buffer.frameBuffer) - { - // TODO: cleanup framebuffers - //buffer.frameBuffer->Dispose(); - //free(buffer.frameBuffer); - delete buffer.frameBuffer; - buffer.frameBuffer = nullptr; - } - } - mPoolBuffers.clear(); - } - - Graphics::FrameBuffer* NativeCanvas::PoolAcquire() - { - for (auto& buffer : mPoolBuffers) - { - if (buffer.isAvailable) - { - buffer.isAvailable = false; - return buffer.frameBuffer; - } - } - // TODO: If no buffers available, pool wasn't large enough. Should it automatically resize? - throw std::runtime_error{"No available frame buffer in pool"}; - } - - void NativeCanvas::PoolRelease(Graphics::FrameBuffer* frameBuffer) - { - for (auto& buffer : mPoolBuffers) - { - if (buffer.frameBuffer == frameBuffer) - { - // TODO: clear framebuffer? - buffer.isAvailable = true; - return; - } - } - } - bool NativeCanvas::UpdateRenderTarget() { // updates when canvas size changes @@ -213,8 +140,9 @@ namespace Babylon::Polyfills::Internal } } { - PoolClear(); - PoolInit(POOL_SIZE); + m_frameBufferPool.clear(); + // PR cedric: Init pool only if filter is needed. + m_frameBufferPool.init(POOL_SIZE, m_graphicsContext); } return true; } @@ -244,7 +172,7 @@ namespace Babylon::Polyfills::Internal { m_frameBuffer.reset(); m_texture.reset(); - PoolClear(); + m_frameBufferPool.clear(); } void NativeCanvas::Dispose(const Napi::CallbackInfo& /*info*/) diff --git a/Polyfills/Canvas/Source/Canvas.h b/Polyfills/Canvas/Source/Canvas.h index 2d025563c..0cc4d6afc 100644 --- a/Polyfills/Canvas/Source/Canvas.h +++ b/Polyfills/Canvas/Source/Canvas.h @@ -6,6 +6,8 @@ #include #include +#include "FrameBufferPool.h" + namespace Babylon::Polyfills { class Canvas::Impl final : public std::enable_shared_from_this @@ -67,17 +69,7 @@ namespace Babylon::Polyfills::Internal // returns true if frameBuffer size has changed bool UpdateRenderTarget(); Babylon::Graphics::FrameBuffer& GetFrameBuffer() { return *m_frameBuffer; } - - struct PoolBuffer - { - Graphics::FrameBuffer* frameBuffer; - bool isAvailable; - }; - std::vector mPoolBuffers; - void NativeCanvas::PoolInit(int nBuffers); - void NativeCanvas::PoolClear(); - Babylon::Graphics::FrameBuffer* NativeCanvas::PoolAcquire(); - void NativeCanvas::PoolRelease(Graphics::FrameBuffer* frameBuffer); + FrameBufferPool m_frameBufferPool; Graphics::DeviceContext& GetGraphicsContext() { diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 6a383658d..2803de649 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -614,32 +614,29 @@ namespace Babylon::Polyfills::Internal // we reuse progs + uniforms across calls between frames nanovg_filterstack::InitBgfx(); - for (auto& buffer : m_canvas->mPoolBuffers) + for (auto& buffer : m_canvas->m_frameBufferPool.getPoolBuffers()) { // sanity check no buffers should have been acquired yet assert(buffer.isAvailable == true); // buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); // TODO: confirm that this not necessary because of ScreenSpaceQuad } std::function acquire = [this, encoder]() -> Babylon::Graphics::FrameBuffer* { - Babylon::Graphics::FrameBuffer *frameBuffer = this->m_canvas->PoolAcquire(); + Babylon::Graphics::FrameBuffer *frameBuffer = this->m_canvas->m_frameBufferPool.acquire(); frameBuffer->Bind(*encoder); return frameBuffer; }; std::function release = [this, encoder](Babylon::Graphics::FrameBuffer* frameBuffer) -> void { frameBuffer->Unbind(*encoder); - this->m_canvas->PoolRelease(frameBuffer); + this->m_canvas->m_frameBufferPool.release(frameBuffer); }; nvgBeginFrame(*m_nvg, float(width), float(height), 1.0f); nvgSetFrameBufferAndEncoder(*m_nvg, frameBuffer, encoder); - nvgSetTargetManager({ - acquire, - release - }); + nvgSetFrameBufferPool(*m_nvg, { acquire, release }); nvgEndFrame(*m_nvg); frameBuffer.Unbind(*encoder); - for (auto& buffer : m_canvas->mPoolBuffers) + for (auto& buffer : m_canvas->m_frameBufferPool.getPoolBuffers()) { // sanity check no unreleased buffers assert(buffer.isAvailable == true); diff --git a/Polyfills/Canvas/Source/FrameBufferPool.cpp b/Polyfills/Canvas/Source/FrameBufferPool.cpp new file mode 100644 index 000000000..5c3b11650 --- /dev/null +++ b/Polyfills/Canvas/Source/FrameBufferPool.cpp @@ -0,0 +1,81 @@ +#include +#include +#include + +#include +#include "FrameBufferPool.h" + +namespace Babylon::Polyfills +{ + std::vector FrameBufferPool::getPoolBuffers() + { + return mPoolBuffers; + } + + void FrameBufferPool::init(int size, Graphics::DeviceContext& graphicsContext) + { + for (int i = 0; i < size; ++i) + { + bgfx::FrameBufferHandle TextBuffer{bgfx::kInvalidHandle}; + Graphics::FrameBuffer* FrameBuffer; + + int width(256), height(256); + std::array textures{ + bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), + bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT)}; + + std::array attachments{}; + for (size_t idx = 0; idx < attachments.size(); ++idx) + { + attachments[idx].init(textures[idx]); + } + TextBuffer = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); + + FrameBuffer = new Graphics::FrameBuffer(graphicsContext, TextBuffer, width, height, false, false, false); + mPoolBuffers.push_back({FrameBuffer, true}); + } + } + + void FrameBufferPool::clear() + { + for (auto& buffer : mPoolBuffers) + { + if (buffer.frameBuffer) + { + // TODO: cleanup framebuffers + //buffer.frameBuffer->Dispose(); + //free(buffer.frameBuffer); + delete buffer.frameBuffer; + buffer.frameBuffer = nullptr; + } + } + mPoolBuffers.clear(); + } + + Graphics::FrameBuffer* FrameBufferPool::acquire() + { + for (auto& buffer : mPoolBuffers) + { + if (buffer.isAvailable) + { + buffer.isAvailable = false; + return buffer.frameBuffer; + } + } + // TODO: If no buffers available, pool wasn't large enough. Should it automatically resize? + throw std::runtime_error{"No available frame buffer in pool"}; + } + + void FrameBufferPool::release(Graphics::FrameBuffer* frameBuffer) + { + for (auto& buffer : mPoolBuffers) + { + if (buffer.frameBuffer == frameBuffer) + { + // TODO: clear framebuffer? + buffer.isAvailable = true; + return; + } + } + } +} diff --git a/Polyfills/Canvas/Source/FrameBufferPool.h b/Polyfills/Canvas/Source/FrameBufferPool.h new file mode 100644 index 000000000..c8e9c6709 --- /dev/null +++ b/Polyfills/Canvas/Source/FrameBufferPool.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +namespace Babylon::Polyfills +{ + class FrameBufferPool final + { + public: + struct PoolBuffer + { + Graphics::FrameBuffer* frameBuffer; + bool isAvailable; + }; + void init(int nBuffers, Graphics::DeviceContext& graphicsContext); + void clear(); + Graphics::FrameBuffer* acquire(); + void release(Graphics::FrameBuffer* frameBuffer); + std::vector getPoolBuffers(); + + typename std::vector::iterator begin(); + typename std::vector::iterator end(); + typename std::vector::const_iterator begin() const; + typename std::vector::const_iterator end() const; + + private: + std::vector mPoolBuffers{}; + }; +} diff --git a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc index 78e315484..7eae3cad1 100644 --- a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc +++ b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc @@ -21,6 +21,7 @@ void main() vec4 color = texture2D(s_tex, v_texcoord0) * weights[0]; // center pixel weighted float alpha = color.a; + // PR cedric: texture coordinate is normalized. Range for sampling is [0..1]. A pixel size in normalized coordinate system is vec2(1./texture width, 1./texture height). Also, take care of half texel : https://asawicki.info/news_1516_half-pixel_offset_in_directx_11 for (int i = 1; i <= 6; i++) { vec2 offset = u_direction.xy * float(i); diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 646cf4642..5ca06a73f 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -52,9 +52,6 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244) // warning C4244: '=' : conversion from #include "nanovg_filterstack.h" -// TODO: figure out why nanovg_babylon.h included more than once -FrameBufferPool mPool; // TODO: move this into nanovg_babylon.h - struct PosTexCoord0Vertex { float m_x; @@ -259,6 +256,7 @@ namespace bgfx::TransientVertexBuffer tvb; Babylon::Graphics::FrameBuffer* frameBuffer; + PoolInterface frameBufferPool; bgfx::Encoder* encoder; struct GLNVGtexture* textures; @@ -865,7 +863,7 @@ namespace }; Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; - call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, mPool.acquire, mPool.release); + call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, gl->frameBufferPool.acquire, gl->frameBufferPool.release); } static void glnvg__triangles(struct GLNVGcontext* gl, struct GLNVGcall* call) @@ -930,7 +928,7 @@ namespace }; Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; - call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, mPool.acquire, mPool.release); + call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, gl->frameBufferPool.acquire, gl->frameBufferPool.release); } } @@ -1390,9 +1388,10 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) return NULL; } -void nvgSetTargetManager(FrameBufferPool pool) +void nvgSetFrameBufferPool(NVGcontext* _ctx, PoolInterface pool) { - mPool = pool; + struct GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(_ctx)->userPtr; + gl->frameBufferPool = pool; } void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder) diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h index bbb9cb631..18800babe 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.h @@ -22,13 +22,13 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator); /// NVGcontext* nvgCreate(int32_t _edgeaa); -struct FrameBufferPool +struct PoolInterface { std::function acquire; std::function release; }; -void nvgSetTargetManager(FrameBufferPool pool); +void nvgSetFrameBufferPool(NVGcontext* _ctx, PoolInterface pool); void nvgSetFrameBufferAndEncoder(NVGcontext* _ctx, Babylon::Graphics::FrameBuffer& frameBuffer, bgfx::Encoder* encoder); /// From 63fcb8e1856215525c0ca8ce0939ae7a031936bf Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Mon, 31 Mar 2025 17:17:14 +1100 Subject: [PATCH 15/24] handle half-texel in blur, clean up filterstack uniform+program setup --- Polyfills/Canvas/Source/Context.cpp | 3 -- .../Canvas/Source/Shaders/fs_gaussblur.sc | 28 ++++++++++++------- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 2 ++ .../Source/nanovg/nanovg_filterstack.cpp | 13 ++++++--- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 2803de649..13b7511a8 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -612,8 +612,6 @@ namespace Babylon::Polyfills::Internal const auto width = m_canvas->GetWidth(); const auto height = m_canvas->GetHeight(); - // we reuse progs + uniforms across calls between frames - nanovg_filterstack::InitBgfx(); for (auto& buffer : m_canvas->m_frameBufferPool.getPoolBuffers()) { // sanity check no buffers should have been acquired yet @@ -641,7 +639,6 @@ namespace Babylon::Polyfills::Internal // sanity check no unreleased buffers assert(buffer.isAvailable == true); } - nanovg_filterstack::DisposeBgfx(); m_dirty = false; }).then(arcana::inline_scheduler, *m_cancellationSource, [this, cancellationSource{m_cancellationSource}](const arcana::expected& result) { diff --git a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc index 7eae3cad1..d3353504a 100644 --- a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc +++ b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc @@ -2,12 +2,21 @@ $input v_position, v_texcoord0 #include "./common.sh" -uniform vec4 u_direction; // vec4 (x, y, unused, unused) +uniform vec4 u_viewSize; // vec4 (width, height, unused, unused) +uniform vec4 u_direction; // vec4 (x, y, unused, unused) SAMPLER2D(s_tex, 0); +#if NEED_HALF_TEXEL +uniform vec4 u_halfTexel; +#endif // NEED_HALF_TEXEL + void main() { +#if !NEED_HALF_TEXEL + vec4 u_halfTexel = vec4_splat(0.0); +#endif // !NEED_HALF_TEXEL + // 13-tap weights float weights[7]; weights[0] = 0.227027; // center @@ -21,17 +30,16 @@ void main() vec4 color = texture2D(s_tex, v_texcoord0) * weights[0]; // center pixel weighted float alpha = color.a; - // PR cedric: texture coordinate is normalized. Range for sampling is [0..1]. A pixel size in normalized coordinate system is vec2(1./texture width, 1./texture height). Also, take care of half texel : https://asawicki.info/news_1516_half-pixel_offset_in_directx_11 + vec2 texcoord0 = v_texcoord0 + u_halfTexel.xy; // handle half texel offset + // vec2 normTex = vec2_splat(1.0) / u_viewSize.xy; // normalized texel size? + for (int i = 1; i <= 6; i++) { - vec2 offset = u_direction.xy * float(i); - - vec4 sample1 = texture2D(s_tex, v_texcoord0 + offset) * weights[i]; - vec4 sample2 = texture2D(s_tex, v_texcoord0 - offset) * weights[i]; - - color.rgb += sample1.rgb + sample2.rgb; // Sum RGB values - alpha += sample1.a * weights[i] + sample2.a * weights[i]; // Sum alpha values + vec2 offset = u_direction.xy * float(i); // TODO: normalize against u_viewSize.xy + vec4 sample1 = texture2D(s_tex, texcoord0 + offset) * weights[i]; + vec4 sample2 = texture2D(s_tex, texcoord0 - offset) * weights[i]; + color += sample1 + sample2; } - gl_FragColor = vec4(color.rgb, alpha); // Combine blurred color and alpha + gl_FragColor = color; } diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 5ca06a73f..eef8ac7e3 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -372,6 +372,7 @@ namespace gl->u_sdf = bgfx::createUniform("u_sdf", bgfx::UniformType::Vec4); gl->s_tex = bgfx::createUniform("s_tex", bgfx::UniformType::Sampler); gl->s_tex2 = bgfx::createUniform("s_tex2", bgfx::UniformType::Sampler); + nanovg_filterstack::InitBgfx(); // initialize filter stack uniforms + programs gl->u_halfTexel.idx = bgfx::kInvalidHandle; @@ -1311,6 +1312,7 @@ namespace bgfx::destroy(gl->u_params); bgfx::destroy(gl->s_tex); bgfx::destroy(gl->s_tex2); + nanovg_filterstack::DisposeBgfx(); if (bgfx::isValid(gl->u_halfTexel) ) { diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index 9a5ea90db..f00cd4e60 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -60,10 +60,15 @@ void nanovg_filterstack::InitBgfx() void nanovg_filterstack::DisposeBgfx() { - bgfx::destroy(m_uniforms.u_strength); - bgfx::destroy(m_uniforms.u_direction); - bgfx::destroy(fspassProg); - bgfx::destroy(blurProg); + // check if uniforms + programs are valid before destroying + if (m_uniforms.u_strength.idx != bgfx::kInvalidHandle) + bgfx::destroy(m_uniforms.u_strength); + if (m_uniforms.u_direction.idx != bgfx::kInvalidHandle) + bgfx::destroy(m_uniforms.u_direction); + if (fspassProg.idx != bgfx::kInvalidHandle) + bgfx::destroy(fspassProg); + if (blurProg.idx != bgfx::kInvalidHandle) + bgfx::destroy(blurProg); } bool nanovg_filterstack::ValidString(const std::string& string) From 6deeb4c12110d4183c69dab1c1f2118bb86ac799 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Mon, 31 Mar 2025 17:18:45 +1100 Subject: [PATCH 16/24] update compiled shaders --- .../Canvas/Source/Shaders/dx11/fs_gaussblur.h | 132 ++++++++++++++++ .../Canvas/Source/Shaders/essl/fs_gaussblur.h | 98 ++++++++++++ .../Canvas/Source/Shaders/glsl/fs_gaussblur.h | 93 +++++++++++ .../Source/Shaders/metal/fs_gaussblur.h | 148 ++++++++++++++++++ .../Source/Shaders/spirv/fs_gaussblur.h | 135 ++++++++++++++++ 5 files changed, 606 insertions(+) create mode 100644 Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h create mode 100644 Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h create mode 100644 Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h create mode 100644 Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h create mode 100644 Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h diff --git a/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h new file mode 100644 index 000000000..14adcfe78 --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h @@ -0,0 +1,132 @@ +static const uint8_t fs_gaussblur_dx11[2064] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0b, 0x75, // FSH............u + 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, // _direction...... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex0..... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex0..... + 0x00, 0x00, 0x00, 0x00, 0xc4, 0x07, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x25, 0x6c, 0x7c, 0x5d, // ........DXBC%l|] + 0x53, 0xcd, 0x4c, 0x18, 0xcb, 0x59, 0xfe, 0x34, 0xba, 0x57, 0xc5, 0xa3, 0x01, 0x00, 0x00, 0x00, // S.L..Y.4.W...... + 0xc4, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, // ........,....... + 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....ISGNh....... + 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....P........... + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, // ............SV_P + 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // OSITION.TEXCOORD + 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....OSGN,....... + 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .... ........... + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, // ............SV_T + 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0xec, 0x06, 0x00, 0x00, // ARGET...SHEX.... + 0x50, 0x00, 0x00, 0x00, 0xbb, 0x01, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x04, // P.......j...Y... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, // F. .........Z... + 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X....p.. + 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xc2, 0x10, 0x10, 0x00, // ....UU..b....... + 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ...... + 0x68, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, // h...........2... + 0x00, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, // ............F. . + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, // A...........E... + 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....CU.......... + 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F~...... + 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, // .`......8....... + 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@.. + 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, // .CG>.CG>.CG>.CG> + 0x00, 0x00, 0x00, 0x08, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, // ....2........... + 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. ......... + 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, // E.......CU...... + 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ....F.......F~.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, // .....`......2... + 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........F....... + 0x02, 0x40, 0x00, 0x00, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, // .@...CG>.CG>.CG> + 0xcf, 0x43, 0x47, 0x3e, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, // .CG>F.......E... + 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....CU.......... + 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F~...... + 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, // .`......2....... + 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@.. + 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, // .yh>.yh>.yh>.yh> + 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0e, 0x32, 0x00, 0x10, 0x00, // F.......2...2... + 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. .A....... + 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, // .....@.....@...@ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, // E.......CU...... + 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ....F.......F~.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, // .....`......8... + 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........F....... + 0x02, 0x40, 0x00, 0x00, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, // .@.....=...=...= + 0xbf, 0x14, 0xf9, 0x3d, 0x32, 0x00, 0x00, 0x0d, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ...=2...2....... + 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // F. ..........@.. + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@...@........ + 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // ........E....... + 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, // CU..........F... + 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....2........... + 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xbf, 0x14, 0xf9, 0x3d, // F........@.....= + 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0x46, 0x0e, 0x10, 0x00, // ...=...=...=F... + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // F.......F....... + 0x32, 0x00, 0x00, 0x0e, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x84, 0x20, 0x80, // 2...........F. . + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // A............@.. + 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, // ..@@..@@...@...@ + 0xe6, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // ........E....... + 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, // CU..........F... + 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. + 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, // ....E.......CU.. + 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F~.......`...... + 0x38, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // 8...........F... + 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x6b, 0xd7, 0x84, 0x3c, 0x6b, 0xd7, 0x84, 0x3c, // .....@..k......... +}; diff --git a/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h new file mode 100644 index 000000000..108fbd2d8 --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h @@ -0,0 +1,98 @@ +static const uint8_t fs_gaussblur_essl[1517] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u + 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex...... + 0x00, 0x00, 0x00, 0x00, 0xb4, 0x05, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, // ........varying + 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, // highp vec2 v_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // coord0;.uniform + 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, // highp vec4 u_dir + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // ection;.uniform + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, // sampler2D s_tex; + 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, // .void main ().{. + 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // lowp vec4 colo + 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, // r_1;. color_1 = + 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, // ((texture2D (s_ + 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tex, v_texcoord0 + 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, 0x32, 0x37, 0x30, 0x32, 0x37, 0x29, 0x20, 0x2b, 0x20, // ) * 0.227027) + + 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, // ((texture2D (s_t + 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ex, . (v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, // oord0 + u_direct + 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, // ion.xy). ) * 0. + 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, // 1945946) + (text + 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, // ure2D (s_tex, . + 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // (v_texcoord0 + 0x2d, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, // - u_direction.xy + 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, // ). ) * 0.194594 + 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, // 6)));. highp ve + 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, // c2 tmpvar_2;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, // mpvar_2 = (u_dir + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, // ection.xy * 2.0) + 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, // ;. color_1 = (c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // olor_1 + ((textu + 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, // re2D (s_tex, . + 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, // (v_texcoord0 + + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, // tmpvar_2). ) * + 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, // 0.1216216) + (t + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // exture2D (s_tex, + 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // . (v_texcoor + 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, // d0 - tmpvar_2). + 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, // ) * 0.1216216)) + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // );. highp vec2 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_3;. tmpv + 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, // ar_3 = (u_direct + 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, // ion.xy * 3.0);. + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, // color_1 = (colo + 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, // r_1 + ((texture2 + 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, // D (s_tex, . ( + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, // v_texcoord0 + tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, // pvar_3). ) * 0. + 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // 054054) + (textu + 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, // re2D (s_tex, . + 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, // (v_texcoord0 - + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, // tmpvar_3). ) * + 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.054054)));. + 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // highp vec2 tmpva + 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, // r_4;. tmpvar_4 + 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, // = (u_direction.x + 0x79, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // y * 4.0);. colo + 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, // r_1 = (color_1 + + 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, // ((texture2D (s_ + 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, // tex, . (v_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // coord0 + tmpvar_ + 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, // 4). ) * 0.01621 + 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, // 6) + (texture2D + 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, // (s_tex, . (v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, // texcoord0 - tmpv + 0x61, 0x72, 0x5f, 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, // ar_4). ) * 0.01 + 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 6216)));. highp + 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, // vec2 tmpvar_5;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, // tmpvar_5 = (u_ + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x35, // direction.xy * 5 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, // .0);. color_1 = + 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, // (color_1 + ((te + 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // xture2D (s_tex, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // . (v_texcoord + 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x0a, 0x20, 0x20, // 0 + tmpvar_5). + 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x29, 0x20, 0x2b, 0x20, // ) * 0.004629) + + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // (texture2D (s_te + 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // x, . (v_texco + 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, // ord0 - tmpvar_5) + 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x29, // . ) * 0.004629) + 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, // ));. highp vec2 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_6;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, // var_6 = (u_direc + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x36, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // tion.xy * 6.0);. + 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, // color_1 = (col + 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // or_1 + ((texture + 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // 2D (s_tex, . + 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, // (v_texcoord0 + t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, // mpvar_6). ) * 0 + 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x33, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, // .000823) + (text + 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, // ure2D (s_tex, . + 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // (v_texcoord0 + 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, // - tmpvar_6). ) + 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x33, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, // * 0.000823)));. + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // gl_FragColor = + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // color_1;.}... +}; diff --git a/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h new file mode 100644 index 000000000..9c38f5263 --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h @@ -0,0 +1,93 @@ +static const uint8_t fs_gaussblur_glsl[1439] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u + 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex...... + 0x00, 0x00, 0x00, 0x00, 0x66, 0x05, 0x00, 0x00, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // ....f...in vec2 + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // v_texcoord0;.uni + 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, // form vec4 u_dire + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, // ction;.uniform s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, // ampler2D s_tex;. + 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // void main ().{. + 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // vec4 color_1;. + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, // color_1 = ((tex + 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, 0x74, // ture (s_tex, v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, 0x32, // excoord0) * 0.22 + 0x37, 0x30, 0x32, 0x37, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // 7027) + ((textur + 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, // e (s_tex, . ( + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x75, 0x5f, // v_texcoord0 + u_ + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x0a, 0x20, 0x20, // direction.xy). + 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x20, 0x2b, // ) * 0.1945946) + + 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // (texture (s_tex + 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // , . (v_texcoo + 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, // rd0 - u_directio + 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, // n.xy). ) * 0.19 + 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, // 45946)));. vec2 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_2;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, // var_2 = (u_direc + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // tion.xy * 2.0);. + 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, // color_1 = (col + 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // or_1 + ((texture + 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, // (s_tex, . (v + 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, // _texcoord0 + tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, // var_2). ) * 0.1 + 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // 216216) + (textu + 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // re (s_tex, . + 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, // (v_texcoord0 - t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, // mpvar_2). ) * 0 + 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, // .1216216)));. v + 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_3;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, // tmpvar_3 = (u_di + 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, // rection.xy * 3.0 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, // );. color_1 = ( + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, // color_1 + ((text + 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, // ure (s_tex, . + 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, // (v_texcoord0 + + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, // tmpvar_3). ) * + 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // 0.054054) + (tex + 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, // ture (s_tex, . + 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, // (v_texcoord0 - + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, // tmpvar_3). ) * + 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.054054)));. + 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // vec2 tmpvar_4;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, // tmpvar_4 = (u_d + 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x34, 0x2e, // irection.xy * 4. + 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // 0);. color_1 = + 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, // (color_1 + ((tex + 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, // ture (s_tex, . + 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, // (v_texcoord0 + + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, // tmpvar_4). ) * + 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, // 0.016216) + (te + 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, // xture (s_tex, . + 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // (v_texcoord0 + 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, // - tmpvar_4). ) + 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, // * 0.016216)));. + 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, // vec2 tmpvar_5;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, // tmpvar_5 = (u_ + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x35, // direction.xy * 5 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, // .0);. color_1 = + 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, // (color_1 + ((te + 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, // xture (s_tex, . + 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // (v_texcoord0 + 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, // + tmpvar_5). ) + 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, // * 0.004629) + (t + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, // exture (s_tex, . + 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // (v_texcoord0 + 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x0a, 0x20, 0x20, 0x29, // - tmpvar_5). ) + 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x29, 0x29, 0x29, 0x3b, 0x0a, // * 0.004629)));. + 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x3b, // vec2 tmpvar_6; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x75, // . tmpvar_6 = (u + 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, // _direction.xy * + 0x36, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, // 6.0);. color_1 + 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, // = (color_1 + ((t + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, // exture (s_tex, . + 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // (v_texcoord0 + 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x0a, 0x20, 0x20, 0x29, // + tmpvar_6). ) + 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x33, 0x29, 0x20, 0x2b, 0x20, 0x28, // * 0.000823) + ( + 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // texture (s_tex, + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // . (v_texcoord + 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x0a, 0x20, 0x20, // 0 - tmpvar_6). + 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x33, 0x29, 0x29, 0x29, 0x3b, // ) * 0.000823))); + 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // . gl_FragColor + 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = color_1;.}... +}; diff --git a/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h new file mode 100644 index 000000000..aea532f7f --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h @@ -0,0 +1,148 @@ +static const uint8_t fs_gaussblur_mtl[2309] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x11, 0x01, 0xff, 0xff, 0x01, // _texSampler..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, // ......s_texTextu + 0x72, 0x65, 0x11, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x75, 0x5f, 0x64, // re...........u_d + 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // irection........ + 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...s_tex........ + 0x00, 0x00, 0x9b, 0x08, 0x00, 0x00, 0x23, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x63, 0x6c, // ......#pragma cl + 0x61, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x20, 0x69, // ang diagnostic i + 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x22, 0x2d, 0x57, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, // gnored "-Wmissin + 0x67, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x0a, 0x23, 0x70, // g-prototypes".#p + 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x63, 0x6c, 0x61, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x61, 0x67, // ragma clang diag + 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x22, // nostic ignored " + 0x2d, 0x57, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x2d, 0x62, 0x72, 0x61, 0x63, 0x65, 0x73, // -Wmissing-braces + 0x22, 0x0a, 0x0a, 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65, 0x74, // "..#include .#incl + 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69, 0x6d, 0x64, 0x2f, 0x73, 0x69, 0x6d, 0x64, 0x2e, 0x68, // ude ..using namespa + 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x0a, 0x74, 0x65, 0x6d, 0x70, 0x6c, // ce metal;..templ + 0x61, 0x74, 0x65, 0x3c, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x54, 0x2c, 0x20, // ate.stru + 0x63, 0x74, 0x20, 0x73, 0x70, 0x76, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x41, 0x72, 0x72, 0x61, // ct spvUnsafeArra + 0x79, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, // y.{. T elemen + 0x74, 0x73, 0x5b, 0x4e, 0x75, 0x6d, 0x20, 0x3f, 0x20, 0x4e, 0x75, 0x6d, 0x20, 0x3a, 0x20, 0x31, // ts[Num ? Num : 1 + 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x65, // ];. . thre + 0x61, 0x64, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, // ad T& operator [ + 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x74, // ] (size_t pos) t + 0x68, 0x72, 0x65, 0x61, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // hread. {. + 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, // return eleme + 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, // nts[pos];. }. + 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, // constexpr co + 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, // nst thread T& op + 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, // erator [] (size_ + 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, // t pos) const thr + 0x65, 0x61, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ead. {. + 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, // return element + 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, // s[pos];. }. + 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x20, 0x54, 0x26, // . device T& + 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, // operator [] (si + 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, // ze_t pos) device + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, // . {. r + 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, // eturn elements[p + 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, // os];. }. c + 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x64, // onstexpr const d + 0x65, 0x76, 0x69, 0x63, 0x65, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, // evice T& operato + 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, // r [] (size_t pos + 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x0a, 0x20, // ) const device. + 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, // {. ret + 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, // urn elements[pos + 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, // ];. }. . + 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, // constexpr cons + 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, // t constant T& op + 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, // erator [] (size_ + 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x63, 0x6f, 0x6e, // t pos) const con + 0x73, 0x74, 0x61, 0x6e, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // stant. {. + 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, // return eleme + 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, // nts[pos];. }. + 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x67, // . threadg + 0x72, 0x6f, 0x75, 0x70, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, // roup T& operator + 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, // [] (size_t pos) + 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x0a, 0x20, 0x20, 0x20, // threadgroup. + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, // {. retur + 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, // n elements[pos]; + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, // . }. const + 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, // expr const threa + 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, // dgroup T& operat + 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, // or [] (size_t po + 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x67, // s) const threadg + 0x72, 0x6f, 0x75, 0x70, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // roup. {. + 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, // return elemen + 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x7d, // ts[pos];. }.} + 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x5f, 0x47, 0x6c, 0x6f, 0x62, 0x61, // ;..struct _Globa + 0x6c, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, // l.{. float4 u + 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, // _direction;.};.. + 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, // struct xlatMtlMa + 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, // in_out.{. flo + 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // at4 bgfx_FragDat + 0x61, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, // a0 [[color(0)]]; + 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // .};..struct xlat + 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, // MtlMain_in.{. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // float2 v_texcoo + 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, 0x31, // rd0 [[user(locn1 + 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, // )]];.};..fragmen + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, // t xlatMtlMain_ou + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x28, 0x78, 0x6c, // t xlatMtlMain(xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x20, // atMtlMain_in in + 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, // [[stage_in]], co + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x5f, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x26, 0x20, // nstant _Global& + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, // _mtl_u [[buffer( + 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, // 0)]], texture2d< + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x20, 0x5b, 0x5b, 0x74, // float> s_tex [[t + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, // exture(0)]], sam + 0x70, 0x6c, 0x65, 0x72, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, // pler s_texSample + 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, // r [[sampler(0)]] + 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // ).{. xlatMtlM + 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, // ain_out out = {} + 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x70, 0x76, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x41, // ;. spvUnsafeA + 0x72, 0x72, 0x61, 0x79, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x2c, 0x20, 0x37, 0x3e, 0x20, 0x5f, // rray _ + 0x32, 0x30, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x30, 0x5d, // 209;. _209[0] + 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x32, 0x32, 0x37, 0x30, 0x32, 0x36, 0x39, 0x39, 0x38, 0x39, 0x39, // = 0.22702699899 + 0x36, 0x37, 0x33, 0x34, 0x36, 0x31, 0x39, 0x31, 0x34, 0x30, 0x36, 0x32, 0x35, 0x3b, 0x0a, 0x20, // 6734619140625;. + 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x31, // _209[1] = 0.1 + 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x30, 0x36, 0x37, 0x35, 0x37, 0x31, 0x36, 0x34, 0x30, 0x30, // 9459460675716400 + 0x31, 0x34, 0x36, 0x34, 0x38, 0x34, 0x33, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, // 146484375;. _ + 0x32, 0x30, 0x39, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, // 209[2] = 0.12162 + 0x31, 0x36, 0x30, 0x31, 0x32, 0x38, 0x33, 0x35, 0x35, 0x30, 0x32, 0x36, 0x32, 0x34, 0x35, 0x31, // 1601283550262451 + 0x31, 0x37, 0x31, 0x38, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, // 171875;. _209 + 0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x33, 0x39, 0x39, // [3] = 0.05405399 + 0x39, 0x34, 0x38, 0x33, 0x35, 0x38, 0x35, 0x33, 0x35, 0x37, 0x36, 0x36, 0x36, 0x30, 0x31, 0x35, // 9483585357666015 + 0x36, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x34, 0x5d, // 625;. _209[4] + 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, 0x36, 0x30, 0x30, 0x30, 0x35, 0x34, // = 0.01621600054 + 0x32, 0x30, 0x34, 0x34, 0x36, 0x33, 0x39, 0x35, 0x38, 0x37, 0x34, 0x30, 0x32, 0x33, 0x34, 0x33, // 2044639587402343 + 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x35, 0x5d, 0x20, // 75;. _209[5] + 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x30, 0x30, 0x30, 0x30, 0x39, 0x30, // = 0.004629000090 + 0x30, 0x36, 0x32, 0x36, 0x31, 0x38, 0x32, 0x35, 0x35, 0x36, 0x31, 0x35, 0x32, 0x33, 0x34, 0x33, // 0626182556152343 + 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x36, 0x5d, 0x20, // 75;. _209[6] + 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x32, 0x39, 0x39, 0x39, 0x39, 0x38, 0x30, // = 0.000822999980 + 0x33, 0x30, 0x30, 0x36, 0x36, 0x34, 0x39, 0x30, 0x31, 0x37, 0x33, 0x33, 0x33, 0x39, 0x38, 0x34, // 3006649017333984 + 0x33, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // 375;. float4 + 0x5f, 0x33, 0x33, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x33, 0x35, 0x20, 0x3d, // _335;. _335 = + 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, // s_tex.sample(s_ + 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x69, 0x6e, 0x2e, 0x76, // texSampler, in.v + 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x32, // _texcoord0) * _2 + 0x30, 0x39, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, // 09[0];. for ( + 0x69, 0x6e, 0x74, 0x20, 0x5f, 0x33, 0x33, 0x34, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x5f, 0x33, // int _334 = 1; _3 + 0x33, 0x34, 0x20, 0x3c, 0x3d, 0x20, 0x36, 0x3b, 0x20, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, // 34 <= 6; ). { + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, // . float2 + 0x5f, 0x32, 0x35, 0x35, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // _255 = _mtl_u.u_ + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x66, // direction.xy * f + 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x5f, 0x33, 0x33, 0x34, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // loat(_334);. + 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x33, 0x35, 0x20, 0x2b, 0x3d, 0x20, 0x28, 0x28, 0x73, 0x5f, // _335 += ((s_ + 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // tex.sample(s_tex + 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, // Sampler, (in.v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x5f, 0x32, 0x35, 0x35, 0x29, // excoord0 + _255) + 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x5f, 0x33, 0x33, 0x34, 0x5d, 0x29, 0x20, // ) * _209[_334]) + 0x2b, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, // + (s_tex.sample( + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, 0x69, // s_texSampler, (i + 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, // n.v_texcoord0 - + 0x5f, 0x32, 0x35, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x5f, 0x33, // _255)) * _209[_3 + 0x33, 0x34, 0x5d, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, // 34]));. _ + 0x33, 0x33, 0x34, 0x2b, 0x2b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, // 334++;. c + 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, // ontinue;. }. + 0x20, 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, // out.bgfx_Frag + 0x44, 0x61, 0x74, 0x61, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x33, 0x33, 0x35, 0x3b, 0x0a, 0x20, 0x20, // Data0 = _335;. + 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, // return out;.}. + 0x0a, 0x00, 0x00, 0x30, 0x00, // ...0. +}; diff --git a/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h new file mode 100644 index 000000000..75bd8653b --- /dev/null +++ b/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h @@ -0,0 +1,135 @@ +static const uint8_t fs_gaussblur_spv[2112] = +{ + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u + 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, // .....s_tex0..... + 0x00, 0x02, 0x22, 0x00, 0x04, 0x08, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, // ..".......#..... + 0x0b, 0x00, 0x08, 0x00, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, // ....P........... + 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, // ............GLSL + 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, // .std.450........ + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, // ....main........ + 0xb8, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ + 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, // ....main........ + 0x23, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // #...s_texSampler + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x26, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, // ........&...s_te + 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, // xTexture........ + 0x78, 0x00, 0x00, 0x00, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, // x...UniformBlock + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........x....... + 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, // u_direction..... + 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xab, 0x00, 0x00, 0x00, // z............... + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, // v_texcoord0..... + 0xb8, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ....bgfx_FragDat + 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // a0..G...#...!... + 0x12, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...#..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...&...!... + 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...&..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....G...x....... + 0x48, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...x.......#... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...z...!... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...z..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xab, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, // ........ ....... + 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ............... + 0x20, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ..."........... + 0x3b, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ;..."...#....... + 0x20, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ...%........... + 0x3b, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ;...%...&....... + 0x15, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....)... ....... + 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // +...)...*....... + 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +...)........... + 0x1b, 0x00, 0x03, 0x00, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ....2........... + 0x43, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // C... .......+... + 0x43, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // C...D........... + 0x45, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // E.......D... ... + 0x46, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // F.......E...+... + 0x07, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0xc4, 0x79, 0x68, 0x3e, 0x2b, 0x00, 0x04, 0x00, // ....H....yh>+... + 0x07, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0xcf, 0x43, 0x47, 0x3e, 0x2b, 0x00, 0x04, 0x00, // ....J....CG>+... + 0x29, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...L.......+... + 0x07, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0xbf, 0x14, 0xf9, 0x3d, 0x2b, 0x00, 0x04, 0x00, // ....M......=+... + 0x29, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...O.......+... + 0x07, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xba, 0x67, 0x5d, 0x3d, 0x2b, 0x00, 0x04, 0x00, // ....P....g]=+... + 0x29, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...R.......+... + 0x07, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x6b, 0xd7, 0x84, 0x3c, 0x2b, 0x00, 0x04, 0x00, // ....S...k..<+... + 0x29, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...U.......+... + 0x07, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0xde, 0xae, 0x97, 0x3b, 0x2b, 0x00, 0x04, 0x00, // ....V......;+... + 0x29, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...X.......+... + 0x07, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x98, 0xbe, 0x57, 0x3a, 0x14, 0x00, 0x02, 0x00, // ....Y.....W:.... + 0x75, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // u.......x....... + 0x20, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, // ...y.......x... + 0x3b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...y...z....... + 0x20, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ...{........... + 0x20, 0x00, 0x04, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ............... + 0x3b, 0x00, 0x04, 0x00, 0xa7, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... + 0x20, 0x00, 0x04, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ............... + 0x3b, 0x00, 0x04, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... + 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... + 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... + 0x46, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // F...........=... + 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....$...#...=... + 0x08, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....'...&...=... + 0x0b, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ............A... + 0x13, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, // ................ + 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......H...A... + 0x13, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, // ............*... + 0x3e, 0x00, 0x03, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......J...A... + 0x13, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, // ............L... + 0x3e, 0x00, 0x03, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......M...A... + 0x13, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, // ............O... + 0x3e, 0x00, 0x03, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......P...A... + 0x13, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, // ............R... + 0x3e, 0x00, 0x03, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......S...A... + 0x13, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, // ............U... + 0x3e, 0x00, 0x03, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......V...A... + 0x13, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, // ............X... + 0x3e, 0x00, 0x03, 0x00, 0xe8, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, // >.......Y...V... + 0x32, 0x00, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // 2...*...'...$... + 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, // W.......,...*... + 0xac, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, // ....A........... + 0xd1, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ........=....... + 0xed, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0xee, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0xed, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ....,........... + 0xf5, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf5, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0x4f, 0x01, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....O........... + 0x16, 0x01, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x29, 0x00, 0x00, 0x00, // ............)... + 0x4e, 0x01, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x19, 0x01, 0x00, 0x00, // N...*........... + 0xf9, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x05, 0x00, 0x75, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, // ........u....... + 0x4e, 0x01, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0x1a, 0x01, 0x00, 0x00, // N...X........... + 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xf8, 0x00, 0x00, 0x00, // ................ + 0xf9, 0x00, 0x00, 0x00, 0x1a, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf9, 0x00, 0x00, 0x00, // ................ + 0x41, 0x00, 0x05, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, // A...{.......z... + 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, // ....=........... + 0xfa, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, // ....O........... + 0xfb, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x6f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x4e, 0x01, 0x00, 0x00, // o...........N... + 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, // ................ + 0xfe, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // ................ + 0xac, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x32, 0x00, 0x00, 0x00, // ........V...2... + 0x33, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, // 3...'...$...W... + 0x0d, 0x00, 0x00, 0x00, 0x35, 0x01, 0x00, 0x00, 0x33, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // ....5...3....... + 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, // A............... + 0x4e, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, // N...=........... + 0x06, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, // ................ + 0x35, 0x01, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // 5............... + 0x0b, 0x01, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, // ............V... + 0x32, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // 2...<...'...$... + 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, // W.......>...<... + 0x0b, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0f, 0x01, 0x00, 0x00, // ....A........... + 0xd1, 0x00, 0x00, 0x00, 0x4e, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ....N...=....... + 0x10, 0x01, 0x00, 0x00, 0x0f, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0x11, 0x01, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, // ....>........... + 0x0d, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, // ................ + 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0x4f, 0x01, 0x00, 0x00, // ............O... + 0x14, 0x01, 0x00, 0x00, 0x80, 0x00, 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0x19, 0x01, 0x00, 0x00, // ........)....... + 0x4e, 0x01, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xf5, 0x00, 0x00, 0x00, // N...*........... + 0xf8, 0x00, 0x02, 0x00, 0x1a, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb8, 0x00, 0x00, 0x00, // ........>....... + 0x4f, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // O.......8....... +}; From 765192844feff57b68b34ff0dfbb78d61486694b Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Mon, 31 Mar 2025 17:43:42 +1100 Subject: [PATCH 17/24] cleanup comments, cleanup FrameBufferPool methods --- Polyfills/Canvas/Source/Canvas.cpp | 6 ++-- Polyfills/Canvas/Source/Context.cpp | 8 ++--- Polyfills/Canvas/Source/FrameBufferPool.cpp | 10 +++---- Polyfills/Canvas/Source/FrameBufferPool.h | 15 ++++------ .../Canvas/Source/nanovg/nanovg_babylon.cpp | 30 ------------------- .../Canvas/Source/nanovg/nanovg_filterstack.h | 13 -------- 6 files changed, 17 insertions(+), 65 deletions(-) diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index a352c4c2a..7d061f476 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -140,9 +140,9 @@ namespace Babylon::Polyfills::Internal } } { - m_frameBufferPool.clear(); + m_frameBufferPool.Clear(); // PR cedric: Init pool only if filter is needed. - m_frameBufferPool.init(POOL_SIZE, m_graphicsContext); + m_frameBufferPool.Init(POOL_SIZE, m_graphicsContext); } return true; } @@ -172,7 +172,7 @@ namespace Babylon::Polyfills::Internal { m_frameBuffer.reset(); m_texture.reset(); - m_frameBufferPool.clear(); + m_frameBufferPool.Clear(); } void NativeCanvas::Dispose(const Napi::CallbackInfo& /*info*/) diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 13b7511a8..46ba1da7e 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -612,20 +612,20 @@ namespace Babylon::Polyfills::Internal const auto width = m_canvas->GetWidth(); const auto height = m_canvas->GetHeight(); - for (auto& buffer : m_canvas->m_frameBufferPool.getPoolBuffers()) + for (auto& buffer : m_canvas->m_frameBufferPool.GetPoolBuffers()) { // sanity check no buffers should have been acquired yet assert(buffer.isAvailable == true); // buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); // TODO: confirm that this not necessary because of ScreenSpaceQuad } std::function acquire = [this, encoder]() -> Babylon::Graphics::FrameBuffer* { - Babylon::Graphics::FrameBuffer *frameBuffer = this->m_canvas->m_frameBufferPool.acquire(); + Babylon::Graphics::FrameBuffer *frameBuffer = this->m_canvas->m_frameBufferPool.Acquire(); frameBuffer->Bind(*encoder); return frameBuffer; }; std::function release = [this, encoder](Babylon::Graphics::FrameBuffer* frameBuffer) -> void { frameBuffer->Unbind(*encoder); - this->m_canvas->m_frameBufferPool.release(frameBuffer); + this->m_canvas->m_frameBufferPool.Release(frameBuffer); }; nvgBeginFrame(*m_nvg, float(width), float(height), 1.0f); @@ -634,7 +634,7 @@ namespace Babylon::Polyfills::Internal nvgEndFrame(*m_nvg); frameBuffer.Unbind(*encoder); - for (auto& buffer : m_canvas->m_frameBufferPool.getPoolBuffers()) + for (auto& buffer : m_canvas->m_frameBufferPool.GetPoolBuffers()) { // sanity check no unreleased buffers assert(buffer.isAvailable == true); diff --git a/Polyfills/Canvas/Source/FrameBufferPool.cpp b/Polyfills/Canvas/Source/FrameBufferPool.cpp index 5c3b11650..2ddada1ed 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.cpp +++ b/Polyfills/Canvas/Source/FrameBufferPool.cpp @@ -7,12 +7,12 @@ namespace Babylon::Polyfills { - std::vector FrameBufferPool::getPoolBuffers() + std::vector FrameBufferPool::GetPoolBuffers() { return mPoolBuffers; } - void FrameBufferPool::init(int size, Graphics::DeviceContext& graphicsContext) + void FrameBufferPool::Init(int size, Graphics::DeviceContext& graphicsContext) { for (int i = 0; i < size; ++i) { @@ -36,7 +36,7 @@ namespace Babylon::Polyfills } } - void FrameBufferPool::clear() + void FrameBufferPool::Clear() { for (auto& buffer : mPoolBuffers) { @@ -52,7 +52,7 @@ namespace Babylon::Polyfills mPoolBuffers.clear(); } - Graphics::FrameBuffer* FrameBufferPool::acquire() + Graphics::FrameBuffer* FrameBufferPool::Acquire() { for (auto& buffer : mPoolBuffers) { @@ -66,7 +66,7 @@ namespace Babylon::Polyfills throw std::runtime_error{"No available frame buffer in pool"}; } - void FrameBufferPool::release(Graphics::FrameBuffer* frameBuffer) + void FrameBufferPool::Release(Graphics::FrameBuffer* frameBuffer) { for (auto& buffer : mPoolBuffers) { diff --git a/Polyfills/Canvas/Source/FrameBufferPool.h b/Polyfills/Canvas/Source/FrameBufferPool.h index c8e9c6709..a022c34f3 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.h +++ b/Polyfills/Canvas/Source/FrameBufferPool.h @@ -13,16 +13,11 @@ namespace Babylon::Polyfills Graphics::FrameBuffer* frameBuffer; bool isAvailable; }; - void init(int nBuffers, Graphics::DeviceContext& graphicsContext); - void clear(); - Graphics::FrameBuffer* acquire(); - void release(Graphics::FrameBuffer* frameBuffer); - std::vector getPoolBuffers(); - - typename std::vector::iterator begin(); - typename std::vector::iterator end(); - typename std::vector::const_iterator begin() const; - typename std::vector::const_iterator end() const; + Graphics::FrameBuffer* Acquire(); + void Clear(); + void Init(int nBuffers, Graphics::DeviceContext& graphicsContext); + void Release(Graphics::FrameBuffer* frameBuffer); + std::vector GetPoolBuffers(); private: std::vector mPoolBuffers{}; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index eef8ac7e3..5a707631b 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -834,7 +834,6 @@ namespace bgfx::ProgramHandle firstProg = gl->prog; std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { - // DEBUG: do we need a guard for setting uniform? bgfx.cpp:3725 is asserting gl->encoder->setUniform(u, value); }; std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { @@ -871,27 +870,6 @@ namespace { if (3 <= call->vertexCount) { - /* - nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); - - gl->encoder->setState(gl->state); - gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); - gl->encoder->setTexture(0, gl->s_tex, gl->th); - hackFrameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); - - // render to canvas - nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); - - gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A - | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) - | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); - - gl->encoder->setTexture(0, gl->s_tex, bgfx::getTexture(hackFrameBuffer->Handle())); - bool s_originBottomLeft = bgfx::getCaps()->originBottomLeft; - screenSpaceQuad(gl->encoder, s_originBottomLeft); - gl->frameBuffer->Submit(*gl->encoder, gl->fsprog, BGFX_DISCARD_ALL);; - */ - /* nvgRenderSetUniforms(gl, call->uniformOffset, call->image); @@ -901,13 +879,8 @@ namespace gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); */ - // TODO: will need to implement some kinda callback function to set uniforms - // float direction[4] = { 0.f, 0.f, 0.f, 0.f }; - // gl->encoder->setUniform(gl->u_direction, direction); - bgfx::ProgramHandle firstProg = gl->prog; std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { - // DEBUG: do we need a guard for setting uniform? bgfx.cpp:3725 is asserting gl->encoder->setUniform(u, value); }; std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { @@ -976,7 +949,6 @@ namespace { struct GLNVGcontext* gl = (struct GLNVGcontext*)_userPtr; //gl->frameBuffer->SetViewPort(gl->encoder, 0.f, 0.f, gl->view[0], gl->view[1]); - // NOTE: I'm not sure why we need to re-define fill in every nvgRenderFlush if (!gl->prog.idx) { bgfx::RendererType::Enum type = bgfx::getRendererType(); @@ -1338,7 +1310,6 @@ namespace } // namespace -// NOTE: This is called from Context constructor. Uniforms get defined when Context created NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) { if (NULL == _allocator) @@ -1374,7 +1345,6 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bx::AllocatorI* _allocator) gl->allocator = _allocator; gl->edgeAntiAlias = _edgeaa; - // NOTE: this calls back out to nvgRenderCreate to initialize uniforms ctx = nvgCreateInternal(¶ms); if (ctx == NULL) goto error; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h index e84796b02..246873687 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.h @@ -36,12 +36,6 @@ class nanovg_filterstack void ParseString(const std::string& string); static bool ValidString(const std::string& string); - // NOTE: This currently happens in Context.cpp - void SetSize(int width, int height) - { - // flush pool - // keep size for new pool item creation - } void AddDropShadow() { // break down shadow as blur + color @@ -79,11 +73,4 @@ class nanovg_filterstack }; }; std::vector stackElements; - - // DISCUSS: Should we get transient target here? Or fine to have the std::function passed down from nanovg_babylon.cpp - Babylon::Graphics::FrameBuffer* GetTransientTarget() - { - // return a framebuffer that will be reused later as a texture or for another element - return {}; - } }; \ No newline at end of file From 7ff2c0cd92b2c7cdfc8c2f9cc336caa26d848169 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Wed, 2 Apr 2025 00:45:03 +1100 Subject: [PATCH 18/24] PR Comments --- Polyfills/Canvas/Source/Canvas.cpp | 5 +- Polyfills/Canvas/Source/FrameBufferPool.cpp | 9 +- Polyfills/Canvas/Source/FrameBufferPool.h | 2 +- .../Canvas/Source/Shaders/dx11/fs_fspass.h | 54 ----------- .../Canvas/Source/Shaders/essl/fs_fspass.h | 35 -------- Polyfills/Canvas/Source/Shaders/fs_fspass.sc | 39 -------- .../Canvas/Source/Shaders/glsl/fs_fspass.h | 33 ------- .../Canvas/Source/Shaders/metal/fs_fspass.h | 62 ------------- .../Canvas/Source/Shaders/spirv/fs_fspass.h | 89 ------------------- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 5 +- .../Source/nanovg/nanovg_filterstack.cpp | 13 --- 11 files changed, 10 insertions(+), 336 deletions(-) delete mode 100644 Polyfills/Canvas/Source/Shaders/dx11/fs_fspass.h delete mode 100644 Polyfills/Canvas/Source/Shaders/essl/fs_fspass.h delete mode 100644 Polyfills/Canvas/Source/Shaders/fs_fspass.sc delete mode 100644 Polyfills/Canvas/Source/Shaders/glsl/fs_fspass.h delete mode 100644 Polyfills/Canvas/Source/Shaders/metal/fs_fspass.h delete mode 100644 Polyfills/Canvas/Source/Shaders/spirv/fs_fspass.h diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index 7d061f476..c6a23caba 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -120,9 +120,8 @@ namespace Babylon::Polyfills::Internal if (m_dirty) { { - std::array textures{ - bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), - bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT) }; + std::array textures{ + bgfx::createTexture2D(m_width, m_height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT) }; std::array attachments{}; for (size_t idx = 0; idx < attachments.size(); ++idx) diff --git a/Polyfills/Canvas/Source/FrameBufferPool.cpp b/Polyfills/Canvas/Source/FrameBufferPool.cpp index 2ddada1ed..149197d24 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.cpp +++ b/Polyfills/Canvas/Source/FrameBufferPool.cpp @@ -7,7 +7,7 @@ namespace Babylon::Polyfills { - std::vector FrameBufferPool::GetPoolBuffers() + const std::vector& FrameBufferPool::GetPoolBuffers() { return mPoolBuffers; } @@ -20,9 +20,8 @@ namespace Babylon::Polyfills Graphics::FrameBuffer* FrameBuffer; int width(256), height(256); - std::array textures{ - bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT), - bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT)}; + std::array textures{ + bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT)}; std::array attachments{}; for (size_t idx = 0; idx < attachments.size(); ++idx) @@ -72,7 +71,7 @@ namespace Babylon::Polyfills { if (buffer.frameBuffer == frameBuffer) { - // TODO: clear framebuffer? + // no need to clear framebuffer, as all filter passes are (currently) full screen buffer.isAvailable = true; return; } diff --git a/Polyfills/Canvas/Source/FrameBufferPool.h b/Polyfills/Canvas/Source/FrameBufferPool.h index a022c34f3..57d24ddfa 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.h +++ b/Polyfills/Canvas/Source/FrameBufferPool.h @@ -17,7 +17,7 @@ namespace Babylon::Polyfills void Clear(); void Init(int nBuffers, Graphics::DeviceContext& graphicsContext); void Release(Graphics::FrameBuffer* frameBuffer); - std::vector GetPoolBuffers(); + const std::vector& GetPoolBuffers(); private: std::vector mPoolBuffers{}; diff --git a/Polyfills/Canvas/Source/Shaders/dx11/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/dx11/fs_fspass.h deleted file mode 100644 index fbc5fd0e6..000000000 --- a/Polyfills/Canvas/Source/Shaders/dx11/fs_fspass.h +++ /dev/null @@ -1,54 +0,0 @@ -static const uint8_t fs_fspass_dx11[810] = -{ - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x73, // FSH............s - 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, // _tex0..........s - 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x02, // _tex0........... - 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x14, 0x89, 0x71, 0xf1, 0xdb, 0x3a, 0xa1, 0x16, 0x97, 0x4f, // ..DXBC..q..:...O - 0x18, 0xbb, 0x2f, 0xc8, 0xa6, 0x3d, 0x01, 0x00, 0x00, 0x00, 0xf4, 0x02, 0x00, 0x00, 0x03, 0x00, // ../..=.......... - 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS - 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNh...........P. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x5c, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO - 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, // N.TEXCOORD....OS - 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. - 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0x1c, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x87, 0x00, // ..SHEX....P..... - 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ..j...Z....`.... - 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X....p......UU - 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xc2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, // ..b...........e. - 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x05, 0x00, // ... ......h..... - 0x00, 0x00, 0x36, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ..6............@ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, // ..6............@ - 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x30, 0x00, 0x00, 0x01, 0x21, 0x00, 0x00, 0x07, 0x22, 0x00, // ......0...!...". - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, // ...............@ - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x03, 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x2b, 0x00, 0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, // ..+..."......... - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x00, 0x10, 0x00, 0x03, 0x00, // ......6......... - 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x22, 0x00, // ..F.......6...". - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x30, 0x00, // .......@......0. - 0x00, 0x01, 0x21, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!...B......... - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, // .......@........ - 0x04, 0x03, 0x2a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x05, 0x12, 0x00, // ..*.......+..... - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, // ..............2. - 0x00, 0x0c, 0xc2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x04, 0x10, 0x00, 0x02, 0x00, // ................ - 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@............ - 0x80, 0x3b, 0x00, 0x00, 0x80, 0x3b, 0xa6, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, // .;...;........E. - 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x04, 0x00, // ......CU........ - 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, // ..........F~.... - 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf2, 0x00, // ...`............ - 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x0e, // ......F.......F. - 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x01, 0x00, // .........."..... - 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x00, // ...........@.... - 0x00, 0x00, 0x16, 0x00, 0x00, 0x01, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......6......... - 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x07, 0x12, 0x00, // ..F............. - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, // ...............@ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x01, 0x38, 0x00, 0x00, 0x0a, 0xf2, 0x20, // ..........8.... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ......F........@ - 0x00, 0x00, 0x88, 0x45, 0x4a, 0x3c, 0x88, 0x45, 0x4a, 0x3c, 0x88, 0x45, 0x4a, 0x3c, 0x88, 0x45, // ...EJ<.EJ<.EJ<.E - 0x4a, 0x3c, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // J<>....... -}; diff --git a/Polyfills/Canvas/Source/Shaders/essl/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/essl/fs_fspass.h deleted file mode 100644 index 2e432b68f..000000000 --- a/Polyfills/Canvas/Source/Shaders/essl/fs_fspass.h +++ /dev/null @@ -1,35 +0,0 @@ -static const uint8_t fs_fspass_essl[512] = -{ - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x73, // FSH............s - 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, 0x01, // _tex............ - 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // ..varying highp - 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // vec2 v_texcoord0 - 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ;.uniform sample - 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // r2D s_tex;.void - 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, // main ().{. lowp - 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // vec4 color_2;. - 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, // color_2 = vec4( - 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, // 0.0, 0.0, 0.0, 0 - 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x68, 0x69, 0x67, 0x68, // .0);. for (high - 0x70, 0x20, 0x69, 0x6e, 0x74, 0x20, 0x79, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x20, // p int y_1 = -4; - 0x79, 0x5f, 0x31, 0x20, 0x3c, 0x20, 0x35, 0x3b, 0x20, 0x79, 0x5f, 0x31, 0x2b, 0x2b, 0x29, 0x20, // y_1 < 5; y_1++) - 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x68, 0x69, 0x67, 0x68, 0x70, // {. for (highp - 0x20, 0x69, 0x6e, 0x74, 0x20, 0x78, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x20, 0x78, // int x_3 = -4; x - 0x5f, 0x33, 0x20, 0x3c, 0x20, 0x35, 0x3b, 0x20, 0x78, 0x5f, 0x33, 0x2b, 0x2b, 0x29, 0x20, 0x7b, // _3 < 5; x_3++) { - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // . highp vec - 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 2 tmpvar_4;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x66, // tmpvar_4.x = f - 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x78, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // loat(x_3);. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x6c, // tmpvar_4.y = fl - 0x6f, 0x61, 0x74, 0x28, 0x79, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // oat(y_1);. - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_2 = (color - 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, // _2 + texture2D ( - 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // s_tex, (v_texcoo - 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, // rd0 + (tmpvar_4 - 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x33, 0x39, 0x30, 0x36, 0x32, 0x35, 0x29, 0x29, 0x29, 0x29, // * 0.00390625)))) - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // ;. };. };. - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_2 = (color - 0x5f, 0x32, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38, 0x29, // _2 * 0.01234568) - 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ;. gl_FragColor - 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = color_2;.}... -}; diff --git a/Polyfills/Canvas/Source/Shaders/fs_fspass.sc b/Polyfills/Canvas/Source/Shaders/fs_fspass.sc deleted file mode 100644 index ee52459cc..000000000 --- a/Polyfills/Canvas/Source/Shaders/fs_fspass.sc +++ /dev/null @@ -1,39 +0,0 @@ -$input v_position, v_texcoord0 - -#include "./common.sh" - -#define EDGE_AA 1 - -uniform mat3 u_scissorMat; -uniform mat3 u_paintMat; -uniform vec4 u_innerCol; -uniform vec4 u_outerCol; -uniform vec4 u_scissorExtScale; -uniform vec4 u_extentRadius; -uniform vec4 u_params; - -SAMPLER2D(s_tex, 0); - -#define u_scissorExt (u_scissorExtScale.xy) -#define u_scissorScale (u_scissorExtScale.zw) -#define u_extent (u_extentRadius.xy) -#define u_radius (u_extentRadius.z) -#define u_feather (u_params.x) -#define u_strokeMult (u_params.y) -#define u_texType (u_params.z) -#define u_type (u_params.w) - -void main() -{ - vec4 color = vec4(0.,0.,0.,0.);//texture2D(s_tex, v_texcoord0); - for (int y = -4;y < 5; y++) - { - for (int x = -4;x < 5; x++) - { - color += texture2D(s_tex, v_texcoord0 + vec2(x,y) * (1./256.)); - } - } - - color *= 1./81.; - gl_FragColor = color;// * vec4(1.,0.5,0.25,1.); -} diff --git a/Polyfills/Canvas/Source/Shaders/glsl/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/glsl/fs_fspass.h deleted file mode 100644 index 7e5714d28..000000000 --- a/Polyfills/Canvas/Source/Shaders/glsl/fs_fspass.h +++ /dev/null @@ -1,33 +0,0 @@ -static const uint8_t fs_fspass_glsl[476] = -{ - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x73, // FSH............s - 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x01, // _tex............ - 0x00, 0x00, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ..in vec2 v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, // oord0;.uniform s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, // ampler2D s_tex;. - 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // void main ().{. - 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // vec4 color_2;. - 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, // color_2 = vec4( - 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, // 0.0, 0.0, 0.0, 0 - 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, // .0);. for (int - 0x79, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x20, 0x79, 0x5f, 0x31, 0x20, 0x3c, 0x20, // y_1 = -4; y_1 < - 0x35, 0x3b, 0x20, 0x79, 0x5f, 0x31, 0x2b, 0x2b, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 5; y_1++) {. - 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, 0x78, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x2d, // for (int x_3 = - - 0x34, 0x3b, 0x20, 0x78, 0x5f, 0x33, 0x20, 0x3c, 0x20, 0x35, 0x3b, 0x20, 0x78, 0x5f, 0x33, 0x2b, // 4; x_3 < 5; x_3+ - 0x2b, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // +) {. vec2 - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_4;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, // tmpvar_4.x = flo - 0x61, 0x74, 0x28, 0x78, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, // at(x_3);. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, // mpvar_4.y = floa - 0x74, 0x28, 0x79, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // t(y_1);. co - 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // lor_2 = (color_2 - 0x20, 0x2b, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // + texture (s_te - 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // x, (v_texcoord0 - 0x2b, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x2a, 0x20, 0x30, 0x2e, // + (tmpvar_4 * 0. - 0x30, 0x30, 0x33, 0x39, 0x30, 0x36, 0x32, 0x35, 0x29, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 00390625))));. - 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // };. };. colo - 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2a, // r_2 = (color_2 * - 0x20, 0x30, 0x2e, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.01234568);. - 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x63, // gl_FragColor = c - 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // olor_2;.}... -}; diff --git a/Polyfills/Canvas/Source/Shaders/metal/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/metal/fs_fspass.h deleted file mode 100644 index faaed7aef..000000000 --- a/Polyfills/Canvas/Source/Shaders/metal/fs_fspass.h +++ /dev/null @@ -1,62 +0,0 @@ -static const uint8_t fs_fspass_mtl[932] = -{ - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0c, 0x73, // FSH............s - 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x11, 0x01, 0xff, 0xff, 0x01, // _texSampler..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, // ......s_texTextu - 0x72, 0x65, 0x11, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, // re...........s_t - 0x65, 0x78, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x03, 0x00, 0x00, // ex..........P... - 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x5f, // #include .#include - 0x20, 0x3c, 0x73, 0x69, 0x6d, 0x64, 0x2f, 0x73, 0x69, 0x6d, 0x64, 0x2e, 0x68, 0x3e, 0x0a, 0x0a, // .. - 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, // using namespace - 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // metal;..struct x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x0a, 0x7b, // latMtlMain_out.{ - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, // . float4 bgfx - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, // _FragData0 [[col - 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, // or(0)]];.};..str - 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, // uct xlatMtlMain_ - 0x69, 0x6e, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, // in.{. float2 - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x75, 0x73, // v_texcoord0 [[us - 0x65, 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, // er(locn1)]];.};. - 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // .fragment xlatMt - 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // lMain_out xlatMt - 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, // lMain(xlatMtlMai - 0x6e, 0x5f, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, // n_in in [[stage_ - 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, // in]], texture2d< - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x20, 0x5b, 0x5b, 0x74, // float> s_tex [[t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, // exture(0)]], sam - 0x70, 0x6c, 0x65, 0x72, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, // pler s_texSample - 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, // r [[sampler(0)]] - 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // ).{. xlatMtlM - 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, // ain_out out = {} - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x20, 0x5f, 0x32, 0x32, 0x31, 0x3b, 0x0a, // ;. int _221;. - 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x32, 0x32, 0x32, 0x3b, // float4 _222; - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x32, 0x32, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, // . _222 = floa - 0x74, 0x34, 0x28, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x32, // t4(0.0);. _22 - 0x31, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // 1 = -4;. floa - 0x74, 0x34, 0x20, 0x5f, 0x32, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, // t4 _225;. for - 0x20, 0x28, 0x3b, 0x20, 0x5f, 0x32, 0x32, 0x31, 0x20, 0x3c, 0x20, 0x35, 0x3b, 0x20, 0x5f, 0x32, // (; _221 < 5; _2 - 0x32, 0x32, 0x20, 0x3d, 0x20, 0x5f, 0x32, 0x32, 0x35, 0x2c, 0x20, 0x5f, 0x32, 0x32, 0x31, 0x2b, // 22 = _225, _221+ - 0x2b, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // +). {. - 0x20, 0x5f, 0x32, 0x32, 0x35, 0x20, 0x3d, 0x20, 0x5f, 0x32, 0x32, 0x32, 0x3b, 0x0a, 0x20, 0x20, // _225 = _222;. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, 0x5f, // for (int _ - 0x32, 0x32, 0x33, 0x20, 0x3d, 0x20, 0x2d, 0x34, 0x3b, 0x20, 0x5f, 0x32, 0x32, 0x33, 0x20, 0x3c, // 223 = -4; _223 < - 0x20, 0x35, 0x3b, 0x20, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, // 5; ). {. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x32, 0x35, // _225 - 0x20, 0x2b, 0x3d, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // += s_tex.sample - 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, // (s_texSampler, ( - 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, // in.v_texcoord0 + - 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x5f, // (float2(float(_ - 0x32, 0x32, 0x33, 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x5f, 0x32, 0x32, 0x31, // 223), float(_221 - 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x33, 0x39, 0x30, 0x36, 0x32, 0x35, 0x29, // )) * 0.00390625) - 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ));. - 0x5f, 0x32, 0x32, 0x33, 0x2b, 0x2b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _223++;. - 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, // continue;. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, // }. }. - 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // out.bgfx_FragD - 0x61, 0x74, 0x61, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x32, 0x32, 0x32, 0x20, 0x2a, 0x20, 0x30, 0x2e, // ata0 = _222 * 0. - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x39, 0x31, 0x30, 0x34, 0x33, 0x32, 0x38, 0x31, // 0123456791043281 - 0x35, 0x35, 0x35, 0x31, 0x37, 0x35, 0x37, 0x38, 0x31, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 55517578125;. - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // return out;.}.. - 0x00, 0x00, 0x20, 0x00, // .. . -}; diff --git a/Polyfills/Canvas/Source/Shaders/spirv/fs_fspass.h b/Polyfills/Canvas/Source/Shaders/spirv/fs_fspass.h deleted file mode 100644 index 94e255adf..000000000 --- a/Polyfills/Canvas/Source/Shaders/spirv/fs_fspass.h +++ /dev/null @@ -1,89 +0,0 @@ -static const uint8_t fs_fspass_spv[1374] = -{ - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x73, // FSH............s - 0x5f, 0x74, 0x65, 0x78, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x22, 0x00, 0x38, 0x05, // _tex0.......".8. - 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00, 0xe5, 0x00, // ....#........... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, // ................ - 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, // ......GLSL.std.4 - 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // 50.............. - 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x10, 0x00, // in....v......... - 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x23, 0x00, 0x00, 0x00, 0x73, 0x5f, // in........#...s_ - 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // texSampler...... - 0x06, 0x00, 0x26, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, // ..&...s_texTextu - 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x76, 0x00, 0x00, 0x00, 0x76, 0x5f, // re........v...v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x83, 0x00, // texcoord0....... - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, // ..bgfx_FragData0 - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x12, 0x00, // ..G...#...!..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...#..."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, // ..G...&...!..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...&..."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, // ..G...v......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x83, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G............. - 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, // ..........!..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, // ................ - 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, // ...... ......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, // .."...........;. - 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .."...#....... . - 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..%...........;. - 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, // ..%...&......... - 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..)... .......+. - 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, // ..)...*......... - 0x03, 0x00, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..2.......+..... - 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x0d, 0x00, // ..=.......,..... - 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..A...=...=...=. - 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x44, 0x00, // ..=...+...)...D. - 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x4b, 0x00, // ......+...)...K. - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x00, 0x02, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..........L...+. - 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3b, 0x2b, 0x00, // .............;+. - 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x88, 0x45, 0x4a, 0x3c, 0x20, 0x00, // ......i....EJ< . - 0x04, 0x00, 0x72, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..r...........;. - 0x04, 0x00, 0x72, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ..r...v....... . - 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..............6. - 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, // ..........=..... - 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, // ..$...#...=..... - 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, // ..'...&...=..... - 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xae, 0x00, // ..w...v......... - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xae, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xe4, 0x00, // ......A......... - 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x29, 0x00, 0x00, 0x00, 0xe0, 0x00, // ..........)..... - 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0xc8, 0x00, // ..D............. - 0x00, 0x00, 0xb1, 0x00, 0x05, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xe0, 0x00, // ......L......... - 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xc8, 0x00, // ..K............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xb2, 0x00, // ................ - 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xb2, 0x00, 0x00, 0x00, 0xf9, 0x00, // ................ - 0x02, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xf5, 0x00, // ................ - 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xb2, 0x00, // ................ - 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x29, 0x00, // ..............). - 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0xb2, 0x00, 0x00, 0x00, 0xc6, 0x00, // ......D......... - 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x05, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xb6, 0x00, // ..........L..... - 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0xc7, 0x00, // ......K......... - 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xb6, 0x00, // ................ - 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xb7, 0x00, // ................ - 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xe2, 0x00, // ..o............. - 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xe0, 0x00, // ..o............. - 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0xba, 0x00, // ..P............. - 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xbe, 0x00, // ................ - 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, // ................ - 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x56, 0x00, // ......w.......V. - 0x05, 0x00, 0x32, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, // ..2.......'...$. - 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0xd9, 0x00, // ..W............. - 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc3, 0x00, // ................ - 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x80, 0x00, 0x05, 0x00, 0x29, 0x00, // ..............). - 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0xf9, 0x00, // ..........*..... - 0x02, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc7, 0x00, 0x00, 0x00, 0xf9, 0x00, // ................ - 0x02, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x80, 0x00, // ................ - 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x2a, 0x00, // ..)...........*. - 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xae, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xcb, 0x00, // ................ - 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xcd, 0x00, 0x00, 0x00, 0xe1, 0x00, // ................ - 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x83, 0x00, 0x00, 0x00, 0xcd, 0x00, // ..i...>......... - 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ......8....... -}; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 5a707631b..845ed8589 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -852,7 +852,7 @@ namespace } }; std::function filterPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *inBuffer, Babylon::Graphics::FrameBuffer *outBuffer) { - nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); + gl->encoder->setUniform(gl->u_viewSize, gl->view); // TODO: also set other common uniforms gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); @@ -882,6 +882,7 @@ namespace bgfx::ProgramHandle firstProg = gl->prog; std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { gl->encoder->setUniform(u, value); + gl->encoder->setUniform(gl->u_viewSize, gl->view); }; std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); @@ -891,7 +892,7 @@ namespace outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); }; std::function filterPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *inBuffer, Babylon::Graphics::FrameBuffer *outBuffer) { - nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); + gl->encoder->setUniform(gl->u_viewSize, gl->view); // TODO: also set other common uniforms gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp index f00cd4e60..70643fcec 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_filterstack.cpp @@ -11,15 +11,10 @@ std::regex noneRegex(R"(^\s*none\s*$)"); #define BLUR_ITERATIONS 3 #include "Shaders/dx11/vs_fspass.h" -#include "Shaders/dx11/fs_fspass.h" #include "Shaders/metal/vs_fspass.h" -#include "Shaders/metal/fs_fspass.h" #include "Shaders/glsl/vs_fspass.h" -#include "Shaders/glsl/fs_fspass.h" #include "Shaders/essl/vs_fspass.h" -#include "Shaders/essl/fs_fspass.h" #include "Shaders/spirv/vs_fspass.h" -#include "Shaders/spirv/fs_fspass.h" #include "Shaders/dx11/fs_gaussblur.h" #include "Shaders/metal/fs_gaussblur.h" @@ -30,7 +25,6 @@ std::regex noneRegex(R"(^\s*none\s*$)"); static const bgfx::EmbeddedShader s_embeddedShadersFilterStack[] = { BGFX_EMBEDDED_SHADER(vs_fspass), - BGFX_EMBEDDED_SHADER(fs_fspass), BGFX_EMBEDDED_SHADER(fs_gaussblur), BGFX_EMBEDDED_SHADER_END() }; @@ -46,11 +40,6 @@ void nanovg_filterstack::InitBgfx() // create shaders used by the different elements bgfx::RendererType::Enum type = bgfx::getRendererType(); - fspassProg = bgfx::createProgram( - bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") - , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_fspass") - , true - ); blurProg = bgfx::createProgram( bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "vs_fspass") , bgfx::createEmbeddedShader(s_embeddedShadersFilterStack, type, "fs_gaussblur") @@ -65,8 +54,6 @@ void nanovg_filterstack::DisposeBgfx() bgfx::destroy(m_uniforms.u_strength); if (m_uniforms.u_direction.idx != bgfx::kInvalidHandle) bgfx::destroy(m_uniforms.u_direction); - if (fspassProg.idx != bgfx::kInvalidHandle) - bgfx::destroy(fspassProg); if (blurProg.idx != bgfx::kInvalidHandle) bgfx::destroy(blurProg); } From c39d7932c8a5b9874233e8128b6f51ff8dcdd32c Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Wed, 2 Apr 2025 02:12:42 +1100 Subject: [PATCH 19/24] PR Comment: Create framebuffers only when needed --- Polyfills/Canvas/Source/Canvas.cpp | 3 +- Polyfills/Canvas/Source/FrameBufferPool.cpp | 37 +++++++++++++++------ Polyfills/Canvas/Source/FrameBufferPool.h | 7 +++- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index c6a23caba..ce61a66e4 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -140,8 +140,7 @@ namespace Babylon::Polyfills::Internal } { m_frameBufferPool.Clear(); - // PR cedric: Init pool only if filter is needed. - m_frameBufferPool.Init(POOL_SIZE, m_graphicsContext); + m_frameBufferPool.SetGraphicsContext(&m_graphicsContext); } return true; } diff --git a/Polyfills/Canvas/Source/FrameBufferPool.cpp b/Polyfills/Canvas/Source/FrameBufferPool.cpp index 149197d24..94bbd841c 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.cpp +++ b/Polyfills/Canvas/Source/FrameBufferPool.cpp @@ -12,9 +12,20 @@ namespace Babylon::Polyfills return mPoolBuffers; } - void FrameBufferPool::Init(int size, Graphics::DeviceContext& graphicsContext) + // sets graphics context to be used for creating framebuffers + void FrameBufferPool::SetGraphicsContext(Graphics::DeviceContext* graphicsContext) { - for (int i = 0; i < size; ++i) + m_graphicsContext = graphicsContext; + } + + void FrameBufferPool::Add(int nBuffers) + { + if (m_graphicsContext == nullptr) + { + throw std::runtime_error("Cannot add framebuffer to pool. Graphics context is not set."); + } + + for (int i = 0; i < nBuffers; ++i) { bgfx::FrameBufferHandle TextBuffer{bgfx::kInvalidHandle}; Graphics::FrameBuffer* FrameBuffer; @@ -30,7 +41,8 @@ namespace Babylon::Polyfills } TextBuffer = bgfx::createFrameBuffer(static_cast(attachments.size()), attachments.data(), true); - FrameBuffer = new Graphics::FrameBuffer(graphicsContext, TextBuffer, width, height, false, false, false); + FrameBuffer = new Graphics::FrameBuffer(*m_graphicsContext, TextBuffer, width, height, false, false, false); + m_available++; mPoolBuffers.push_back({FrameBuffer, true}); } } @@ -41,28 +53,33 @@ namespace Babylon::Polyfills { if (buffer.frameBuffer) { - // TODO: cleanup framebuffers - //buffer.frameBuffer->Dispose(); - //free(buffer.frameBuffer); - delete buffer.frameBuffer; - buffer.frameBuffer = nullptr; + if (buffer.frameBuffer->Handle().idx != bgfx::kInvalidHandle) + { + bgfx::destroy(buffer.frameBuffer->Handle()); + } } } + m_available = 0; mPoolBuffers.clear(); } Graphics::FrameBuffer* FrameBufferPool::Acquire() { + // no buffers in pool, add one + if (m_available == 0) + { + Add(1); + } + for (auto& buffer : mPoolBuffers) { if (buffer.isAvailable) { buffer.isAvailable = false; + m_available--; return buffer.frameBuffer; } } - // TODO: If no buffers available, pool wasn't large enough. Should it automatically resize? - throw std::runtime_error{"No available frame buffer in pool"}; } void FrameBufferPool::Release(Graphics::FrameBuffer* frameBuffer) diff --git a/Polyfills/Canvas/Source/FrameBufferPool.h b/Polyfills/Canvas/Source/FrameBufferPool.h index 57d24ddfa..7b58635fc 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.h +++ b/Polyfills/Canvas/Source/FrameBufferPool.h @@ -13,13 +13,18 @@ namespace Babylon::Polyfills Graphics::FrameBuffer* frameBuffer; bool isAvailable; }; + // acquire a frame buffer from the pool, graphics context must be set Graphics::FrameBuffer* Acquire(); + void Add(int nBuffers); void Clear(); - void Init(int nBuffers, Graphics::DeviceContext& graphicsContext); void Release(Graphics::FrameBuffer* frameBuffer); + // sets graphics context to be used for creating framebuffers + void SetGraphicsContext(Graphics::DeviceContext *graphicsContext); const std::vector& GetPoolBuffers(); private: std::vector mPoolBuffers{}; + Graphics::DeviceContext *m_graphicsContext; + int m_available{0}; }; } From 783566a7be7a02fd6ab3c8beefda4d160fbf5785 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Wed, 2 Apr 2025 22:52:54 +1100 Subject: [PATCH 20/24] bit of cleanup around framebuffer mgmt, add todos in shader --- Polyfills/Canvas/Source/Context.cpp | 5 +- Polyfills/Canvas/Source/FrameBufferPool.cpp | 8 +- Polyfills/Canvas/Source/FrameBufferPool.h | 2 +- .../Canvas/Source/Shaders/dx11/fs_gaussblur.h | 154 ++++++--------- .../Canvas/Source/Shaders/essl/fs_gaussblur.h | 148 +++++++-------- .../Canvas/Source/Shaders/fs_gaussblur.sc | 19 +- .../Canvas/Source/Shaders/glsl/fs_gaussblur.h | 145 +++++++-------- .../Source/Shaders/metal/fs_gaussblur.h | 80 ++++---- .../Source/Shaders/spirv/fs_gaussblur.h | 175 +++++++++--------- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 1 - 10 files changed, 327 insertions(+), 410 deletions(-) diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index 4d5d5863f..b8579f7a3 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -625,7 +625,6 @@ namespace Babylon::Polyfills::Internal { // sanity check no buffers should have been acquired yet assert(buffer.isAvailable == true); - // buffer.frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.f, 0); // TODO: confirm that this not necessary because of ScreenSpaceQuad } std::function acquire = [this, encoder]() -> Babylon::Graphics::FrameBuffer* { Babylon::Graphics::FrameBuffer *frameBuffer = this->m_canvas->m_frameBufferPool.Acquire(); @@ -633,8 +632,10 @@ namespace Babylon::Polyfills::Internal return frameBuffer; }; std::function release = [this, encoder](Babylon::Graphics::FrameBuffer* frameBuffer) -> void { - frameBuffer->Unbind(*encoder); + // no need to clear framebuffer (yet), as all filter passes are (currently) full screen + //frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR, 0, 0, 0); this->m_canvas->m_frameBufferPool.Release(frameBuffer); + frameBuffer->Unbind(*encoder); }; nvgBeginFrame(*m_nvg, float(width), float(height), 1.0f); diff --git a/Polyfills/Canvas/Source/FrameBufferPool.cpp b/Polyfills/Canvas/Source/FrameBufferPool.cpp index 94bbd841c..ada811a16 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.cpp +++ b/Polyfills/Canvas/Source/FrameBufferPool.cpp @@ -53,10 +53,7 @@ namespace Babylon::Polyfills { if (buffer.frameBuffer) { - if (buffer.frameBuffer->Handle().idx != bgfx::kInvalidHandle) - { - bgfx::destroy(buffer.frameBuffer->Handle()); - } + buffer.frameBuffer->Dispose(); } } m_available = 0; @@ -80,6 +77,8 @@ namespace Babylon::Polyfills return buffer.frameBuffer; } } + + throw std::runtime_error("No available frame buffer in pool."); } void FrameBufferPool::Release(Graphics::FrameBuffer* frameBuffer) @@ -88,7 +87,6 @@ namespace Babylon::Polyfills { if (buffer.frameBuffer == frameBuffer) { - // no need to clear framebuffer, as all filter passes are (currently) full screen buffer.isAvailable = true; return; } diff --git a/Polyfills/Canvas/Source/FrameBufferPool.h b/Polyfills/Canvas/Source/FrameBufferPool.h index 7b58635fc..a756c4108 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.h +++ b/Polyfills/Canvas/Source/FrameBufferPool.h @@ -24,7 +24,7 @@ namespace Babylon::Polyfills private: std::vector mPoolBuffers{}; - Graphics::DeviceContext *m_graphicsContext; + Graphics::DeviceContext* m_graphicsContext; int m_available{0}; }; } diff --git a/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h index 14adcfe78..7d57e65ef 100644 --- a/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h @@ -1,12 +1,12 @@ -static const uint8_t fs_gaussblur_dx11[2064] = +static const uint8_t fs_gaussblur_dx11[1548] = { 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0b, 0x75, // FSH............u 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, // _direction...... 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex0..... 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex0..... - 0x00, 0x00, 0x00, 0x00, 0xc4, 0x07, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x25, 0x6c, 0x7c, 0x5d, // ........DXBC%l|] - 0x53, 0xcd, 0x4c, 0x18, 0xcb, 0x59, 0xfe, 0x34, 0xba, 0x57, 0xc5, 0xa3, 0x01, 0x00, 0x00, 0x00, // S.L..Y.4.W...... - 0xc4, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, // ........,....... + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x05, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x8e, 0x49, 0xc4, 0xb1, // ........DXBC.I.. + 0xe7, 0xed, 0xae, 0x7d, 0x9b, 0x80, 0xd2, 0x20, 0x75, 0xe7, 0x0a, 0xe1, 0x01, 0x00, 0x00, 0x00, // ...}... u....... + 0xc0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, // ........,....... 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....ISGNh....... 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....P........... 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, // ................ @@ -17,116 +17,84 @@ static const uint8_t fs_gaussblur_dx11[2064] = 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....OSGN,....... 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .... ........... 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, // ............SV_T - 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0xec, 0x06, 0x00, 0x00, // ARGET...SHEX.... - 0x50, 0x00, 0x00, 0x00, 0xbb, 0x01, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x04, // P.......j...Y... + 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0xe8, 0x04, 0x00, 0x00, // ARGET...SHEX.... + 0x50, 0x00, 0x00, 0x00, 0x3a, 0x01, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x04, // P...:...j...Y... 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, // F. .........Z... 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X....p.. 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xc2, 0x10, 0x10, 0x00, // ....UU..b....... 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ...... - 0x68, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, // h...........2... - 0x00, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, // ............F. . - 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, // A...........E... - 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....CU.......... - 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F~...... - 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, // .`......8....... - 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@.. - 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, // .CG>.CG>.CG>.CG> - 0x00, 0x00, 0x00, 0x08, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, // ....2........... + 0x68, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // h.......E....... + 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, // CU.............. + 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0f, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....2........... + 0xe6, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, // .........@.....? + 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x02, 0x40, 0x00, 0x00, // ...?...?...?.@.. + 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, // ...?...?...?...? + 0x00, 0x00, 0x00, 0x08, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, // ....2........... 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. ......... 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, // E.......CU...... - 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ....F.......F~.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, // .....`......2... - 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........F....... - 0x02, 0x40, 0x00, 0x00, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, // .@...CG>.CG>.CG> - 0xcf, 0x43, 0x47, 0x3e, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, // .CG>F.......E... - 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....CU.......... - 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F~...... - 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, // .`......2....... - 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@.. - 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, // .yh>.yh>.yh>.yh> - 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0e, 0x32, 0x00, 0x10, 0x00, // F.......2...2... - 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. .A....... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, // .....@.....@...@ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, // E.......CU...... - 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ....F.......F~.. + 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ....F.......F~.. 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, // .....`......8... - 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........F....... - 0x02, 0x40, 0x00, 0x00, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, // .@.....=...=...= - 0xbf, 0x14, 0xf9, 0x3d, 0x32, 0x00, 0x00, 0x0d, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ...=2...2....... + 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ........F....... + 0x02, 0x40, 0x00, 0x00, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, // .@...CG>.CG>.CG> + 0xcf, 0x43, 0x47, 0x3e, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // .CG>2........... + 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xc4, 0x79, 0x68, 0x3e, // F........@...yh> + 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, 0x46, 0x0e, 0x10, 0x00, // .yh>.yh>.yh>F... + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ........2....... + 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, // ........F. .A... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // ........E....... + 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, // CU..........F... + 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... + 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xcf, 0x43, 0x47, 0x3e, // F........@...CG> + 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0x46, 0x0e, 0x10, 0x00, // .CG>.CG>.CG>F... + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0d, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....2...2....... 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // F. ..........@.. 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@...@........ - 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // ........E....... + 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // ........E....... 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, // CU..........F... 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....2........... + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xbf, 0x14, 0xf9, 0x3d, // F........@.....= 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0x46, 0x0e, 0x10, 0x00, // ...=...=...=F... - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // F.......F....... - 0x32, 0x00, 0x00, 0x0e, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x84, 0x20, 0x80, // 2...........F. . - 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // A............@.. - 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, // ..@@..@@...@...@ - 0xe6, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // ........E....... - 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, // CU..........F... - 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. - 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, // ....E.......CU.. - 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F~.......`...... - 0x38, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // 8...........F... - 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x6b, 0xd7, 0x84, 0x3c, 0x6b, 0xd7, 0x84, 0x3c, // .....@..k......... + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... + 0x46, 0x0e, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xba, 0x67, 0x5d, 0x3d, // F........@...g]= + 0xba, 0x67, 0x5d, 0x3d, 0xba, 0x67, 0x5d, 0x3d, 0xba, 0x67, 0x5d, 0x3d, 0x46, 0x0e, 0x10, 0x00, // .g]=.g]=.g]=F... + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... + 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x6b, 0xd7, 0x84, 0x3c, // F........@..k..< + 0x6b, 0xd7, 0x84, 0x3c, 0x6b, 0xd7, 0x84, 0x3c, 0x6b, 0xd7, 0x84, 0x3c, 0x46, 0x0e, 0x10, 0x00, // k......... }; diff --git a/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h index 108fbd2d8..d24e0c094 100644 --- a/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h @@ -1,98 +1,78 @@ -static const uint8_t fs_gaussblur_essl[1517] = +static const uint8_t fs_gaussblur_essl[1191] = { 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex...... - 0x00, 0x00, 0x00, 0x00, 0xb4, 0x05, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, // ........varying + 0x00, 0x00, 0x00, 0x00, 0x6e, 0x04, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, // ....n...varying 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, // highp vec2 v_tex 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // coord0;.uniform 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, // highp vec4 u_dir 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // ection;.uniform 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, // sampler2D s_tex; 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, // .void main ().{. - 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // lowp vec4 colo - 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, // r_1;. color_1 = - 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, // ((texture2D (s_ - 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tex, v_texcoord0 - 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, 0x32, 0x37, 0x30, 0x32, 0x37, 0x29, 0x20, 0x2b, 0x20, // ) * 0.227027) + - 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, // ((texture2D (s_t - 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ex, . (v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, // oord0 + u_direct - 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, // ion.xy). ) * 0. - 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, // 1945946) + (text - 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, // ure2D (s_tex, . - 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // (v_texcoord0 - 0x2d, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, // - u_direction.xy - 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, // ). ) * 0.194594 - 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, // 6)));. highp ve - 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, // c2 tmpvar_2;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, // mpvar_2 = (u_dir - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, // ection.xy * 2.0) - 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, // ;. color_1 = (c - 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // olor_1 + ((textu - 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, // re2D (s_tex, . - 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, // (v_texcoord0 + - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, // tmpvar_2). ) * - 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, // 0.1216216) + (t + 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x65, 0x78, // highp vec2 tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, // coord0_1;. lowp + 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // vec4 color_2;. + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, // color_2 = (text + 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, // ure2D (s_tex, v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, // texcoord0) * 0.2 + 0x32, 0x37, 0x30, 0x32, 0x37, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // 27027);. texcoo + 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // rd0_1 = ((v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2b, 0x20, 0x30, // oord0 * 0.5) + 0 + 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // .5);. color_2 = + 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // (color_2 + (tex + 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // ture2D (s_tex, ( + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x75, 0x5f, // texcoord0_1 + u_ + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x20, 0x2a, // direction.xy)) * + 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.1945946));. + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_2 = (color + 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, // _2 + (texture2D + 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // (s_tex, (texcoor + 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, // d0_1 - u_directi + 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, // on.xy)) * 0.1945 + 0x39, 0x34, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, // 946));. highp v + 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_3;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, // tmpvar_3 = (u_di + 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, // rection.xy * 2.0 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // );. color_2 = ( + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // color_2 + (textu + 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, // re2D (s_tex, (te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, // xcoord0_1 + tmpv + 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, // ar_3)) * 0.12162 + 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, // 16));. color_2 + 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, // = (color_2 + (te + 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // xture2D (s_tex, + 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, 0x74, // (texcoord0_1 - t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x32, // mpvar_3)) * 0.12 + 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 16216));. highp + 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, // vec2 tmpvar_4;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, // tmpvar_4 = (u_ + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x33, // direction.xy * 3 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // .0);. color_2 = + 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // (color_2 + (tex + 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // ture2D (s_tex, ( + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x74, 0x6d, // texcoord0_1 + tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, // pvar_4)) * 0.054 + 0x30, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // 054));. color_2 + 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, // = (color_2 + (t 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // exture2D (s_tex, - 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // . (v_texcoor - 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, // d0 - tmpvar_2). - 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, // ) * 0.1216216)) - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // );. highp vec2 - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_3;. tmpv - 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, // ar_3 = (u_direct - 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, // ion.xy * 3.0);. - 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, // color_1 = (colo - 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, // r_1 + ((texture2 - 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, // D (s_tex, . ( - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, // v_texcoord0 + tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, // pvar_3). ) * 0. - 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // 054054) + (textu - 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, // re2D (s_tex, . - 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, // (v_texcoord0 - - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, // tmpvar_3). ) * - 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.054054)));. - 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // highp vec2 tmpva - 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, // r_4;. tmpvar_4 - 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, // = (u_direction.x - 0x79, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // y * 4.0);. colo - 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, // r_1 = (color_1 + - 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, // ((texture2D (s_ - 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, // tex, . (v_tex - 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // coord0 + tmpvar_ - 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, // 4). ) * 0.01621 - 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, // 6) + (texture2D - 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, // (s_tex, . (v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, // texcoord0 - tmpv - 0x61, 0x72, 0x5f, 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, // ar_4). ) * 0.01 - 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 6216)));. highp + 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, // (texcoord0_1 - + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, // tmpvar_4)) * 0.0 + 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 54054));. highp 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, // vec2 tmpvar_5;. 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, // tmpvar_5 = (u_ - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x35, // direction.xy * 5 - 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, // .0);. color_1 = - 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, // (color_1 + ((te - 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // xture2D (s_tex, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // . (v_texcoord - 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x0a, 0x20, 0x20, // 0 + tmpvar_5). - 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x29, 0x20, 0x2b, 0x20, // ) * 0.004629) + - 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // (texture2D (s_te - 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // x, . (v_texco - 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, // ord0 - tmpvar_5) - 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x29, // . ) * 0.004629) - 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, // ));. highp vec2 - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_6;. tmp - 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, // var_6 = (u_direc - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x36, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // tion.xy * 6.0);. - 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, // color_1 = (col - 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // or_1 + ((texture - 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // 2D (s_tex, . - 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, // (v_texcoord0 + t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, // mpvar_6). ) * 0 - 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x33, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, // .000823) + (text - 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, // ure2D (s_tex, . - 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // (v_texcoord0 - 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, // - tmpvar_6). ) - 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x33, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, // * 0.000823)));. - 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // gl_FragColor = - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // color_1;.}... + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x34, // direction.xy * 4 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // .0);. color_2 = + 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // (color_2 + (tex + 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // ture2D (s_tex, ( + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x74, 0x6d, // texcoord0_1 + tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, // pvar_5)) * 0.016 + 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // 216));. color_2 + 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, // = (color_2 + (t + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // exture2D (s_tex, + 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, // (texcoord0_1 - + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, // tmpvar_5)) * 0.0 + 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // 16216));. gl_Fr + 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // agColor = color_ + 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 2;.}... }; diff --git a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc index d3353504a..9d76b5a20 100644 --- a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc +++ b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc @@ -17,28 +17,25 @@ void main() vec4 u_halfTexel = vec4_splat(0.0); #endif // !NEED_HALF_TEXEL - // 13-tap weights - float weights[7]; + // 9-tap weights + float weights[5]; weights[0] = 0.227027; // center weights[1] = 0.1945946; weights[2] = 0.1216216; weights[3] = 0.054054; weights[4] = 0.016216; - weights[5] = 0.004629; - weights[6] = 0.000823; vec4 color = texture2D(s_tex, v_texcoord0) * weights[0]; // center pixel weighted - float alpha = color.a; - vec2 texcoord0 = v_texcoord0 + u_halfTexel.xy; // handle half texel offset - // vec2 normTex = vec2_splat(1.0) / u_viewSize.xy; // normalized texel size? + // convert NDC (-1 to 1) to 0 UV (0 to 1) + vec2 texcoord0 = v_texcoord0 * 0.5 + 0.5; + // TODO: + u_halfTexel.xy; // handle half texel offset - for (int i = 1; i <= 6; i++) + for (int i = 1; i <= 4; i++) { vec2 offset = u_direction.xy * float(i); // TODO: normalize against u_viewSize.xy - vec4 sample1 = texture2D(s_tex, texcoord0 + offset) * weights[i]; - vec4 sample2 = texture2D(s_tex, texcoord0 - offset) * weights[i]; - color += sample1 + sample2; + color += texture2D(s_tex, texcoord0 + offset) * weights[i]; + color += texture2D(s_tex, texcoord0 - offset) * weights[i]; } gl_FragColor = color; diff --git a/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h index 9c38f5263..a5d35eaf5 100644 --- a/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h @@ -1,93 +1,74 @@ -static const uint8_t fs_gaussblur_glsl[1439] = +static const uint8_t fs_gaussblur_glsl[1127] = { 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex...... - 0x00, 0x00, 0x00, 0x00, 0x66, 0x05, 0x00, 0x00, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // ....f...in vec2 + 0x00, 0x00, 0x00, 0x00, 0x2e, 0x04, 0x00, 0x00, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // ........in vec2 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // v_texcoord0;.uni 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, // form vec4 u_dire 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, // ction;.uniform s 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, // ampler2D s_tex;. 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // void main ().{. - 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // vec4 color_1;. - 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, // color_1 = ((tex - 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, 0x74, // ture (s_tex, v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, 0x32, // excoord0) * 0.22 - 0x37, 0x30, 0x32, 0x37, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // 7027) + ((textur - 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, // e (s_tex, . ( - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x75, 0x5f, // v_texcoord0 + u_ - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x0a, 0x20, 0x20, // direction.xy). - 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x20, 0x2b, // ) * 0.1945946) + - 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // (texture (s_tex - 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // , . (v_texcoo - 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, // rd0 - u_directio - 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, // n.xy). ) * 0.19 - 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, // 45946)));. vec2 - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_2;. tmp - 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, // var_2 = (u_direc - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // tion.xy * 2.0);. - 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, // color_1 = (col - 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // or_1 + ((texture - 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, // (s_tex, . (v - 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, // _texcoord0 + tmp - 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, // var_2). ) * 0.1 - 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // 216216) + (textu - 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // re (s_tex, . - 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, // (v_texcoord0 - t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, 0x30, // mpvar_2). ) * 0 - 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, // .1216216)));. v - 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_3;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, // tmpvar_3 = (u_di - 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, // rection.xy * 3.0 - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, // );. color_1 = ( - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, 0x74, // color_1 + ((text - 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, 0x20, // ure (s_tex, . - 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, // (v_texcoord0 + - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, 0x20, // tmpvar_3). ) * - 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // 0.054054) + (tex - 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, // ture (s_tex, . - 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, // (v_texcoord0 - - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, // tmpvar_3). ) * - 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.054054)));. - 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // vec2 tmpvar_4;. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, // tmpvar_4 = (u_d - 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x34, 0x2e, // irection.xy * 4. - 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // 0);. color_1 = - 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, 0x78, // (color_1 + ((tex - 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, 0x20, // ture (s_tex, . - 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, // (v_texcoord0 + - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2a, // tmpvar_4). ) * - 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, // 0.016216) + (te - 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, // xture (s_tex, . - 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // (v_texcoord0 - 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, // - tmpvar_4). ) - 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, // * 0.016216)));. - 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, // vec2 tmpvar_5;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, // tmpvar_5 = (u_ - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x35, // direction.xy * 5 - 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, // .0);. color_1 = - 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, 0x65, // (color_1 + ((te - 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, 0x20, // xture (s_tex, . - 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // (v_texcoord0 - 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, // + tmpvar_5). ) - 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x74, // * 0.004629) + (t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, // exture (s_tex, . - 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // (v_texcoord0 - 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x0a, 0x20, 0x20, 0x29, // - tmpvar_5). ) - 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x29, 0x29, 0x29, 0x3b, 0x0a, // * 0.004629)));. - 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x3b, // vec2 tmpvar_6; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x75, // . tmpvar_6 = (u - 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, // _direction.xy * - 0x36, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, // 6.0);. color_1 - 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x28, 0x28, 0x74, // = (color_1 + ((t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x0a, // exture (s_tex, . - 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // (v_texcoord0 - 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x0a, 0x20, 0x20, 0x29, // + tmpvar_6). ) - 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x33, 0x29, 0x20, 0x2b, 0x20, 0x28, // * 0.000823) + ( + 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, // vec2 texcoord0_ + 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // 1;. vec4 color_ + 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // 2;. color_2 = ( 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // texture (s_tex, - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // . (v_texcoord - 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x0a, 0x20, 0x20, // 0 - tmpvar_6). - 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x33, 0x29, 0x29, 0x29, 0x3b, // ) * 0.000823))); - 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // . gl_FragColor - 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = color_1;.}... + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x30, // v_texcoord0) * 0 + 0x2e, 0x32, 0x32, 0x37, 0x30, 0x32, 0x37, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x78, 0x63, // .227027);. texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x76, 0x5f, 0x74, 0x65, // oord0_1 = ((v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2b, // xcoord0 * 0.5) + + 0x20, 0x30, 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // 0.5);. color_2 + 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, // = (color_2 + (t + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // exture (s_tex, ( + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x75, 0x5f, // texcoord0_1 + u_ + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x20, 0x2a, // direction.xy)) * + 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.1945946));. + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_2 = (color + 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, // _2 + (texture (s + 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // _tex, (texcoord0 + 0x5f, 0x31, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // _1 - u_direction + 0x2e, 0x78, 0x79, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, // .xy)) * 0.194594 + 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, // 6));. vec2 tmpv + 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, // ar_3;. tmpvar_3 + 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, // = (u_direction. + 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, // xy * 2.0);. col + 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, // or_2 = (color_2 + 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // + (texture (s_te + 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, // x, (texcoord0_1 + 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, // + tmpvar_3)) * 0 + 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, // .1216216));. co + 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // lor_2 = (color_2 + 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, // + (texture (s_t + 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, // ex, (texcoord0_1 + 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, // - tmpvar_3)) * + 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, // 0.1216216));. v + 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_4;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, // tmpvar_4 = (u_di + 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, // rection.xy * 3.0 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // );. color_2 = ( + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // color_2 + (textu + 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, // re (s_tex, (texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // oord0_1 + tmpvar + 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, // _4)) * 0.054054) + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // );. color_2 = ( + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // color_2 + (textu + 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, // re (s_tex, (texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // oord0_1 - tmpvar + 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, // _4)) * 0.054054) + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // );. vec2 tmpvar + 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, // _5;. tmpvar_5 = + 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, // (u_direction.xy + 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // * 4.0);. color + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, // _2 = (color_2 + + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // (texture (s_tex, + 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, // (texcoord0_1 + + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, // tmpvar_5)) * 0.0 + 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // 16216));. color + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, // _2 = (color_2 + + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // (texture (s_tex, + 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, // (texcoord0_1 - + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, // tmpvar_5)) * 0.0 + 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // 16216));. gl_Fr + 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // agColor = color_ + 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 2;.}... }; diff --git a/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h index aea532f7f..6853915b5 100644 --- a/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h @@ -1,4 +1,4 @@ -static const uint8_t fs_gaussblur_mtl[2309] = +static const uint8_t fs_gaussblur_mtl[2254] = { 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x73, // FSH............s 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x11, 0x01, 0xff, 0xff, 0x01, // _texSampler..... @@ -6,7 +6,7 @@ static const uint8_t fs_gaussblur_mtl[2309] = 0x72, 0x65, 0x11, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x75, 0x5f, 0x64, // re...........u_d 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // irection........ 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...s_tex........ - 0x00, 0x00, 0x9b, 0x08, 0x00, 0x00, 0x23, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x63, 0x6c, // ......#pragma cl + 0x00, 0x00, 0x64, 0x08, 0x00, 0x00, 0x23, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x63, 0x6c, // ..d...#pragma cl 0x61, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x20, 0x69, // ang diagnostic i 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x22, 0x2d, 0x57, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, // gnored "-Wmissin 0x67, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x0a, 0x23, 0x70, // g-prototypes".#p @@ -96,53 +96,49 @@ static const uint8_t fs_gaussblur_mtl[2309] = 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // ).{. xlatMtlM 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, // ain_out out = {} 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x70, 0x76, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x41, // ;. spvUnsafeA - 0x72, 0x72, 0x61, 0x79, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x2c, 0x20, 0x37, 0x3e, 0x20, 0x5f, // rray _ - 0x32, 0x30, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x30, 0x5d, // 209;. _209[0] + 0x72, 0x72, 0x61, 0x79, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x2c, 0x20, 0x35, 0x3e, 0x20, 0x5f, // rray _ + 0x31, 0x39, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x30, 0x5d, // 197;. _197[0] 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x32, 0x32, 0x37, 0x30, 0x32, 0x36, 0x39, 0x39, 0x38, 0x39, 0x39, // = 0.22702699899 0x36, 0x37, 0x33, 0x34, 0x36, 0x31, 0x39, 0x31, 0x34, 0x30, 0x36, 0x32, 0x35, 0x3b, 0x0a, 0x20, // 6734619140625;. - 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x31, // _209[1] = 0.1 + 0x20, 0x20, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x31, // _197[1] = 0.1 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x30, 0x36, 0x37, 0x35, 0x37, 0x31, 0x36, 0x34, 0x30, 0x30, // 9459460675716400 0x31, 0x34, 0x36, 0x34, 0x38, 0x34, 0x33, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, // 146484375;. _ - 0x32, 0x30, 0x39, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, // 209[2] = 0.12162 + 0x31, 0x39, 0x37, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, // 197[2] = 0.12162 0x31, 0x36, 0x30, 0x31, 0x32, 0x38, 0x33, 0x35, 0x35, 0x30, 0x32, 0x36, 0x32, 0x34, 0x35, 0x31, // 1601283550262451 - 0x31, 0x37, 0x31, 0x38, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, // 171875;. _209 + 0x31, 0x37, 0x31, 0x38, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x31, 0x39, 0x37, // 171875;. _197 0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x33, 0x39, 0x39, // [3] = 0.05405399 0x39, 0x34, 0x38, 0x33, 0x35, 0x38, 0x35, 0x33, 0x35, 0x37, 0x36, 0x36, 0x36, 0x30, 0x31, 0x35, // 9483585357666015 - 0x36, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x34, 0x5d, // 625;. _209[4] + 0x36, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x34, 0x5d, // 625;. _197[4] 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, 0x36, 0x30, 0x30, 0x30, 0x35, 0x34, // = 0.01621600054 0x32, 0x30, 0x34, 0x34, 0x36, 0x33, 0x39, 0x35, 0x38, 0x37, 0x34, 0x30, 0x32, 0x33, 0x34, 0x33, // 2044639587402343 - 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x35, 0x5d, 0x20, // 75;. _209[5] - 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x34, 0x36, 0x32, 0x39, 0x30, 0x30, 0x30, 0x30, 0x39, 0x30, // = 0.004629000090 - 0x30, 0x36, 0x32, 0x36, 0x31, 0x38, 0x32, 0x35, 0x35, 0x36, 0x31, 0x35, 0x32, 0x33, 0x34, 0x33, // 0626182556152343 - 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x36, 0x5d, 0x20, // 75;. _209[6] - 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x38, 0x32, 0x32, 0x39, 0x39, 0x39, 0x39, 0x38, 0x30, // = 0.000822999980 - 0x33, 0x30, 0x30, 0x36, 0x36, 0x34, 0x39, 0x30, 0x31, 0x37, 0x33, 0x33, 0x33, 0x39, 0x38, 0x34, // 3006649017333984 - 0x33, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // 375;. float4 - 0x5f, 0x33, 0x33, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x33, 0x35, 0x20, 0x3d, // _335;. _335 = - 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, // s_tex.sample(s_ - 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x69, 0x6e, 0x2e, 0x76, // texSampler, in.v - 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x32, // _texcoord0) * _2 - 0x30, 0x39, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, // 09[0];. for ( - 0x69, 0x6e, 0x74, 0x20, 0x5f, 0x33, 0x33, 0x34, 0x20, 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x5f, 0x33, // int _334 = 1; _3 - 0x33, 0x34, 0x20, 0x3c, 0x3d, 0x20, 0x36, 0x3b, 0x20, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, // 34 <= 6; ). { - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, // . float2 - 0x5f, 0x32, 0x35, 0x35, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // _255 = _mtl_u.u_ - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x66, // direction.xy * f - 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x5f, 0x33, 0x33, 0x34, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // loat(_334);. - 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x33, 0x35, 0x20, 0x2b, 0x3d, 0x20, 0x28, 0x28, 0x73, 0x5f, // _335 += ((s_ - 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // tex.sample(s_tex - 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, // Sampler, (in.v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x5f, 0x32, 0x35, 0x35, 0x29, // excoord0 + _255) - 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x5f, 0x33, 0x33, 0x34, 0x5d, 0x29, 0x20, // ) * _209[_334]) - 0x2b, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, // + (s_tex.sample( - 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, 0x69, // s_texSampler, (i - 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, // n.v_texcoord0 - - 0x5f, 0x32, 0x35, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x32, 0x30, 0x39, 0x5b, 0x5f, 0x33, // _255)) * _209[_3 - 0x33, 0x34, 0x5d, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, // 34]));. _ - 0x33, 0x33, 0x34, 0x2b, 0x2b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, // 334++;. c - 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, // ontinue;. }. - 0x20, 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, // out.bgfx_Frag - 0x44, 0x61, 0x74, 0x61, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x33, 0x33, 0x35, 0x3b, 0x0a, 0x20, 0x20, // Data0 = _335;. - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, // return out;.}. - 0x0a, 0x00, 0x00, 0x30, 0x00, // ...0. + 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x5f, // 75;. float2 _ + 0x32, 0x32, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 225 = (in.v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2b, 0x20, 0x66, // oord0 * 0.5) + f + 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // loat2(0.5);. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x33, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, // float4 _314;. + 0x20, 0x5f, 0x33, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, // _314 = s_tex.sa + 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, // mple(s_texSample + 0x72, 0x2c, 0x20, 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // r, in.v_texcoord + 0x30, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // 0) * _197[0];. + 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, 0x5f, 0x33, 0x31, 0x33, 0x20, // for (int _313 + 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x5f, 0x33, 0x31, 0x33, 0x20, 0x3c, 0x3d, 0x20, 0x34, 0x3b, 0x20, // = 1; _313 <= 4; + 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ). {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x5f, 0x32, 0x33, 0x36, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // float2 _236 = _m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // tl_u.u_direction + 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x5f, 0x33, 0x31, 0x33, // .xy * float(_313 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x31, 0x34, 0x20, // );. _314 + 0x3d, 0x20, 0x28, 0x5f, 0x33, 0x31, 0x34, 0x20, 0x2b, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // = (_314 + (s_tex + 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, // .sample(s_texSam + 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, 0x5f, 0x32, 0x32, 0x35, 0x20, 0x2b, 0x20, 0x5f, 0x32, // pler, (_225 + _2 + 0x33, 0x36, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x5f, 0x33, 0x31, 0x33, // 36)) * _197[_313 + 0x5d, 0x29, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, // ])) + (s_tex.sam + 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ple(s_texSampler + 0x2c, 0x20, 0x28, 0x5f, 0x32, 0x32, 0x35, 0x20, 0x2d, 0x20, 0x5f, 0x32, 0x33, 0x36, 0x29, 0x29, // , (_225 - _236)) + 0x20, 0x2a, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x5f, 0x33, 0x31, 0x33, 0x5d, 0x29, 0x3b, 0x0a, // * _197[_313]);. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x31, 0x33, 0x2b, 0x2b, 0x3b, 0x0a, // _313++;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, // continue + 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, // ;. }. out. + 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x20, 0x3d, // bgfx_FragData0 = + 0x20, 0x5f, 0x33, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, // _314;. retur + 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x30, 0x00, // n out;.}....0. }; diff --git a/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h index 75bd8653b..2226d45dd 100644 --- a/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h @@ -1,36 +1,36 @@ -static const uint8_t fs_gaussblur_spv[2112] = +static const uint8_t fs_gaussblur_spv[2060] = { 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, // .....s_tex0..... - 0x00, 0x02, 0x22, 0x00, 0x04, 0x08, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, // ..".......#..... - 0x0b, 0x00, 0x08, 0x00, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, // ....P........... + 0x00, 0x02, 0x22, 0x00, 0xd0, 0x07, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, // ..".......#..... + 0x0b, 0x00, 0x08, 0x00, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, // ....;........... 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, // ............GLSL 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, // .std.450........ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, // ....main........ - 0xb8, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, // ....main........ + 0xac, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, // ....main........ 0x23, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // #...s_texSampler 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x26, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, // ........&...s_te 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, // xTexture........ - 0x78, 0x00, 0x00, 0x00, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, // x...UniformBlock - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........x....... + 0x6f, 0x00, 0x00, 0x00, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, // o...UniformBlock + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........o....... 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, // u_direction..... - 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xab, 0x00, 0x00, 0x00, // z............... + 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x9f, 0x00, 0x00, 0x00, // q............... 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, // v_texcoord0..... - 0xb8, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ....bgfx_FragDat + 0xac, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ....bgfx_FragDat 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // a0..G...#...!... 0x12, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...#..."... 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...&...!... 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...&..."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....G...x....... - 0x48, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...x.......#... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...z...!... - 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...z..."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xab, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....G...o....... + 0x48, 0x00, 0x05, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...o.......#... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...q...!... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...q..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xac, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, // ........ ....... @@ -48,7 +48,7 @@ static const uint8_t fs_gaussblur_spv[2112] = 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +...)........... 0x1b, 0x00, 0x03, 0x00, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ....2........... 0x43, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // C... .......+... - 0x43, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // C...D........... + 0x43, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // C...D........... 0x45, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // E.......D... ... 0x46, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // F.......E...+... 0x07, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0xc4, 0x79, 0x68, 0x3e, 0x2b, 0x00, 0x04, 0x00, // ....H....yh>+... @@ -59,77 +59,74 @@ static const uint8_t fs_gaussblur_spv[2112] = 0x07, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xba, 0x67, 0x5d, 0x3d, 0x2b, 0x00, 0x04, 0x00, // ....P....g]=+... 0x29, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...R.......+... 0x07, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x6b, 0xd7, 0x84, 0x3c, 0x2b, 0x00, 0x04, 0x00, // ....S...k..<+... - 0x29, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...U.......+... - 0x07, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0xde, 0xae, 0x97, 0x3b, 0x2b, 0x00, 0x04, 0x00, // ....V......;+... - 0x29, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...X.......+... - 0x07, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x98, 0xbe, 0x57, 0x3a, 0x14, 0x00, 0x02, 0x00, // ....Y.....W:.... - 0x75, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // u.......x....... - 0x20, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, // ...y.......x... - 0x3b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...y...z....... - 0x20, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ...{........... - 0x20, 0x00, 0x04, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0xa7, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... - 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... - 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x46, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // F...........=... - 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....$...#...=... - 0x08, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....'...&...=... - 0x0b, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ............A... - 0x13, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, // ................ - 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......H...A... - 0x13, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, // ............*... - 0x3e, 0x00, 0x03, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......J...A... - 0x13, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, // ............L... - 0x3e, 0x00, 0x03, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......M...A... - 0x13, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, // ............O... - 0x3e, 0x00, 0x03, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......P...A... - 0x13, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, // ............R... - 0x3e, 0x00, 0x03, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......S...A... - 0x13, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, // ............U... - 0x3e, 0x00, 0x03, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......V...A... - 0x13, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, // ............X... - 0x3e, 0x00, 0x03, 0x00, 0xe8, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, // >.......Y...V... - 0x32, 0x00, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // 2...*...'...$... - 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, // W.......,...*... - 0xac, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, // ....A........... - 0xd1, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ........=....... - 0xed, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0xee, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0xed, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ....,........... - 0xf5, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf5, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x4f, 0x01, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....O........... - 0x16, 0x01, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x29, 0x00, 0x00, 0x00, // ............)... - 0x4e, 0x01, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x19, 0x01, 0x00, 0x00, // N...*........... - 0xf9, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x05, 0x00, 0x75, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, // ........u....... - 0x4e, 0x01, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0x1a, 0x01, 0x00, 0x00, // N...X........... - 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xf8, 0x00, 0x00, 0x00, // ................ - 0xf9, 0x00, 0x00, 0x00, 0x1a, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf9, 0x00, 0x00, 0x00, // ................ - 0x41, 0x00, 0x05, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, // A...{.......z... - 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, // ....=........... - 0xfa, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, // ....O........... - 0xfb, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x6f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x4e, 0x01, 0x00, 0x00, // o...........N... - 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, // ................ - 0xfe, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // ................ - 0xac, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x32, 0x00, 0x00, 0x00, // ........V...2... - 0x33, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, // 3...'...$...W... - 0x0d, 0x00, 0x00, 0x00, 0x35, 0x01, 0x00, 0x00, 0x33, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // ....5...3....... - 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, // A............... - 0x4e, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, // N...=........... - 0x06, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, // ................ - 0x35, 0x01, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // 5............... - 0x0b, 0x01, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, // ............V... - 0x32, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // 2...<...'...$... - 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, // W.......>...<... - 0x0b, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0f, 0x01, 0x00, 0x00, // ....A........... - 0xd1, 0x00, 0x00, 0x00, 0x4e, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ....N...=....... - 0x10, 0x01, 0x00, 0x00, 0x0f, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x11, 0x01, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, // ....>........... - 0x0d, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, // ................ - 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0x4f, 0x01, 0x00, 0x00, // ............O... - 0x14, 0x01, 0x00, 0x00, 0x80, 0x00, 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0x19, 0x01, 0x00, 0x00, // ........)....... - 0x4e, 0x01, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xf5, 0x00, 0x00, 0x00, // N...*........... - 0xf8, 0x00, 0x02, 0x00, 0x1a, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb8, 0x00, 0x00, 0x00, // ........>....... - 0x4f, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // O.......8....... + 0x07, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x14, 0x00, 0x02, 0x00, // ....`......?.... + 0x6c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // l.......o....... + 0x20, 0x00, 0x04, 0x00, 0x70, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, // ...p.......o... + 0x3b, 0x00, 0x04, 0x00, 0x70, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...p...q....... + 0x20, 0x00, 0x04, 0x00, 0x72, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ...r........... + 0x20, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ............... + 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... + 0x20, 0x00, 0x04, 0x00, 0xab, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ............... + 0x3b, 0x00, 0x04, 0x00, 0xab, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... + 0x2c, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, // ,.......8...`... + 0x60, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // `...6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3b, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;...F........... + 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // =.......$...#... + 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, // =.......'...&... + 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, // =............... + 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... + 0x2e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, // ....>.......H... + 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... + 0x2a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, // *...>.......J... + 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... + 0x4c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd5, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, // L...>.......M... + 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... + 0x4f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // O...>.......P... + 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... + 0x52, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd7, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // R...>.......S... + 0x56, 0x00, 0x05, 0x00, 0x32, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, // V...2.......'... + 0x24, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, // $...W........... + 0x16, 0x01, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, // ........A....... + 0xdb, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... + 0x07, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, // ................ + 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, // ................ + 0x60, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, // `............... + 0xdf, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xe2, 0x00, 0x00, 0x00, // ....8........... + 0xf8, 0x00, 0x02, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0x3a, 0x01, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // :............... + 0xe6, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x29, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, // ........)...9... + 0x2a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, // *............... + 0xb3, 0x00, 0x05, 0x00, 0x6c, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, // ....l.......9... + 0x52, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0x06, 0x01, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, // R............... + 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xe5, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, // ................ + 0x06, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ............A... + 0x72, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, // r.......q....... + 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, // =............... + 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, // O............... + 0xe8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00, // ............o... + 0x07, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ........9....... + 0x0b, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, // ................ + 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, // ................ + 0xec, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x32, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, // ....V...2....... + 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // '...$...W....... + 0x21, 0x01, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // !...........A... + 0x13, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, // ............9... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, // =............... + 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x00, // ............!... + 0xf4, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, // ................ + 0x3a, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // :............... + 0xfa, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, // ............V... + 0x32, 0x00, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // 2...(...'...$... + 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, // W.......*...(... + 0xfa, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, // ....A........... + 0xc5, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ....9...=....... + 0xff, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, // ....*........... + 0x0d, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x80, 0x00, 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, // ....).......9... + 0x2a, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // *............... + 0x06, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xac, 0x00, 0x00, 0x00, 0x3a, 0x01, 0x00, 0x00, // ....>.......:... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // ....8....... }; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index 845ed8589..dfc1cc2f5 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -882,7 +882,6 @@ namespace bgfx::ProgramHandle firstProg = gl->prog; std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { gl->encoder->setUniform(u, value); - gl->encoder->setUniform(gl->u_viewSize, gl->view); }; std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); From 287ff0165e05588ebce7742b9f12cbbd85c453e7 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Thu, 3 Apr 2025 01:57:16 +1100 Subject: [PATCH 21/24] clear released framebuffers, bind canvas framebuffer for final filterpass --- Apps/Playground/Scripts/experience.js | 2 +- Polyfills/Canvas/Source/Canvas.cpp | 2 - Polyfills/Canvas/Source/Context.cpp | 4 +- .../Canvas/Source/Shaders/dx11/fs_gaussblur.h | 199 ++++++------- .../Canvas/Source/Shaders/essl/fs_gaussblur.h | 155 +++++----- .../Canvas/Source/Shaders/fs_gaussblur.sc | 20 +- .../Canvas/Source/Shaders/glsl/fs_gaussblur.h | 138 ++++----- .../Source/Shaders/metal/fs_gaussblur.h | 269 +++++++++--------- .../Source/Shaders/spirv/fs_gaussblur.h | 269 +++++++++--------- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 2 + 10 files changed, 543 insertions(+), 517 deletions(-) diff --git a/Apps/Playground/Scripts/experience.js b/Apps/Playground/Scripts/experience.js index 1352b68fe..d107b7196 100644 --- a/Apps/Playground/Scripts/experience.js +++ b/Apps/Playground/Scripts/experience.js @@ -149,7 +149,7 @@ CreateBoxAsync(scene).then(function () { context.stroke(); // filter blur text - context.filter = "blur(1.5px)"; + context.filter = "blur(1.25px)"; context.fillStyle = "White"; context.font = `bold ${50}px monospace`; context.fillText("BLUR TEST BLUR TEST", 100, 246); diff --git a/Polyfills/Canvas/Source/Canvas.cpp b/Polyfills/Canvas/Source/Canvas.cpp index ce61a66e4..a12dddcf7 100644 --- a/Polyfills/Canvas/Source/Canvas.cpp +++ b/Polyfills/Canvas/Source/Canvas.cpp @@ -8,8 +8,6 @@ #include "Colors.h" #include "Gradient.h" -const int POOL_SIZE = 3; - namespace { constexpr auto JS_CANVAS_NAME = "_CanvasImpl"; diff --git a/Polyfills/Canvas/Source/Context.cpp b/Polyfills/Canvas/Source/Context.cpp index b8579f7a3..63b29779c 100644 --- a/Polyfills/Canvas/Source/Context.cpp +++ b/Polyfills/Canvas/Source/Context.cpp @@ -632,8 +632,8 @@ namespace Babylon::Polyfills::Internal return frameBuffer; }; std::function release = [this, encoder](Babylon::Graphics::FrameBuffer* frameBuffer) -> void { - // no need to clear framebuffer (yet), as all filter passes are (currently) full screen - //frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR, 0, 0, 0); + // clear framebuffer when released + frameBuffer->Clear(*encoder, BGFX_CLEAR_COLOR, 0, 0, 0); this->m_canvas->m_frameBufferPool.Release(frameBuffer); frameBuffer->Unbind(*encoder); }; diff --git a/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h index 7d57e65ef..775e1842e 100644 --- a/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h @@ -1,100 +1,103 @@ -static const uint8_t fs_gaussblur_dx11[1548] = +static const uint8_t fs_gaussblur_dx11[1585] = { - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0b, 0x75, // FSH............u - 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, // _direction...... - 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex0..... - 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex0..... - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x05, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x8e, 0x49, 0xc4, 0xb1, // ........DXBC.I.. - 0xe7, 0xed, 0xae, 0x7d, 0x9b, 0x80, 0xd2, 0x20, 0x75, 0xe7, 0x0a, 0xe1, 0x01, 0x00, 0x00, 0x00, // ...}... u....... - 0xc0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, // ........,....... - 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....ISGNh....... - 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....P........... - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, // ............SV_P - 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // OSITION.TEXCOORD - 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....OSGN,....... - 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .... ........... - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, // ............SV_T - 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0xe8, 0x04, 0x00, 0x00, // ARGET...SHEX.... - 0x50, 0x00, 0x00, 0x00, 0x3a, 0x01, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x04, // P...:...j...Y... - 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, // F. .........Z... - 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X....p.. - 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xc2, 0x10, 0x10, 0x00, // ....UU..b....... - 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ...... - 0x68, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // h.......E....... - 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, // CU.............. - 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0f, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....2........... - 0xe6, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, // .........@.....? - 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x02, 0x40, 0x00, 0x00, // ...?...?...?.@.. - 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3f, // ...?...?...?...? - 0x00, 0x00, 0x00, 0x08, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, // ....2........... - 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. ......... - 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, // E.......CU...... - 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ....F.......F~.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, // .....`......8... - 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ........F....... - 0x02, 0x40, 0x00, 0x00, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, // .@...CG>.CG>.CG> - 0xcf, 0x43, 0x47, 0x3e, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // .CG>2........... - 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xc4, 0x79, 0x68, 0x3e, // F........@...yh> - 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, 0xc4, 0x79, 0x68, 0x3e, 0x46, 0x0e, 0x10, 0x00, // .yh>.yh>.yh>F... - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ........2....... - 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, // ........F. .A... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // ........E....... - 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, // CU..........F... - 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... - 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xcf, 0x43, 0x47, 0x3e, // F........@...CG> - 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0xcf, 0x43, 0x47, 0x3e, 0x46, 0x0e, 0x10, 0x00, // .CG>.CG>.CG>F... - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0d, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....2...2....... - 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // F. ..........@.. - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@...@........ - 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // ........E....... - 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, // CU..........F... - 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... - 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xbf, 0x14, 0xf9, 0x3d, // F........@.....= - 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0x46, 0x0e, 0x10, 0x00, // ...=...=...=F... - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0e, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....2...2....... - 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // F. .A........... - 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, // .@.....@...@.... - 0x00, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, // ............E... - 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....CU.......... - 0x46, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F~...... - 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, // .`......2....... - 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@.. - 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, 0xbf, 0x14, 0xf9, 0x3d, // ...=...=...=...= - 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0d, 0xf2, 0x00, 0x10, 0x00, // F.......2....... - 0x02, 0x00, 0x00, 0x00, 0x46, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. ......... - 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x80, 0x40, // .@....@@..@@...@ - 0x00, 0x00, 0x80, 0x40, 0xe6, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0e, // ...@........2... - 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x84, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, // ........F. .A... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, // .........@....@@ - 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0x46, 0x0e, 0x10, 0x00, // ..@@...@...@F... - 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, // ....E.......CU.. - 0xf2, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ........F....... - 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F~.......`...... - 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, // E.......CU...... - 0x02, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, // ............F~.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, // .....`......2... - 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, // ........F....... - 0x02, 0x40, 0x00, 0x00, 0xba, 0x67, 0x5d, 0x3d, 0xba, 0x67, 0x5d, 0x3d, 0xba, 0x67, 0x5d, 0x3d, // .@...g]=.g]=.g]= - 0xba, 0x67, 0x5d, 0x3d, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, // .g]=F.......E... - 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, // ....CU.......... - 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F~...... - 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, // .`......E....... - 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, // CU.............. - 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`.. - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... - 0x46, 0x0e, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xba, 0x67, 0x5d, 0x3d, // F........@...g]= - 0xba, 0x67, 0x5d, 0x3d, 0xba, 0x67, 0x5d, 0x3d, 0xba, 0x67, 0x5d, 0x3d, 0x46, 0x0e, 0x10, 0x00, // .g]=.g]=.g]=F... - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... - 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x6b, 0xd7, 0x84, 0x3c, // F........@..k..< - 0x6b, 0xd7, 0x84, 0x3c, 0x6b, 0xd7, 0x84, 0x3c, 0x6b, 0xd7, 0x84, 0x3c, 0x46, 0x0e, 0x10, 0x00, // k......... + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0a, 0x75, // FSH............u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // _viewSize....... + 0x00, 0x00, 0x00, 0x0b, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, // ....u_direction. + 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, // ..........s_tex0 + 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, // ..........s_tex0 + 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x44, 0x58, 0x42, // .............DXB + 0x43, 0x87, 0xf0, 0xab, 0x21, 0xf5, 0x28, 0x19, 0xa5, 0xb4, 0x55, 0x62, 0xc0, 0x96, 0x43, 0xf5, // C...!.(...Ub..C. + 0xe6, 0x01, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, // .............,.. + 0x00, 0x9c, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, // .........ISGNh.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........P...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // ................ + 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, // ................ + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, // .SV_POSITION.TEX + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, // COORD....OSGN,.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // ................ + 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x45, // .SV_TARGET...SHE + 0x58, 0xf8, 0x04, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x6a, 0x08, 0x00, // X....P...>...j.. + 0x01, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .Y...F. ........ + 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, // .Z....`......X.. + 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, // ..p......UU..b.. + 0x03, 0xc2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, // .........e.... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, // .....h.......E.. + 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, // .....CU......... + 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, // .........F~..... + 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0b, 0xf2, 0x00, 0x10, // ..`............. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, // ......@.....?... + 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x46, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, // ?...?...?F. .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, // .....2...2...... + 0x00, 0x46, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, // .F. ............ + 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, // .............E.. + 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, // .....CU......... + 0x00, 0x46, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, // .F.......F~..... + 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, // ..`......8...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, // .....F........@. + 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x80, // ....>...>...>... + 0x3e, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, // >2...........F.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x7b, 0x14, 0xae, 0x3e, 0x7b, 0x14, 0xae, // ......@..{..>{.. + 0x3e, 0x7b, 0x14, 0xae, 0x3e, 0x7b, 0x14, 0xae, 0x3e, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, // >{..>{..>F...... + 0x00, 0x32, 0x00, 0x00, 0x0b, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, // .2...2.......F. + 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, // .A.............. + 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, // .............8.. + 0x08, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, // .........F...... + 0x00, 0x46, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, // .F. .........E.. + 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, // .....CU......... + 0x00, 0x46, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, // .F.......F~..... + 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, // ..`......2...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, // .....F........@. + 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x80, // ....>...>...>... + 0x3e, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0x32, 0x00, 0x10, // >F.......2...2.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, // ..............@. + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....@...@....... + 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, // .........E...... + 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, // .CU..........F.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, // .....F~.......`. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, // .....2.......... + 0x00, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xb8, 0x1e, 0x05, // .F........@..... + 0x3e, 0xb8, 0x1e, 0x05, 0x3e, 0xb8, 0x1e, 0x05, 0x3e, 0xb8, 0x1e, 0x05, 0x3e, 0x46, 0x0e, 0x10, // >...>...>...>F.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0d, 0x32, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, // .....2...2...... + 0x00, 0xe6, 0x0a, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, // .....A........@. + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....@...@....... + 0x00, 0xe6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, // .........E...... + 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, // .CU..........F.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, // .....F~.......`. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, // .....2.......... + 0x00, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xb8, 0x1e, 0x05, // .F........@..... + 0x3e, 0xb8, 0x1e, 0x05, 0x3e, 0xb8, 0x1e, 0x05, 0x3e, 0xb8, 0x1e, 0x05, 0x3e, 0x46, 0x0e, 0x10, // >...>...>...>F.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, // .....2.......... + 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, // .F........@....@ + 0x40, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0xe6, 0x1e, 0x10, // @..@@...@...@... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0d, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, // .....2.......... + 0x00, 0x46, 0x0e, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, // .F...A........@. + 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, // ...@@..@@...@... + 0x40, 0xe6, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, // @........E...... + 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, // .CU..........F.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, // .....F~.......`. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, // .....E.......CU. + 0x00, 0xf2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, // .F~.......`..... + 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, // .2...........F.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x8f, 0xc2, 0x75, 0x3d, 0x8f, 0xc2, 0x75, // ......@....u=..u + 0x3d, 0x8f, 0xc2, 0x75, 0x3d, 0x8f, 0xc2, 0x75, 0x3d, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, // =..u=..u=F...... + 0x00, 0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, // .E.......CU..... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, // .....F.......F~. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, // ......`......E.. + 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, // .....CU......... + 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, // .........F~..... + 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, // ..`......2...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, // .....F........@. + 0x00, 0x8f, 0xc2, 0x75, 0x3d, 0x8f, 0xc2, 0x75, 0x3d, 0x8f, 0xc2, 0x75, 0x3d, 0x8f, 0xc2, 0x75, // ...u=..u=..u=..u + 0x3d, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, // =F.......2...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, // .....F........@. + 0x00, 0x0a, 0xd7, 0xa3, 0x3c, 0x0a, 0xd7, 0xa3, 0x3c, 0x0a, 0xd7, 0xa3, 0x3c, 0x0a, 0xd7, 0xa3, // ....<...<...<... + 0x3c, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0c, 0xf2, 0x20, 0x10, // ..... + 0x00, // . }; diff --git a/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h index d24e0c094..a252e325b 100644 --- a/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/essl/fs_gaussblur.h @@ -1,78 +1,85 @@ -static const uint8_t fs_gaussblur_essl[1191] = +static const uint8_t fs_gaussblur_essl[1301] = { - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u - 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... - 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex...... - 0x00, 0x00, 0x00, 0x00, 0x6e, 0x04, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, // ....n...varying - 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, // highp vec2 v_tex - 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // coord0;.uniform - 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, // highp vec4 u_dir - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // ection;.uniform - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, // sampler2D s_tex; - 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, // .void main ().{. - 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x65, 0x78, // highp vec2 tex - 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, // coord0_1;. lowp - 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // vec4 color_2;. - 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, // color_2 = (text - 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, // ure2D (s_tex, v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, // texcoord0) * 0.2 - 0x32, 0x37, 0x30, 0x32, 0x37, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // 27027);. texcoo - 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // rd0_1 = ((v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2b, 0x20, 0x30, // oord0 * 0.5) + 0 - 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // .5);. color_2 = - 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // (color_2 + (tex - 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // ture2D (s_tex, ( - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x75, 0x5f, // texcoord0_1 + u_ - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x20, 0x2a, // direction.xy)) * - 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.1945946));. - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_2 = (color - 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, // _2 + (texture2D - 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // (s_tex, (texcoor - 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, // d0_1 - u_directi - 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, // on.xy)) * 0.1945 - 0x39, 0x34, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, // 946));. highp v - 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_3;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, // tmpvar_3 = (u_di - 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, // rection.xy * 2.0 + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0a, 0x75, // FSH............u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // _viewSize....... + 0x00, 0x00, 0x00, 0x0b, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x02, // ....u_direction. + 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, // ..........s_tex. + 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x04, 0x00, 0x00, 0x76, 0x61, 0x72, // .............var + 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // ying highp vec2 + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // v_texcoord0;.uni + 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // form highp vec4 + 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, // u_viewSize;.unif + 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, // orm highp vec4 u + 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, // _direction;.unif + 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, // orm sampler2D s_ + 0x74, 0x65, 0x78, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, // tex;.void main ( + 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, // ).{. highp vec2 + 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // texelSize_1;. + 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // lowp vec4 color_ + 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // 2;. color_2 = ( + 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // texture2D (s_tex + 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, // , v_texcoord0) * + 0x20, 0x30, 0x2e, 0x33, 0x34, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, // 0.34);. texelS + 0x69, 0x7a, 0x65, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2f, 0x28, 0x75, 0x5f, // ize_1 = (1.0/(u_ + 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, // viewSize.xy));. + 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, // highp vec2 tmpv + 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, // ar_3;. tmpvar_3 + 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, // = (u_direction. + 0x78, 0x79, 0x20, 0x2a, 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x31, // xy * texelSize_1 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // );. color_2 = ( 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // color_2 + (textu - 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, // re2D (s_tex, (te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, // xcoord0_1 + tmpv - 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, // ar_3)) * 0.12162 - 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, // 16));. color_2 - 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, // = (color_2 + (te - 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // xture2D (s_tex, - 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, 0x74, // (texcoord0_1 - t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x32, // mpvar_3)) * 0.12 - 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 16216));. highp - 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, // vec2 tmpvar_4;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, // tmpvar_4 = (u_ - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x33, // direction.xy * 3 - 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // .0);. color_2 = - 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // (color_2 + (tex - 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // ture2D (s_tex, ( - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x74, 0x6d, // texcoord0_1 + tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, // pvar_4)) * 0.054 - 0x30, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // 054));. color_2 - 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, // = (color_2 + (t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // exture2D (s_tex, - 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, // (texcoord0_1 - - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, // tmpvar_4)) * 0.0 - 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 54054));. highp - 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, // vec2 tmpvar_5;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, // tmpvar_5 = (u_ - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x34, // direction.xy * 4 - 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // .0);. color_2 = - 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // (color_2 + (tex - 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // ture2D (s_tex, ( - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x74, 0x6d, // texcoord0_1 + tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, // pvar_5)) * 0.016 - 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // 216));. color_2 - 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, // = (color_2 + (t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // exture2D (s_tex, - 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, // (texcoord0_1 - - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, // tmpvar_5)) * 0.0 - 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // 16216));. gl_Fr - 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // agColor = color_ - 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 2;.}... + 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, // re2D (s_tex, (v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, // texcoord0 + tmpv + 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, 0x35, 0x29, 0x29, 0x3b, // ar_3)) * 0.25)); + 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, // . color_2 = (co + 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // lor_2 + (texture + 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, // 2D (s_tex, (v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // xcoord0 - tmpvar + 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, 0x35, 0x29, 0x29, 0x3b, 0x0a, 0x20, // _3)) * 0.25));. + 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, // highp vec2 tmpv + 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // ar_4;. tmpvar_4 + 0x20, 0x3d, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // = ((u_direction + 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, // .xy * texelSize_ + 0x31, 0x29, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, // 1) * 2.0);. col + 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, // or_2 = (color_2 + 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, // + (texture2D (s_ + 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // tex, (v_texcoord + 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, // 0 + tmpvar_4)) * + 0x20, 0x30, 0x2e, 0x31, 0x33, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // 0.13));. color + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, // _2 = (color_2 + + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // (texture2D (s_te + 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // x, (v_texcoord0 + 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, // - tmpvar_4)) * 0 + 0x2e, 0x31, 0x33, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, // .13));. highp v + 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_5;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x64, // tmpvar_5 = ((u_d + 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x74, 0x65, // irection.xy * te + 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x31, 0x29, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, // xelSize_1) * 3.0 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // );. color_2 = ( + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // color_2 + (textu + 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, // re2D (s_tex, (v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, // texcoord0 + tmpv + 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x36, 0x29, 0x29, 0x3b, // ar_5)) * 0.06)); + 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, // . color_2 = (co + 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // lor_2 + (texture + 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, // 2D (s_tex, (v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // xcoord0 - tmpvar + 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, // _5)) * 0.06));. + 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, // highp vec2 tmpv + 0x61, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, // ar_6;. tmpvar_6 + 0x20, 0x3d, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // = ((u_direction + 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, // .xy * texelSize_ + 0x31, 0x29, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, // 1) * 4.0);. col + 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, // or_2 = (color_2 + 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, // + (texture2D (s_ + 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // tex, (v_texcoord + 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x29, 0x20, 0x2a, // 0 + tmpvar_6)) * + 0x20, 0x30, 0x2e, 0x30, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // 0.02));. color + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, // _2 = (color_2 + + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // (texture2D (s_te + 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // x, (v_texcoord0 + 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, // - tmpvar_6)) * 0 + 0x2e, 0x30, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // .02));. gl_Frag + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, // Color = color_2; + 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; diff --git a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc index 9d76b5a20..f8823eecc 100644 --- a/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc +++ b/Polyfills/Canvas/Source/Shaders/fs_gaussblur.sc @@ -19,21 +19,19 @@ void main() // 9-tap weights float weights[5]; - weights[0] = 0.227027; // center - weights[1] = 0.1945946; - weights[2] = 0.1216216; - weights[3] = 0.054054; - weights[4] = 0.016216; + weights[0] = 0.340; // center + weights[1] = 0.250; + weights[2] = 0.130; + weights[3] = 0.060; + weights[4] = 0.020; - vec4 color = texture2D(s_tex, v_texcoord0) * weights[0]; // center pixel weighted - - // convert NDC (-1 to 1) to 0 UV (0 to 1) - vec2 texcoord0 = v_texcoord0 * 0.5 + 0.5; - // TODO: + u_halfTexel.xy; // handle half texel offset + vec2 texcoord0 = v_texcoord0 + u_halfTexel.xy; + vec4 color = texture2D(s_tex, texcoord0) * weights[0]; // center pixel + vec2 texelSize = vec2_splat(1.0) / u_viewSize.xy; for (int i = 1; i <= 4; i++) { - vec2 offset = u_direction.xy * float(i); // TODO: normalize against u_viewSize.xy + vec2 offset = u_direction.xy * texelSize * float(i); color += texture2D(s_tex, texcoord0 + offset) * weights[i]; color += texture2D(s_tex, texcoord0 - offset) * weights[i]; } diff --git a/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h index a5d35eaf5..8f50c8d29 100644 --- a/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/glsl/fs_gaussblur.h @@ -1,74 +1,80 @@ -static const uint8_t fs_gaussblur_glsl[1127] = +static const uint8_t fs_gaussblur_glsl[1225] = { - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u - 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... - 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, // .....s_tex...... - 0x00, 0x00, 0x00, 0x00, 0x2e, 0x04, 0x00, 0x00, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // ........in vec2 - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // v_texcoord0;.uni - 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, // form vec4 u_dire - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, // ction;.uniform s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, // ampler2D s_tex;. - 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // void main ().{. - 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, // vec2 texcoord0_ - 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // 1;. vec4 color_ - 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // 2;. color_2 = ( - 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, // texture (s_tex, - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x30, // v_texcoord0) * 0 - 0x2e, 0x32, 0x32, 0x37, 0x30, 0x32, 0x37, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x78, 0x63, // .227027);. texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x76, 0x5f, 0x74, 0x65, // oord0_1 = ((v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2b, // xcoord0 * 0.5) + - 0x20, 0x30, 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // 0.5);. color_2 + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0a, 0x75, // FSH............u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // _viewSize....... + 0x00, 0x00, 0x00, 0x0b, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x02, // ....u_direction. + 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, // ..........s_tex. + 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x69, 0x6e, 0x20, // .........{...in + 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // vec2 v_texcoord0 + 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, // ;.uniform vec4 u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // _viewSize;.unifo + 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, // rm vec4 u_direct + 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, // ion;.uniform sam + 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x3b, 0x0a, 0x76, 0x6f, // pler2D s_tex;.vo + 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, // id main ().{. v + 0x65, 0x63, 0x32, 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x31, 0x3b, // ec2 texelSize_1; + 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, // . vec4 color_2; + 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, // . color_2 = (te + 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x76, 0x5f, // xture (s_tex, v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x33, // texcoord0) * 0.3 + 0x34, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, // 4);. texelSize_ + 0x31, 0x20, 0x3d, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2f, 0x28, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // 1 = (1.0/(u_view + 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, // Size.xy));. vec + 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // 2 tmpvar_3;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, // pvar_3 = (u_dire + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, // ction.xy * texel + 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // Size_1);. color + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, // _2 = (color_2 + + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // (texture (s_tex, + 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, // (v_texcoord0 + + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, // tmpvar_3)) * 0.2 + 0x35, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // 5));. color_2 = + 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // (color_2 + (tex + 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, // ture (s_tex, (v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, // texcoord0 - tmpv + 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x32, 0x35, 0x29, 0x29, 0x3b, // ar_3)) * 0.25)); + 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // . vec2 tmpvar_4 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x28, // ;. tmpvar_4 = ( + 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, // (u_direction.xy + 0x2a, 0x20, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x31, 0x29, 0x20, 0x2a, // * texelSize_1) * + 0x20, 0x32, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // 2.0);. color_2 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, // = (color_2 + (t 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // exture (s_tex, ( - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x75, 0x5f, // texcoord0_1 + u_ - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x29, 0x20, 0x2a, // direction.xy)) * - 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // 0.1945946));. - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_2 = (color - 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, // _2 + (texture (s - 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // _tex, (texcoord0 - 0x5f, 0x31, 0x20, 0x2d, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // _1 - u_direction - 0x2e, 0x78, 0x79, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x39, 0x34, 0x35, 0x39, 0x34, // .xy)) * 0.194594 - 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, // 6));. vec2 tmpv - 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, // ar_3;. tmpvar_3 - 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, // = (u_direction. - 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, // xy * 2.0);. col - 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, // or_2 = (color_2 - 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // + (texture (s_te - 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, // x, (texcoord0_1 - 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, // + tmpvar_3)) * 0 - 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, // .1216216));. co - 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // lor_2 = (color_2 - 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, // + (texture (s_t - 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, // ex, (texcoord0_1 - 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, // - tmpvar_3)) * - 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, // 0.1216216));. v - 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_4;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, // tmpvar_4 = (u_di - 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x30, // rection.xy * 3.0 + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, // v_texcoord0 + tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x33, 0x29, // pvar_4)) * 0.13) 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // );. color_2 = ( 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // color_2 + (textu - 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, // re (s_tex, (texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // oord0_1 + tmpvar - 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, // _4)) * 0.054054) + 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, // re (s_tex, (v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // xcoord0 - tmpvar + 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x31, 0x33, 0x29, 0x29, 0x3b, 0x0a, 0x20, // _4)) * 0.13));. + 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, // vec2 tmpvar_5;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x75, // tmpvar_5 = ((u + 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, // _direction.xy * + 0x74, 0x65, 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x31, 0x29, 0x20, 0x2a, 0x20, 0x33, // texelSize_1) * 3 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // .0);. color_2 = + 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, // (color_2 + (tex + 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, // ture (s_tex, (v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, // texcoord0 + tmpv + 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x36, 0x29, 0x29, 0x3b, // ar_5)) * 0.06)); + 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, // . color_2 = (co + 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // lor_2 + (texture + 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // (s_tex, (v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, // oord0 - tmpvar_5 + 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, // )) * 0.06));. v + 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, // ec2 tmpvar_6;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x75, 0x5f, 0x64, // tmpvar_6 = ((u_d + 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x74, 0x65, // irection.xy * te + 0x78, 0x65, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x31, 0x29, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, // xelSize_1) * 4.0 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, // );. color_2 = ( 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, // color_2 + (textu - 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, // re (s_tex, (texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // oord0_1 - tmpvar - 0x5f, 0x34, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x34, 0x29, // _4)) * 0.054054) - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // );. vec2 tmpvar - 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, // _5;. tmpvar_5 = - 0x20, 0x28, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, // (u_direction.xy - 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // * 4.0);. color - 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, // _2 = (color_2 + - 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // (texture (s_tex, - 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2b, 0x20, // (texcoord0_1 + - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, // tmpvar_5)) * 0.0 - 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // 16216));. color - 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, // _2 = (color_2 + - 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, // (texture (s_tex, - 0x20, 0x28, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x5f, 0x31, 0x20, 0x2d, 0x20, // (texcoord0_1 - - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, // tmpvar_5)) * 0.0 - 0x31, 0x36, 0x32, 0x31, 0x36, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // 16216));. gl_Fr - 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // agColor = color_ - 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 2;.}... + 0x72, 0x65, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, // re (s_tex, (v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // xcoord0 + tmpvar + 0x5f, 0x36, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, // _6)) * 0.02));. + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x63, 0x6f, 0x6c, 0x6f, // color_2 = (colo + 0x72, 0x5f, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x20, 0x28, // r_2 + (texture ( + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // s_tex, (v_texcoo + 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x29, // rd0 - tmpvar_6)) + 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x30, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, // * 0.02));. gl_ + 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // FragColor = colo + 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_2;.}... }; diff --git a/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h index 6853915b5..5a093dc61 100644 --- a/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/metal/fs_gaussblur.h @@ -1,144 +1,147 @@ -static const uint8_t fs_gaussblur_mtl[2254] = +static const uint8_t fs_gaussblur_mtl[2298] = { - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x73, // FSH............s + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0c, 0x73, // FSH............s 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x11, 0x01, 0xff, 0xff, 0x01, // _texSampler..... 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, // ......s_texTextu - 0x72, 0x65, 0x11, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x75, 0x5f, 0x64, // re...........u_d - 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // irection........ - 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...s_tex........ - 0x00, 0x00, 0x64, 0x08, 0x00, 0x00, 0x23, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x63, 0x6c, // ..d...#pragma cl - 0x61, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x20, 0x69, // ang diagnostic i - 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x22, 0x2d, 0x57, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, // gnored "-Wmissin - 0x67, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x0a, 0x23, 0x70, // g-prototypes".#p - 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x63, 0x6c, 0x61, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x61, 0x67, // ragma clang diag - 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x22, // nostic ignored " - 0x2d, 0x57, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x2d, 0x62, 0x72, 0x61, 0x63, 0x65, 0x73, // -Wmissing-braces - 0x22, 0x0a, 0x0a, 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65, 0x74, // "..#include .#incl - 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69, 0x6d, 0x64, 0x2f, 0x73, 0x69, 0x6d, 0x64, 0x2e, 0x68, // ude ..using namespa - 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x0a, 0x74, 0x65, 0x6d, 0x70, 0x6c, // ce metal;..templ - 0x61, 0x74, 0x65, 0x3c, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x54, 0x2c, 0x20, // ate.stru - 0x63, 0x74, 0x20, 0x73, 0x70, 0x76, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x41, 0x72, 0x72, 0x61, // ct spvUnsafeArra - 0x79, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, // y.{. T elemen - 0x74, 0x73, 0x5b, 0x4e, 0x75, 0x6d, 0x20, 0x3f, 0x20, 0x4e, 0x75, 0x6d, 0x20, 0x3a, 0x20, 0x31, // ts[Num ? Num : 1 - 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x65, // ];. . thre - 0x61, 0x64, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, // ad T& operator [ - 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x74, // ] (size_t pos) t - 0x68, 0x72, 0x65, 0x61, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // hread. {. + 0x72, 0x65, 0x11, 0x01, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x5f, 0x76, // re...........u_v + 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // iewSize......... + 0x00, 0x0b, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x01, 0x10, // ..u_direction... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x10, 0x00, 0x00, // ........s_tex... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x08, 0x00, 0x00, 0x23, 0x70, 0x72, 0x61, 0x67, // .......{...#prag + 0x6d, 0x61, 0x20, 0x63, 0x6c, 0x61, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, // ma clang diagnos + 0x74, 0x69, 0x63, 0x20, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x20, 0x22, 0x2d, 0x57, 0x6d, // tic ignored "-Wm + 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, // issing-prototype + 0x73, 0x22, 0x0a, 0x23, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x63, 0x6c, 0x61, 0x6e, 0x67, // s".#pragma clang + 0x20, 0x64, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x20, 0x69, 0x67, 0x6e, 0x6f, // diagnostic igno + 0x72, 0x65, 0x64, 0x20, 0x22, 0x2d, 0x57, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x2d, 0x62, // red "-Wmissing-b + 0x72, 0x61, 0x63, 0x65, 0x73, 0x22, 0x0a, 0x0a, 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, // races"..#include + 0x20, 0x3c, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a, // . + 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69, 0x6d, 0x64, 0x2f, 0x73, // #include ..using na + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x0a, // mespace metal;.. + 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x3c, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, // template + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x73, 0x70, 0x76, 0x55, 0x6e, 0x73, 0x61, 0x66, // .struct spvUnsaf + 0x65, 0x41, 0x72, 0x72, 0x61, 0x79, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x54, 0x20, 0x65, // eArray.{. T e + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x4e, 0x75, 0x6d, 0x20, 0x3f, 0x20, 0x4e, 0x75, // lements[Num ? Nu + 0x6d, 0x20, 0x3a, 0x20, 0x31, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, // m : 1];. . + 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, // thread T& opera + 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, // tor [] (size_t p + 0x6f, 0x73, 0x29, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, // os) thread. { + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // . return + 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, // elements[pos];. + 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, // }. constex + 0x70, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x20, // pr const thread + 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, // T& operator [] ( + 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, // size_t pos) cons + 0x74, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, // t thread. {. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, // return el + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, // ements[pos];. + 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x76, 0x69, // }. . devi + 0x63, 0x65, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, // ce T& operator [ + 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x64, // ] (size_t pos) d + 0x65, 0x76, 0x69, 0x63, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // evice. {. 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, // return eleme 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, // nts[pos];. }. 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, // constexpr co - 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, // nst thread T& op + 0x6e, 0x73, 0x74, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, // nst device T& op 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, // erator [] (size_ - 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, // t pos) const thr - 0x65, 0x61, 0x64, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ead. {. + 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x64, 0x65, 0x76, // t pos) const dev + 0x69, 0x63, 0x65, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ice. {. 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, // return element 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, // s[pos];. }. - 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x20, 0x54, 0x26, // . device T& - 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, // operator [] (si - 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, // ze_t pos) device - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, // . {. r - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, // eturn elements[p - 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, // os];. }. c - 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x64, // onstexpr const d - 0x65, 0x76, 0x69, 0x63, 0x65, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, // evice T& operato - 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, // r [] (size_t pos - 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x0a, 0x20, // ) const device. - 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, // {. ret - 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, // urn elements[pos - 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, // ];. }. . - 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, // constexpr cons - 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, // t constant T& op - 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, // erator [] (size_ - 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x63, 0x6f, 0x6e, // t pos) const con - 0x73, 0x74, 0x61, 0x6e, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // stant. {. - 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, // return eleme - 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, // nts[pos];. }. - 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x67, // . threadg - 0x72, 0x6f, 0x75, 0x70, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, // roup T& operator - 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, // [] (size_t pos) - 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x0a, 0x20, 0x20, 0x20, // threadgroup. - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, // {. retur - 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, // n elements[pos]; - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, // . }. const - 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, // expr const threa - 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, // dgroup T& operat - 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, // or [] (size_t po - 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x67, // s) const threadg - 0x72, 0x6f, 0x75, 0x70, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // roup. {. - 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, // return elemen - 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x7d, // ts[pos];. }.} - 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x5f, 0x47, 0x6c, 0x6f, 0x62, 0x61, // ;..struct _Globa - 0x6c, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, // l.{. float4 u - 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, // _direction;.};.. - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, // struct xlatMtlMa - 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, // in_out.{. flo - 0x61, 0x74, 0x34, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // at4 bgfx_FragDat - 0x61, 0x30, 0x20, 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, // a0 [[color(0)]]; - 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // .};..struct xlat - 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, // MtlMain_in.{. - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // float2 v_texcoo - 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, 0x31, // rd0 [[user(locn1 - 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, // )]];.};..fragmen - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, // t xlatMtlMain_ou - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x28, 0x78, 0x6c, // t xlatMtlMain(xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x20, // atMtlMain_in in - 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, // [[stage_in]], co - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x5f, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x26, 0x20, // nstant _Global& - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, // _mtl_u [[buffer( - 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, // 0)]], texture2d< - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x20, 0x5b, 0x5b, 0x74, // float> s_tex [[t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, // exture(0)]], sam - 0x70, 0x6c, 0x65, 0x72, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, // pler s_texSample - 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, // r [[sampler(0)]] - 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // ).{. xlatMtlM - 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, // ain_out out = {} - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x73, 0x70, 0x76, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x41, // ;. spvUnsafeA - 0x72, 0x72, 0x61, 0x79, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x2c, 0x20, 0x35, 0x3e, 0x20, 0x5f, // rray _ - 0x31, 0x39, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x30, 0x5d, // 197;. _197[0] - 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x32, 0x32, 0x37, 0x30, 0x32, 0x36, 0x39, 0x39, 0x38, 0x39, 0x39, // = 0.22702699899 - 0x36, 0x37, 0x33, 0x34, 0x36, 0x31, 0x39, 0x31, 0x34, 0x30, 0x36, 0x32, 0x35, 0x3b, 0x0a, 0x20, // 6734619140625;. - 0x20, 0x20, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x31, // _197[1] = 0.1 - 0x39, 0x34, 0x35, 0x39, 0x34, 0x36, 0x30, 0x36, 0x37, 0x35, 0x37, 0x31, 0x36, 0x34, 0x30, 0x30, // 9459460675716400 - 0x31, 0x34, 0x36, 0x34, 0x38, 0x34, 0x33, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, // 146484375;. _ - 0x31, 0x39, 0x37, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x31, 0x32, 0x31, 0x36, 0x32, // 197[2] = 0.12162 - 0x31, 0x36, 0x30, 0x31, 0x32, 0x38, 0x33, 0x35, 0x35, 0x30, 0x32, 0x36, 0x32, 0x34, 0x35, 0x31, // 1601283550262451 - 0x31, 0x37, 0x31, 0x38, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x31, 0x39, 0x37, // 171875;. _197 - 0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x30, 0x35, 0x33, 0x39, 0x39, // [3] = 0.05405399 - 0x39, 0x34, 0x38, 0x33, 0x35, 0x38, 0x35, 0x33, 0x35, 0x37, 0x36, 0x36, 0x36, 0x30, 0x31, 0x35, // 9483585357666015 - 0x36, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x34, 0x5d, // 625;. _197[4] - 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x36, 0x32, 0x31, 0x36, 0x30, 0x30, 0x30, 0x35, 0x34, // = 0.01621600054 - 0x32, 0x30, 0x34, 0x34, 0x36, 0x33, 0x39, 0x35, 0x38, 0x37, 0x34, 0x30, 0x32, 0x33, 0x34, 0x33, // 2044639587402343 - 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x5f, // 75;. float2 _ - 0x32, 0x32, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 225 = (in.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2b, 0x20, 0x66, // oord0 * 0.5) + f - 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // loat2(0.5);. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x33, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, // float4 _314;. - 0x20, 0x5f, 0x33, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, // _314 = s_tex.sa - 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, // mple(s_texSample - 0x72, 0x2c, 0x20, 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // r, in.v_texcoord - 0x30, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // 0) * _197[0];. - 0x20, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, 0x5f, 0x33, 0x31, 0x33, 0x20, // for (int _313 - 0x3d, 0x20, 0x31, 0x3b, 0x20, 0x5f, 0x33, 0x31, 0x33, 0x20, 0x3c, 0x3d, 0x20, 0x34, 0x3b, 0x20, // = 1; _313 <= 4; - 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ). {. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x5f, 0x32, 0x33, 0x36, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // float2 _236 = _m - 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // tl_u.u_direction - 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x5f, 0x33, 0x31, 0x33, // .xy * float(_313 - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x31, 0x34, 0x20, // );. _314 - 0x3d, 0x20, 0x28, 0x5f, 0x33, 0x31, 0x34, 0x20, 0x2b, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // = (_314 + (s_tex - 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, // .sample(s_texSam - 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, 0x5f, 0x32, 0x32, 0x35, 0x20, 0x2b, 0x20, 0x5f, 0x32, // pler, (_225 + _2 - 0x33, 0x36, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x5f, 0x33, 0x31, 0x33, // 36)) * _197[_313 - 0x5d, 0x29, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, // ])) + (s_tex.sam + 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, 0x70, 0x72, // . constexpr + 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, // const constant + 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, // T& operator [] ( + 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, // size_t pos) cons + 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, // t constant. { + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // . return + 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, // elements[pos];. + 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, // }. . th + 0x72, 0x65, 0x61, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x54, 0x26, 0x20, 0x6f, 0x70, 0x65, // readgroup T& ope + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x74, // rator [] (size_t + 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x67, 0x72, 0x6f, 0x75, // pos) threadgrou + 0x70, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // p. {. + 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, // return elements[ + 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, // pos];. }. + 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x78, 0x70, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, // constexpr const + 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x54, 0x26, 0x20, 0x6f, // threadgroup T& o + 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x5b, 0x5d, 0x20, 0x28, 0x73, 0x69, 0x7a, 0x65, // perator [] (size + 0x5f, 0x74, 0x20, 0x70, 0x6f, 0x73, 0x29, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x20, 0x74, 0x68, // _t pos) const th + 0x72, 0x65, 0x61, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, // readgroup. {. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, // return e + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5b, 0x70, 0x6f, 0x73, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // lements[pos];. + 0x20, 0x20, 0x7d, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x5f, // }.};..struct _ + 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, // Global.{. flo + 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x3b, 0x0a, // at4 u_viewSize;. + 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x64, 0x69, 0x72, // float4 u_dir + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, // ection;.};..stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, // ct xlatMtlMain_o + 0x75, 0x74, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // ut.{. float4 + 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x20, 0x5b, // bgfx_FragData0 [ + 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, // [color(0)]];.};. + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // .struct xlatMtlM + 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, // ain_in.{. flo + 0x61, 0x74, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // at2 v_texcoord0 + 0x5b, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, 0x31, 0x29, 0x5d, 0x5d, 0x3b, // [[user(locn1)]]; + 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, // .};..fragment xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x78, 0x6c, // atMtlMain_out xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // atMtlMain(xlatMt + 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x5b, 0x5b, 0x73, 0x74, // lMain_in in [[st + 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, // age_in]], consta + 0x6e, 0x74, 0x20, 0x5f, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // nt _Global& _mtl + 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, // _u [[buffer(0)]] + 0x2c, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 0x6c, 0x6f, 0x61, // , texture2d s_tex [[textu + 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // re(0)]], sampler + 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5b, 0x5b, // s_texSampler [[ + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, // sampler(0)]]).{. + 0x20, 0x20, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x5f, // xlatMtlMain_ + 0x6f, 0x75, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // out out = {};. + 0x20, 0x20, 0x73, 0x70, 0x76, 0x55, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x41, 0x72, 0x72, 0x61, 0x79, // spvUnsafeArray + 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x2c, 0x20, 0x35, 0x3e, 0x20, 0x5f, 0x32, 0x31, 0x33, 0x3b, // _213; + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x31, 0x33, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, 0x30, // . _213[0] = 0 + 0x2e, 0x33, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x35, 0x37, 0x36, 0x32, 0x37, 0x38, // .340000003576278 + 0x36, 0x38, 0x36, 0x35, 0x32, 0x33, 0x34, 0x33, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 6865234375;. + 0x5f, 0x32, 0x31, 0x33, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x32, 0x35, 0x3b, 0x0a, // _213[1] = 0.25;. + 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x31, 0x33, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, // _213[2] = 0. + 0x31, 0x32, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x35, 0x32, 0x33, 0x31, 0x36, 0x32, 0x38, 0x34, // 1299999952316284 + 0x31, 0x37, 0x39, 0x36, 0x38, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x31, // 1796875;. _21 + 0x33, 0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x39, 0x39, 0x39, 0x39, 0x39, // 3[3] = 0.0599999 + 0x39, 0x38, 0x36, 0x35, 0x38, 0x38, 0x39, 0x35, 0x34, 0x39, 0x32, 0x35, 0x35, 0x33, 0x37, 0x31, // 9865889549255371 + 0x30, 0x39, 0x33, 0x37, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x32, 0x31, 0x33, 0x5b, // 09375;. _213[ + 0x34, 0x5d, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x31, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, // 4] = 0.019999999 + 0x35, 0x35, 0x32, 0x39, 0x36, 0x35, 0x31, 0x36, 0x34, 0x31, 0x38, 0x34, 0x35, 0x37, 0x30, 0x33, // 5529651641845703 + 0x31, 0x32, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, // 125;. float2 + 0x5f, 0x32, 0x34, 0x38, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x31, 0x2e, // _248 = float2(1. + 0x30, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, // 0) / _mtl_u.u_vi + 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, // ewSize.xy;. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x33, 0x34, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // loat4 _344;. + 0x5f, 0x33, 0x34, 0x34, 0x20, 0x3d, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, // _344 = s_tex.sam 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ple(s_texSampler - 0x2c, 0x20, 0x28, 0x5f, 0x32, 0x32, 0x35, 0x20, 0x2d, 0x20, 0x5f, 0x32, 0x33, 0x36, 0x29, 0x29, // , (_225 - _236)) - 0x20, 0x2a, 0x20, 0x5f, 0x31, 0x39, 0x37, 0x5b, 0x5f, 0x33, 0x31, 0x33, 0x5d, 0x29, 0x3b, 0x0a, // * _197[_313]);. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x31, 0x33, 0x2b, 0x2b, 0x3b, 0x0a, // _313++;. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, // continue - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, // ;. }. out. - 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x20, 0x3d, // bgfx_FragData0 = - 0x20, 0x5f, 0x33, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, // _314;. retur - 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x30, 0x00, // n out;.}....0. + 0x2c, 0x20, 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // , in.v_texcoord0 + 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x32, 0x31, 0x33, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, // ) * _213[0];. + 0x20, 0x66, 0x6f, 0x72, 0x20, 0x28, 0x69, 0x6e, 0x74, 0x20, 0x5f, 0x33, 0x34, 0x33, 0x20, 0x3d, // for (int _343 = + 0x20, 0x31, 0x3b, 0x20, 0x5f, 0x33, 0x34, 0x33, 0x20, 0x3c, 0x3d, 0x20, 0x34, 0x3b, 0x20, 0x29, // 1; _343 <= 4; ) + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, // . {. f + 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x5f, 0x32, 0x36, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, // loat2 _261 = (_m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // tl_u.u_direction + 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x5f, 0x32, 0x34, 0x38, 0x29, 0x20, 0x2a, 0x20, 0x66, 0x6c, // .xy * _248) * fl + 0x6f, 0x61, 0x74, 0x28, 0x5f, 0x33, 0x34, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // oat(_343);. + 0x20, 0x20, 0x20, 0x5f, 0x33, 0x34, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x33, 0x34, 0x34, 0x20, // _344 = (_344 + 0x2b, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, // + (s_tex.sample( + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2c, 0x20, 0x28, 0x69, // s_texSampler, (i + 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, // n.v_texcoord0 + + 0x5f, 0x32, 0x36, 0x31, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x32, 0x31, 0x33, 0x5b, 0x5f, 0x33, // _261)) * _213[_3 + 0x34, 0x33, 0x5d, 0x29, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, // 43])) + (s_tex.s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, // ample(s_texSampl + 0x65, 0x72, 0x2c, 0x20, 0x28, 0x69, 0x6e, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // er, (in.v_texcoo + 0x72, 0x64, 0x30, 0x20, 0x2d, 0x20, 0x5f, 0x32, 0x36, 0x31, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, // rd0 - _261)) * _ + 0x32, 0x31, 0x33, 0x5b, 0x5f, 0x33, 0x34, 0x33, 0x5d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 213[_343]);. + 0x20, 0x20, 0x20, 0x20, 0x5f, 0x33, 0x34, 0x33, 0x2b, 0x2b, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // _343++;. + 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x3b, 0x0a, 0x20, 0x20, // continue;. + 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x62, 0x67, 0x66, 0x78, // }. out.bgfx + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x33, 0x34, // _FragData0 = _34 + 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, // 4;. return ou + 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, 0x00, 0x40, 0x00, // t;.}....@. }; diff --git a/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h b/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h index 2226d45dd..e5e80ee49 100644 --- a/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h +++ b/Polyfills/Canvas/Source/Shaders/spirv/fs_gaussblur.h @@ -1,132 +1,141 @@ -static const uint8_t fs_gaussblur_spv[2060] = +static const uint8_t fs_gaussblur_spv[2193] = { - 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0b, 0x75, // FSH............u - 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, // _direction...... - 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, // .....s_tex0..... - 0x00, 0x02, 0x22, 0x00, 0xd0, 0x07, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, // ..".......#..... - 0x0b, 0x00, 0x08, 0x00, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, // ............GLSL - 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, // .std.450........ - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, // ....main........ - 0xac, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ - 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, // ....main........ - 0x23, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // #...s_texSampler - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x26, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, // ........&...s_te - 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, // xTexture........ - 0x6f, 0x00, 0x00, 0x00, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, // o...UniformBlock - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........o....... - 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, // u_direction..... - 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x9f, 0x00, 0x00, 0x00, // q............... - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, // v_texcoord0..... - 0xac, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ....bgfx_FragDat - 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // a0..G...#...!... - 0x12, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...#..."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...&...!... - 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...&..."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....G...o....... - 0x48, 0x00, 0x05, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...o.......#... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...q...!... - 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...q..."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xac, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... - 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ - 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, // ........ ....... - 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ - 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ............... - 0x20, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ..."........... - 0x3b, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ;..."...#....... - 0x20, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ...%........... - 0x3b, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ;...%...&....... - 0x15, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....)... ....... - 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // +...)...*....... - 0x2b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +...)........... - 0x1b, 0x00, 0x03, 0x00, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ....2........... - 0x43, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // C... .......+... - 0x43, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // C...D........... - 0x45, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // E.......D... ... - 0x46, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // F.......E...+... - 0x07, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0xc4, 0x79, 0x68, 0x3e, 0x2b, 0x00, 0x04, 0x00, // ....H....yh>+... - 0x07, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0xcf, 0x43, 0x47, 0x3e, 0x2b, 0x00, 0x04, 0x00, // ....J....CG>+... - 0x29, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...L.......+... - 0x07, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0xbf, 0x14, 0xf9, 0x3d, 0x2b, 0x00, 0x04, 0x00, // ....M......=+... - 0x29, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...O.......+... - 0x07, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xba, 0x67, 0x5d, 0x3d, 0x2b, 0x00, 0x04, 0x00, // ....P....g]=+... - 0x29, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // )...R.......+... - 0x07, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x6b, 0xd7, 0x84, 0x3c, 0x2b, 0x00, 0x04, 0x00, // ....S...k..<+... - 0x07, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x14, 0x00, 0x02, 0x00, // ....`......?.... - 0x6c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // l.......o....... - 0x20, 0x00, 0x04, 0x00, 0x70, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, // ...p.......o... - 0x3b, 0x00, 0x04, 0x00, 0x70, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...p...q....... - 0x20, 0x00, 0x04, 0x00, 0x72, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ...r........... - 0x20, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0xab, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0xab, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... - 0x2c, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, // ,.......8...`... - 0x60, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // `...6........... - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ - 0x3b, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;...F........... - 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // =.......$...#... - 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, // =.......'...&... - 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, // =............... - 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... - 0x2e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, // ....>.......H... - 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... - 0x2a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, // *...>.......J... - 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... - 0x4c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd5, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, // L...>.......M... - 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... - 0x4f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // O...>.......P... - 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, // A............... - 0x52, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd7, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // R...>.......S... - 0x56, 0x00, 0x05, 0x00, 0x32, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, // V...2.......'... - 0x24, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, // $...W........... - 0x16, 0x01, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, // ........A....... - 0xdb, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... - 0x07, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, // ................ - 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, // ................ - 0x60, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, // `............... - 0xdf, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xe2, 0x00, 0x00, 0x00, // ....8........... - 0xf8, 0x00, 0x02, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x3a, 0x01, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // :............... - 0xe6, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x29, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, // ........)...9... - 0x2a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, // *............... - 0xb3, 0x00, 0x05, 0x00, 0x6c, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, // ....l.......9... - 0x52, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0x06, 0x01, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, // R............... - 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xe5, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, // ................ - 0x06, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ............A... - 0x72, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, // r.......q....... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, // =............... - 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, // O............... - 0xe8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x04, 0x00, // ............o... - 0x07, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ........9....... - 0x0b, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, // ................ - 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, // ................ - 0xec, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x32, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, // ....V...2....... - 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // '...$...W....... - 0x21, 0x01, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // !...........A... - 0x13, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, // ............9... - 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, // =............... - 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x00, // ............!... - 0xf4, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, // ................ - 0x3a, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // :............... - 0xfa, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, // ............V... - 0x32, 0x00, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, // 2...(...'...$... - 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, // W.......*...(... - 0xfa, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, // ....A........... - 0xc5, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ....9...=....... - 0xff, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x00, 0x01, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, // ....*........... - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ - 0x80, 0x00, 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x39, 0x01, 0x00, 0x00, // ....).......9... - 0x2a, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // *............... - 0x06, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xac, 0x00, 0x00, 0x00, 0x3a, 0x01, 0x00, 0x00, // ....>.......:... - 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // ....8....... + 0x46, 0x53, 0x48, 0x0b, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0a, 0x75, // FSH............u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // _viewSize....... + 0x00, 0x00, 0x00, 0x0b, 0x75, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, // ....u_direction. + 0x01, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x30, // ..........s_tex0 + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x22, 0x00, 0x40, 0x08, 0x00, 0x00, 0x03, 0x02, 0x23, // .......".@.....# + 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x59, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // .........Y...... + 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... + 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0xb0, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, // ................ + 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x05, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, // .....'...s_texSa + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x2a, 0x00, 0x00, // mpler........*.. + 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, // .s_texTexture... + 0x00, 0x05, 0x00, 0x06, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // .....o...Uniform + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x6f, 0x00, 0x00, // Block........o.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x00, // .....u_viewSize. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x64, // .....o.......u_d + 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x05, 0x00, 0x03, 0x00, 0x71, 0x00, 0x00, // irection.....q.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, // .............v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xbd, 0x00, 0x00, // excoord0........ + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, // .G...'...!...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...'..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .G...*...!...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...*..."...... + 0x00, 0x47, 0x00, 0x03, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .G...o.......H.. + 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .o.......#...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...o.......#.. + 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, // .....G...q...!.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // .....G...q...".. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, // .............!.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, // ......... ...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // . .............. + 0x00, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // . ...&.......... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .;...&...'...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // . ...).......... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .;...)...*...... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....-... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .+...-.......... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .+...-...2...... + 0x00, 0x1b, 0x00, 0x03, 0x00, 0x36, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .....6.......... + 0x00, 0x4b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .K... .......+.. + 0x00, 0x4b, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .K...L.......... + 0x00, 0x4d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .M.......L... .. + 0x00, 0x4e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .N.......M...+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x7b, 0x14, 0xae, 0x3e, 0x2b, 0x00, 0x04, // .....P...{..>+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3e, 0x2b, 0x00, 0x04, // .....R......>+.. + 0x00, 0x2d, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .-...T.......+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0xb8, 0x1e, 0x05, 0x3e, 0x2b, 0x00, 0x04, // .....U......>+.. + 0x00, 0x2d, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .-...W.......+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x8f, 0xc2, 0x75, 0x3d, 0x2b, 0x00, 0x04, // .....X.....u=+.. + 0x00, 0x2d, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .-...Z.......+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x0a, 0xd7, 0xa3, 0x3c, 0x2b, 0x00, 0x04, // .....[......<+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x1e, 0x00, 0x04, // .....l......?... + 0x00, 0x6f, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .o........... .. + 0x00, 0x70, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .p.......o...;.. + 0x00, 0x70, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .p...q....... .. + 0x00, 0x72, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x14, 0x00, 0x02, // .r.............. + 0x00, 0x7f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xac, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xac, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x56, 0x01, 0x00, // .....,.......V.. + 0x00, 0x6c, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, // .l...l...6...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, // .....;...N...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .....=.......(.. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, // .'...=.......+.. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, // .*...=.......... + 0x00, 0xb0, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, // .....A.......... + 0x00, 0xd5, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe5, 0x00, 0x00, // .....2...>...... + 0x00, 0x50, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, // .P...A.......... + 0x00, 0xd5, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe6, 0x00, 0x00, // .........>...... + 0x00, 0x52, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, // .R...A.......... + 0x00, 0xd5, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe7, 0x00, 0x00, // .....T...>...... + 0x00, 0x55, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, // .U...A.......... + 0x00, 0xd5, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe8, 0x00, 0x00, // .....W...>...... + 0x00, 0x58, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, // .X...A.......... + 0x00, 0xd5, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe9, 0x00, 0x00, // .....Z...>...... + 0x00, 0x5b, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x36, 0x00, 0x00, 0x00, 0x2f, 0x01, 0x00, // .[...V...6.../.. + 0x00, 0x2b, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // .+...(...W...... + 0x00, 0x31, 0x01, 0x00, 0x00, 0x2f, 0x01, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, // .1.../.......A.. + 0x00, 0x13, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, // .............2.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, // .=.............. + 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0x31, 0x01, 0x00, // .............1.. + 0x00, 0xf2, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x72, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, // .....A...r...... + 0x00, 0x71, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .q...2...=...... + 0x00, 0xf6, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, // .........O...... + 0x00, 0xf7, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, // ................ + 0x00, 0x56, 0x01, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xf9, 0x00, 0x00, // .V.............. + 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, // ................ + 0x00, 0x58, 0x01, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, // .X.............. + 0x00, 0xfd, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, // .........-...W.. + 0x00, 0x2e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x1e, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x00, // ................ + 0x00, 0xb3, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, // .............W.. + 0x00, 0x5a, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0x1f, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x00, // .Z.............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, // ................ + 0x00, 0x1f, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xfd, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, // .............A.. + 0x00, 0x72, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, // .r.......q...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, // .=.............. + 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, // .O.............. + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x00, // ................ + 0x00, 0x6f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x57, 0x01, 0x00, // .o...........W.. + 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ + 0x00, 0x04, 0x01, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, // ................ + 0x00, 0xb1, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x36, 0x00, 0x00, // .........V...6.. + 0x00, 0x3c, 0x01, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, // .<...+...(...W.. + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x08, 0x01, 0x00, // .....>...<...... + 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0xd5, 0x00, 0x00, // .A.............. + 0x00, 0x57, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x01, 0x00, // .W...=.......... + 0x00, 0x0c, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x00, // ................ + 0x00, 0x3e, 0x01, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // .>.............. + 0x00, 0x10, 0x01, 0x00, 0x00, 0x58, 0x01, 0x00, 0x00, 0x0e, 0x01, 0x00, 0x00, 0x83, 0x00, 0x05, // .....X.......... + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, // ................ + 0x00, 0x56, 0x00, 0x05, 0x00, 0x36, 0x00, 0x00, 0x00, 0x45, 0x01, 0x00, 0x00, 0x2b, 0x00, 0x00, // .V...6...E...+.. + 0x00, 0x28, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x47, 0x01, 0x00, // .(...W.......G.. + 0x00, 0x45, 0x01, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, // .E.......A...... + 0x00, 0x17, 0x01, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0x57, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, // .........W...=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x17, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, // ................ + 0x00, 0x0d, 0x00, 0x00, 0x00, 0x19, 0x01, 0x00, 0x00, 0x47, 0x01, 0x00, 0x00, 0x18, 0x01, 0x00, // .........G...... + 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, // ................ + 0x00, 0x19, 0x01, 0x00, 0x00, 0x80, 0x00, 0x05, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x1e, 0x01, 0x00, // .........-...... + 0x00, 0x57, 0x01, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xf9, 0x00, 0x00, // .W.............. + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbd, 0x00, 0x00, // .........>...... + 0x00, 0x58, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, // .X.......8..... + 0x00, // . }; diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index dfc1cc2f5..ba78682c4 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -862,6 +862,7 @@ namespace outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); }; Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; + finalFrameBuffer->Bind(*gl->encoder); // Should this be bound elsewhere? call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, gl->frameBufferPool.acquire, gl->frameBufferPool.release); } @@ -901,6 +902,7 @@ namespace outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); }; Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; + finalFrameBuffer->Bind(*gl->encoder); // Should this be bound elsewhere? call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, gl->frameBufferPool.acquire, gl->frameBufferPool.release); } From 62ec4b735e6cacbe58bc56fce6cff1b7ce2e0af9 Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Thu, 3 Apr 2025 17:22:38 +1100 Subject: [PATCH 22/24] support filter passes in glnvg__fill, glnvg__convexfill --- .../Canvas/Source/nanovg/nanovg_babylon.cpp | 235 +++++++++--------- 1 file changed, 124 insertions(+), 111 deletions(-) diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index ba78682c4..d61e0112d 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -705,133 +705,155 @@ namespace static void glnvg__fill(struct GLNVGcontext* gl, struct GLNVGcall* call) { - struct GLNVGpath* paths = &gl->paths[call->pathOffset]; - int i, npaths = call->pathCount; + bgfx::ProgramHandle firstProg = gl->prog; + std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { + gl->encoder->setUniform(u, value); + }; + std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { - // set bindpoint for solid loc - nvgRenderSetUniforms(gl, call->uniformOffset, 0, 0); + struct GLNVGpath* paths = &gl->paths[call->pathOffset]; + int i, npaths = call->pathCount; - for (i = 0; i < npaths; i++) - { - if (2 < paths[i].fillCount) + // set bindpoint for solid loc + nvgRenderSetUniforms(gl, call->uniformOffset, 0, 0); + + for (i = 0; i < npaths; i++) { - gl->encoder->setState(0); - gl->encoder->setStencil(0 - | BGFX_STENCIL_TEST_ALWAYS - | BGFX_STENCIL_FUNC_RMASK(0xff) - | BGFX_STENCIL_OP_FAIL_S_KEEP - | BGFX_STENCIL_OP_FAIL_Z_KEEP - | BGFX_STENCIL_OP_PASS_Z_INCR - , 0 - | BGFX_STENCIL_TEST_ALWAYS - | BGFX_STENCIL_FUNC_RMASK(0xff) - | BGFX_STENCIL_OP_FAIL_S_KEEP - | BGFX_STENCIL_OP_FAIL_Z_KEEP - | BGFX_STENCIL_OP_PASS_Z_DECR - ); - gl->encoder->setVertexBuffer(0, &gl->tvb); - gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->encoder->setTexture(1, gl->s_tex2, gl->th2); - fan(gl->encoder, paths[i].fillOffset, paths[i].fillCount); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + if (2 < paths[i].fillCount) + { + gl->encoder->setState(0); + gl->encoder->setStencil(0 + | BGFX_STENCIL_TEST_ALWAYS + | BGFX_STENCIL_FUNC_RMASK(0xff) + | BGFX_STENCIL_OP_FAIL_S_KEEP + | BGFX_STENCIL_OP_FAIL_Z_KEEP + | BGFX_STENCIL_OP_PASS_Z_INCR + , 0 + | BGFX_STENCIL_TEST_ALWAYS + | BGFX_STENCIL_FUNC_RMASK(0xff) + | BGFX_STENCIL_OP_FAIL_S_KEEP + | BGFX_STENCIL_OP_FAIL_Z_KEEP + | BGFX_STENCIL_OP_PASS_Z_DECR + ); + gl->encoder->setVertexBuffer(0, &gl->tvb); + gl->encoder->setTexture(0, gl->s_tex, gl->th); + gl->encoder->setTexture(1, gl->s_tex2, gl->th2); + fan(gl->encoder, paths[i].fillOffset, paths[i].fillCount); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + } } - } - // Draw aliased off-pixels - nvgRenderSetUniforms(gl, call->uniformOffset + gl->fragSize, call->image, call->image2); + // Draw aliased off-pixels + nvgRenderSetUniforms(gl, call->uniformOffset + gl->fragSize, call->image, call->image2); - if (gl->edgeAntiAlias) - { - // Draw fringes - for (i = 0; i < npaths; i++) + if (gl->edgeAntiAlias) { - gl->encoder->setState(gl->state - | BGFX_STATE_PT_TRISTRIP - ); - gl->encoder->setStencil(0 - | BGFX_STENCIL_TEST_EQUAL + // Draw fringes + for (i = 0; i < npaths; i++) + { + gl->encoder->setState(gl->state + | BGFX_STATE_PT_TRISTRIP + ); + gl->encoder->setStencil(0 + | BGFX_STENCIL_TEST_EQUAL + | BGFX_STENCIL_FUNC_RMASK(0xff) + | BGFX_STENCIL_OP_FAIL_S_KEEP + | BGFX_STENCIL_OP_FAIL_Z_KEEP + | BGFX_STENCIL_OP_PASS_Z_KEEP + ); + gl->encoder->setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); + gl->encoder->setTexture(0, gl->s_tex, gl->th); + gl->encoder->setTexture(1, gl->s_tex2, gl->th2); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + } + } + + // Draw fill + gl->encoder->setState(gl->state); + gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); + gl->encoder->setTexture(0, gl->s_tex, gl->th); + gl->encoder->setTexture(1, gl->s_tex2, gl->th2); + gl->encoder->setStencil(0 + | BGFX_STENCIL_TEST_NOTEQUAL | BGFX_STENCIL_FUNC_RMASK(0xff) - | BGFX_STENCIL_OP_FAIL_S_KEEP - | BGFX_STENCIL_OP_FAIL_Z_KEEP - | BGFX_STENCIL_OP_PASS_Z_KEEP + | BGFX_STENCIL_OP_FAIL_S_ZERO + | BGFX_STENCIL_OP_FAIL_Z_ZERO + | BGFX_STENCIL_OP_PASS_Z_ZERO ); - gl->encoder->setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); - gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->encoder->setTexture(1, gl->s_tex2, gl->th2); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); - } - } + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + }; + std::function filterPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *inBuffer, Babylon::Graphics::FrameBuffer *outBuffer) { + gl->encoder->setUniform(gl->u_viewSize, gl->view); // TODO: also set other common uniforms + gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A + | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) + | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); + gl->encoder->setTexture(0, gl->s_tex, bgfx::getTexture(inBuffer->Handle())); + bool s_originBottomLeft = bgfx::getCaps()->originBottomLeft; + screenSpaceQuad(gl->encoder, s_originBottomLeft); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + }; + Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; + finalFrameBuffer->Bind(*gl->encoder); // Should this be bound elsewhere? - // Draw fill - gl->encoder->setState(gl->state); - gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); - gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->encoder->setTexture(1, gl->s_tex2, gl->th2); - gl->encoder->setStencil(0 - | BGFX_STENCIL_TEST_NOTEQUAL - | BGFX_STENCIL_FUNC_RMASK(0xff) - | BGFX_STENCIL_OP_FAIL_S_ZERO - | BGFX_STENCIL_OP_FAIL_Z_ZERO - | BGFX_STENCIL_OP_PASS_Z_ZERO - ); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, gl->frameBufferPool.acquire, gl->frameBufferPool.release); } static void glnvg__convexFill(struct GLNVGcontext* gl, struct GLNVGcall* call) { - struct GLNVGpath* paths = &gl->paths[call->pathOffset]; - int i, npaths = call->pathCount; - - nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); + bgfx::ProgramHandle firstProg = gl->prog; + std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { + gl->encoder->setUniform(u, value); + }; + std::function firstPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *outBuffer) { + struct GLNVGpath* paths = &gl->paths[call->pathOffset]; + int i, npaths = call->pathCount; - for (i = 0; i < npaths; i++) - { - if (paths[i].fillCount == 0) continue; - gl->encoder->setState(gl->state); - gl->encoder->setVertexBuffer(0, &gl->tvb); - gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->encoder->setTexture(1, gl->s_tex2, gl->th2); - fan(gl->encoder, paths[i].fillOffset, paths[i].fillCount); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); - } + nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); - if (gl->edgeAntiAlias) - { - // Draw fringes for (i = 0; i < npaths; i++) { - gl->encoder->setState(gl->state - | BGFX_STATE_PT_TRISTRIP - ); - gl->encoder->setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); + if (paths[i].fillCount == 0) continue; + gl->encoder->setState(gl->state); + gl->encoder->setVertexBuffer(0, &gl->tvb); gl->encoder->setTexture(0, gl->s_tex, gl->th); gl->encoder->setTexture(1, gl->s_tex2, gl->th2); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); + fan(gl->encoder, paths[i].fillOffset, paths[i].fillCount); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); } - } + + if (gl->edgeAntiAlias) + { + // Draw fringes + for (i = 0; i < npaths; i++) + { + gl->encoder->setState(gl->state + | BGFX_STATE_PT_TRISTRIP + ); + gl->encoder->setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); + gl->encoder->setTexture(0, gl->s_tex, gl->th); + gl->encoder->setTexture(1, gl->s_tex2, gl->th2); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + } + } + }; + std::function filterPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *inBuffer, Babylon::Graphics::FrameBuffer *outBuffer) { + gl->encoder->setUniform(gl->u_viewSize, gl->view); // TODO: also set other common uniforms + gl->encoder->setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A + | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_INV_SRC_ALPHA) + | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_ADD)); + gl->encoder->setTexture(0, gl->s_tex, bgfx::getTexture(inBuffer->Handle())); + bool s_originBottomLeft = bgfx::getCaps()->originBottomLeft; + screenSpaceQuad(gl->encoder, s_originBottomLeft); + outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); + }; + Babylon::Graphics::FrameBuffer *finalFrameBuffer = gl->frameBuffer; + finalFrameBuffer->Bind(*gl->encoder); // Should this be bound elsewhere? + + call->filterStack.Render(firstProg, setUniform, firstPass, filterPass, finalFrameBuffer, gl->frameBufferPool.acquire, gl->frameBufferPool.release); } static void glnvg__stroke(struct GLNVGcontext* gl, struct GLNVGcall* call) { - /* - struct GLNVGpath* paths = &gl->paths[call->pathOffset]; - int npaths = call->pathCount, i; - - nvgRenderSetUniforms(gl, call->uniformOffset, call->image, call->image2); - - // Draw Strokes - for (i = 0; i < npaths; i++) - { - gl->encoder->setState(gl->state - | BGFX_STATE_PT_TRISTRIP - ); - gl->encoder->setVertexBuffer(0, &gl->tvb, paths[i].strokeOffset, paths[i].strokeCount); - gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->encoder->setTexture(1, gl->s_tex2, gl->th2); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); - } - */ - bgfx::ProgramHandle firstProg = gl->prog; std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { gl->encoder->setUniform(u, value); @@ -871,15 +893,6 @@ namespace { if (3 <= call->vertexCount) { - /* - nvgRenderSetUniforms(gl, call->uniformOffset, call->image); - - gl->encoder->setState(gl->state); - gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); - gl->encoder->setTexture(0, gl->s_tex, gl->th); - gl->frameBuffer->Submit(*gl->encoder, gl->prog, BGFX_DISCARD_ALL); - */ - bgfx::ProgramHandle firstProg = gl->prog; std::function setUniform = [gl](bgfx::UniformHandle u, const void *value) { gl->encoder->setUniform(u, value); From d514391f44a5e1612c2d4592bfabaf4bd29cb2be Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Thu, 3 Apr 2025 21:42:38 +1100 Subject: [PATCH 23/24] fix: pass second texture to glnvg__triangles, gradient text works again --- Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp index d61e0112d..5a8eeddc4 100644 --- a/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp +++ b/Polyfills/Canvas/Source/nanovg/nanovg_babylon.cpp @@ -902,6 +902,7 @@ namespace gl->encoder->setState(gl->state); gl->encoder->setVertexBuffer(0, &gl->tvb, call->vertexOffset, call->vertexCount); gl->encoder->setTexture(0, gl->s_tex, gl->th); + gl->encoder->setTexture(1, gl->s_tex2, gl->th2); outBuffer->Submit(*gl->encoder, prog, BGFX_DISCARD_ALL); }; std::function filterPass = [gl, call](bgfx::ProgramHandle prog, Babylon::Graphics::FrameBuffer *inBuffer, Babylon::Graphics::FrameBuffer *outBuffer) { From 86095b3fa9da6ae9954720c385e525c72c3fcf4d Mon Sep 17 00:00:00 2001 From: Jun Min Cheong Date: Mon, 7 Apr 2025 20:24:59 +1000 Subject: [PATCH 24/24] do bgfx::ReleaseFn, bx::memSet for FrameBufferPool textures --- Polyfills/Canvas/Source/FrameBufferPool.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Polyfills/Canvas/Source/FrameBufferPool.cpp b/Polyfills/Canvas/Source/FrameBufferPool.cpp index ada811a16..f3b660daf 100644 --- a/Polyfills/Canvas/Source/FrameBufferPool.cpp +++ b/Polyfills/Canvas/Source/FrameBufferPool.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include "FrameBufferPool.h" @@ -29,10 +30,19 @@ namespace Babylon::Polyfills { bgfx::FrameBufferHandle TextBuffer{bgfx::kInvalidHandle}; Graphics::FrameBuffer* FrameBuffer; - int width(256), height(256); + + // make sure render targets are filled with 0 : https://registry.khronos.org/webgl/specs/latest/1.0/#TEXIMAGE2D + bgfx::ReleaseFn releaseFn{[](void*, void* userData) { + bimg::imageFree(static_cast(userData)); + }}; + + bimg::ImageContainer* image = bimg::imageAlloc(&Babylon::Graphics::DeviceContext::GetDefaultAllocator(), bimg::TextureFormat::RGBA8, width, height, 1 /*depth*/, 1, false /*cubeMap*/, false /*hasMips*/); + const bgfx::Memory* mem = bgfx::makeRef(image->m_data, image->m_size, releaseFn, image); + bx::memSet(image->m_data, 0, image->m_size); + std::array textures{ - bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT)}; + bgfx::createTexture2D(width, height, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT, mem)}; std::array attachments{}; for (size_t idx = 0; idx < attachments.size(); ++idx)