Vulkan and HLSL object tracker support

This commit is contained in:
Jack Andersen 2017-11-05 20:58:04 -10:00
parent 3894749675
commit 62c1dc467f
47 changed files with 801 additions and 347 deletions

View File

@ -70,14 +70,15 @@ struct CAABoxShaderGLDataBindingFactory : TShader<CAABoxShader>::IDataBindingFac
#if BOO_HAS_VULKAN
struct CAABoxShaderVulkanDataBindingFactory : TShader<CAABoxShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CAABoxShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CAABoxShader& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
return cctx.newShaderDataBinding(filter.m_zOnly ? s_zOnlyPipeline : s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
@ -118,6 +119,14 @@ TShader<CAABoxShader>::IDataBindingFactory* CAABoxShader::Initialize(boo::Vulkan
boo::ZTest::LEqual, true, false, false, boo::CullMode::None);
return new CAABoxShaderVulkanDataBindingFactory;
}
template <>
void CAABoxShader::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
s_zOnlyPipeline.reset();
}
#endif
}

View File

@ -44,20 +44,21 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CAABoxShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::IShaderPipeline* s_zOnlyPipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
static boo::ObjToken<boo::IShaderPipeline> s_zOnlyPipeline;
struct CAABoxShaderD3DDataBindingFactory : TShader<CAABoxShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CAABoxShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CAABoxShader& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
return cctx.newShaderDataBinding(filter.m_zOnly ? s_zOnlyPipeline : s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
@ -78,4 +79,12 @@ TShader<CAABoxShader>::IDataBindingFactory* CAABoxShader::Initialize(boo::ID3DDa
return new CAABoxShaderD3DDataBindingFactory;
}
template <>
void CAABoxShader::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
s_zOnlyPipeline.reset();
}
}

View File

@ -106,15 +106,16 @@ struct CCameraBlurFilterGLDataBindingFactory : TShader<CCameraBlurFilter>::IData
#if BOO_HAS_VULKAN
struct CCameraBlurFilterVulkanDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraBlurFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraBlurFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -150,6 +151,13 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CCameraBlurFilterVulkanDataBindingFactory;
}
template <>
void CCameraBlurFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
#endif
}

View File

@ -87,20 +87,21 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
struct CCameraBlurFilterD3DDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraBlurFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraBlurFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -120,4 +121,11 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
return new CCameraBlurFilterD3DDataBindingFactory;
}
template <>
void CCameraBlurFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
}

View File

@ -85,15 +85,15 @@ struct CColoredQuadFilterGLDataBindingFactory : TMultiBlendShader<CColoredQuadFi
#if BOO_HAS_VULKAN
struct CColoredQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CColoredQuadFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CColoredQuadFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
@ -143,6 +143,15 @@ CColoredQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CColoredQuadFilterVulkanDataBindingFactory;
}
template <>
void CColoredQuadFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_AlphaPipeline.reset();
s_AddPipeline.reset();
s_MultPipeline.reset();
}
#endif
}

View File

@ -43,12 +43,12 @@ static const char* FS =
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
{
switch (type)
{
@ -59,21 +59,21 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
return {};
}
}
struct CColoredQuadFilterD3DDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CColoredQuadFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CColoredQuadFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
@ -101,4 +101,13 @@ CColoredQuadFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CColoredQuadFilterD3DDataBindingFactory;
}
template <>
void CColoredQuadFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_AlphaPipeline.reset();
s_AddPipeline.reset();
s_MultPipeline.reset();
}
}

View File

@ -484,8 +484,9 @@ void CElementGenShaders::Shutdown<boo::GLDataFactory>()
#if BOO_HAS_VULKAN
struct VulkanElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CElementGenShaders& shaders)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CElementGenShaders& shaders)
{
CElementGen& gen = shaders.m_gen;
CGenDescription* desc = gen.GetDesc();
@ -493,7 +494,7 @@ struct VulkanElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindi
CUVElement* texr = desc->x54_x40_TEXR.get();
CUVElement* tind = desc->x58_x44_TIND.get();
int texCount = 0;
boo::ITexture* textures[3];
boo::ObjToken<boo::ITexture> textures[3];
if (texr)
{
@ -501,7 +502,7 @@ struct VulkanElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindi
texCount = 1;
if (tind)
{
textures[1] = CGraphics::g_SpareTexture;
textures[1] = CGraphics::g_SpareTexture.get();
textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture();
texCount = 3;
}
@ -509,39 +510,39 @@ struct VulkanElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindi
if (gen.m_instBuf)
{
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
if (shaders.m_regPipeline)
gen.m_normalDataBind = ctx.newShaderDataBinding(shaders.m_regPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures, nullptr, nullptr);
if (shaders.m_regPipelineSub)
gen.m_normalSubDataBind = ctx.newShaderDataBinding(shaders.m_regPipelineSub, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures, nullptr, nullptr);
if (shaders.m_redToAlphaPipeline)
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(shaders.m_redToAlphaPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures, nullptr, nullptr);
if (shaders.m_redToAlphaPipelineSub)
gen.m_redToAlphaSubDataBind = ctx.newShaderDataBinding(shaders.m_redToAlphaPipelineSub, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures, nullptr, nullptr);
}
if (gen.m_instBufPmus)
{
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBufPmus};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBufPmus.get()};
texCount = std::min(texCount, 1);
if (shaders.m_regPipelinePmus)
gen.m_normalDataBindPmus = ctx.newShaderDataBinding(shaders.m_regPipelinePmus, nullptr, nullptr,
gen.m_instBufPmus, nullptr, 1, uniforms,
gen.m_instBufPmus.get(), nullptr, 1, uniforms,
nullptr, texCount, textures, nullptr, nullptr);
if (shaders.m_redToAlphaPipelinePmus)
gen.m_redToAlphaDataBindPmus = ctx.newShaderDataBinding(shaders.m_redToAlphaPipelinePmus, nullptr, nullptr,
gen.m_instBufPmus, nullptr, 1, uniforms,
gen.m_instBufPmus.get(), nullptr, 1, uniforms,
nullptr, texCount, textures, nullptr, nullptr);
}
@ -700,6 +701,42 @@ TShader<CElementGenShaders>::IDataBindingFactory* CElementGenShaders::Initialize
return new struct VulkanElementDataBindingFactory;
}
template <>
void CElementGenShaders::Shutdown<boo::VulkanDataFactory>()
{
m_vtxFormatTex.reset();
m_vtxFormatIndTex.reset();
m_vtxFormatNoTex.reset();
m_texZTestZWrite.reset();
m_texNoZTestZWrite.reset();
m_texZTestNoZWrite.reset();
m_texNoZTestNoZWrite.reset();
m_texAdditiveZTest.reset();
m_texAdditiveNoZTest.reset();
m_texRedToAlphaZTest.reset();
m_texRedToAlphaNoZTest.reset();
m_texZTestNoZWriteSub.reset();
m_texNoZTestNoZWriteSub.reset();
m_texRedToAlphaZTestSub.reset();
m_texRedToAlphaNoZTestSub.reset();
m_indTexZWrite.reset();
m_indTexNoZWrite.reset();
m_indTexAdditive.reset();
m_cindTexZWrite.reset();
m_cindTexNoZWrite.reset();
m_cindTexAdditive.reset();
m_noTexZTestZWrite.reset();
m_noTexNoZTestZWrite.reset();
m_noTexZTestNoZWrite.reset();
m_noTexNoZTestNoZWrite.reset();
m_noTexAdditiveZTest.reset();
m_noTexAdditiveNoZTest.reset();
}
#endif
}

