Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS Metal crash during initialization #251

Closed
jwwalker opened this issue Nov 19, 2021 · 27 comments
Closed

macOS Metal crash during initialization #251

jwwalker opened this issue Nov 19, 2021 · 27 comments
Assignees
Labels
bug Something isn't working Metal Issue affects Metal specifically. Don't use this tag if all RenderSystems are affected

Comments

@jwwalker
Copy link
Contributor

System Information

  • Ogre Version: 2.3
  • Operating System / Platform: macOS 11.6.1
  • RenderSystem: Metal
  • GPU: NVIDIA GeForce GT 750M

Detailled description

A colleague gets an immediate crash when opening an Ogre app, even Sample_Tutorial01_Initialization. The same apps work on my Mac running the same version of macOS. One difference is that his Mac has Nvidia graphics, while mine has AMD graphics. Both have Intel CPUs, not Apple Silicon.

Ogre.log

22:48:52: Creating resource group General
22:48:52: Creating resource group Internal
22:48:52: Creating resource group Autodetect
22:48:52: SceneManagerFactory for type 'DefaultSceneManager' registered.
22:48:52: Registering ResourceManager for type Material
22:48:52: Registering ResourceManager for type Mesh
22:48:52: Registering ResourceManager for type Mesh2
22:48:52: Registering ResourceManager for type OldSkeleton
22:48:52: MovableObjectFactory for type 'ParticleSystem' registered.
22:48:52: ArchiveFactory for archive type FileSystem registered.
22:48:52: ArchiveFactory for archive type Zip registered.
22:48:52: ArchiveFactory for archive type EmbeddedZip registered.
22:48:52: DDS codec registering
22:48:52: FreeImage version: 3.15.3
22:48:52: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
22:48:52: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic
22:48:52: OITD codec registering
22:48:52: Registering ResourceManager for type HighLevelGpuProgram
22:48:52: MovableObjectFactory for type 'Decal' registered.
22:48:52: MovableObjectFactory for type 'InternalCubemapProbe' registered.
22:48:52: MovableObjectFactory for type 'Entity' registered.
22:48:52: MovableObjectFactory for type 'Item' registered.
22:48:52: MovableObjectFactory for type 'Light' registered.
22:48:52: MovableObjectFactory for type 'Rectangle2Dv2' registered.
22:48:52: MovableObjectFactory for type 'BillboardSet' registered.
22:48:52: MovableObjectFactory for type 'ManualObject2' registered.
22:48:52: MovableObjectFactory for type 'BillboardChain' registered.
22:48:52: MovableObjectFactory for type 'RibbonTrail' registered.
22:48:52: MovableObjectFactory for type 'WireAabb' registered.
22:48:52: Loading library RenderSystem_Metal
22:48:52: Installing plugin: Metal RenderSystem
22:48:52: Metal: Devices Detection Starts
22:48:52: Metal: "Intel Iris Pro Graphics"
22:48:52: Metal: "NVIDIA GeForce GT 750M"
22:48:52: Metal: Devices Detection Ends
22:48:52: Plugin successfully installed
22:48:52: Loading library Plugin_ParticleFX
22:48:52: Installing plugin: ParticleFX
22:48:52: Particle Emitter Type 'Point' registered
22:48:52: Particle Emitter Type 'Box' registered
22:48:52: Particle Emitter Type 'Ellipsoid' registered
22:48:52: Particle Emitter Type 'Cylinder' registered
22:48:52: Particle Emitter Type 'Ring' registered
22:48:52: Particle Emitter Type 'HollowEllipsoid' registered
22:48:52: Particle Affector Type 'LinearForce' registered
22:48:52: Particle Affector Type 'ColourFader' registered
22:48:52: Particle Affector Type 'ColourFader2' registered
22:48:52: Particle Affector Type 'ColourImage' registered
22:48:52: Particle Affector Type 'ColourInterpolator' registered
22:48:52: Particle Affector Type 'Scaler' registered
22:48:52: Particle Affector Type 'Rotator' registered
22:48:52: Particle Affector Type 'DirectionRandomiser' registered
22:48:52: Particle Affector Type 'DeflectorPlane' registered
22:48:52: Plugin successfully installed
22:48:52: *-*-* OGRE Initialising
22:48:52: *-*-* Version 2.3.0unstable (Daedalus)
22:48:52: OverlayElementFactory for type Panel registered.
22:48:52: OverlayElementFactory for type BorderPanel registered.
22:48:52: OverlayElementFactory for type TextArea registered.
22:48:52: Registering ResourceManager for type Font
22:48:52: CPU Identifier & Features
22:48:52: -------------------------
22:48:52:  *   CPU ID: GenuineIntel: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
22:48:52:  *   Logical cores: 8
22:48:52:  *      SSE: yes
22:48:52:  *     SSE2: yes
22:48:52:  *     SSE3: yes
22:48:52:  *      MMX: yes
22:48:52:  *   MMXEXT: yes
22:48:52:  *    3DNOW: no
22:48:52:  * 3DNOWEXT: no
22:48:52:  *     CMOV: yes
22:48:52:  *      TSC: yes
22:48:52:  *      FPU: yes
22:48:52:  *      PRO: yes
22:48:52:  *       HT: no
22:48:52: -------------------------
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/2.0/scripts/materials/Common' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/2.0/scripts/materials/Common/Any' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/2.0/scripts/materials/Common/GLSL' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/2.0/scripts/materials/Common/GLSLES' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/2.0/scripts/materials/Common/HLSL' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/2.0/scripts/materials/Common/Metal' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/Hlms/Common/Any' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/Hlms/Common/GLSL' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/Hlms/Common/HLSL' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/Hlms/Common/Metal' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/Compute/Algorithms/IBL' of type 'FileSystem' to resource group 'General'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/Compute/Tools/Any' of type 'FileSystem' to resource group 'General'
22:48:52: Creating resource group Popular
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/2.0/scripts/Compositors' of type 'FileSystem' to resource group 'Popular'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/models' of type 'FileSystem' to resource group 'Popular'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/textures' of type 'FileSystem' to resource group 'Popular'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/textures/Cubemaps' of type 'FileSystem' to resource group 'Popular'
22:48:52: Added resource location '/Volumes/Homeland/Users/jwwalker/Applications/OgreViewer.app/Contents/Resources/2.0/scripts/materials/PbsMaterials' of type 'FileSystem' to resource group 'General'
22:48:52: Metal: Devices Detection Starts
22:48:52: Metal: "Intel Iris Pro Graphics"
22:48:52: Metal: "NVIDIA GeForce GT 750M"
22:48:52: Metal: Devices Detection Ends
22:48:52: Metal: Requested "(default)", selected "NVIDIA GeForce GT 750M (system default)"
22:48:52: Supports: OSX_GPUFamily1_v1
22:48:52: Registering ResourceManager for type GpuProgram
22:48:52: DefaultWorkQueue('Root') initialising on thread main.
22:48:52: Particle Renderer Type 'billboard' registered
22:48:52: [INFO] Texture cache not found at /Volumes/Homeland/Users/jwwalker/Library/Application Support/Ogre//textureMetadataCache.json
22:48:52: Parsing scripts for resource group Autodetect
22:48:52: Finished parsing scripts for resource group Autodetect
22:48:52: Creating resources for group Autodetect
22:48:52: All done
22:48:52: Parsing scripts for resource group General
22:48:52: Parsing script Quad.program
22:48:52: Shader Ogre/Compositor/Quad_vs_Metal compiled successfully.
22:48:52: Shader Ogre/Compositor/QuadCameraDir_vs_Metal compiled successfully.
22:48:52: Shader Ogre/Compositor/QuadCameraDirNoUV_vs_Metal compiled successfully.
22:48:52: Parsing script Copyback.material
22:48:52: Shader Ogre/Copy/4xFP32_ps_Metal compiled successfully.
22:48:52: Shader Ogre/Copy/4xFP32_2DArray_ps_Metal compiled successfully.
22:48:52: Shader Ogre/Copy/1xFP32_ps_Metal compiled successfully.
22:48:52: Shader Ogre/Resolve/1xFP32_Subsample0_ps_Metal compiled successfully.
22:48:52: Parsing script DepthUtils.material
22:48:52: Shader Ogre/Depth/DownscaleMax_ps_Metal compiled successfully.
22:48:52: Parsing script DPM.material
22:48:52: Shader Ogre/DPM/CubeToDpm_4xFP16_ps_Metal compiled successfully.
22:48:52: Parsing script DPSM.material
22:48:52: Shader Ogre/DPSM/CubeToDpsm_ps_Metal compiled successfully.
22:48:52: Shader Ogre/DPSM/CubeToDpsm_Colour_ps_Metal compiled successfully.
22:48:52: Parsing script EsmGaussianBlurLogFilter.material
22:48:52: Shader ESM/GaussianLogFilterH_ps_Metal compiled successfully.
22:48:52: Shader ESM/GaussianLogFilterV_ps_Metal compiled successfully.
22:48:52: Parsing script HiddenAreaMeshVr.material
22:48:52: Shader Ogre/VR/HiddenAreaMeshVr_vs_Metal compiled successfully.
22:48:52: OGRE EXCEPTION(3:RenderingAPIException): Failed to create pipeline state for reflection, error No primitive topology specified for layer selection program generation in MetalProgram::analyzeRenderParameters at /Volumes/Work/git-repos/ogre-next-fork/RenderSystems/Metal/src/OgreMetalProgram.mm (line 399)

