mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
aeba4b7f1b
|
@ -34,7 +34,7 @@ static uint32_t ParseTag(const char16_t* str)
|
||||||
for (i=0 ; i<8 && str[i] ; ++i)
|
for (i=0 ; i<8 && str[i] ; ++i)
|
||||||
parseStr[i] = str[i];
|
parseStr[i] = str[i];
|
||||||
parseStr[i] = '\0';
|
parseStr[i] = '\0';
|
||||||
return strtol(parseStr, nullptr, 16);
|
return strtoul(parseStr, nullptr, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::u16string::const_iterator SkipCommas(std::u16string& ret,
|
static std::u16string::const_iterator SkipCommas(std::u16string& ret,
|
||||||
|
|
|
@ -80,6 +80,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
||||||
|
|
||||||
struct CCameraBlurFilterGLDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
struct CCameraBlurFilterGLDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
||||||
|
@ -113,7 +114,7 @@ struct CCameraBlurFilterVulkanDataBindingFactory : TShader<CCameraBlurFilter>::I
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
|
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs);
|
nullptr, nullptr, nullptr, 1, texs);
|
||||||
}
|
}
|
||||||
|
@ -137,8 +138,8 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CCameraBlurFilterVulkanDataBindingFactory;
|
return new CCameraBlurFilterVulkanDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,35 +88,34 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
|
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
||||||
|
|
||||||
struct CCameraBlurFilterD3DDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
struct CCameraBlurFilterD3DDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CCameraBlurFilter& filter)
|
CCameraBlurFilter& filter)
|
||||||
{
|
{
|
||||||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
|
boo::ITexture* texs[] = {CGraphics::g_SpareTexture};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs);
|
nullptr, nullptr, nullptr, 1, texs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(boo::ID3DDataFactory::Context& ctx,
|
TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
boo::IShaderPipeline*& pipeOut,
|
|
||||||
boo::IVertexFormat*& vtxFmtOut)
|
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
pipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CCameraBlurFilterD3DDataBindingFactory;
|
return new CCameraBlurFilterD3DDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
||||||
|
@ -88,12 +89,13 @@ struct CColoredQuadFilterGLDataBindingFactory : TMultiBlendShader<CColoredQuadFi
|
||||||
struct CColoredQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
|
struct CColoredQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
|
CCameraFilterPass::EFilterType type,
|
||||||
CColoredQuadFilter& filter)
|
CColoredQuadFilter& filter)
|
||||||
{
|
{
|
||||||
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
|
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
return cctx.newShaderDataBinding(SelectPipeline(type), vtxFmt,
|
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 0, nullptr);
|
nullptr, nullptr, nullptr, 0, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -121,12 +123,12 @@ CColoredQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
s_AddPipeline = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
s_MultPipeline = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::SrcColor,
|
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CColoredQuadFilterVulkanDataBindingFactory;
|
return new CColoredQuadFilterVulkanDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,42 +45,57 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
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::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case CCameraFilterPass::EFilterType::Blend:
|
||||||
|
return s_AlphaPipeline;
|
||||||
|
case CCameraFilterPass::EFilterType::Add:
|
||||||
|
return s_AddPipeline;
|
||||||
|
case CCameraFilterPass::EFilterType::Multiply:
|
||||||
|
return s_MultPipeline;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct CColoredQuadFilterD3DDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
|
struct CColoredQuadFilterD3DDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
CCameraFilterPass::EFilterType type,
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CColoredQuadFilter& filter)
|
CColoredQuadFilter& filter)
|
||||||
{
|
{
|
||||||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 0, nullptr);
|
nullptr, nullptr, nullptr, 0, nullptr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory*
|
TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory*
|
||||||
CColoredQuadFilter::Initialize(boo::ID3DDataFactory::Context& ctx,
|
CColoredQuadFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
boo::IShaderPipeline*& alphaPipeOut,
|
|
||||||
boo::IShaderPipeline*& additivePipeOut,
|
|
||||||
boo::IShaderPipeline*& colorMultiplyPipeOut,
|
|
||||||
boo::IVertexFormat*& vtxFmtOut)
|
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
{nullptr, nullptr, boo::VertexSemantic::Position4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
alphaPipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
additivePipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_AddPipeline = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_MultPipeline = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcColor,
|
s_VtxFmt, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CColoredQuadFilterD3DDataBindingFactory;
|
return new CColoredQuadFilterD3DDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
||||||
|
|
||||||
struct CSpaceWarpFilterGLDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
|
struct CSpaceWarpFilterGLDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
|
||||||
|
@ -86,7 +87,7 @@ struct CSpaceWarpFilterVulkanDataBindingFactory : TShader<CSpaceWarpFilter>::IDa
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
|
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 2, texs);
|
nullptr, nullptr, nullptr, 2, texs);
|
||||||
}
|
}
|
||||||
|
@ -110,8 +111,8 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::One,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CSpaceWarpFilterVulkanDataBindingFactory;
|
return new CSpaceWarpFilterVulkanDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,35 +55,34 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
|
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
||||||
|
|
||||||
struct CSpaceWarpFilterD3DDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
|
struct CSpaceWarpFilterD3DDataBindingFactory : TShader<CSpaceWarpFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CSpaceWarpFilter& filter)
|
CSpaceWarpFilter& filter)
|
||||||
{
|
{
|
||||||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
|
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_warpTex};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 2, texs);
|
nullptr, nullptr, nullptr, 2, texs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo::ID3DDataFactory::Context& ctx,
|
TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
boo::IShaderPipeline*& pipeOut,
|
|
||||||
boo::IVertexFormat*& vtxFmtOut)
|
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
pipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::One,
|
s_VtxFmt, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CSpaceWarpFilterD3DDataBindingFactory;
|
return new CSpaceWarpFilterD3DDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
#include "CTextSupportShader.hpp"
|
||||||
|
#include "GuiSys/CTextRenderBuffer.hpp"
|
||||||
|
#include "TMultiBlendShader.hpp"
|
||||||
|
#include "Graphics/CTexture.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
static const char* TextVS =
|
||||||
|
"struct InstData\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 posIn[4] : POSITION;\n"
|
||||||
|
" float4 uvIn[4] : UV;\n"
|
||||||
|
" float4 fontColorIn : COLOR0;\n"
|
||||||
|
" float4 outlineColorIn : COLOR1;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"cbuffer TextSupportUniform : register(b0)\n"
|
||||||
|
"{\n"
|
||||||
|
" float4x4 mtx;\n"
|
||||||
|
" float4 color;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"struct VertToFrag\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 pos : SV_Position;\n"
|
||||||
|
" float4 fontColor : COLOR0;\n"
|
||||||
|
" float4 outlineColor : COLOR1;\n"
|
||||||
|
" float3 uv : UV;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"VertToFrag main(in InstData inst, in uint vertId : SV_VertexID)\n"
|
||||||
|
"{\n"
|
||||||
|
" VertToFrag vtf;\n"
|
||||||
|
" vtf.fontColor = color * inst.fontColorIn;\n"
|
||||||
|
" vtf.outlineColor = color * inst.outlineColorIn;\n"
|
||||||
|
" vtf.uv = inst.uvIn[vertId].xyz;\n"
|
||||||
|
" vtf.pos = mul(mtx, float4(inst.posIn[vertId].xyz, 1.0));\n"
|
||||||
|
" return vtf;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
static const char* TextFS =
|
||||||
|
"struct VertToFrag\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 pos : SV_Position;\n"
|
||||||
|
" float4 fontColor : COLOR0;\n"
|
||||||
|
" float4 outlineColor : COLOR1;\n"
|
||||||
|
" float3 uv : UV;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"Texture2DArray tex : register(t0);\n"
|
||||||
|
"SamplerState samp : register(s0);\n"
|
||||||
|
"\n"
|
||||||
|
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 texel = tex.Sample(samp, vtf.uv.xyz);\n"
|
||||||
|
" return vtf.fontColor * texel.r + vtf.outlineColor * texel.g;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
static const char* ImgVS =
|
||||||
|
"struct InstData\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 posIn[4] : POSITION;\n"
|
||||||
|
" float4 uvIn[4] : UV;\n"
|
||||||
|
" float4 colorIn : COLOR;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"cbuffer TextSupportUniform : register(b0)\n"
|
||||||
|
"{\n"
|
||||||
|
" float4x4 mtx;\n"
|
||||||
|
" float4 color;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"struct VertToFrag\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 pos : SV_Position;\n"
|
||||||
|
" float4 color : COLOR;\n"
|
||||||
|
" float2 uv : UV;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"VertToFrag main(in InstData inst, in uint vertId : SV_VertexID)\n"
|
||||||
|
"{\n"
|
||||||
|
" VertToFrag vtf;\n"
|
||||||
|
" vtf.color = color * inst.colorIn;\n"
|
||||||
|
" vtf.uv = inst.uvIn[vertId].xy;\n"
|
||||||
|
" vtf.pos = mul(mtx, float4(inst.posIn[vertId].xyz, 1.0));\n"
|
||||||
|
" return vtf;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
static const char* ImgFS =
|
||||||
|
"struct VertToFrag\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 pos : SV_Position;\n"
|
||||||
|
" float4 color : COLOR;\n"
|
||||||
|
" float2 uv : UV;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"Texture2D tex : register(t0);\n"
|
||||||
|
"SamplerState samp : register(s0);\n"
|
||||||
|
"\n"
|
||||||
|
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 texel = tex.Sample(samp, vtf.uv);\n"
|
||||||
|
" return vtf.color * texel;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
TMultiBlendShader<CTextSupportShader>::IDataBindingFactory*
|
||||||
|
CTextSupportShader::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
|
{
|
||||||
|
boo::VertexElementDescriptor TextVtxVmt[] =
|
||||||
|
{
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 1},
|
||||||
|
};
|
||||||
|
s_TextVtxFmt = ctx.newVertexFormat(10, TextVtxVmt);
|
||||||
|
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
|
s_TextVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
|
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
|
s_TextVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
|
|
||||||
|
boo::VertexElementDescriptor ImageVtxVmt[] =
|
||||||
|
{
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4 | boo::VertexSemantic::Instanced, 3},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 0},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 1},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 2},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4 | boo::VertexSemantic::Instanced, 3},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Color | boo::VertexSemantic::Instanced, 0},
|
||||||
|
};
|
||||||
|
s_ImageVtxFmt = ctx.newVertexFormat(9, ImageVtxVmt);
|
||||||
|
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
|
s_ImageVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
|
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
|
s_ImageVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -97,6 +97,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
|
||||||
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
static boo::IShaderPipeline* s_AddPipeline = nullptr;
|
||||||
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
static boo::IShaderPipeline* s_MultPipeline = nullptr;
|
||||||
|
@ -116,6 +117,7 @@ static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_AVtxFmt = nullptr;
|
||||||
static boo::IShaderPipeline* s_AAlphaPipeline = nullptr;
|
static boo::IShaderPipeline* s_AAlphaPipeline = nullptr;
|
||||||
static boo::IShaderPipeline* s_AAddPipeline = nullptr;
|
static boo::IShaderPipeline* s_AAddPipeline = nullptr;
|
||||||
static boo::IShaderPipeline* s_AMultPipeline = nullptr;
|
static boo::IShaderPipeline* s_AMultPipeline = nullptr;
|
||||||
|
@ -168,7 +170,7 @@ struct CTexturedQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CTextured
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {filter.m_booTex};
|
boo::ITexture* texs[] = {filter.m_booTex};
|
||||||
return cctx.newShaderDataBinding(SelectPipeline(type), vtxFmt,
|
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs);
|
nullptr, nullptr, nullptr, 1, texs);
|
||||||
}
|
}
|
||||||
|
@ -198,12 +200,12 @@ CTexturedQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, vtxFmtOut, boo::BlendFactor::SrcColor,
|
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CTexturedQuadFilterVulkanDataBindingFactory;
|
return new CTexturedQuadFilterVulkanDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +246,7 @@ struct CTexturedQuadFilterAlphaVulkanDataBindingFactory : TMultiBlendShader<CTex
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {filter.m_booTex};
|
boo::ITexture* texs[] = {filter.m_booTex};
|
||||||
return cctx.newShaderDataBinding(SelectAlphaPipeline(type), vtxFmt,
|
return cctx.newShaderDataBinding(SelectAlphaPipeline(type), s_AVtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs);
|
nullptr, nullptr, nullptr, 1, texs);
|
||||||
}
|
}
|
||||||
|
@ -274,12 +276,12 @@ CTexturedQuadFilterAlpha::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_AVtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, vtxFmtOut, boo::BlendFactor::SrcColor,
|
s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CTexturedQuadFilterAlphaVulkanDataBindingFactory;
|
return new CTexturedQuadFilterAlphaVulkanDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,86 +98,116 @@ static const char* FSAlpha =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||||
|
|
||||||
|
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* SelectPipeline(CCameraFilterPass::EFilterType type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case CCameraFilterPass::EFilterType::Blend:
|
||||||
|
return s_AlphaPipeline;
|
||||||
|
case CCameraFilterPass::EFilterType::Add:
|
||||||
|
return s_AddPipeline;
|
||||||
|
case CCameraFilterPass::EFilterType::Multiply:
|
||||||
|
return s_MultPipeline;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct CTexturedQuadFilterD3DDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
|
struct CTexturedQuadFilterD3DDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
CCameraFilterPass::EFilterType type,
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CTexturedQuadFilter& filter)
|
CTexturedQuadFilter& filter)
|
||||||
{
|
{
|
||||||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {filter.m_booTex};
|
boo::ITexture* texs[] = {filter.m_booTex};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs);
|
nullptr, nullptr, nullptr, 1, texs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory*
|
TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory*
|
||||||
CTexturedQuadFilter::Initialize(boo::ID3DDataFactory::Context& ctx,
|
CTexturedQuadFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
boo::IShaderPipeline*& alphaPipeOut,
|
|
||||||
boo::IShaderPipeline*& additivePipeOut,
|
|
||||||
boo::IShaderPipeline*& colorMultiplyPipeOut,
|
|
||||||
boo::IVertexFormat*& vtxFmtOut)
|
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
alphaPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_AlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
additivePipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_AddPipeline = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
colorMultiplyPipeOut = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcColor,
|
s_VtxFmt, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CTexturedQuadFilterD3DDataBindingFactory;
|
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;
|
||||||
|
|
||||||
|
static boo::IShaderPipeline* SelectAlphaPipeline(CCameraFilterPass::EFilterType type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case CCameraFilterPass::EFilterType::Blend:
|
||||||
|
return s_AAlphaPipeline;
|
||||||
|
case CCameraFilterPass::EFilterType::Add:
|
||||||
|
return s_AAddPipeline;
|
||||||
|
case CCameraFilterPass::EFilterType::Multiply:
|
||||||
|
return s_AMultPipeline;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct CTexturedQuadFilterAlphaD3DDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
|
struct CTexturedQuadFilterAlphaD3DDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
CCameraFilterPass::EFilterType type,
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CTexturedQuadFilterAlpha& filter)
|
CTexturedQuadFilterAlpha& filter)
|
||||||
{
|
{
|
||||||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {filter.m_booTex};
|
boo::ITexture* texs[] = {filter.m_booTex};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(SelectAlphaPipeline(type), s_AVtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 1, texs);
|
nullptr, nullptr, nullptr, 1, texs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory*
|
TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory*
|
||||||
CTexturedQuadFilterAlpha::Initialize(boo::ID3DDataFactory::Context& ctx,
|
CTexturedQuadFilterAlpha::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
boo::IShaderPipeline*& alphaPipeOut,
|
|
||||||
boo::IShaderPipeline*& additivePipeOut,
|
|
||||||
boo::IShaderPipeline*& colorMultiplyPipeOut,
|
|
||||||
boo::IVertexFormat*& vtxFmtOut)
|
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_AVtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
alphaPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_AVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
additivePipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcAlpha,
|
s_AVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
colorMultiplyPipeOut = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::SrcColor,
|
s_AVtxFmt, boo::BlendFactor::SrcColor,
|
||||||
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CTexturedQuadFilterAlphaD3DDataBindingFactory;
|
return new CTexturedQuadFilterAlphaD3DDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
||||||
|
|
||||||
struct CThermalColdFilterGLDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
|
struct CThermalColdFilterGLDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
|
||||||
|
@ -108,7 +109,7 @@ struct CThermalColdFilterVulkanDataBindingFactory : TShader<CThermalColdFilter>:
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
|
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
|
||||||
return cctx.newShaderDataBinding(s_Pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 2, texs);
|
nullptr, nullptr, nullptr, 2, texs);
|
||||||
}
|
}
|
||||||
|
@ -132,8 +133,8 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::One,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CThermalColdFilterVulkanDataBindingFactory;
|
return new CThermalColdFilterVulkanDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,35 +77,34 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
|
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
||||||
|
|
||||||
struct CThermalColdFilterD3DDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
|
struct CThermalColdFilterD3DDataBindingFactory : TShader<CThermalColdFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CThermalColdFilter& filter)
|
CThermalColdFilter& filter)
|
||||||
{
|
{
|
||||||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
|
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_shiftTex};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 2, texs);
|
nullptr, nullptr, nullptr, 2, texs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::ID3DDataFactory::Context& ctx,
|
TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
boo::IShaderPipeline*& pipeOut,
|
|
||||||
boo::IVertexFormat*& vtxFmtOut)
|
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
pipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::One,
|
s_VtxFmt, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CThermalColdFilterD3DDataBindingFactory;
|
return new CThermalColdFilterD3DDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,35 +54,34 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CThermalHotFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CThermalHotFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
|
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
||||||
|
|
||||||
struct CThermalHotFilterD3DDataBindingFactory : TShader<CThermalHotFilter>::IDataBindingFactory
|
struct CThermalHotFilterD3DDataBindingFactory : TShader<CThermalHotFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CThermalHotFilter& filter)
|
CThermalHotFilter& filter)
|
||||||
{
|
{
|
||||||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
|
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 2, texs);
|
nullptr, nullptr, nullptr, 2, texs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(boo::ID3DDataFactory::Context& ctx,
|
TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
boo::IShaderPipeline*& pipeOut,
|
|
||||||
boo::IVertexFormat*& vtxFmtOut)
|
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
pipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::DstAlpha, boo::BlendFactor::InvDstAlpha,
|
s_VtxFmt, boo::BlendFactor::DstAlpha, boo::BlendFactor::InvDstAlpha,
|
||||||
boo::Primitive::TriStrips, false, false, false);
|
boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CThermalHotFilterD3DDataBindingFactory;
|
return new CThermalHotFilterD3DDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,6 @@ struct CXRayBlurFilterGLDataBindingFactory : TShader<CXRayBlurFilter>::IDataBind
|
||||||
struct CXRayBlurFilterVulkanDataBindingFactory : TShader<CXRayBlurFilter>::IDataBindingFactory
|
struct CXRayBlurFilterVulkanDataBindingFactory : TShader<CXRayBlurFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CXRayBlurFilter& filter)
|
CXRayBlurFilter& filter)
|
||||||
{
|
{
|
||||||
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
|
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
|
||||||
|
|
|
@ -69,35 +69,34 @@ static const char* FS =
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CXRayBlurFilter)
|
URDE_DECL_SPECIALIZE_SHADER(CXRayBlurFilter)
|
||||||
|
|
||||||
|
static boo::IVertexFormat* s_VtxFmt = nullptr;
|
||||||
|
static boo::IShaderPipeline* s_Pipeline = nullptr;
|
||||||
|
|
||||||
struct CXRayBlurFilterD3DDataBindingFactory : TShader<CXRayBlurFilter>::IDataBindingFactory
|
struct CXRayBlurFilterD3DDataBindingFactory : TShader<CXRayBlurFilter>::IDataBindingFactory
|
||||||
{
|
{
|
||||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline* pipeline,
|
|
||||||
boo::IVertexFormat* vtxFmt,
|
|
||||||
CXRayBlurFilter& filter)
|
CXRayBlurFilter& filter)
|
||||||
{
|
{
|
||||||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
|
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
|
||||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
return cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
|
||||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
nullptr, nullptr, nullptr, 2, texs);
|
nullptr, nullptr, nullptr, 2, texs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::ID3DDataFactory::Context& ctx,
|
TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
boo::IShaderPipeline*& pipeOut,
|
|
||||||
boo::IVertexFormat*& vtxFmtOut)
|
|
||||||
{
|
{
|
||||||
const boo::VertexElementDescriptor VtxVmt[] =
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
{
|
{
|
||||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
};
|
};
|
||||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
|
||||||
pipeOut = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(), ComPtr<ID3DBlob>(),
|
||||||
vtxFmtOut, boo::BlendFactor::One,
|
s_VtxFmt, boo::BlendFactor::One,
|
||||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||||
return new CXRayBlurFilterD3DDataBindingFactory;
|
return new CXRayBlurFilterD3DDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D11:
|
case boo::IGraphicsDataFactory::Platform::D3D11:
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D12:
|
case boo::IGraphicsDataFactory::Platform::D3D12:
|
||||||
m_bindFactory.reset(FilterImp::Initialize(static_cast<boo::ID3DDataFactory::Context&>(ctx)));
|
m_bindFactory.reset(ShaderImp::Initialize(static_cast<boo::ID3DDataFactory::Context&>(ctx)));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if BOO_HAS_METAL
|
#if BOO_HAS_METAL
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
case boo::IGraphicsDataFactory::Platform::Vulkan:
|
case boo::IGraphicsDataFactory::Platform::Vulkan:
|
||||||
m_bindFactory.reset(FilterImp::Initialize(static_cast<boo::VulkanDataFactory::Context&>(ctx)));
|
m_bindFactory.reset(ShaderImp::Initialize(static_cast<boo::VulkanDataFactory::Context&>(ctx)));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D11:
|
case boo::IGraphicsDataFactory::Platform::D3D11:
|
||||||
case boo::IGraphicsDataFactory::Platform::D3D12:
|
case boo::IGraphicsDataFactory::Platform::D3D12:
|
||||||
m_bindFactory.reset(FilterImp::Initialize(static_cast<boo::ID3DDataFactory::Context&>(ctx)));
|
m_bindFactory.reset(ShaderImp::Initialize(static_cast<boo::ID3DDataFactory::Context&>(ctx)));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if BOO_HAS_METAL
|
#if BOO_HAS_METAL
|
||||||
|
@ -49,7 +49,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
case boo::IGraphicsDataFactory::Platform::Vulkan:
|
case boo::IGraphicsDataFactory::Platform::Vulkan:
|
||||||
m_bindFactory.reset(FilterImp::Initialize(static_cast<boo::VulkanDataFactory::Context&>(ctx)));
|
m_bindFactory.reset(ShaderImp::Initialize(static_cast<boo::VulkanDataFactory::Context&>(ctx)));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
@ -95,7 +95,7 @@ void CTextRenderBuffer::CommitResources()
|
||||||
|
|
||||||
boo::IGraphicsBuffer* uniforms[] = {uBufInfo.first};
|
boo::IGraphicsBuffer* uniforms[] = {uBufInfo.first};
|
||||||
boo::PipelineStage unistages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage unistages[] = {boo::PipelineStage::Vertex};
|
||||||
size_t unioffs[] = {uBufInfo.second};
|
size_t unioffs[] = {size_t(uBufInfo.second)};
|
||||||
size_t unisizes[] = {sizeof(CTextSupportShader::Uniform)};
|
size_t unisizes[] = {sizeof(CTextSupportShader::Uniform)};
|
||||||
boo::ITexture* texs[] = {chs.m_font->GetTexture()};
|
boo::ITexture* texs[] = {chs.m_font->GetTexture()};
|
||||||
chs.m_dataBinding = ctx.newShaderDataBinding(CTextSupportShader::SelectTextPipeline(m_drawFlags),
|
chs.m_dataBinding = ctx.newShaderDataBinding(CTextSupportShader::SelectTextPipeline(m_drawFlags),
|
||||||
|
@ -130,7 +130,7 @@ void CTextRenderBuffer::CommitResources()
|
||||||
|
|
||||||
boo::IGraphicsBuffer* uniforms[] = {uBufInfo.first};
|
boo::IGraphicsBuffer* uniforms[] = {uBufInfo.first};
|
||||||
boo::PipelineStage unistages[] = {boo::PipelineStage::Vertex};
|
boo::PipelineStage unistages[] = {boo::PipelineStage::Vertex};
|
||||||
size_t unioffs[] = {uBufInfo.second};
|
size_t unioffs[] = {size_t(uBufInfo.second)};
|
||||||
size_t unisizes[] = {sizeof(CTextSupportShader::Uniform)};
|
size_t unisizes[] = {sizeof(CTextSupportShader::Uniform)};
|
||||||
img.m_dataBinding.reserve(img.m_imageDef.x4_texs.size());
|
img.m_dataBinding.reserve(img.m_imageDef.x4_texs.size());
|
||||||
for (TToken<CTexture>& tex : img.m_imageDef.x4_texs)
|
for (TToken<CTexture>& tex : img.m_imageDef.x4_texs)
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit d4fd78673feebcc5b29eba53178e545cee695891
|
Subproject commit 1dbd769296619bfa0a9534c76c43c83ae7b7eede
|
Loading…
Reference in New Issue