View File

@ -189,8 +189,9 @@ static const char* FS_HLSL_NOTEX =
struct D3DElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CElementGenShaders& shaders)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CElementGenShaders& shaders)
{
CElementGen& gen = shaders.m_gen;
CGenDescription* desc = gen.GetDesc();
@ -198,7 +199,7 @@ struct D3DElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
CUVElement* texr = desc->x54_x40_TEXR.get();
CUVElement* tind = desc->x58_x44_TIND.get();
int texCount = 0;
boo::ITexture* textures[3];
boo::ObjToken<boo::ITexture> textures[3];
if (texr)
{
@ -206,7 +207,7 @@ struct D3DElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
texCount = 1;
if (tind)
{
textures[1] = CGraphics::g_SpareTexture;
textures[1] = CGraphics::g_SpareTexture.get();
textures[2] = tind->GetValueTexture(0).GetObj()->GetBooTexture();
texCount = 3;
}
@ -214,43 +215,43 @@ struct D3DElementDataBindingFactory : TShader<CElementGenShaders>::IDataBindingF
if (gen.m_instBuf)
{
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
if (shaders.m_regPipeline)
gen.m_normalDataBind = ctx.newShaderDataBinding(shaders.m_regPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures,
nullptr, nullptr);
if (shaders.m_regPipelineSub)
gen.m_normalSubDataBind = ctx.newShaderDataBinding(shaders.m_regPipelineSub, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures,
nullptr, nullptr);
if (shaders.m_redToAlphaPipeline)
gen.m_redToAlphaDataBind = ctx.newShaderDataBinding(shaders.m_redToAlphaPipeline, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures,
nullptr, nullptr);
if (shaders.m_redToAlphaPipelineSub)
gen.m_redToAlphaSubDataBind = ctx.newShaderDataBinding(shaders.m_redToAlphaPipelineSub, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures,
nullptr, nullptr);
}
if (gen.m_instBufPmus)
{
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBufPmus};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBufPmus.get()};
texCount = std::min(texCount, 1);
if (shaders.m_regPipelinePmus)
gen.m_normalDataBindPmus = ctx.newShaderDataBinding(shaders.m_regPipelinePmus, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures,
nullptr, nullptr);
if (shaders.m_redToAlphaPipelinePmus)
gen.m_redToAlphaDataBindPmus = ctx.newShaderDataBinding(shaders.m_redToAlphaPipelinePmus, nullptr, nullptr,
gen.m_instBuf, nullptr, 1, uniforms,
gen.m_instBuf.get(), nullptr, 1, uniforms,
nullptr, texCount, textures,
nullptr, nullptr);
}
@ -432,4 +433,40 @@ TShader<CElementGenShaders>::IDataBindingFactory* CElementGenShaders::Initialize
return new struct D3DElementDataBindingFactory;
}
template <>
void CElementGenShaders::Shutdown<boo::ID3DDataFactory>()
{
m_vtxFormatTex.reset();
m_vtxFormatIndTex.reset();
m_vtxFormatNoTex.reset();
m_texZTestZWrite.reset();
m_texNoZTestZWrite.reset();
m_texZTestNoZWrite.reset();
m_texNoZTestNoZWrite.reset();
m_texAdditiveZTest.reset();
m_texAdditiveNoZTest.reset();
m_texRedToAlphaZTest.reset();
m_texRedToAlphaNoZTest.reset();
m_texZTestNoZWriteSub.reset();
m_texNoZTestNoZWriteSub.reset();
m_texRedToAlphaZTestSub.reset();
m_texRedToAlphaNoZTestSub.reset();
m_indTexZWrite.reset();
m_indTexNoZWrite.reset();
m_indTexAdditive.reset();
m_cindTexZWrite.reset();
m_cindTexNoZWrite.reset();
m_cindTexAdditive.reset();
m_noTexZTestZWrite.reset();
m_noTexNoZTestZWrite.reset();
m_noTexZTestNoZWrite.reset();
m_noTexNoZTestNoZWrite.reset();
m_noTexAdditiveZTest.reset();
m_noTexAdditiveNoZTest.reset();
}
}

View File

@ -83,18 +83,18 @@ struct CEnergyBarShaderGLDataBindingFactory : TShader<CEnergyBarShader>::IDataBi
#if BOO_HAS_VULKAN
struct CEnergyBarShaderVulkanDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CEnergyBarShader& filter)
boo::ObjToken<boo::IShaderDataBinding> BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CEnergyBarShader& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[1];
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
boo::ObjToken<boo::IGraphicsBuffer> bufs[1];
boo::ObjToken<boo::ITexture> texs[] = {filter.m_tex->GetBooTexture()};
for (int i=0 ; i<3 ; ++i)
{
bufs[0] = filter.m_uniBuf[i];
bufs[0] = filter.m_uniBuf[i].get();
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
return filter.m_dataBind[0];
@ -134,6 +134,13 @@ CEnergyBarShader::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
return new CEnergyBarShaderVulkanDataBindingFactory;
}
template <>
void CEnergyBarShader::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
#endif
}

View File

@ -52,23 +52,24 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CEnergyBarShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
struct CEnergyBarShaderD3DDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CEnergyBarShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CEnergyBarShader& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[1];
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
boo::ObjToken<boo::IGraphicsBuffer> bufs[1];
boo::ObjToken<boo::ITexture> texs[] = {filter.m_tex->GetBooTexture()};
for (int i=0 ; i<3 ; ++i)
{
bufs[0] = filter.m_uniBuf[i];
bufs[0] = filter.m_uniBuf[i].get();
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
return filter.m_dataBind[0];
@ -90,4 +91,11 @@ CEnergyBarShader::Initialize(boo::ID3DDataFactory::Context& ctx)
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
return new CEnergyBarShaderD3DDataBindingFactory;
}
template <>
void CEnergyBarShader::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
}

View File

@ -124,9 +124,12 @@ private:
boo::ObjToken<boo::IShaderDataBinding> BuildBinding(boo::GLDataFactory::Context& ctx,
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door);
#if _WIN32
static boo::IShaderPipeline* BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info);
static boo::IShaderPipeline* BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info);
boo::IShaderDataBinding* BuildBinding(boo::ID3DDataFactory::Context& ctx, boo::IShaderPipeline* pipeline, bool door);
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::ID3DDataFactory::Context& ctx,
const SFluidPlaneShaderInfo& info);
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::ID3DDataFactory::Context& ctx,
const SFluidPlaneDoorShaderInfo& info);
boo::ObjToken<boo::IShaderDataBinding> BuildBinding(boo::ID3DDataFactory::Context& ctx,
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door);
#endif
#if BOO_HAS_METAL
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::MetalDataFactory::Context& ctx,
@ -137,9 +140,12 @@ private:
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door);
#endif
#if BOO_HAS_VULKAN
static boo::IShaderPipeline* BuildShader(boo::VulkanDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info);
static boo::IShaderPipeline* BuildShader(boo::VulkanDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info);
boo::IShaderDataBinding* BuildBinding(boo::VulkanDataFactory::Context& ctx, boo::IShaderPipeline* pipeline, bool door);
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::VulkanDataFactory::Context& ctx,
const SFluidPlaneShaderInfo& info);
static boo::ObjToken<boo::IShaderPipeline> BuildShader(boo::VulkanDataFactory::Context& ctx,
const SFluidPlaneDoorShaderInfo& info);
boo::ObjToken<boo::IShaderDataBinding> BuildBinding(boo::VulkanDataFactory::Context& ctx,
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door);
#endif
void PrepareBinding(const boo::ObjToken<boo::IShaderPipeline>& pipeline, u32 maxVertCount, bool door);

View File

@ -539,12 +539,12 @@ CFluidPlaneShader::BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPla
}
#if BOO_HAS_VULKAN
static boo::IVertexFormat* s_vtxFmt = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_vtxFmt;
boo::IShaderPipeline*
boo::ObjToken<boo::IShaderPipeline>
CFluidPlaneShader::BuildShader(boo::VulkanDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info)
{
if (s_vtxFmt == nullptr)
if (!s_vtxFmt)
{
boo::VertexElementDescriptor elements[] =
{
@ -568,10 +568,10 @@ CFluidPlaneShader::BuildShader(boo::VulkanDataFactory::Context& ctx, const SFlui
boo::CullMode::None);
}
boo::IShaderPipeline*
boo::ObjToken<boo::IShaderPipeline>
CFluidPlaneShader::BuildShader(boo::VulkanDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info)
{
if (s_vtxFmt == nullptr)
if (!s_vtxFmt)
{
boo::VertexElementDescriptor elements[] =
{
@ -634,16 +634,17 @@ CFluidPlaneShader::BuildBinding(boo::GLDataFactory::Context& ctx,
}
#if BOO_HAS_VULKAN
boo::IShaderDataBinding* CFluidPlaneShader::BuildBinding(boo::VulkanDataFactory::Context& ctx,
boo::IShaderPipeline* pipeline, bool door)
boo::ObjToken<boo::IShaderDataBinding>
CFluidPlaneShader::BuildBinding(boo::VulkanDataFactory::Context& ctx,
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door)
{
boo::IGraphicsBuffer* ubufs[] = { m_uniBuf, m_uniBuf, m_uniBuf };
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = { m_uniBuf.get(), m_uniBuf.get(), m_uniBuf.get() };
boo::PipelineStage ubufStages[] = { boo::PipelineStage::Vertex, boo::PipelineStage::Vertex,
boo::PipelineStage::Fragment };
size_t ubufOffs[] = {0, 0, 768};
size_t ubufSizes[] = {768, 768, 256};
size_t texCount = 0;
boo::ITexture* texs[7] = {};
boo::ObjToken<boo::ITexture> texs[7] = {};
if (m_patternTex1)
texs[texCount++] = (*m_patternTex1)->GetBooTexture();
if (m_patternTex2)
@ -658,7 +659,7 @@ boo::IShaderDataBinding* CFluidPlaneShader::BuildBinding(boo::VulkanDataFactory:
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
if (m_lightmap)
texs[texCount++] = (*m_lightmap)->GetBooTexture();
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo, nullptr, nullptr, door ? 1 : 3,
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, door ? 1 : 3,
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
}
#endif

View File

@ -3,7 +3,7 @@
namespace urde
{
static boo::IVertexFormat* s_vtxFmt = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_vtxFmt;
static const char* VS =
"struct VertData\n"
@ -140,10 +140,10 @@ static const char* FSDoor =
" return colorOut;\n"
"}\n";
boo::IShaderPipeline*
boo::ObjToken<boo::IShaderPipeline>
CFluidPlaneShader::BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidPlaneShaderInfo& info)
{
if (s_vtxFmt == nullptr)
if (!s_vtxFmt)
{
boo::VertexElementDescriptor elements[] =
{
@ -466,10 +466,10 @@ CFluidPlaneShader::BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidP
boo::CullMode::None);
}
boo::IShaderPipeline*
boo::ObjToken<boo::IShaderPipeline>
CFluidPlaneShader::BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidPlaneDoorShaderInfo& info)
{
if (s_vtxFmt == nullptr)
if (!s_vtxFmt)
{
boo::VertexElementDescriptor elements[] =
{
@ -521,16 +521,17 @@ CFluidPlaneShader::BuildShader(boo::ID3DDataFactory::Context& ctx, const SFluidP
boo::CullMode::None);
}
boo::IShaderDataBinding* CFluidPlaneShader::BuildBinding(boo::ID3DDataFactory::Context& ctx,
boo::IShaderPipeline* pipeline, bool door)
boo::ObjToken<boo::IShaderDataBinding>
CFluidPlaneShader::BuildBinding(boo::ID3DDataFactory::Context& ctx,
const boo::ObjToken<boo::IShaderPipeline>& pipeline, bool door)
{
boo::IGraphicsBuffer* ubufs[] = { m_uniBuf, m_uniBuf, m_uniBuf };
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = { m_uniBuf.get(), m_uniBuf.get(), m_uniBuf.get() };
boo::PipelineStage ubufStages[] = { boo::PipelineStage::Vertex, boo::PipelineStage::Vertex,
boo::PipelineStage::Fragment };
size_t ubufOffs[] = {0, 0, 768};
size_t ubufSizes[] = {768, 768, 256};
size_t texCount = 0;
boo::ITexture* texs[7] = {};
boo::ObjToken<boo::ITexture> texs[7] = {};
if (m_patternTex1)
texs[texCount++] = (*m_patternTex1)->GetBooTexture();
if (m_patternTex2)
@ -545,7 +546,7 @@ boo::IShaderDataBinding* CFluidPlaneShader::BuildBinding(boo::ID3DDataFactory::C
texs[texCount++] = (*m_envBumpMap)->GetBooTexture();
if (m_lightmap)
texs[texCount++] = (*m_lightmap)->GetBooTexture();
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo, nullptr, nullptr, door ? 1 : 3,
return ctx.newShaderDataBinding(pipeline, s_vtxFmt, m_vbo.get(), nullptr, nullptr, door ? 1 : 3,
ubufs, ubufStages, ubufOffs, ubufSizes, texCount, texs, nullptr, nullptr);
}

View File

@ -122,21 +122,22 @@ struct CFogVolumeFilterGLDataBindingFactory : TShader<CFogVolumeFilter>::IDataBi
#if BOO_HAS_VULKAN
struct CFogVolumeFilterVulkanDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumeFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumeFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::ITexture* texs[] = { CGraphics::g_SpareTexture, CGraphics::g_SpareTexture,
g_Renderer->GetFogRampTex() };
boo::ObjToken<boo::ITexture> texs[] = { CGraphics::g_SpareTexture.get(), CGraphics::g_SpareTexture.get(),
g_Renderer->GetFogRampTex().get() };
int bindIdxs[] = {0, 1, 0};
bool bindDepth[] = {true, true, false};
boo::IGraphicsBuffer* ubufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = {filter.m_uniBuf.get()};
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
filter.m_vbo.get(), nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
filter.m_vbo.get(), nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
return filter.m_dataBind1Way;
}
@ -182,6 +183,14 @@ CFogVolumeFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CFogVolumeFilterVulkanDataBindingFactory;
}
template <>
void CFogVolumeFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_1WayPipeline.reset();
s_2WayPipeline.reset();
}
#endif
}

View File

@ -83,27 +83,28 @@ static const char* FS2Way =
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_1WayPipeline = nullptr;
static boo::IShaderPipeline* s_2WayPipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_1WayPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_2WayPipeline;
struct CFogVolumeFilterD3DDataBindingFactory : TShader<CFogVolumeFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumeFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumeFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::ITexture* texs[] = { CGraphics::g_SpareTexture, CGraphics::g_SpareTexture,
g_Renderer->GetFogRampTex() };
boo::ObjToken<boo::ITexture> texs[] = { CGraphics::g_SpareTexture.get(), CGraphics::g_SpareTexture.get(),
g_Renderer->GetFogRampTex().get() };
int bindIdxs[] = {0, 1, 0};
bool bindDepth[] = {true, true, false};
boo::IGraphicsBuffer* ubufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> ubufs[] = {filter.m_uniBuf.get()};
filter.m_dataBind1Way = cctx.newShaderDataBinding(s_1WayPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
filter.m_vbo.get(), nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
filter.m_dataBind2Way = cctx.newShaderDataBinding(s_2WayPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, ubufs,
filter.m_vbo.get(), nullptr, nullptr, 1, ubufs,
nullptr, nullptr, nullptr, 3, texs, bindIdxs, bindDepth);
return filter.m_dataBind1Way;
}
@ -127,4 +128,12 @@ CFogVolumeFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CFogVolumeFilterD3DDataBindingFactory;
}
template <>
void CFogVolumeFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_1WayPipeline.reset();
s_2WayPipeline.reset();
}
}

View File

@ -52,14 +52,15 @@ struct CFogVolumePlaneShaderGLDataBindingFactory : TShader<CFogVolumePlaneShader
#if BOO_HAS_VULKAN
struct CFogVolumePlaneShaderVulkanDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
for (int i=0 ; i<4 ; ++i)
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 0, nullptr,
filter.m_vbo.get(), nullptr, nullptr, 0, nullptr,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return filter.m_dataBinds[0];
}
@ -116,6 +117,16 @@ CFogVolumePlaneShader::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::Greater, false, false, false, boo::CullMode::Backface);
return new CFogVolumePlaneShaderVulkanDataBindingFactory;
}
template <>
void CFogVolumePlaneShader::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipelines[0].reset();
s_Pipelines[1].reset();
s_Pipelines[2].reset();
s_Pipelines[3].reset();
}
#endif
}

