Home Page

HLSL effect crashes locally-compiled MAME

Posted By: Robert Hildinger

HLSL effect crashes locally-compiled MAME - 11/05/19 11:57 PM

There is a strange issue with the MacOS version of MAME that has been going on since at least the 209 timeframe. Specifically, using the HLSL effect crashes MAME when I build it on my computer. It also crashes the build at https://choccyhobnob.com/, but does NOT crash the build created at http://sdlmame.lngn.net/.

This is the error that occurs (for both my build and the choccyhobnob build):

Code
RHILDING-M-26W8:mame rhilding$ ./mame_galaga_64 galaga -window -nomax -video bgfx -bgfx_screen_chains hlsl
2019-11-05 17:53:33.455 mame_galaga_64[68895:490990] ../../../../../3rdparty/bgfx/src/renderer_mtl.mm (2465): BGFX 0x00000001: Failed to create Fragment shader.
Abort trap: 6



Note: I'm compiling on MacOS Mojave 10.14.6, and here is the relevant compile information:

Build version: 0.215 (mame0215)
Build architecure:
Build defines 1: SDLMAME_UNIX=1 SDLMAME_MACOSX=1 SDLMAME_DARWIN=1
Build defines 1: LSB_FIRST=1 PTR64=1
SDL/OpenGL defines: SDL_COMPILEDVERSION=2009 USE_OPENGL=1
Compiler defines A: __GNUC__=4 __GNUC_MINOR__=2 __GNUC_PATCHLEVEL__=1 __VERSION__="4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.3)"
Compiler defines B: __amd64__=1 __x86_64__=1
Compiler defines C: _FORTIFY_SOURCE=2
Posted By: R. Belmont

Re: HLSL effect crashes locally-compiled MAME - 11/06/19 12:39 AM

Which BGFX backend are you using? The HLSL chain does fail to compile with the Metal backend (-bgfx_backend metal), but prior to 0.215 it worked with OpenGL (-bgfx_backend opengl). Currently -bgfx_backend opengl doesn't work at all for me.

(Ryan: Is there some way to enable verbose BGFX shader compilation errors so we can track this down?)
Posted By: Robert Hildinger

Re: HLSL effect crashes locally-compiled MAME - 11/06/19 01:47 AM

sdlmame.lngn.net 215 build:
- hlsl compiles successfully on all bgfx backends (opengl, gles, metal).

my local build and chocyhobnob 215 build:
- hlsl compiles successfully for: opengl
- hlsl fails to compile for: metal and gles

I've noticed in all cases where hlsl successfully compiles that it appears to not be honoring the monitor rotation setting, at least for Galaga. The Galaga scanlines appear horizontal instead of vertical like they should be...
Posted By: R. Belmont

Re: HLSL effect crashes locally-compiled MAME - 11/06/19 01:58 AM

Correct, the scanlines are always horizontal for the HLSL chain.
Posted By: R. Belmont

Re: HLSL effect crashes locally-compiled MAME - 11/06/19 02:04 AM

The sdlmame.lngn.net build actually doesn't allow Metal - it always picks OpenGL for BGFX. I just tried it, you can run with -bgfx_debug to show on-screen what backend it's really using plus some performance data.
Posted By: Robert Hildinger

Re: HLSL effect crashes locally-compiled MAME - 11/06/19 02:17 AM

Originally Posted by R. Belmont
The sdlmame.lngn.net build actually doesn't allow Metal - it always picks OpenGL for BGFX. I just tried it, you can run with -bgfx_debug to show on-screen what backend it's really using plus some performance data.


Aha! That would explain it then. Good to know it's not some hard-to-find difference in compilers. Sorry for throwing up a red herring...
Posted By: Just Desserts

Re: HLSL effect crashes locally-compiled MAME - 11/06/19 10:50 AM

Originally Posted by R. Belmont
(Ryan: Is there some way to enable verbose BGFX shader compilation errors so we can track this down?)


Yes, I'll look at it when I get home from work.
Posted By: R. Belmont

Re: HLSL effect crashes locally-compiled MAME - 11/13/19 03:33 AM

MAME top-of-tree has an updated BGFX where the HLSL shader works fine on the Metal backend. This will be in 0.216, of course.
© 2020 Forums