From d01d4cbe01abab584aa27a38402a44c5fc901caf Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Thu, 19 Oct 2023 23:34:32 +0200 Subject: [PATCH] Metal: GpuProgram - entrypoint cannot be main & some robustness --- RenderSystems/Metal/src/OgreMetalProgram.mm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/RenderSystems/Metal/src/OgreMetalProgram.mm b/RenderSystems/Metal/src/OgreMetalProgram.mm index dd68fcbe67f..727f3e1c1df 100644 --- a/RenderSystems/Metal/src/OgreMetalProgram.mm +++ b/RenderSystems/Metal/src/OgreMetalProgram.mm @@ -84,6 +84,7 @@ of this software and associated documentation files (the "Software"), to deal PT_STRING),&msCmdShaderReflectionPairHint); } mTargetBufferName = ""; + mEntryPoint = "mainfunc"; // 1.4.4: A Metal function cannot be called main. } //--------------------------------------------------------------------------- MetalProgram::~MetalProgram() @@ -284,6 +285,10 @@ of this software and associated documentation files (the "Software"), to deal "MetalProgram::analyzeRenderParameters" ); } shader->load(); + + if(shader->hasCompileError()) + return; + assert( dynamic_cast( shader->_getBindingDelegate() ) ); MetalProgram *vertexShader = static_cast( shader->_getBindingDelegate() ); autoFillDummyVertexAttributesForShader( vertexShader->getMetalFunction(), psd ); @@ -430,13 +435,11 @@ of this software and associated documentation files (the "Software"), to deal if( mType != GPT_COMPUTE_PROGRAM ) { - //You think this is a code smell? How about making BUILDconstantDefinitions const??? - //It's an oxymoron. - const_cast(this)->analyzeRenderParameters(); + analyzeRenderParameters(); } else { - const_cast(this)->analyzeComputeParameters(); + analyzeComputeParameters(); } mLogicalToPhysical.reset(); // disallow access by index for now