View File

@ -23,19 +23,20 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipelines[4] = {};
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipelines[4];
struct CFogVolumePlaneShaderD3DDataBindingFactory : TShader<CFogVolumePlaneShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CFogVolumePlaneShader& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
for (int i=0 ; i<4 ; ++i)
filter.m_dataBinds[i] = cctx.newShaderDataBinding(s_Pipelines[i], s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 0, nullptr,
filter.m_vbo.get(), nullptr, nullptr, 0, nullptr,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return filter.m_dataBinds[0];
}
@ -64,4 +65,14 @@ CFogVolumePlaneShader::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CFogVolumePlaneShaderD3DDataBindingFactory;
}
template <>
void CFogVolumePlaneShader::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipelines[0].reset();
s_Pipelines[1].reset();
s_Pipelines[2].reset();
s_Pipelines[3].reset();
}
}

View File

@ -167,13 +167,16 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
struct VulkanLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{
void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
boo::IShaderPipeline* pipeline, boo::ITexture* texture)
const boo::ObjToken<boo::IShaderPipeline>& pipeline,
const boo::ObjToken<boo::ITexture>& texture)
{
int texCount = 0;
boo::ITexture* textures[1];
boo::ObjToken<boo::ITexture> textures[1];
std::pair<boo::IGraphicsBufferD*, hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp> vbufInfo;
std::pair<boo::IGraphicsBufferD*, hecl::UniformBufferPool<CLineRenderer::SDrawUniform>::IndexTp> ubufInfo =
std::pair<boo::ObjToken<boo::IGraphicsBufferD>,
hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp> vbufInfo;
std::pair<boo::ObjToken<boo::IGraphicsBufferD>,
hecl::UniformBufferPool<CLineRenderer::SDrawUniform>::IndexTp> ubufInfo =
renderer.m_uniformBuf.getBufferInfo();
if (texture)
{
@ -186,12 +189,12 @@ struct VulkanLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
vbufInfo = renderer.m_vertBufNoTex.getBufferInfo();
}
boo::IGraphicsBuffer* uniforms[] = {ubufInfo.first};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {ubufInfo.first.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
size_t ubufOffs[] = {size_t(ubufInfo.second)};
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, nullptr, vbufInfo.first,
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, nullptr, vbufInfo.first.get(),
nullptr, nullptr, 1, uniforms,
stages, ubufOffs, ubufSizes, texCount, textures,
nullptr, nullptr, vbufInfo.second);

View File

@ -89,13 +89,16 @@ static const char* FS_HLSL_NOTEX =
struct HLSLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{
void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
boo::IShaderPipeline* pipeline, boo::ITexture* texture)
const boo::ObjToken<boo::IShaderPipeline>& pipeline,
const boo::ObjToken<boo::ITexture>& texture)
{
int texCount = 0;
boo::ITexture* textures[1];
boo::ObjToken<boo::ITexture> textures[1];
std::pair<boo::IGraphicsBufferD*, hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp> vbufInfo;
std::pair<boo::IGraphicsBufferD*, hecl::UniformBufferPool<CLineRenderer::SDrawUniform>::IndexTp> ubufInfo =
std::pair<boo::ObjToken<boo::IGraphicsBufferD>,
hecl::VertexBufferPool<CLineRenderer::SDrawVertTex>::IndexTp> vbufInfo;
std::pair<boo::ObjToken<boo::IGraphicsBufferD>,
hecl::UniformBufferPool<CLineRenderer::SDrawUniform>::IndexTp> ubufInfo =
renderer.m_uniformBuf.getBufferInfo();
if (texture)
{
@ -108,12 +111,12 @@ struct HLSLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
vbufInfo = renderer.m_vertBufNoTex.getBufferInfo();
}
boo::IGraphicsBuffer* uniforms[] = {ubufInfo.first};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {ubufInfo.first.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
size_t ubufOffs[] = {size_t(ubufInfo.second)};
size_t ubufSizes[] = {sizeof(CLineRenderer::SDrawUniform)};
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, nullptr, vbufInfo.first,
renderer.m_shaderBind = ctx.newShaderDataBinding(pipeline, nullptr, vbufInfo.first.get(),
nullptr, nullptr, 1, uniforms, stages,
ubufOffs, ubufSizes, texCount, textures,
nullptr, nullptr, vbufInfo.second);

View File

@ -71,14 +71,15 @@ struct CMapSurfaceShaderGLDataBindingFactory : TShader<CMapSurfaceShader>::IData
#if BOO_HAS_VULKAN
struct CMapSurfaceShaderVulkanDataBindingFactory : TShader<CMapSurfaceShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CMapSurfaceShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CMapSurfaceShader& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
filter.m_dataBind = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, filter.m_ibo, 1, bufs,
filter.m_vbo.get(), nullptr, filter.m_ibo.get(), 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return filter.m_dataBind;
}
@ -116,6 +117,13 @@ CMapSurfaceShader::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
return new CMapSurfaceShaderVulkanDataBindingFactory;
}
template <>
void CMapSurfaceShader::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
#endif
}

