mirror of https://github.com/AxioDL/metaforce.git
Updated rendering interface for boo
This commit is contained in:
parent
165094b949
commit
9cc364c4fd
|
@ -1 +1 @@
|
|||
Subproject commit 05c26a535b23b1b787523e896853c3641cb888c8
|
||||
Subproject commit 5f903c09eead505d8af39b8b5c3c1f2550477f97
|
|
@ -601,7 +601,8 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
&vertBlob, &fragBlob, &pipelineBlob, tag.newVertexFormat(ctx),
|
||||
boo::BlendFactor(m_backend.m_blendSrc), boo::BlendFactor(m_backend.m_blendDst),
|
||||
tag.getPrimType(), tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getPrimType(), tag.getDepthTest() ? boo::ZTest::LEqual : boo::ZTest::None,
|
||||
tag.getDepthWrite(), true, false,
|
||||
tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None);
|
||||
if (!objOut)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
|
@ -679,7 +680,8 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
&vertBlob, &fragBlob, &pipelineBlob,
|
||||
tag.newVertexFormat(ctx),
|
||||
blendSrc, blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getDepthTest() ? boo::ZTest::LEqual : boo::ZTest::None,
|
||||
tag.getDepthWrite(), true, false,
|
||||
tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None);
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
|
@ -726,9 +728,11 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
m_backend.m_blendSrc : slot.srcFactor),
|
||||
boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ?
|
||||
m_backend.m_blendDst : slot.dstFactor),
|
||||
tag.getPrimType(), tag.getDepthTest(), slot.noDepthWrite ? false : tag.getDepthWrite(),
|
||||
tag.getPrimType(), tag.getDepthTest() ? boo::ZTest::LEqual : boo::ZTest::None,
|
||||
slot.noDepthWrite ? false : tag.getDepthWrite(),
|
||||
!slot.noColorWrite, !slot.noAlphaWrite,
|
||||
tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None);
|
||||
slot.frontfaceCull ? boo::CullMode::Frontface :
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
cachedSz += pipeBlob.vert.size() * sizeof(unsigned int);
|
||||
|
@ -811,6 +815,27 @@ struct SPIRVBackendFactory : 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::VulkanDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(nullptr, nullptr,
|
||||
|
@ -818,9 +843,10 @@ struct SPIRVBackendFactory : 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(), slot.noDepthWrite ? false : tag.getDepthWrite(),
|
||||
tag.getPrimType(), zTest, slot.noDepthWrite ? false : tag.getDepthWrite(),
|
||||
!slot.noColorWrite, !slot.noAlphaWrite,
|
||||
tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None);
|
||||
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);
|
||||
|
|
|
@ -322,7 +322,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
boo::BlendFactor(m_backend.m_blendSrc),
|
||||
boo::BlendFactor(m_backend.m_blendDst),
|
||||
tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getDepthTest() ? boo::ZTest::LEqual : boo::ZTest::None, tag.getDepthWrite(), true, false,
|
||||
tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None);
|
||||
if (!objOut)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
|
@ -415,7 +415,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
ReferenceComPtr(vertBlob), ReferenceComPtr(fragBlob), ReferenceComPtr(pipelineBlob),
|
||||
tag.newVertexFormat(ctx),
|
||||
blendSrc, blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getDepthTest() ? boo::ZTest::LEqual : boo::ZTest::None, tag.getDepthWrite(), true, false,
|
||||
tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None);
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
|
@ -481,6 +481,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
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(), zTest, slot.noDepthWrite ? false : tag.getDepthWrite(),
|
||||
!slot.noColorWrite, !slot.noAlphaWrite,
|
||||
slot.frontfaceCull ? boo::CullMode::Frontface :
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None));
|
||||
if (!ret)
|
||||
|
@ -600,6 +601,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
boo::BlendFactor((slot.srcFactor == hecl::Backend::BlendFactor::Original) ? blendSrc : slot.srcFactor),
|
||||
boo::BlendFactor((slot.dstFactor == hecl::Backend::BlendFactor::Original) ? blendDst : slot.dstFactor),
|
||||
tag.getPrimType(), zTest, slot.noDepthWrite ? false : tag.getDepthWrite(),
|
||||
!slot.noColorWrite, !slot.noAlphaWrite,
|
||||
slot.frontfaceCull ? boo::CullMode::Frontface :
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None));
|
||||
if (!ret)
|
||||
|
|
|
@ -48,6 +48,11 @@ static void UpdateFunctionHash(XXH64_state_t* st, const ShaderCacheExtensions::F
|
|||
if (func.m_entry)
|
||||
XXH64_update(st, func.m_entry, strlen(func.m_entry));
|
||||
}
|
||||
template<typename T>
|
||||
static void UpdateFieldHash(XXH64_state_t* st, T field)
|
||||
{
|
||||
XXH64_update(st, &field, sizeof(field));
|
||||
}
|
||||
uint64_t ShaderCacheExtensions::hashExtensions() const
|
||||
{
|
||||
XXH64_state_t st;
|
||||
|
@ -56,6 +61,13 @@ uint64_t ShaderCacheExtensions::hashExtensions() const
|
|||
{
|
||||
UpdateFunctionHash(&st, slot.lighting);
|
||||
UpdateFunctionHash(&st, slot.post);
|
||||
UpdateFieldHash(&st, slot.srcFactor);
|
||||
UpdateFieldHash(&st, slot.dstFactor);
|
||||
UpdateFieldHash(&st, slot.depthTest);
|
||||
UpdateFieldHash(&st, slot.frontfaceCull);
|
||||
UpdateFieldHash(&st, slot.noDepthWrite);
|
||||
UpdateFieldHash(&st, slot.noColorWrite);
|
||||
UpdateFieldHash(&st, slot.noAlphaWrite);
|
||||
}
|
||||
return XXH64_digest(&st);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue