mirror of https://github.com/AxioDL/metaforce.git
boo lambda D3D sync
This commit is contained in:
parent
72fc1e5754
commit
f254b34cca
|
@ -1 +1 @@
|
||||||
Subproject commit bf6b4e37e81b72532afe2b4a56201b3bea7d4c63
|
Subproject commit ecc65a9fd531588b9679dc787624bea80272679b
|
|
@ -240,14 +240,11 @@ namespace Runtime
|
||||||
struct HLSLBackendFactory : IShaderBackendFactory
|
struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
{
|
{
|
||||||
Backend::HLSL m_backend;
|
Backend::HLSL m_backend;
|
||||||
boo::ID3DDataFactory* m_gfxFactory;
|
|
||||||
|
|
||||||
HLSLBackendFactory(boo::IGraphicsDataFactory* gfxFactory)
|
|
||||||
: m_gfxFactory(dynamic_cast<boo::ID3DDataFactory*>(gfxFactory)) {}
|
|
||||||
|
|
||||||
ShaderCachedData buildShaderFromIR(const ShaderTag& tag,
|
ShaderCachedData buildShaderFromIR(const ShaderTag& tag,
|
||||||
const hecl::Frontend::IR& ir,
|
const hecl::Frontend::IR& ir,
|
||||||
hecl::Frontend::Diagnostics& diag,
|
hecl::Frontend::Diagnostics& diag,
|
||||||
|
boo::IGraphicsDataFactory::Context& ctx,
|
||||||
boo::IShaderPipeline*& objOut)
|
boo::IShaderPipeline*& objOut)
|
||||||
{
|
{
|
||||||
m_backend.reset(ir, diag);
|
m_backend.reset(ir, diag);
|
||||||
|
@ -261,12 +258,13 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
ComPtr<ID3DBlob> fragBlob;
|
ComPtr<ID3DBlob> fragBlob;
|
||||||
ComPtr<ID3DBlob> pipelineBlob;
|
ComPtr<ID3DBlob> pipelineBlob;
|
||||||
objOut =
|
objOut =
|
||||||
m_gfxFactory->newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
static_cast<boo::ID3DDataFactory::Context&>(ctx).
|
||||||
vertBlob, fragBlob, pipelineBlob,
|
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||||
tag.newVertexFormat(m_gfxFactory),
|
vertBlob, fragBlob, pipelineBlob,
|
||||||
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
tag.newVertexFormat(ctx),
|
||||||
tag.getDepthTest(), tag.getDepthWrite(),
|
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
||||||
tag.getBackfaceCulling());
|
tag.getDepthTest(), tag.getDepthWrite(),
|
||||||
|
tag.getBackfaceCulling());
|
||||||
if (!objOut)
|
if (!objOut)
|
||||||
Log.report(logvisor::Fatal, "unable to build shader");
|
Log.report(logvisor::Fatal, "unable to build shader");
|
||||||
|
|
||||||
|
@ -314,7 +312,8 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
return dataOut;
|
return dataOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IShaderPipeline* buildShaderFromCache(const ShaderCachedData& data)
|
boo::IShaderPipeline* buildShaderFromCache(const ShaderCachedData& data,
|
||||||
|
boo::IGraphicsDataFactory::Context& ctx)
|
||||||
{
|
{
|
||||||
const ShaderTag& tag = data.m_tag;
|
const ShaderTag& tag = data.m_tag;
|
||||||
athena::io::MemoryReader r(data.m_data.get(), data.m_sz);
|
athena::io::MemoryReader r(data.m_data.get(), data.m_sz);
|
||||||
|
@ -346,12 +345,13 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IShaderPipeline* ret =
|
boo::IShaderPipeline* ret =
|
||||||
m_gfxFactory->newShaderPipeline(nullptr, nullptr,
|
static_cast<boo::ID3DDataFactory::Context&>(ctx).
|
||||||
vertBlob, fragBlob, pipelineBlob,
|
newShaderPipeline(nullptr, nullptr,
|
||||||
tag.newVertexFormat(m_gfxFactory),
|
vertBlob, fragBlob, pipelineBlob,
|
||||||
blendSrc, blendDst, boo::Primitive::TriStrips,
|
tag.newVertexFormat(ctx),
|
||||||
tag.getDepthTest(), tag.getDepthWrite(),
|
blendSrc, blendDst, boo::Primitive::TriStrips,
|
||||||
tag.getBackfaceCulling());
|
tag.getDepthTest(), tag.getDepthWrite(),
|
||||||
|
tag.getBackfaceCulling());
|
||||||
if (!ret)
|
if (!ret)
|
||||||
Log.report(logvisor::Fatal, "unable to build shader");
|
Log.report(logvisor::Fatal, "unable to build shader");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -361,6 +361,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
const hecl::Frontend::IR& ir,
|
const hecl::Frontend::IR& ir,
|
||||||
hecl::Frontend::Diagnostics& diag,
|
hecl::Frontend::Diagnostics& diag,
|
||||||
const std::vector<ShaderCacheExtensions::ExtensionSlot>& extensionSlots,
|
const std::vector<ShaderCacheExtensions::ExtensionSlot>& extensionSlots,
|
||||||
|
boo::IGraphicsDataFactory::Context& ctx,
|
||||||
FReturnExtensionShader returnFunc)
|
FReturnExtensionShader returnFunc)
|
||||||
{
|
{
|
||||||
m_backend.reset(ir, diag);
|
m_backend.reset(ir, diag);
|
||||||
|
@ -380,12 +381,13 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
fragPipeBlobs.emplace_back();
|
fragPipeBlobs.emplace_back();
|
||||||
std::pair<ComPtr<ID3DBlob>, ComPtr<ID3DBlob>>& fragPipeBlob = fragPipeBlobs.back();
|
std::pair<ComPtr<ID3DBlob>, ComPtr<ID3DBlob>>& fragPipeBlob = fragPipeBlobs.back();
|
||||||
boo::IShaderPipeline* ret =
|
boo::IShaderPipeline* ret =
|
||||||
m_gfxFactory->newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
static_cast<boo::ID3DDataFactory::Context&>(ctx).
|
||||||
vertBlob, fragPipeBlob.first, fragPipeBlob.second,
|
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||||
tag.newVertexFormat(m_gfxFactory),
|
vertBlob, fragPipeBlob.first, fragPipeBlob.second,
|
||||||
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
tag.newVertexFormat(ctx),
|
||||||
tag.getDepthTest(), tag.getDepthWrite(),
|
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
|
||||||
tag.getBackfaceCulling());
|
tag.getDepthTest(), tag.getDepthWrite(),
|
||||||
|
tag.getBackfaceCulling());
|
||||||
if (!ret)
|
if (!ret)
|
||||||
Log.report(logvisor::Fatal, "unable to build shader");
|
Log.report(logvisor::Fatal, "unable to build shader");
|
||||||
if (fragPipeBlob.first)
|
if (fragPipeBlob.first)
|
||||||
|
@ -434,6 +436,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
|
|
||||||
void buildExtendedShaderFromCache(const ShaderCachedData& data,
|
void buildExtendedShaderFromCache(const ShaderCachedData& data,
|
||||||
const std::vector<ShaderCacheExtensions::ExtensionSlot>& extensionSlots,
|
const std::vector<ShaderCacheExtensions::ExtensionSlot>& extensionSlots,
|
||||||
|
boo::IGraphicsDataFactory::Context& ctx,
|
||||||
FReturnExtensionShader returnFunc)
|
FReturnExtensionShader returnFunc)
|
||||||
{
|
{
|
||||||
const ShaderTag& tag = data.m_tag;
|
const ShaderTag& tag = data.m_tag;
|
||||||
|
@ -468,12 +471,13 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IShaderPipeline* ret =
|
boo::IShaderPipeline* ret =
|
||||||
m_gfxFactory->newShaderPipeline(nullptr, nullptr,
|
static_cast<boo::ID3DDataFactory::Context&>(ctx).
|
||||||
vertBlob, fragBlob, pipelineBlob,
|
newShaderPipeline(nullptr, nullptr,
|
||||||
tag.newVertexFormat(m_gfxFactory),
|
vertBlob, fragBlob, pipelineBlob,
|
||||||
blendSrc, blendDst, boo::Primitive::TriStrips,
|
tag.newVertexFormat(ctx),
|
||||||
tag.getDepthTest(), tag.getDepthWrite(),
|
blendSrc, blendDst, boo::Primitive::TriStrips,
|
||||||
tag.getBackfaceCulling());
|
tag.getDepthTest(), tag.getDepthWrite(),
|
||||||
|
tag.getBackfaceCulling());
|
||||||
if (!ret)
|
if (!ret)
|
||||||
Log.report(logvisor::Fatal, "unable to build shader");
|
Log.report(logvisor::Fatal, "unable to build shader");
|
||||||
returnFunc(ret);
|
returnFunc(ret);
|
||||||
|
@ -481,9 +485,9 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IShaderBackendFactory* _NewHLSLBackendFactory(boo::IGraphicsDataFactory* gfxFactory)
|
IShaderBackendFactory* _NewHLSLBackendFactory()
|
||||||
{
|
{
|
||||||
return new struct HLSLBackendFactory(gfxFactory);
|
return new struct HLSLBackendFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue