mirror of https://github.com/AxioDL/metaforce.git
OS X Fixes
This commit is contained in:
parent
22c3ce608d
commit
e9a173c680
|
@ -53,6 +53,22 @@ static const char* FS =
|
||||||
" return vtf.color * float4(tex.sample(samp, vtf.uv).rgb, 1.0);\n"
|
" return vtf.color * float4(tex.sample(samp, vtf.uv).rgb, 1.0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
|
static const char* FSAlpha =
|
||||||
|
"#include <metal_stdlib>\n"
|
||||||
|
"using namespace metal;\n"
|
||||||
|
"constexpr sampler samp(address::repeat, filter::linear);\n"
|
||||||
|
"struct VertToFrag\n"
|
||||||
|
"{\n"
|
||||||
|
" float4 position [[ position ]];\n"
|
||||||
|
" float4 color;\n"
|
||||||
|
" float2 uv;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]], texture2d<float> tex [[ texture(0) ]])\n"
|
||||||
|
"{\n"
|
||||||
|
" return vtf.color * tex.sample(samp, vtf.uv);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||||
|
|
||||||
struct CTexturedQuadFilterMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
|
struct CTexturedQuadFilterMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
|
||||||
|
@ -94,4 +110,43 @@ CTexturedQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx,
|
||||||
return new CTexturedQuadFilterMetalDataBindingFactory;
|
return new CTexturedQuadFilterMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct CTexturedQuadFilterAlphaMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
|
||||||
|
{
|
||||||
|
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||||
|
boo::IShaderPipeline* pipeline,
|
||||||
|
boo::IVertexFormat* vtxFmt,
|
||||||
|
CTexturedQuadFilterAlpha& filter)
|
||||||
|
{
|
||||||
|
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||||
|
|
||||||
|
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||||
|
boo::ITexture* texs[] = {filter.m_booTex};
|
||||||
|
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
||||||
|
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||||
|
nullptr, nullptr, nullptr, 1, texs);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory*
|
||||||
|
CTexturedQuadFilterAlpha::Initialize(boo::MetalDataFactory::Context& ctx,
|
||||||
|
boo::IShaderPipeline*& alphaPipeOut,
|
||||||
|
boo::IShaderPipeline*& additivePipeOut,
|
||||||
|
boo::IShaderPipeline*& colorMultiplyPipeOut,
|
||||||
|
boo::IVertexFormat*& vtxFmtOut)
|
||||||
|
{
|
||||||
|
const boo::VertexElementDescriptor VtxVmt[] =
|
||||||
|
{
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||||
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||||
|
};
|
||||||
|
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
||||||
|
alphaPipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||||
|
additivePipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||||
|
boo::BlendFactor::One, boo::Primitive::TriStrips, false, false, false);
|
||||||
|
colorMultiplyPipeOut = ctx.newShaderPipeline(VS, FSAlpha, vtxFmtOut, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
|
||||||
|
boo::BlendFactor::DstColor, boo::Primitive::TriStrips, false, false, false);
|
||||||
|
return new CTexturedQuadFilterAlphaMetalDataBindingFactory;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 262a74e1d5b3888677cfcf380d9e75ee7ea94b9d
|
Subproject commit 3a5bdade6f3e26b82eded9bee1bdcec2856fb0df
|
2
nod
2
nod
|
@ -1 +1 @@
|
||||||
Subproject commit 02d9f800fcf327ad6cd99de618db81a24e58e380
|
Subproject commit 2132895242586251712d40405dd755ff703da638
|
Loading…
Reference in New Issue