diff --git a/Runtime/Graphics/Shaders/CWorldShadowShader.cpp b/Runtime/Graphics/Shaders/CWorldShadowShader.cpp index b083a6dde..ff28220ab 100644 --- a/Runtime/Graphics/Shaders/CWorldShadowShader.cpp +++ b/Runtime/Graphics/Shaders/CWorldShadowShader.cpp @@ -4,11 +4,16 @@ namespace urde { CWorldShadowShader::CWorldShadowShader(u32 w, u32 h) -: m_w(w), m_h(h) {} - -void CWorldShadowShader::_buildTex(boo::IGraphicsDataFactory::Context& ctx) +: m_w(w), m_h(h) { - m_tex = ctx.newRenderTexture(m_w, m_h, boo::TextureClampMode::ClampToWhite, 1, 0); + m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) + { + m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 16, 4); + m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1); + m_dataBind = TShader::BuildShaderDataBinding(ctx, *this); + m_tex = ctx.newRenderTexture(m_w, m_h, boo::TextureClampMode::ClampToWhite, 1, 0); + return true; + }); } void CWorldShadowShader::bindRenderTarget() diff --git a/Runtime/Graphics/Shaders/CWorldShadowShader.hpp b/Runtime/Graphics/Shaders/CWorldShadowShader.hpp index 1619abacc..c709c9b9f 100644 --- a/Runtime/Graphics/Shaders/CWorldShadowShader.hpp +++ b/Runtime/Graphics/Shaders/CWorldShadowShader.hpp @@ -15,6 +15,7 @@ class CWorldShadowShader friend struct CWorldShadowShaderD3DDataBindingFactory; friend struct CWorldShadowShaderMetalDataBindingFactory; + boo::GraphicsDataToken m_token; boo::ITextureR* m_tex; std::experimental::optional m_prevQuad; u32 m_w, m_h; @@ -31,8 +32,6 @@ class CWorldShadowShader boo::IShaderDataBinding* m_zDataBind = nullptr; Uniform m_uniform; - void _buildTex(boo::IGraphicsDataFactory::Context& ctx); - public: CWorldShadowShader(u32 w, u32 h); void bindRenderTarget(); diff --git a/Runtime/Graphics/Shaders/CWorldShadowShaderGLSL.cpp b/Runtime/Graphics/Shaders/CWorldShadowShaderGLSL.cpp index 5fedad08f..239a91e3b 100644 --- a/Runtime/Graphics/Shaders/CWorldShadowShaderGLSL.cpp +++ b/Runtime/Graphics/Shaders/CWorldShadowShaderGLSL.cpp @@ -67,7 +67,6 @@ struct CWorldShadowShaderGLDataBindingFactory : TShader::IDa filter.m_zDataBind = cctx.newShaderDataBinding(s_ZPipeline, vtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr); - filter._buildTex(ctx); return nullptr; } }; @@ -87,7 +86,6 @@ struct CWorldShadowShaderVulkanDataBindingFactory : TShader: filter.m_zDataBind = cctx.newShaderDataBinding(s_ZPipeline, s_VtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs, nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr); - filter._buildTex(ctx); return nullptr; } }; diff --git a/Runtime/Graphics/Shaders/CWorldShadowShaderHLSL.cpp b/Runtime/Graphics/Shaders/CWorldShadowShaderHLSL.cpp index 1f24eecc9..2958a5da0 100644 --- a/Runtime/Graphics/Shaders/CWorldShadowShaderHLSL.cpp +++ b/Runtime/Graphics/Shaders/CWorldShadowShaderHLSL.cpp @@ -61,7 +61,6 @@ struct CWorldShadowShaderD3DDataBindingFactory : TShader::ID filter.m_zDataBind = cctx.newShaderDataBinding(s_ZPipeline, s_VtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs, nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr); - filter._buildTex(ctx); return nullptr; } }; diff --git a/Runtime/Graphics/Shaders/CWorldShadowShaderMetal.cpp b/Runtime/Graphics/Shaders/CWorldShadowShaderMetal.cpp index 787fc662d..9a462b168 100644 --- a/Runtime/Graphics/Shaders/CWorldShadowShaderMetal.cpp +++ b/Runtime/Graphics/Shaders/CWorldShadowShaderMetal.cpp @@ -65,7 +65,6 @@ struct CWorldShadowShaderMetalDataBindingFactory : TShader:: filter.m_zDataBind = cctx.newShaderDataBinding(s_ZPipeline, s_VtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs, nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr); - filter._buildTex(ctx); return nullptr; } }; diff --git a/hecl b/hecl index 2ff1ff22b..8f8c02721 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 2ff1ff22b3ba5ef8c89de1faea6c992ad4542952 +Subproject commit 8f8c02721a9d28b1e0ff4e9c741e55102e1c62b5