Skip to content

Commit

Permalink
Metal: GpuProgram - entrypoint cannot be main & some robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Oct 20, 2023
1 parent 029de78 commit d01d4cb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions RenderSystems/Metal/src/OgreMetalProgram.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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<MetalProgram*>( shader->_getBindingDelegate() ) );
MetalProgram *vertexShader = static_cast<MetalProgram*>( shader->_getBindingDelegate() );
autoFillDummyVertexAttributesForShader( vertexShader->getMetalFunction(), psd );
Expand Down Expand Up @@ -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<MetalProgram*>(this)->analyzeRenderParameters();
analyzeRenderParameters();
}
else
{
const_cast<MetalProgram*>(this)->analyzeComputeParameters();
analyzeComputeParameters();
}

mLogicalToPhysical.reset(); // disallow access by index for now
Expand Down

0 comments on commit d01d4cb

Please sign in to comment.