|
Joined: May 2009
Posts: 2,119 Likes: 152
Very Senior Member
|
Very Senior Member
Joined: May 2009
Posts: 2,119 Likes: 152 |
That's a shame, I think MAME users enjoyed the "plugin" aspect to the OpenGL code. And yet there are commercial games using BGFX. Don't be impertinent, we're hardly the only/biggest user of the library. The same rule goes for the BGFX library that goes for MAME itself: Feature requests can fuck off if they don't come with a corresponding patch.
|
|
|
|
Joined: Mar 2001
Posts: 17,005 Likes: 94
Very Senior Member
|
Very Senior Member
Joined: Mar 2001
Posts: 17,005 Likes: 94 |
And in this case he'd want the compiler to work on at least Mac and Linux (ie, without D3DCompiler) so that would be quite some patch.
|
|
|
|
Joined: Apr 2006
Posts: 770 Likes: 2
Senior Member
|
Senior Member
Joined: Apr 2006
Posts: 770 Likes: 2 |
OpenGL and BGFX. I still using both. 
Windows 10 Home 64-bit / AMD Radeon RX 5700 XT / AMD Ryzen 7 3700X 8-Core 3.59 GHz / RAM 16 GB
|
|
|
|
Joined: May 2009
Posts: 2,119 Likes: 152
Very Senior Member
|
Very Senior Member
Joined: May 2009
Posts: 2,119 Likes: 152 |
And in this case he'd want the compiler to work on at least Mac and Linux (ie, without D3DCompiler) so that would be quite some patch. That having been said, I'm pretty sure there's already a way to invoke shaderc for a specific platform. If shaderc could be made to compile on Linux and OS X (for all I know it already does), then I see no reason why Micko couldn't work his magic and change "make shaders" to only invoke the GLSL, GLES, and Vulkan targets for shaderc.
|
|
|
|
Joined: Jul 2007
Posts: 79
Member
|
Member
Joined: Jul 2007
Posts: 79 |
Shaderc does already compile on Linux. Lacking in clean makefile magic, I had to make the following changes in order for "make shaders" to work: - In src/osd/modules/render/bgfx/shaders/makefile, comment out the lines that contain TARGET=n, except for the case n=4.
- In src/osd/modules/render/bgfx/shaders/shader.mk, add a backslash before the semicolon in the lines
VS_FLAGS+=-i $(THISDIR)../src/;$(THISDIR)../examples/common/
FS_FLAGS+=-i $(THISDIR)../src/;$(THISDIR)../examples/common/
For a first try, I've ported my CRT shader to bgfx; get it here in uncompiled form. Note that this has only been tested on Linux/GLSL with an Nvidia card.
|
|
|
|
Joined: Apr 2006
Posts: 770 Likes: 2
Senior Member
|
Senior Member
Joined: Apr 2006
Posts: 770 Likes: 2 |
# # BGFX POST-PROCESSING OPTIONS # bgfx_path bgfx bgfx_backend auto bgfx_debug 0 bgfx_screen_chains crt-geom,crt-geom,crt-geom bgfx_shadow_mask slot-mask.png bgfx_avi_name bgfx.avi
Not showing the effect here on MAME64 (Windows 10 with AMD graphics card). I just tried it out. I'm doing it wrong? The rest of the bgfx shaders works.
Windows 10 Home 64-bit / AMD Radeon RX 5700 XT / AMD Ryzen 7 3700X 8-Core 3.59 GHz / RAM 16 GB
|
|
|
|
Joined: May 2009
Posts: 2,119 Likes: 152
Very Senior Member
|
Very Senior Member
Joined: May 2009
Posts: 2,119 Likes: 152 |
No shit it doesn't show the effect, he said he supplied the shader in uncompiled form. You need to build it first.
|
|
|
|
Joined: Apr 2006
Posts: 770 Likes: 2
Senior Member
|
Senior Member
Joined: Apr 2006
Posts: 770 Likes: 2 |
Windows 10 Home 64-bit / AMD Radeon RX 5700 XT / AMD Ryzen 7 3700X 8-Core 3.59 GHz / RAM 16 GB
|
|
|
|
Joined: Jul 2015
Posts: 104
Senior Member
|
Senior Member
Joined: Jul 2015
Posts: 104 |
thats awesome cgwg... will try as soon as i am home... sounds promising.
I live... I die... I live again.
|
|
|
|
Joined: May 2011
Posts: 41
Member
|
OP
Member
Joined: May 2011
Posts: 41 |
Shaderc does already compile on Linux. Lacking in clean makefile magic, I had to make the following changes in order for "make shaders" to work: - In src/osd/modules/render/bgfx/shaders/makefile, comment out the lines that contain TARGET=n, except for the case n=4.
- In src/osd/modules/render/bgfx/shaders/shader.mk, add a backslash before the semicolon in the lines
VS_FLAGS+=-i $(THISDIR)../src/;$(THISDIR)../examples/common/
FS_FLAGS+=-i $(THISDIR)../src/;$(THISDIR)../examples/common/
For a first try, I've ported my CRT shader to bgfx; get it here in uncompiled form. Note that this has only been tested on Linux/GLSL with an Nvidia card. Neat! But dx9 and dx11 shaders won't compile right now because bgfx has some annoying constraints (bgfx itself, not MAME). Look here: https://bkaradzic.github.io/bgfx/tools.htmland you'll see: No bool/int uniforms, all uniforms must be float.
Attributes and varyings can be accessed only from main() function.
Must use SAMPLER2D/3D/CUBE/etc. macros instead of sampler2D/3D/Cube/etc. tokens.
Must use vec2/3/4_splat(<value>) instead of vec2/3/4(<value>).
Must use mul(x, y) when multiplying vectors and matrices.
Must use varying.def.sc to define input/output semantic and precission instead of using attribute/in and varying/in/out.
$input/$output tokens must appear at the begining of shader. So for crt-geom to work we need: - all the "vec2(0.5)" type things updated to vec2(0.5, 0.5) or I guess vec2_splat(0.5)
- the matrix multiply for the transformtation to use mul(x,y)
- all access of varying parameters to be in main() ONLY
The last one is a bit of a pain for your shader because you expect sinangle, cosangle, stretch, etc to be available everywhere. The shader will need those passed into every function that uses them. Also, even though the varying parameters aren't accessible in functions that aren't main(), you still can't use those variable names in the helper functions. So you can't for example do this:
float intersect(vec2 xy, vec2 sinangle, vec2 cosangle)
because the compiler will bitch about the name sinangle and cosangle. And somewhere you have a variable called "point" that is some kind of reserved name or something. So that needs changing too. I'm not trying to force you to make all these changes, I could probably do it if I have a few minutes later. But I wanted to list the required changes here in case you wanted to make the modifications yourself, but didn't have access to a Windows PC with MAME build tools. Good work though. HLSL is too slow to run on integrated graphics and CRT-geom isn't. So it definitely is useful to have available.
|
|
|
4 members (Pernod, R. Belmont, 2 invisible),
58
guests, and
0
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics9,189
Posts120,324
Members5,044
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|