mirror of https://github.com/AxioDL/metaforce.git
Add primitive type to shader tag
This commit is contained in:
parent
a0b0cec67d
commit
831ad0af8e
|
@ -1 +1 @@
|
|||
Subproject commit d047a37e2b97ecc8158680b6ca192c6175b270fb
|
||||
Subproject commit 229b0b28a8873e091ed06a13749d609b25ad49ec
|
|
@ -47,6 +47,7 @@ class ShaderTag : public Hash
|
|||
uint8_t m_weightCount;
|
||||
uint8_t m_skinSlotCount;
|
||||
uint8_t m_texMtxCount;
|
||||
uint8_t m_primitiveType;
|
||||
bool m_depthTest:1;
|
||||
bool m_depthWrite:1;
|
||||
bool m_backfaceCulling:1;
|
||||
|
@ -54,20 +55,20 @@ class ShaderTag : public Hash
|
|||
};
|
||||
public:
|
||||
ShaderTag() = default;
|
||||
ShaderTag(const std::string& source, uint8_t c, uint8_t u, uint8_t w, uint8_t s, uint8_t t,
|
||||
ShaderTag(const std::string& source, uint8_t c, uint8_t u, uint8_t w, uint8_t s, uint8_t t, boo::Primitive pt,
|
||||
bool depthTest, bool depthWrite, bool backfaceCulling)
|
||||
: Hash(source), m_colorCount(c), m_uvCount(u), m_weightCount(w), m_skinSlotCount(s), m_texMtxCount(t),
|
||||
m_depthTest(depthTest), m_depthWrite(depthWrite), m_backfaceCulling(backfaceCulling)
|
||||
m_primitiveType(uint8_t(pt)), m_depthTest(depthTest), m_depthWrite(depthWrite), m_backfaceCulling(backfaceCulling)
|
||||
{hash ^= m_meta;}
|
||||
ShaderTag(const hecl::Frontend::IR& ir, uint8_t c, uint8_t u, uint8_t w, uint8_t s, uint8_t t,
|
||||
ShaderTag(const hecl::Frontend::IR& ir, uint8_t c, uint8_t u, uint8_t w, uint8_t s, uint8_t t, boo::Primitive pt,
|
||||
bool depthTest, bool depthWrite, bool backfaceCulling)
|
||||
: Hash(ir.m_hash), m_colorCount(c), m_uvCount(u), m_weightCount(w), m_skinSlotCount(s), m_texMtxCount(t),
|
||||
m_depthTest(depthTest), m_depthWrite(depthWrite), m_backfaceCulling(backfaceCulling)
|
||||
m_primitiveType(uint8_t(pt)), m_depthTest(depthTest), m_depthWrite(depthWrite), m_backfaceCulling(backfaceCulling)
|
||||
{hash ^= m_meta;}
|
||||
ShaderTag(uint64_t hashin, uint8_t c, uint8_t u, uint8_t w, uint8_t s, uint8_t t,
|
||||
ShaderTag(uint64_t hashin, uint8_t c, uint8_t u, uint8_t w, uint8_t s, uint8_t t, boo::Primitive pt,
|
||||
bool depthTest, bool depthWrite, bool backfaceCulling)
|
||||
: Hash(hashin), m_colorCount(c), m_uvCount(u), m_weightCount(w), m_skinSlotCount(s), m_texMtxCount(t),
|
||||
m_depthTest(depthTest), m_depthWrite(depthWrite), m_backfaceCulling(backfaceCulling)
|
||||
m_primitiveType(uint8_t(pt)), m_depthTest(depthTest), m_depthWrite(depthWrite), m_backfaceCulling(backfaceCulling)
|
||||
{hash ^= m_meta;}
|
||||
ShaderTag(uint64_t comphashin, uint64_t meta)
|
||||
: Hash(comphashin), m_meta(meta) {}
|
||||
|
@ -77,6 +78,7 @@ public:
|
|||
uint8_t getWeightCount() const {return m_weightCount;}
|
||||
uint8_t getSkinSlotCount() const {return m_skinSlotCount;}
|
||||
uint8_t getTexMtxCount() const {return m_texMtxCount;}
|
||||
boo::Primitive getPrimType() const {return boo::Primitive(m_primitiveType);}
|
||||
bool getDepthTest() const {return m_depthTest;}
|
||||
bool getDepthWrite() const {return m_depthWrite;}
|
||||
bool getBackfaceCulling() const {return m_backfaceCulling;}
|
||||
|
@ -220,7 +222,7 @@ public:
|
|||
/* Some platforms (like Metal) require information about the render target
|
||||
* for encoding the pipeline state. This must be called before building shaders */
|
||||
void setRenderTargetSamples(unsigned samps) {m_factory->m_rtHint = samps;}
|
||||
|
||||
|
||||
boo::IShaderPipeline* buildShader(const ShaderTag& tag, const std::string& source,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory::Context& ctx);
|
||||
|
|
|
@ -274,7 +274,7 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
m_backend.m_texMapEnd, "texs",
|
||||
1, STD_BLOCKNAMES,
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!objOut)
|
||||
|
@ -306,7 +306,7 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
texMapEnd, "texs",
|
||||
1, STD_BLOCKNAMES,
|
||||
blendSrc, blendDst, boo::Primitive::TriStrips,
|
||||
blendSrc, blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
@ -341,7 +341,7 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(vertSource.c_str(), fragSources.back().c_str(),
|
||||
m_backend.m_texMapEnd, "texs",
|
||||
1, STD_BLOCKNAMES,
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
@ -380,7 +380,7 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
texMapEnd, "texs",
|
||||
1, STD_BLOCKNAMES,
|
||||
blendSrc, blendDst, boo::Primitive::TriStrips,
|
||||
blendSrc, blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
@ -424,7 +424,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
static_cast<boo::VulkanDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
vertBlob, fragBlob, pipelineBlob, tag.newVertexFormat(ctx),
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!objOut)
|
||||
|
@ -499,7 +499,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(nullptr, nullptr,
|
||||
vertBlob, fragBlob, pipelineBlob,
|
||||
tag.newVertexFormat(ctx),
|
||||
blendSrc, blendDst, boo::Primitive::TriStrips,
|
||||
blendSrc, blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
@ -536,7 +536,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
vertBlob, fragPipeBlob.first, fragPipeBlob.second,
|
||||
tag.newVertexFormat(ctx),
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
@ -620,7 +620,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(nullptr, nullptr,
|
||||
vertBlob, fragBlob, pipelineBlob,
|
||||
tag.newVertexFormat(ctx),
|
||||
blendSrc, blendDst, boo::Primitive::TriStrips,
|
||||
blendSrc, blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
|
|
@ -262,7 +262,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
vertBlob, fragBlob, pipelineBlob,
|
||||
tag.newVertexFormat(ctx),
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!objOut)
|
||||
|
@ -349,7 +349,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(nullptr, nullptr,
|
||||
vertBlob, fragBlob, pipelineBlob,
|
||||
tag.newVertexFormat(ctx),
|
||||
blendSrc, blendDst, boo::Primitive::TriStrips,
|
||||
blendSrc, blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
@ -385,7 +385,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
vertBlob, fragPipeBlob.first, fragPipeBlob.second,
|
||||
tag.newVertexFormat(ctx),
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
@ -475,7 +475,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
newShaderPipeline(nullptr, nullptr,
|
||||
vertBlob, fragBlob, pipelineBlob,
|
||||
tag.newVertexFormat(ctx),
|
||||
blendSrc, blendDst, boo::Primitive::TriStrips,
|
||||
blendSrc, blendDst, tag.getPrimType(),
|
||||
tag.getDepthTest(), tag.getDepthWrite(),
|
||||
tag.getBackfaceCulling());
|
||||
if (!ret)
|
||||
|
|
|
@ -86,7 +86,7 @@ struct HECLApplicationCallback : boo::IApplicationCallback
|
|||
|
||||
/* Compile HECL shader */
|
||||
static std::string testShader = "HECLOpaque(Texture(0, UV(0)))";
|
||||
hecl::Runtime::ShaderTag testShaderTag(testShader, 0, 1, 0, 0, 0, false, false, false);
|
||||
hecl::Runtime::ShaderTag testShaderTag(testShader, 0, 1, 0, 0, 0, boo::Primitive::TriStrips, false, false, false);
|
||||
boo::IShaderPipeline* testShaderObj =
|
||||
shaderMgr.buildShader(testShaderTag, testShader, "testShader", ctx);
|
||||
|
||||
|
|
Loading…
Reference in New Issue