Callstack

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff20589462 __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff205b7610 pthread_kill + 263
2   libsystem_c.dylib             	0x00007fff2050a720 abort + 120
3   libc++abi.dylib               	0x00007fff2057c418 abort_message + 231
4   libc++abi.dylib               	0x00007fff2056da65 demangling_terminate_handler() + 242
5   libobjc.A.dylib               	0x00007fff204639b9 _objc_terminate() + 104
6   libc++abi.dylib               	0x00007fff2057b847 std::__terminate(void (*)()) + 8
7   libc++abi.dylib               	0x00007fff2057e34d __cxa_rethrow + 99
8   libobjc.A.dylib               	0x00007fff20461747 objc_exception_rethrow + 37
9   com.apple.AppKit              	0x00007fff22ebe6d3 -[NSApplication run] + 659
10  com.apple.AppKit              	0x00007fff22e9296f NSApplicationMain + 816
11  libdyld.dylib                 	0x00007fff205d2621 start + 1
@jwwalker
Copy link
Contributor Author

P.S. Here's some information about the Metal capabilities of that machine:

Supports GPU families:
    MTLGPUFamilyCommon1
    MTLGPUFamilyCommon2
    MTLGPUFamilyMac1
Supports GPU feature sets:
    MTLFeatureSet_macOS_GPUFamily1_v1
    MTLFeatureSet_macOS_GPUFamily1_v2
    MTLFeatureSet_macOS_GPUFamily1_v3
    MTLFeatureSet_macOS_GPUFamily1_v4

