2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-20 12:59:12 +00:00

Refactor for boo upgrades

This commit is contained in:
Jack Andersen
2017-03-13 21:03:22 -10:00
parent 21194f43db
commit 626056f3b9
6 changed files with 190 additions and 30 deletions

View File

@@ -451,6 +451,28 @@ struct HLSLBackendFactory : IShaderBackendFactory
slot.lighting, slot.post, slot.texCount, slot.texs);
pipeBlobs.emplace_back();
Blobs& thisPipeBlobs = pipeBlobs.back();
boo::ZTest zTest;
switch (slot.depthTest)
{
case hecl::Backend::ZTest::Original:
default:
zTest = tag.getDepthTest() ? boo::ZTest::LEqual : boo::ZTest::None;
break;
case hecl::Backend::ZTest::None:
zTest = boo::ZTest::None;
break;
case hecl::Backend::ZTest::LEqual:
zTest = boo::ZTest::LEqual;
break;
case hecl::Backend::ZTest::Greater:
zTest = boo::ZTest::Greater;
break;
case hecl::Backend::ZTest::Equal:
zTest = boo::ZTest::Equal;
break;
}
boo::IShaderPipeline* ret =
static_cast<boo::ID3DDataFactory::Context&>(ctx).
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
@@ -458,9 +480,9 @@ struct HLSLBackendFactory : IShaderBackendFactory
tag.newVertexFormat(ctx),
boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ? m_backend.m_blendSrc : slot.srcFactor),
boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? m_backend.m_blendDst : slot.dstFactor),
tag.getPrimType(),
tag.getDepthTest(), tag.getDepthWrite(),
tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None);
tag.getPrimType(), zTest, slot.noDepthWrite ? false : tag.getDepthWrite(),
slot.frontfaceCull ? boo::CullMode::Frontface :
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None));
if (!ret)
Log.report(logvisor::Fatal, "unable to build shader");
if (thisPipeBlobs.vert)
@@ -549,6 +571,27 @@ struct HLSLBackendFactory : IShaderBackendFactory
if (r.hasError())
return false;
boo::ZTest zTest;
switch (slot.depthTest)
{
case hecl::Backend::ZTest::Original:
default:
zTest = tag.getDepthTest() ? boo::ZTest::LEqual : boo::ZTest::None;
break;
case hecl::Backend::ZTest::None:
zTest = boo::ZTest::None;
break;
case hecl::Backend::ZTest::LEqual:
zTest = boo::ZTest::LEqual;
break;
case hecl::Backend::ZTest::Greater:
zTest = boo::ZTest::Greater;
break;
case hecl::Backend::ZTest::Equal:
zTest = boo::ZTest::Equal;
break;
}
boo::IShaderPipeline* ret =
static_cast<boo::ID3DDataFactory::Context&>(ctx).
newShaderPipeline(nullptr, nullptr,
@@ -556,9 +599,9 @@ struct HLSLBackendFactory : IShaderBackendFactory
tag.newVertexFormat(ctx),
boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ? blendSrc : slot.srcFactor),
boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? blendDst : slot.dstFactor),
tag.getPrimType(),
tag.getDepthTest(), tag.getDepthWrite(),
tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None);
tag.getPrimType(), zTest, slot.noDepthWrite ? false : tag.getDepthWrite(),
slot.frontfaceCull ? boo::CullMode::Frontface :
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None));
if (!ret)
Log.report(logvisor::Fatal, "unable to build shader");
returnFunc(ret);