boo lambda D3D sync

This commit is contained in:
Jack Andersen 2016-03-30 10:43:09 -10:00
parent 72fc1e5754
commit f254b34cca
2 changed files with 36 additions and 32 deletions

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit bf6b4e37e81b72532afe2b4a56201b3bea7d4c63 Subproject commit ecc65a9fd531588b9679dc787624bea80272679b

View File

@ -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,9 +258,10 @@ 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).
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
vertBlob, fragBlob, pipelineBlob, vertBlob, fragBlob, pipelineBlob,
tag.newVertexFormat(m_gfxFactory), tag.newVertexFormat(ctx),
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips, m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
tag.getDepthTest(), tag.getDepthWrite(), tag.getDepthTest(), tag.getDepthWrite(),
tag.getBackfaceCulling()); tag.getBackfaceCulling());
@ -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,9 +345,10 @@ struct HLSLBackendFactory : IShaderBackendFactory
} }
boo::IShaderPipeline* ret = boo::IShaderPipeline* ret =
m_gfxFactory->newShaderPipeline(nullptr, nullptr, static_cast<boo::ID3DDataFactory::Context&>(ctx).
newShaderPipeline(nullptr, nullptr,
vertBlob, fragBlob, pipelineBlob, vertBlob, fragBlob, pipelineBlob,
tag.newVertexFormat(m_gfxFactory), tag.newVertexFormat(ctx),
blendSrc, blendDst, boo::Primitive::TriStrips, blendSrc, blendDst, boo::Primitive::TriStrips,
tag.getDepthTest(), tag.getDepthWrite(), tag.getDepthTest(), tag.getDepthWrite(),
tag.getBackfaceCulling()); tag.getBackfaceCulling());
@ -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,9 +381,10 @@ 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).
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
vertBlob, fragPipeBlob.first, fragPipeBlob.second, vertBlob, fragPipeBlob.first, fragPipeBlob.second,
tag.newVertexFormat(m_gfxFactory), tag.newVertexFormat(ctx),
m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips, m_backend.m_blendSrc, m_backend.m_blendDst, boo::Primitive::TriStrips,
tag.getDepthTest(), tag.getDepthWrite(), tag.getDepthTest(), tag.getDepthWrite(),
tag.getBackfaceCulling()); tag.getBackfaceCulling());
@ -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,9 +471,10 @@ struct HLSLBackendFactory : IShaderBackendFactory
} }
boo::IShaderPipeline* ret = boo::IShaderPipeline* ret =
m_gfxFactory->newShaderPipeline(nullptr, nullptr, static_cast<boo::ID3DDataFactory::Context&>(ctx).
newShaderPipeline(nullptr, nullptr,
vertBlob, fragBlob, pipelineBlob, vertBlob, fragBlob, pipelineBlob,
tag.newVertexFormat(m_gfxFactory), tag.newVertexFormat(ctx),
blendSrc, blendDst, boo::Primitive::TriStrips, blendSrc, blendDst, boo::Primitive::TriStrips,
tag.getDepthTest(), tag.getDepthWrite(), tag.getDepthTest(), tag.getDepthWrite(),
tag.getBackfaceCulling()); tag.getBackfaceCulling());
@ -481,9 +485,9 @@ struct HLSLBackendFactory : IShaderBackendFactory
} }
}; };
IShaderBackendFactory* _NewHLSLBackendFactory(boo::IGraphicsDataFactory* gfxFactory) IShaderBackendFactory* _NewHLSLBackendFactory()
{ {
return new struct HLSLBackendFactory(gfxFactory); return new struct HLSLBackendFactory();
} }
} }