hack: don't attempt to compile shaders with errors

This commit is contained in:
Samuliak 2024-08-28 20:09:45 +02:00
parent a6c8d83436
commit bbed00751f
3 changed files with 17 additions and 0 deletions

View File

@ -350,6 +350,12 @@ MTL::RenderPipelineState* MetalPipelineCache::GetRenderPipelineState(const Latte
auto mtlVertexShader = static_cast<RendererShaderMtl*>(vertexShader->shader);
auto mtlPixelShader = static_cast<RendererShaderMtl*>(pixelShader->shader);
mtlVertexShader->CompileVertexFunction();
// HACK
if (!mtlVertexShader->GetFunction())
{
debug_printf("no vertex function, skipping draw\n");
return nullptr;
}
mtlPixelShader->CompileFragmentFunction(activeFBO);
// Render pipeline state

View File

@ -218,12 +218,20 @@ void RendererShaderMtl::Compile(const std::string& mslCode)
if (m_function)
m_function->release();
// HACK
if (m_hasError)
return;
NS::Error* error = nullptr;
MTL::Library* library = m_mtlr->GetDevice()->newLibrary(ToNSString(mslCode), nullptr, &error);
if (error)
{
printf("failed to create library (error: %s) -> source:\n%s\n", error->localizedDescription()->utf8String(), mslCode.c_str());
error->release();
// HACK
m_hasError = true;
return;
}
m_function = library->newFunction(ToNSString("main0"));

View File

@ -63,5 +63,8 @@ private:
std::vector<uint8> m_binary;
std::string m_mslCode;
// HACK
bool m_hasError = false;
void Compile(const std::string& mslCode);
};