View File

@ -44,19 +44,20 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CMapSurfaceShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
struct CMapSurfaceShaderD3DDataBindingFactory : TShader<CMapSurfaceShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CMapSurfaceShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CMapSurfaceShader& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
filter.m_dataBind = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, filter.m_ibo, 1, bufs,
filter.m_vbo.get(), nullptr, filter.m_ibo.get(), 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return filter.m_dataBind;
}
@ -76,4 +77,11 @@ CMapSurfaceShader::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CMapSurfaceShaderD3DDataBindingFactory;
}
template <>
void CMapSurfaceShader::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
}

View File

@ -150,18 +150,19 @@ void CParticleSwooshShaders::Shutdown<boo::GLDataFactory>()
#if BOO_HAS_VULKAN
struct VulkanParticleSwooshDataBindingFactory : TShader<CParticleSwooshShaders>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CParticleSwooshShaders& shaders)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CParticleSwooshShaders& shaders)
{
CParticleSwoosh& gen = shaders.m_gen;
CSwooshDescription* desc = gen.GetDesc();
CUVElement* texr = desc->x3c_TEXR.get();
boo::ITexture* textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
boo::ObjToken<boo::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
gen.m_dataBind = ctx.newShaderDataBinding(shaders.m_pipeline, CParticleSwooshShaders::m_vtxFormat,
gen.m_vertBuf, nullptr, nullptr, 1, uniforms,
gen.m_vertBuf.get(), nullptr, nullptr, 1, uniforms,
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
return nullptr;
}
@ -213,6 +214,22 @@ TShader<CParticleSwooshShaders>::IDataBindingFactory* CParticleSwooshShaders::In
return new struct VulkanParticleSwooshDataBindingFactory;
}
template <>
void CParticleSwooshShaders::Shutdown<boo::VulkanDataFactory>()
{
m_vtxFormat.reset();
m_texZWrite.reset();
m_texNoZWrite.reset();
m_texAdditiveZWrite.reset();
m_texAdditiveNoZWrite.reset();
m_noTexZWrite.reset();
m_noTexNoZWrite.reset();
m_noTexAdditiveZWrite.reset();
m_noTexAdditiveNoZWrite.reset();
}
#endif
}

View File

@ -64,18 +64,19 @@ static const char* FS_NOTEX =
struct D3DParticleSwooshDataBindingFactory : TShader<CParticleSwooshShaders>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CParticleSwooshShaders& shaders)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CParticleSwooshShaders& shaders)
{
CParticleSwoosh& gen = shaders.m_gen;
CSwooshDescription* desc = gen.GetDesc();
CUVElement* texr = desc->x3c_TEXR.get();
boo::ITexture* textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
boo::ObjToken<boo::ITexture> textures[] = {texr ? texr->GetValueTexture(0).GetObj()->GetBooTexture() : nullptr};
boo::IGraphicsBuffer* uniforms[] = {gen.m_uniformBuf};
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {gen.m_uniformBuf.get()};
gen.m_dataBind = ctx.newShaderDataBinding(shaders.m_pipeline, CParticleSwooshShaders::m_vtxFormat,
gen.m_vertBuf, nullptr, nullptr, 1, uniforms,
gen.m_vertBuf.get(), nullptr, nullptr, 1, uniforms,
nullptr, texr ? 1 : 0, textures, nullptr, nullptr);
return nullptr;
}
@ -128,4 +129,19 @@ TShader<CParticleSwooshShaders>::IDataBindingFactory* CParticleSwooshShaders::In
return new struct D3DParticleSwooshDataBindingFactory;
}
template <>
void CParticleSwooshShaders::Shutdown<boo::ID3DDataFactory>()
{
m_vtxFormat.reset();
m_texZWrite.reset();
m_texNoZWrite.reset();
m_texAdditiveZWrite.reset();
m_texAdditiveNoZWrite.reset();
m_noTexZWrite.reset();
m_noTexNoZWrite.reset();
m_noTexAdditiveZWrite.reset();
m_noTexAdditiveNoZWrite.reset();
}
}

View File