@darksylinc
Copy link
Member

darksylinc commented Nov 19, 2021

I didn't know Metal-capable NVIDIA GPUs existed at all.

That shader uses [[viewport_array_index]] which either that GPU doesn't support or Apple never bothered testing given that it is a rare feature on a GPU Apple would probably rather see gone.

But this is definitely an Ogre bug because Ogre should not abort loading, it should log the error, mark the material as unsupported and move on (this isn't a fatal error; this is the same as having a shader compiler error: as long as the material isn't used, all is well).

That material is only used in VR, as its name suggests.

A seemingly simple way to repro on any machine the error would be to do:

diff --git a/RenderSystems/Metal/src/OgreMetalProgram.mm b/RenderSystems/Metal/src/OgreMetalProgram.mm
index f3e9002a04..6818f2ea2c 100644
--- a/RenderSystems/Metal/src/OgreMetalProgram.mm
+++ b/RenderSystems/Metal/src/OgreMetalProgram.mm
@@ -388,7 +388,7 @@ namespace Ogre {
                 [mDevice->mDevice newRenderPipelineStateWithDescriptor:psd
                 options:MTLPipelineOptionBufferTypeInfo reflection:&reflection error:&error];
 
-        if( !pso || error )
+        if( !pso || error || mName == "Ogre/VR/HiddenAreaMeshVr_ps_Metal" )
         {
             String errorDesc;
             if( error )

To see what parent function is missing a try()catch() pair (it should be far up, i.e. when parsing materials; because we definitely want to throw if we try to use this shader during rendering).

@darksylinc darksylinc self-assigned this Nov 19, 2021
@darksylinc darksylinc added bug Something isn't working Metal Issue affects Metal specifically. Don't use this tag if all RenderSystems are affected labels Nov 19, 2021
@jwwalker
Copy link
Contributor Author

By the way, this Mac has Intel Iris Pro integrated graphics as well as the Nvidia card. That wouldn't be better for Ogre, would it?

@jwwalker
Copy link
Contributor Author

Correction, my colleague now reports that the Sample_Tutorial01_Initialization app does run now that he supplied the SDL dylib that had been missing. It's just an app that I built without SDL that crashes. Yet Sample_Tutorial01_Initialization does contain HiddenAreaMeshVr.material in its resources, so I'm confused.

@darksylinc
Copy link
Member

I'd expect the Intel GPU to probably support this feature and hence not crash, but when it comes to performance the NVIDIA card should win.

AFAIK there is a switch to select which GPU to use when the graphics settings prompt appears (Eugene added this feature).

@jwwalker
Copy link
Contributor Author

That [[viewport_array_index]] thing is also used in RadialDensityMask_vs.metal, by the way.

@darksylinc
Copy link
Member

Correction, my colleague now reports that the Sample_Tutorial01_Initialization app does run now that he supplied the SDL dylib that had been missing. It's just an app that I built without SDL that crashes. Yet Sample_Tutorial01_Initialization does contain HiddenAreaMeshVr.material in its resources, so I'm confused.

I'm a bit confused by this: So it's not crashing for him anymore?

@jwwalker
Copy link
Contributor Author

That's right, Sample_Tutorial01_Initialization is not crashing for him any more. That was a "red herring". The actual Metal crash was in a different app that I built without using SDL. I made him a new build omitting HiddenAreaMeshVr.material and RadialDensityMask.material from the resources, and that made it not crash.

@darksylinc
Copy link
Member

The only thing that comes to mind is just a coincidence: That was the last material it parses before crashing due to something unrelated (like SDL)

@jwwalker
Copy link
Contributor Author

Let's review: Initially, my app was having a fatal Metal exception just after the Ogre.log said it had compiled HiddenAreaMeshVr_vs_Metal. I removed that, and then there was a fatal exception just after the log said it had compiled RadialDensityMask_vs_Metal. I removed that, and no more fatal exception. And those just happen to be the exact two vertex shaders that use [[viewport_array_index]]. That seems like too much of a coincidence to me, there must be something to your initial theory. What doesn't make sense is that Sample_Tutorial01_Initialization does not have the same problem.

@jwwalker
Copy link
Contributor Author

Oh, on taking another look at the log for Tutorial01, for some reason it doesn't actually compile those shaders it just has

10:13:16: Parsing scripts for resource group General
10:13:16: Finished parsing scripts for resource group General
10:13:16: Creating resources for group General
10:13:16: All done

for the General group. I'll ask the guy with the Nvidia Mac to try Tutorial02.

@jwwalker
Copy link
Contributor Author

As I suspected, Tutorial02 shows the same Metal exception right after "HiddenAreaMeshVr_vs_Metal compiled successfully" when the Nvidia card is selected as the rendering device. When Intel graphics are selected, it runs successfully.

@darksylinc
Copy link
Member

I see, then we're missing a try/catch block at a higher level

@jwwalker
Copy link
Contributor Author

That certainly sounds like an improvement. But I wonder whether there is any way to give a more helpful report of what’s actually wrong? If an unavailable feature is being used in these vertex shaders, why does the compile succeed?

@darksylinc
Copy link
Member

darksylinc commented Nov 21, 2021

The majority of times that step fails because of a driver error/bug.

The driver reports what's wrong in NSError (which we log and in this case it says No primitive topology specified for layer selection whatever that means) and doesn't tend to be very helpful

That error makes it sound like we should specificy whether the PSO uses tri-lists, tri strips, indexed or not, etc.

But I don't know how to specify that (but it's not worth it because that GPU is not powerful enough for VR anyway)

@darksylinc
Copy link
Member

Fixed!

Thanks for the report!

@jwwalker
Copy link
Contributor Author

Sorry, there is still a problem. My colleague with the Nvidia GPU still reports a crash. So on my own machine, I changed line 393 of OgreMetalProgram.mm to

if( !pso || error || mName == "Ogre/VR/HiddenAreaMeshVr_vs_Metal" )

and the immediate exception gets caught but leads to more problems later. The final part of Ogre.log is:

08:57:34: Parsing script HiddenAreaMeshVr.material
08:57:34: Shader Ogre/VR/HiddenAreaMeshVr_vs_Metal compiled successfully.
08:57:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to create pipeline state for reflection, error  in MetalProgram::analyzeRenderParameters at /Volumes/Work/git-repos/ogre-next-fork/RenderSystems/Metal/src/OgreMetalProgram.mm (line 403)
08:58:37: OGRE EXCEPTION(3:RenderingAPIException): Failed to create pipeline state for reflection, error  in MetalProgram::analyzeRenderParameters at /Volumes/Work/git-repos/ogre-next-fork/RenderSystems/Metal/src/OgreMetalProgram.mm (line 403)
08:58:37: OGRE EXCEPTION(5:ItemIdentityException): Parameter called projectionMatrix does not exist. Known names are:  in GpuProgramParameters::_findNamedConstantDefinition at /Volumes/Work/git-repos/ogre-next-fork/OgreMain/src/OgreGpuProgramParams.cpp (line 2228)
08:59:31: Compiler error: invalid parameters in HiddenAreaMeshVr.material(34): setting of constant failed
08:59:31: OGRE EXCEPTION(5:ItemIdentityException): Parameter called rsDepthRange does not exist. Known names are:  in GpuProgramParameters::_findNamedConstantDefinition at /Volumes/Work/git-repos/ogre-next-fork/OgreMain/src/OgreGpuProgramParams.cpp (line 2228)
08:59:35: Compiler error: invalid parameters in HiddenAreaMeshVr.material(35): setting of constant failed
08:59:35: Shader Ogre/VR/HiddenAreaMeshVr_ps_Metal compiled successfully.

and then the program crashes at line 374 of OgreMetalProgram.mm,

assert( dynamic_cast<MetalProgram*>( shader->_getBindingDelegate() ) );

@darksylinc darksylinc reopened this Nov 23, 2021
@darksylinc
Copy link
Member

Ok that crash makes little sense because:

shader->load();
assert( dynamic_cast<MetalProgram*>( shader->_getBindingDelegate() ) );

There multiple scenarios:

  • shader is nullptr. That makes little sense because shader->load() should crash first.
  • shader is valid ptr, but it is not of type MetalProgram (how???)
  • shader is corrupted memory

Note that on my system when I tried it worked fine: the exception is raised and it later continues normally (i.e. I could not repro your problem).

More info on what "shader" is would shed some light on why it is asserting (also the contents of variables, e.g. what's in mShaderReflectionPairHint and this->mName)

@jwwalker
Copy link
Contributor Author

Are you sure you tested the same way I did? Earlier in this thread, you mentioned the idea of saying

if( !pso || error || mName == "Ogre/VR/HiddenAreaMeshVr_ps_Metal" )

whereas I said that I used

if( !pso || error || mName == "Ogre/VR/HiddenAreaMeshVr_vs_Metal" )

note that it's the vertex shader, not the pixel shader.

When the assertion fails, shader is not nullptr, but shader->_getBindingDelegate() is nullptr. this->mName is "Ogre/VR/HiddenAreaMeshVr_ps_Metal" and mShaderReflectionPairHint is "Ogre/VR/HiddenAreaMeshVr_vs".

@darksylinc
Copy link
Member

Sneaky!!! I thought the VS was succeeding but then failing when paired with PS. I can see why it would fail for VS first.

When the assertion fails, shader is not nullptr, but shader->_getBindingDelegate() is nullptr.

D'oh! Now it makes sense.

Yeah I see the problem now. I'll try to repro the problem again.

Obviously we're not handling the case where a valid shader reflection pair was provided but that pair failed to compile.

@darksylinc
Copy link
Member

darksylinc commented Nov 27, 2021

OK I coded this one blind, in other words I didn't test it. I'll leave testing to you 😝

Hopefully it works since it's wasn't a hard error (famous last words), it should be working now

@jwwalker
Copy link
Contributor Author

Still no good. In the function MetalProgram::analyzeRenderParameters(), after the call to -[MTLDevice newRenderPipelineStateWithDescriptor:error:], I made the modification

if( !pso || error || mName == "Ogre/VR/HiddenAreaMeshVr_vs_Metal" )

and in the main program I added a try/catch block around initialization:

try
{
    graphicsSystem.initialize( "Tutorial 02: Variable Framerate" );
}
catch (Ogre::Exception& ex)
{
    Ogre::LogManager::getSingleton().logMessage(
        "exception caught from graphicsSystem.initialize:");
    Ogre::LogManager::getSingleton().logMessage( ex.getFullDescription() );
    return 1;
}

End of Ogre.log:

10:58:33: Parsing script HiddenAreaMeshVr.material
10:58:33: Shader Ogre/VR/HiddenAreaMeshVr_vs_Metal compiled successfully.
10:58:33: OGRE EXCEPTION(3:RenderingAPIException): Failed to create pipeline state for reflection, error  in MetalProgram::analyzeRenderParameters at /Volumes/Work/git-repos/ogre-next-fork/RenderSystems/Metal/src/OgreMetalProgram.mm (line 416)
10:58:33: OGRE EXCEPTION(3:RenderingAPIException): Failed to create pipeline state for reflection, error  in MetalProgram::analyzeRenderParameters at /Volumes/Work/git-repos/ogre-next-fork/RenderSystems/Metal/src/OgreMetalProgram.mm (line 416)
10:58:33: OGRE EXCEPTION(5:ItemIdentityException): Parameter called projectionMatrix does not exist. Known names are:  in GpuProgramParameters::_findNamedConstantDefinition at /Volumes/Work/git-repos/ogre-next-fork/OgreMain/src/OgreGpuProgramParams.cpp (line 2228)
10:58:33: Compiler error: invalid parameters in HiddenAreaMeshVr.material(34): setting of constant failed
10:58:33: OGRE EXCEPTION(5:ItemIdentityException): Parameter called rsDepthRange does not exist. Known names are:  in GpuProgramParameters::_findNamedConstantDefinition at /Volumes/Work/git-repos/ogre-next-fork/OgreMain/src/OgreGpuProgramParams.cpp (line 2228)
10:58:33: Compiler error: invalid parameters in HiddenAreaMeshVr.material(35): setting of constant failed
10:58:33: Shader Ogre/VR/HiddenAreaMeshVr_ps_Metal compiled successfully.
10:58:33: OGRE EXCEPTION(2:InvalidParametersException): Shader reflection hint 'Ogre/VR/HiddenAreaMeshVr_vs' for pixel shader 'Ogre/VR/HiddenAreaMeshVr_ps_Metal' had a compiler error. in MetalProgram::analyzeRenderParameters at /Volumes/Work/git-repos/ogre-next-fork/RenderSystems/Metal/src/OgreMetalProgram.mm (line 384)
10:58:33: exception caught from graphicsSystem.initialize:
10:58:33: OGRE EXCEPTION(2:InvalidParametersException): Shader reflection hint 'Ogre/VR/HiddenAreaMeshVr_vs' for pixel shader 'Ogre/VR/HiddenAreaMeshVr_ps_Metal' had a compiler error. in MetalProgram::analyzeRenderParameters at /Volumes/Work/git-repos/ogre-next-fork/RenderSystems/Metal/src/OgreMetalProgram.mm (line 384)
10:58:33: WARNING: GraphicsSystem::deinitialize() not called!!!

@darksylinc darksylinc reopened this Nov 28, 2021
@dyunchik
Copy link
Contributor

dyunchik commented Jan 4, 2022

Please check compatibility with list here: https://support.apple.com/en-us/HT208898
I'm sure NVIDIA GeForce GT 750M does not support Metal. Macs with with this hardware may not legally to be updated even to macOS 10.14!

@darksylinc
Copy link
Member

Please check compatibility with list here: https://support.apple.com/en-us/HT208898 I'm sure NVIDIA GeForce GT 750M does not support Metal. Macs with with this hardware may not legally updates event to macOS 10.14!

While true, I'd like to keep the ticket open until fixed, since the ticket is revealing we're incorrectly handling errors; and I have the feeling it's going to bite us in the future if left unfixed (however it's currently low priority for me).

@jwwalker
Copy link
Contributor Author

jwwalker commented Jan 4, 2022

@dyunchik The support article you link to says it is for Mac Pro, not all Macs. The Mac with the NVIDIA GeForce GT 750M is a MacBook Pro, different machine. I'm not sure exactly which model my colleague has, but one such model is the 15-inch mid-2014 model with specs here: https://everymac.com/systems/apple/macbook_pro/specs/macbook-pro-core-i7-2.8-15-dual-graphics-mid-2014-retina-display-specs.html This model can go as far as Big Sur (it goes to 11). According to this Apple page, Metal 2 is supported on MacBook Pros from mid 2012 on.

@dyunchik
Copy link
Contributor

dyunchik commented Jan 4, 2022

@dyunchik The support article you link to says it is for Mac Pro, not all Macs. The Mac with the NVIDIA GeForce GT 750M is a MacBook Pro, different machine. I'm not sure exactly which model my colleague has, but one such model is the 15-inch mid-2014 model with specs here: https://everymac.com/systems/apple/macbook_pro/specs/macbook-pro-core-i7-2.8-15-dual-graphics-mid-2014-retina-display-specs.html This model can go as far as Big Sur (it goes to 11). According to this Apple page, Metal 2 is supported on MacBook Pros from mid 2012 on.

You're right.

darksylinc added a commit that referenced this issue Feb 14, 2022
Log the errors/failures instead of raising an exception, which causes a
crash if the GPU doesn't support a specific feature despite the shader
being valid.

Fixes #251
@darksylinc
Copy link
Member

This issue has been fixed on both 2.4 & 2.3 branches.

Thanks for all the info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Metal Issue affects Metal specifically. Don't use this tag if all RenderSystems are affected
Projects
None yet
Development

No branches or pull requests

3 participants