mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 15:47:46 +00:00
Dramatic shader cache performance improvement
This commit is contained in:
@@ -74,23 +74,23 @@ struct HECLApplicationCallback : boo::IApplicationCallback
|
||||
std::unique_lock<std::mutex> innerLk(initmt);
|
||||
boo::IGraphicsDataFactory* gfxF = m_mainWindow->getLoadContextDataFactory();
|
||||
|
||||
/* HECL managers */
|
||||
hecl::Runtime::FileStoreManager fileMgr(app->getUniqueName());
|
||||
hecl::Runtime::ShaderCacheManager shaderMgr(fileMgr, gfxF);
|
||||
|
||||
/* Compile HECL shader */
|
||||
static std::string testShader = "HECLOpaque(Texture(0, UV(0)))";
|
||||
//static std::string testShader = "HECLOpaque(vec4(1.0,1.0,1.0,1.0))";
|
||||
hecl::Runtime::ShaderTag testShaderTag(testShader, 0, 1, 0, 0, 0, boo::Primitive::TriStrips, false, false, false);
|
||||
std::shared_ptr<hecl::Runtime::ShaderPipelines> testShaderObj =
|
||||
shaderMgr.buildShader(testShaderTag, testShader, "testShader", *gfxF);
|
||||
|
||||
boo::GraphicsDataToken data =
|
||||
gfxF->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||
{
|
||||
boo::SWindowRect mainWindowRect = m_mainWindow->getWindowFrame();
|
||||
renderTex = ctx.newRenderTexture(mainWindowRect.size[0], mainWindowRect.size[1], false, false);
|
||||
|
||||
/* HECL managers */
|
||||
hecl::Runtime::FileStoreManager fileMgr(app->getUniqueName());
|
||||
hecl::Runtime::ShaderCacheManager shaderMgr(fileMgr, gfxF);
|
||||
|
||||
/* Compile HECL shader */
|
||||
static std::string testShader = "HECLOpaque(Texture(0, UV(0)))";
|
||||
//static std::string testShader = "HECLOpaque(vec4(1.0,1.0,1.0,1.0))";
|
||||
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);
|
||||
|
||||
/* Generate meta structure (usually statically serialized) */
|
||||
hecl::HMDLMeta testMeta;
|
||||
testMeta.topology = hecl::HMDLTopology::TriStrips;
|
||||
@@ -146,7 +146,7 @@ struct HECLApplicationCallback : boo::IApplicationCallback
|
||||
vubo = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(VertexUBO), 1);
|
||||
|
||||
/* Assemble data binding */
|
||||
binding = testData.newShaderDataBindng(ctx, testShaderObj, 1, (boo::IGraphicsBuffer**)&vubo, nullptr, 1, &texture);
|
||||
binding = testData.newShaderDataBindng(ctx, testShaderObj->m_pipelines[0], 1, (boo::IGraphicsBuffer**)&vubo, nullptr, 1, &texture);
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user