@ -230,56 +230,57 @@ struct CPhazonSuitFilterGLDataBindingFactory : TShader<CPhazonSuitFilter>::IData
#if BOO_HAS_VULKAN
struct CPhazonSuitFilterVulkanDataBindingFactory : TShader<CPhazonSuitFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CPhazonSuitFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CPhazonSuitFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBufBlurX};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBufBlurX.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ITexture* texs[4];
boo::ObjToken<boo::ITexture> texs[4];
int texBindIdxs[4];
texs[0] = CGraphics::g_SpareTexture;
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 1;
filter.m_dataBindBlurX = cctx.newShaderDataBinding(s_BlurPipeline,
s_BlurVtxFmt, filter.m_blurVbo, nullptr, nullptr,
s_BlurVtxFmt, filter.m_blurVbo.get(), nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
bufs[0] = filter.m_uniBufBlurY;
texs[0] = CGraphics::g_SpareTexture;
bufs[0] = filter.m_uniBufBlurY.get();
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 2;
filter.m_dataBindBlurY = cctx.newShaderDataBinding(s_BlurPipeline,
s_BlurVtxFmt, filter.m_blurVbo, nullptr, nullptr,
s_BlurVtxFmt, filter.m_blurVbo.get(), nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
bufs[0] = filter.m_uniBuf;
bufs[0] = filter.m_uniBuf.get();
size_t texCount;
if (filter.m_indTex)
{
texs[0] = CGraphics::g_SpareTexture;
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 0;
texs[1] = filter.m_indTex->GetBooTexture();
texBindIdxs[1] = 0;
texs[2] = CGraphics::g_SpareTexture;
texs[2] = CGraphics::g_SpareTexture.get();
texBindIdxs[2] = 1;
texs[3] = CGraphics::g_SpareTexture;
texs[3] = CGraphics::g_SpareTexture.get();
texBindIdxs[3] = 2;
texCount = 4;
}
else
{
texs[0] = CGraphics::g_SpareTexture;
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 0;
texs[1] = CGraphics::g_SpareTexture;
texs[1] = CGraphics::g_SpareTexture.get();
texBindIdxs[1] = 1;
texs[2] = CGraphics::g_SpareTexture;
texs[2] = CGraphics::g_SpareTexture.get();
texBindIdxs[2] = 2;
texCount = 3;
}
return cctx.newShaderDataBinding(filter.m_indTex ? s_IndPipeline : s_Pipeline,
s_VtxFmt, filter.m_vbo, nullptr, nullptr,
s_VtxFmt, filter.m_vbo.get(), nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, texCount, texs, texBindIdxs, nullptr);
}
};
@ -343,6 +344,17 @@ CPhazonSuitFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::None, false, false, true, boo::CullMode::None);
return new CPhazonSuitFilterVulkanDataBindingFactory;
}
template <>
void CPhazonSuitFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_BlurVtxFmt.reset();
s_IndPipeline.reset();
s_Pipeline.reset();
s_BlurPipeline.reset();
}
#endif
}

View File

@ -147,64 +147,65 @@ static const char* BlurFS =
URDE_DECL_SPECIALIZE_SHADER(CPhazonSuitFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IVertexFormat* s_BlurVtxFmt = nullptr;
static boo::IShaderPipeline* s_IndPipeline = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::IShaderPipeline* s_BlurPipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IVertexFormat> s_BlurVtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_IndPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
static boo::ObjToken<boo::IShaderPipeline> s_BlurPipeline;
struct CPhazonSuitFilterD3DDataBindingFactory : TShader<CPhazonSuitFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CPhazonSuitFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CPhazonSuitFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBufBlurX};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBufBlurX.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ITexture* texs[4];
boo::ObjToken<boo::ITexture> texs[4];
int texBindIdxs[4];
texs[0] = CGraphics::g_SpareTexture;
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 1;
filter.m_dataBindBlurX = cctx.newShaderDataBinding(s_BlurPipeline,
s_BlurVtxFmt, filter.m_blurVbo, nullptr, nullptr,
s_BlurVtxFmt, filter.m_blurVbo.get(), nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
bufs[0] = filter.m_uniBufBlurY;
texs[0] = CGraphics::g_SpareTexture;
bufs[0] = filter.m_uniBufBlurY.get();
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 2;
filter.m_dataBindBlurY = cctx.newShaderDataBinding(s_BlurPipeline,
s_BlurVtxFmt, filter.m_blurVbo, nullptr, nullptr,
s_BlurVtxFmt, filter.m_blurVbo.get(), nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 1, texs, texBindIdxs, nullptr);
bufs[0] = filter.m_uniBuf;
bufs[0] = filter.m_uniBuf.get();
size_t texCount;
if (filter.m_indTex)
{
texs[0] = CGraphics::g_SpareTexture;
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 0;
texs[1] = filter.m_indTex->GetBooTexture();
texBindIdxs[1] = 0;
texs[2] = CGraphics::g_SpareTexture;
texs[2] = CGraphics::g_SpareTexture.get();
texBindIdxs[2] = 1;
texs[3] = CGraphics::g_SpareTexture;
texs[3] = CGraphics::g_SpareTexture.get();
texBindIdxs[3] = 2;
texCount = 4;
}
else
{
texs[0] = CGraphics::g_SpareTexture;
texs[0] = CGraphics::g_SpareTexture.get();
texBindIdxs[0] = 0;
texs[1] = CGraphics::g_SpareTexture;
texs[1] = CGraphics::g_SpareTexture.get();
texBindIdxs[1] = 1;
texs[2] = CGraphics::g_SpareTexture;
texs[2] = CGraphics::g_SpareTexture.get();
texBindIdxs[2] = 2;
texCount = 3;
}
return cctx.newShaderDataBinding(filter.m_indTex ? s_IndPipeline : s_Pipeline,
s_VtxFmt, filter.m_vbo, nullptr, nullptr,
s_VtxFmt, filter.m_vbo.get(), nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, texCount, texs, texBindIdxs, nullptr);
}
};
@ -238,4 +239,14 @@ CPhazonSuitFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CPhazonSuitFilterD3DDataBindingFactory;
}
template <>
void CPhazonSuitFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_BlurVtxFmt.reset();
s_IndPipeline.reset();
s_Pipeline.reset();
s_BlurPipeline.reset();
}
}

View File

@ -85,15 +85,16 @@ struct CRadarPaintShaderGLDataBindingFactory : TShader<CRadarPaintShader>::IData
#if BOO_HAS_VULKAN
struct CRadarPaintShaderVulkanDataBindingFactory : TShader<CRadarPaintShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CRadarPaintShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CRadarPaintShader& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {filter.m_tex->GetBooTexture()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
nullptr, filter.m_vbo, nullptr, 1, bufs,
nullptr, filter.m_vbo.get(), nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -138,6 +139,13 @@ CRadarPaintShader::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CRadarPaintShaderVulkanDataBindingFactory;
}
template <>
void CRadarPaintShader::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
#endif
}

View File

@ -51,20 +51,21 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CRadarPaintShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
struct CRadarPaintShaderD3DDataBindingFactory : TShader<CRadarPaintShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CRadarPaintShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CRadarPaintShader& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {filter.m_tex->GetBooTexture()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
nullptr, filter.m_vbo, nullptr, 1, bufs,
nullptr, filter.m_vbo.get(), nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -92,4 +93,10 @@ CRadarPaintShader::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CRadarPaintShaderD3DDataBindingFactory;
}
template <>
void CRadarPaintShader::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
}

View File

@ -151,16 +151,16 @@ struct CRandomStaticFilterGLDataBindingFactory : TMultiBlendShader<CRandomStatic
#if BOO_HAS_VULKAN
struct CRandomStaticFilterVulkanDataBindingFactory : TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CRandomStaticFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CRandomStaticFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {g_Renderer->GetRandomStaticEntropyTex()};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {g_Renderer->GetRandomStaticEntropyTex().get()};
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
s_VtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs,
s_VtxFmt, filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -219,6 +219,16 @@ CRandomStaticFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::LEqual, true, false, false, boo::CullMode::None);
return new CRandomStaticFilterVulkanDataBindingFactory;
}
template <>
void CRandomStaticFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_AlphaPipeline.reset();
s_AddPipeline.reset();
s_MultPipeline.reset();
s_CookieCutterPipeline.reset();
}
#endif
}

View File

@ -105,13 +105,13 @@ static const char* FSCookieCutter =
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* s_CookieCutterPipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_CookieCutterPipeline;
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
{
switch (type)
{
@ -122,22 +122,22 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
return {};
}
}
struct CRandomStaticFilterD3DDataBindingFactory : TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CRandomStaticFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CRandomStaticFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {g_Renderer->GetRandomStaticEntropyTex()};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {g_Renderer->GetRandomStaticEntropyTex().get()};
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
s_VtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs,
s_VtxFmt, filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -170,4 +170,13 @@ CRandomStaticFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CRandomStaticFilterD3DDataBindingFactory;
}
template <>
void CRandomStaticFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_AlphaPipeline.reset();
s_AddPipeline.reset();
s_MultPipeline.reset();
s_CookieCutterPipeline.reset();
}
}

View File

@ -89,15 +89,15 @@ struct CScanLinesFilterGLDataBindingFactory : TMultiBlendShader<CScanLinesFilter
#if BOO_HAS_VULKAN
struct CScanLinesFilterVulkanDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CScanLinesFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CScanLinesFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* vbo = filter.m_even ?
g_Renderer->GetScanLinesEvenVBO() : g_Renderer->GetScanLinesOddVBO();
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> vbo = filter.m_even ?
g_Renderer->GetScanLinesEvenVBO().get() : g_Renderer->GetScanLinesOddVBO().get();
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
@ -149,6 +149,15 @@ CScanLinesFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CScanLinesFilterVulkanDataBindingFactory;
}
template <>
void CScanLinesFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_AlphaPipeline.reset();
s_AddPipeline.reset();
s_MultPipeline.reset();
}
#endif
}

View File

@ -46,12 +46,12 @@ static const char* FS =
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type)
{
switch (type)
{
@ -68,15 +68,15 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type)
struct CScanLinesFilterD3DDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CScanLinesFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CScanLinesFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* vbo = filter.m_even ?
g_Renderer->GetScanLinesEvenVBO() : g_Renderer->GetScanLinesOddVBO();
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> vbo = filter.m_even ?
g_Renderer->GetScanLinesEvenVBO().get() : g_Renderer->GetScanLinesOddVBO().get();
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
@ -106,4 +106,13 @@ CScanLinesFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CScanLinesFilterD3DDataBindingFactory;
}
template <>
void CScanLinesFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_AlphaPipeline.reset();
s_AddPipeline.reset();
s_MultPipeline.reset();
}
}

View File

@ -80,15 +80,16 @@ struct CSpaceWarpFilterGLDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBi
#if BOO_HAS_VULKAN
struct CSpaceWarpFilterVulkanDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CSpaceWarpFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CSpaceWarpFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_warpTex.get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -124,6 +125,13 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CSpaceWarpFilterVulkanDataBindingFactory;
}
template <>
void CSpaceWarpFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
#endif
}

View File

@ -55,20 +55,21 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
struct CSpaceWarpFilterD3DDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CSpaceWarpFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CSpaceWarpFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_warpTex.get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -88,4 +89,10 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
return new CSpaceWarpFilterD3DDataBindingFactory;
}
template <>
void CSpaceWarpFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
}

View File

@ -184,6 +184,17 @@ CTextSupportShader::Initialize(boo::VulkanDataFactory::Context& ctx)
return nullptr;
}
template <>
void CTextSupportShader::Shutdown<boo::VulkanDataFactory>()
{
s_TextVtxFmt.reset();
s_TextAlphaPipeline.reset();
s_TextAddPipeline.reset();
s_ImageVtxFmt.reset();
s_ImageAlphaPipeline.reset();
s_ImageAddPipeline.reset();
}
#endif
}

View File

@ -160,4 +160,14 @@ CTextSupportShader::Initialize(boo::ID3DDataFactory::Context& ctx)
return nullptr;
}
template <>
void CTextSupportShader::Shutdown<boo::ID3DDataFactory>()
{
s_TextVtxFmt.reset();
s_TextAlphaPipeline.reset();
s_TextAddPipeline.reset();
s_ImageVtxFmt.reset();
s_ImageAlphaPipeline.reset();
s_ImageAddPipeline.reset();
}
}

View File

@ -170,16 +170,16 @@ struct CTexturedQuadFilterGLDataBindingFactory : TMultiBlendShader<CTexturedQuad
#if BOO_HAS_VULKAN
struct CTexturedQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CTexturedQuadFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CTexturedQuadFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {filter.m_booTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {filter.m_booTex.get()};
return cctx.newShaderDataBinding(SelectPipeline(type, filter.m_gequal), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -238,6 +238,16 @@ CTexturedQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CTexturedQuadFilterVulkanDataBindingFactory;
}
template <>
void CTexturedQuadFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_AlphaPipeline.reset();
s_AlphaGEqualPipeline.reset();
s_AddPipeline.reset();
s_MultPipeline.reset();
}
#endif
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilterAlpha)
@ -266,16 +276,16 @@ struct CTexturedQuadFilterAlphaGLDataBindingFactory : TMultiBlendShader<CTexture
#if BOO_HAS_VULKAN
struct CTexturedQuadFilterAlphaVulkanDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CTexturedQuadFilterAlpha& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CTexturedQuadFilterAlpha& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {filter.m_booTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {filter.m_booTex.get()};
return cctx.newShaderDataBinding(SelectAlphaPipeline(type), s_AVtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -327,6 +337,15 @@ CTexturedQuadFilterAlpha::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CTexturedQuadFilterAlphaVulkanDataBindingFactory;
}
template <>
void CTexturedQuadFilterAlpha::Shutdown<boo::VulkanDataFactory>()
{
s_AVtxFmt.reset();
s_AAlphaPipeline.reset();
s_AAddPipeline.reset();
s_AMultPipeline.reset();
}
#endif
}

View File

@ -106,13 +106,13 @@ static const char* FSAlpha =
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AlphaGEqualPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaGEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
static boo::IShaderPipeline* SelectPipeline(EFilterType type, bool gequal)
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type, bool gequal)
{
if (gequal)
return s_AlphaGEqualPipeline;
@ -125,22 +125,22 @@ static boo::IShaderPipeline* SelectPipeline(EFilterType type, bool gequal)
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
return {};
}
}
struct CTexturedQuadFilterD3DDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CTexturedQuadFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CTexturedQuadFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {filter.m_booTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {filter.m_booTex.get()};
return cctx.newShaderDataBinding(SelectPipeline(type, filter.m_gequal), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -173,12 +173,22 @@ CTexturedQuadFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CTexturedQuadFilterD3DDataBindingFactory;
}
static boo::IVertexFormat* s_AVtxFmt = nullptr;
static boo::IShaderPipeline* s_AAlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AAddPipeline = nullptr;
static boo::IShaderPipeline* s_AMultPipeline = nullptr;
template <>
void CTexturedQuadFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_AlphaPipeline.reset();
s_AlphaGEqualPipeline.reset();
s_AddPipeline.reset();
s_MultPipeline.reset();
}
static boo::IShaderPipeline* SelectAlphaPipeline(EFilterType type)
static boo::ObjToken<boo::IVertexFormat> s_AVtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_AAlphaPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AAddPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AMultPipeline;
static boo::ObjToken<boo::IShaderPipeline> SelectAlphaPipeline(EFilterType type)
{
switch (type)
{
@ -189,22 +199,22 @@ static boo::IShaderPipeline* SelectAlphaPipeline(EFilterType type)
case EFilterType::Multiply:
return s_AMultPipeline;
default:
return nullptr;
return {};
}
}
struct CTexturedQuadFilterAlphaD3DDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CTexturedQuadFilterAlpha& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type, CTexturedQuadFilterAlpha& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {filter.m_booTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {filter.m_booTex.get()};
return cctx.newShaderDataBinding(SelectAlphaPipeline(type), s_AVtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
};
@ -233,4 +243,12 @@ CTexturedQuadFilterAlpha::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CTexturedQuadFilterAlphaD3DDataBindingFactory;
}
template <>
void CTexturedQuadFilterAlpha::Shutdown<boo::ID3DDataFactory>()
{
s_AVtxFmt.reset();
s_AAlphaPipeline.reset();
s_AAddPipeline.reset();
s_AMultPipeline.reset();
}
}

View File

@ -102,15 +102,16 @@ struct CThermalColdFilterGLDataBindingFactory : TShader<CThermalColdFilter>::IDa
#if BOO_HAS_VULKAN
struct CThermalColdFilterVulkanDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CThermalColdFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CThermalColdFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_shiftTex.get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -146,6 +147,13 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CThermalColdFilterVulkanDataBindingFactory;
}
template <>
void CThermalColdFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
#endif
}

View File

@ -77,20 +77,21 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
struct CThermalColdFilterD3DDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CThermalColdFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CThermalColdFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_shiftTex.get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -110,4 +111,10 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
return new CThermalColdFilterD3DDataBindingFactory;
}
template <>
void CThermalColdFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
}

View File

@ -79,15 +79,16 @@ struct CThermalHotFilterGLDataBindingFactory : TShader<CThermalHotFilter>::IData
#if BOO_HAS_VULKAN
struct CThermalHotFilterVulkanDataBindingFactory : TShader<CThermalHotFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CThermalHotFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CThermalHotFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), g_Renderer->GetThermoPalette()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -123,6 +124,13 @@ TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(b
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CThermalHotFilterVulkanDataBindingFactory;
}
template <>
void CThermalHotFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
#endif
}

View File

@ -54,20 +54,21 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CThermalHotFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
struct CThermalHotFilterD3DDataBindingFactory : TShader<CThermalHotFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CThermalHotFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CThermalHotFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), g_Renderer->GetThermoPalette().get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -87,4 +88,10 @@ TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(b
return new CThermalHotFilterD3DDataBindingFactory;
}
template <>
void CThermalHotFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
}

View File

@ -74,17 +74,18 @@ struct CWorldShadowShaderGLDataBindingFactory : TShader<CWorldShadowShader>::IDa
#if BOO_HAS_VULKAN
struct CWorldShadowShaderVulkanDataBindingFactory : TShader<CWorldShadowShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CWorldShadowShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CWorldShadowShader& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
filter.m_dataBind = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
filter.m_zDataBind = cctx.newShaderDataBinding(s_ZPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return nullptr;
}
@ -128,6 +129,14 @@ CWorldShadowShader::Initialize(boo::VulkanDataFactory::Context& ctx)
boo::ZTest::LEqual, true, true, false, boo::CullMode::None);
return new CWorldShadowShaderVulkanDataBindingFactory;
}
template <>
void CWorldShadowShader::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
s_ZPipeline.reset();
}
#endif
}

View File

@ -43,23 +43,24 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CWorldShadowShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::IShaderPipeline* s_ZPipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
static boo::ObjToken<boo::IShaderPipeline> s_ZPipeline;
struct CWorldShadowShaderD3DDataBindingFactory : TShader<CWorldShadowShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CWorldShadowShader& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CWorldShadowShader& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
filter.m_dataBind = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
filter.m_zDataBind = cctx.newShaderDataBinding(s_ZPipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
return nullptr;
}
@ -82,5 +83,12 @@ CWorldShadowShader::Initialize(boo::ID3DDataFactory::Context& ctx)
return new CWorldShadowShaderD3DDataBindingFactory;
}
template <>
void CWorldShadowShader::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
s_ZPipeline.reset();
}
}

View File

@ -91,15 +91,16 @@ struct CXRayBlurFilterGLDataBindingFactory : TShader<CXRayBlurFilter>::IDataBind
#if BOO_HAS_VULKAN
struct CXRayBlurFilterVulkanDataBindingFactory : TShader<CXRayBlurFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CXRayBlurFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CXRayBlurFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_booTex.get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -135,6 +136,13 @@ TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CXRayBlurFilterVulkanDataBindingFactory;
}
template <>
void CXRayBlurFilter::Shutdown<boo::VulkanDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
#endif
}

View File

@ -69,20 +69,21 @@ static const char* FS =
URDE_DECL_SPECIALIZE_SHADER(CXRayBlurFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
static boo::ObjToken<boo::IVertexFormat> s_VtxFmt;
static boo::ObjToken<boo::IShaderPipeline> s_Pipeline;
struct CXRayBlurFilterD3DDataBindingFactory : TShader<CXRayBlurFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CXRayBlurFilter& filter)
boo::ObjToken<boo::IShaderDataBinding>
BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CXRayBlurFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::ObjToken<boo::ITexture> texs[] = {CGraphics::g_SpareTexture.get(), filter.m_booTex.get()};
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
filter.m_vbo.get(), nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 2, texs, nullptr, nullptr);
}
};
@ -102,4 +103,10 @@ TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::
return new CXRayBlurFilterD3DDataBindingFactory;
}
template <>
void CXRayBlurFilter::Shutdown<boo::ID3DDataFactory>()
{
s_VtxFmt.reset();
s_Pipeline.reset();
}
}

2
hecl

@ -1 +1 @@
Subproject commit fead3cde4a114104dc7aaae39493a0b4ddd274a5
Subproject commit 9e67b21251e51ab30f07762fe1a0297045eea7ad

@ -1 +1 @@
Subproject commit 3cf7aee6175e45e2dd5b45dcf1319ff668afa74d
Subproject commit 09e058228206fe019de796d2098dd3843d347f04