mirror of https://github.com/AxioDL/metaforce.git
More flexible cull-mode options for shader extensions
This commit is contained in:
parent
a60a02a31e
commit
93711460f8
|
@ -46,6 +46,14 @@ enum class ZTest : uint8_t
|
|||
Original = 0xff
|
||||
};
|
||||
|
||||
enum class CullMode : uint8_t
|
||||
{
|
||||
None,
|
||||
Backface,
|
||||
Frontface,
|
||||
Original = 0xff
|
||||
};
|
||||
|
||||
struct TextureInfo
|
||||
{
|
||||
TexGenSrc src;
|
||||
|
|
|
@ -141,7 +141,7 @@ public:
|
|||
Backend::BlendFactor srcFactor = Backend::BlendFactor::Original;
|
||||
Backend::BlendFactor dstFactor = Backend::BlendFactor::Original;
|
||||
Backend::ZTest depthTest = Backend::ZTest::Original;
|
||||
bool frontfaceCull = false;
|
||||
Backend::CullMode cullMode = Backend::CullMode::Backface;
|
||||
bool noDepthWrite = false;
|
||||
bool noColorWrite = false;
|
||||
bool noAlphaWrite = false;
|
||||
|
@ -162,7 +162,7 @@ public:
|
|||
size_t texCount, const Backend::TextureInfo* texs,
|
||||
Backend::BlendFactor srcFactor, Backend::BlendFactor dstFactor,
|
||||
Backend::ZTest depthTest = Backend::ZTest::Original,
|
||||
bool frontfaceCull = false,
|
||||
Backend::CullMode cullMode = Backend::CullMode::Backface,
|
||||
bool noDepthWrite = false,
|
||||
bool noColorWrite = false,
|
||||
bool noAlphaWrite = false,
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
slot.srcFactor = srcFactor;
|
||||
slot.dstFactor = dstFactor;
|
||||
slot.depthTest = depthTest;
|
||||
slot.frontfaceCull = frontfaceCull;
|
||||
slot.cullMode = cullMode;
|
||||
slot.noDepthWrite = noDepthWrite;
|
||||
slot.noColorWrite = noColorWrite;
|
||||
slot.noAlphaWrite = noAlphaWrite;
|
||||
|
|
|
@ -527,8 +527,9 @@ struct GLSLBackendFactory : 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));
|
||||
(slot.cullMode == hecl::Backend::CullMode::Original) ?
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None) :
|
||||
boo::CullMode(slot.cullMode));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
returnFunc(ret);
|
||||
|
@ -609,8 +610,9 @@ struct GLSLBackendFactory : 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));
|
||||
(slot.cullMode == hecl::Backend::CullMode::Original) ?
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None) :
|
||||
boo::CullMode(slot.cullMode));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
returnFunc(ret);
|
||||
|
@ -790,8 +792,9 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
tag.getPrimType(), tag.getDepthTest() ? boo::ZTest::LEqual : boo::ZTest::None,
|
||||
slot.noDepthWrite ? false : tag.getDepthWrite(),
|
||||
!slot.noColorWrite, !slot.noAlphaWrite,
|
||||
slot.frontfaceCull ? boo::CullMode::Frontface :
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None));
|
||||
(slot.cullMode == hecl::Backend::CullMode::Original) ?
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None) :
|
||||
boo::CullMode(slot.cullMode));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
cachedSz += pipeBlob.vert.size() * sizeof(unsigned int);
|
||||
|
@ -904,8 +907,9 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
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));
|
||||
(slot.cullMode == hecl::Backend::CullMode::Original) ?
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None) :
|
||||
boo::CullMode(slot.cullMode));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
returnFunc(ret);
|
||||
|
|
|
@ -544,8 +544,9 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
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));
|
||||
(slot.cullMode == hecl::Backend::CullMode::Original) ?
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None) :
|
||||
boo::CullMode(slot.cullMode));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
if (thisPipeBlobs.vert)
|
||||
|
@ -664,8 +665,9 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
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));
|
||||
(slot.cullMode == hecl::Backend::CullMode::Original) ?
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None) :
|
||||
boo::CullMode(slot.cullMode));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
returnFunc(ret);
|
||||
|
|
|
@ -591,8 +591,9 @@ struct MetalBackendFactory : IShaderBackendFactory
|
|||
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));
|
||||
(slot.cullMode == hecl::Backend::CullMode::Original) ?
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None) :
|
||||
boo::CullMode(slot.cullMode));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
|
||||
|
@ -683,8 +684,9 @@ struct MetalBackendFactory : IShaderBackendFactory
|
|||
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));
|
||||
(slot.cullMode == hecl::Backend::CullMode::Original) ?
|
||||
(tag.getBackfaceCulling() ? boo::CullMode::Backface : boo::CullMode::None) :
|
||||
boo::CullMode(slot.cullMode));
|
||||
if (!ret)
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
returnFunc(ret);
|
||||
|
|
|
@ -66,7 +66,7 @@ uint64_t ShaderCacheExtensions::hashExtensions() const
|
|||
UpdateFieldHash(&st, slot.srcFactor);
|
||||
UpdateFieldHash(&st, slot.dstFactor);
|
||||
UpdateFieldHash(&st, slot.depthTest);
|
||||
UpdateFieldHash(&st, slot.frontfaceCull);
|
||||
UpdateFieldHash(&st, slot.cullMode);
|
||||
UpdateFieldHash(&st, slot.noDepthWrite);
|
||||
UpdateFieldHash(&st, slot.noColorWrite);
|
||||
UpdateFieldHash(&st, slot.noAlphaWrite);
|
||||
|
|
Loading…
Reference in New Issue