2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 15:04:56 +00:00

Metal shader fixes

This commit is contained in:
Jack Andersen
2019-02-03 14:01:44 -10:00
parent 0bb51f067c
commit a353c7ddcf
5 changed files with 19 additions and 15 deletions

View File

@@ -75,6 +75,7 @@ static const char* BlockNames[] = {"LightingUniform"};
static const char* ThermalBlockNames[] = {"ThermalUniform"};
static const char* SolidBlockNames[] = {"SolidUniform"};
static const char* MBShadowBlockNames[] = {"MBShadowUniform"};
static const char* DisintegrateBlockNames[] = {"DisintegrateUniform"};
static hecl::Backend::ExtensionSlot g_ExtensionSlots[] = {
/* Default solid shading */
@@ -138,7 +139,7 @@ static hecl::Backend::ExtensionSlot g_ExtensionSlots[] = {
{1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::InvSrcAlpha,
hecl::Backend::ZTest::GEqual, hecl::Backend::CullMode::Backface, true, false, true},
/* Disintegration */
{1, BlockNames, 2, DisintegrateTextures, hecl::Backend::BlendFactor::SrcAlpha,
{1, DisintegrateBlockNames, 2, DisintegrateTextures, hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::LEqual, hecl::Backend::CullMode::Original, false,
false, true, false, false, true},
/* Forced additive shading without culling or Z-write and greater depth test */
@@ -185,11 +186,15 @@ CModelShaders::ShaderPipelines CModelShaders::BuildExtendedShader(const hecl::Ba
auto search = g_ShaderPipelines.find(tag.val64());
if (search != g_ShaderPipelines.cend())
return search->second;
ShaderPipelines& newPipelines = g_ShaderPipelines[tag.val64()];
newPipelines = std::make_shared<ShaderPipelinesData>();
size_t idx = 0;
for (const auto& ext : g_ExtensionSlots)
(*newPipelines)[idx++] = hecl::conv->convert(hecl::HECLIR(ir, tag, ext));
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
size_t idx = 0;
for (const auto& ext : g_ExtensionSlots)
(*newPipelines)[idx++] = hecl::conv->convert(ctx, hecl::HECLIR(ir, tag, ext));
return true;
} BooTrace);
return newPipelines;
}
} // namespace urde

View File

@@ -212,10 +212,10 @@ static std::string_view DisintegratePostMetal = FOG_STRUCT_METAL
"static float4 EXTDisintegratePostFunc(thread VertToFrag& vtf, constant DisintegrateUniform& lu, sampler samp,\n"
" sampler clampSamp, texture2d<float> extTex7, float4 colorIn)\n"
"{\n"
" float4 texel0 = extTex7.sample(samp, vtf.extTcgs[0]);\n"
" float4 texel1 = extTex7.sample(samp, vtf.extTcgs[1]);\n"
" float4 texel0 = extTex7.sample(samp, vtf.extTcgs0);\n"
" float4 texel1 = extTex7.sample(samp, vtf.extTcgs1);\n"
" colorIn = mix(float4(0.0), texel1, texel0);\n"
" colorIn.rgb += addColor.rgb;\n" FOG_ALGORITHM_METAL
" colorIn.rgb += lu.addColor.rgb;\n" FOG_ALGORITHM_METAL
"}\n"
"\n"sv;
@@ -267,9 +267,4 @@ const hecl::Backend::Function ExtensionPostFuncsMetal[] = {
{MainPostMetal, "MainPostFunc"},
};
static const char* BlockNames[] = {"LightingUniform"};
static const char* ThermalBlockNames[] = {"ThermalUniform"};
static const char* SolidBlockNames[] = {"SolidUniform"};
static const char* MBShadowBlockNames[] = {"MBShadowUniform"};
} // namespace urde