mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 17:47:43 +00:00
More reliable shader cache; update submodules
This commit is contained in:
@@ -379,13 +379,16 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
||||
boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
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, false, false);
|
||||
atUint8 texMapEnd = r.readUByte();
|
||||
boo::BlendFactor blendSrc = boo::BlendFactor(r.readUByte());
|
||||
boo::BlendFactor blendDst = boo::BlendFactor(r.readUByte());
|
||||
std::string vertSource = r.readString();
|
||||
std::string fragSource = r.readString();
|
||||
|
||||
if (r.hasError())
|
||||
return nullptr;
|
||||
|
||||
if (texMapEnd > 8)
|
||||
Log.report(logvisor::Fatal, "maximum of 8 texture maps supported");
|
||||
|
||||
@@ -463,17 +466,20 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
||||
return dataOut;
|
||||
}
|
||||
|
||||
void buildExtendedShaderFromCache(const ShaderCachedData& data,
|
||||
bool buildExtendedShaderFromCache(const ShaderCachedData& data,
|
||||
const std::vector<ShaderCacheExtensions::ExtensionSlot>& extensionSlots,
|
||||
boo::IGraphicsDataFactory::Context& ctx,
|
||||
FReturnExtensionShader returnFunc)
|
||||
{
|
||||
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, false, false);
|
||||
atUint8 texMapEnd = r.readUByte();
|
||||
hecl::Backend::BlendFactor blendSrc = hecl::Backend::BlendFactor(r.readUByte());
|
||||
hecl::Backend::BlendFactor blendDst = hecl::Backend::BlendFactor(r.readUByte());
|
||||
|
||||
if (r.hasError())
|
||||
return false;
|
||||
|
||||
if (texMapEnd > 8)
|
||||
Log.report(logvisor::Fatal, "maximum of 8 texture maps supported");
|
||||
|
||||
@@ -489,6 +495,10 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
||||
|
||||
std::string vertSource = r.readString();
|
||||
std::string fragSource = r.readString();
|
||||
|
||||
if (r.hasError())
|
||||
return false;
|
||||
|
||||
boo::IShaderPipeline* ret =
|
||||
static_cast<boo::GLDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
@@ -501,6 +511,8 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
returnFunc(ret);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -589,7 +601,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
||||
boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
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, false, false);
|
||||
size_t texCount = size_t(r.readByte());
|
||||
boo::BlendFactor blendSrc = boo::BlendFactor(r.readUByte());
|
||||
boo::BlendFactor blendDst = boo::BlendFactor(r.readUByte());
|
||||
@@ -609,6 +621,9 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
||||
if (pipelineSz)
|
||||
r.readUBytesToBuf(pipelineBlob.data(), pipelineSz);
|
||||
|
||||
if (r.hasError())
|
||||
return nullptr;
|
||||
|
||||
boo::IShaderPipeline* ret =
|
||||
static_cast<boo::VulkanDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(nullptr, nullptr,
|
||||
@@ -712,7 +727,7 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
||||
return dataOut;
|
||||
}
|
||||
|
||||
void buildExtendedShaderFromCache(const ShaderCachedData& data,
|
||||
bool buildExtendedShaderFromCache(const ShaderCachedData& data,
|
||||
const std::vector<ShaderCacheExtensions::ExtensionSlot>& extensionSlots,
|
||||
boo::IGraphicsDataFactory::Context& ctx,
|
||||
FReturnExtensionShader returnFunc)
|
||||
@@ -723,6 +738,9 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
||||
hecl::Backend::BlendFactor blendSrc = hecl::Backend::BlendFactor(r.readUByte());
|
||||
hecl::Backend::BlendFactor blendDst = hecl::Backend::BlendFactor(r.readUByte());
|
||||
|
||||
if (r.hasError())
|
||||
return false;
|
||||
|
||||
for (const ShaderCacheExtensions::ExtensionSlot& slot : extensionSlots)
|
||||
{
|
||||
atUint32 vertSz = r.readUint32Big();
|
||||
@@ -740,6 +758,9 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
||||
if (pipelineSz)
|
||||
r.readUBytesToBuf(pipelineBlob.data(), pipelineSz);
|
||||
|
||||
if (r.hasError())
|
||||
return false;
|
||||
|
||||
boo::IShaderPipeline* ret =
|
||||
static_cast<boo::VulkanDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(nullptr, nullptr,
|
||||
@@ -753,6 +774,8 @@ struct SPIRVBackendFactory : IShaderBackendFactory
|
||||
Log.report(logvisor::Fatal, "unable to build shader");
|
||||
returnFunc(ret);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user