Previous Thread
Next Thread
Print Thread
Page 2 of 5 1 2 3 4 5
Re: bgfx-tools/shader compiling problems [Re: Stiletto] #105918
06/03/16 03:49 PM
06/03/16 03:49 PM
Joined: May 2009
Posts: 1,747
J
Just Desserts Offline
Very Senior Member
Just Desserts  Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,747
Originally Posted By Stiletto
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.

Re: bgfx-tools/shader compiling problems [Re: SoltanGris42] #105919
06/03/16 03:56 PM
06/03/16 03:56 PM
Joined: Mar 2001
Posts: 16,070
USA
R
R. Belmont Online content
Very Senior Member
R. Belmont  Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,070
USA
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.

Re: bgfx-tools/shader compiling problems [Re: SoltanGris42] #105921
06/03/16 06:34 PM
06/03/16 06:34 PM
Joined: Apr 2006
Posts: 628
Fort Worth, TX.
D
Dullaron Offline
Senior Member
Dullaron  Offline
Senior Member
D
Joined: Apr 2006
Posts: 628
Fort Worth, TX.
OpenGL and BGFX. I still using both. laugh


Windows 10 Pro 64-bit / Intel Core i5-4460 3.20 GHz / 8.00 GB RAM / AMD Radeon R9 200 Series
Re: bgfx-tools/shader compiling problems [Re: R. Belmont] #105930
06/04/16 10:21 AM
06/04/16 10:21 AM
Joined: May 2009
Posts: 1,747
J
Just Desserts Offline
Very Senior Member
Just Desserts  Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,747
Originally Posted By R. Belmont
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.

Re: bgfx-tools/shader compiling problems [Re: Just Desserts] #105980
06/09/16 10:24 PM
06/09/16 10:24 PM
Joined: Jul 2007
Posts: 78
C
cgwg Offline
Member
cgwg  Offline
Member
C
Joined: Jul 2007
Posts: 78
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
    Code:
    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.

Re: bgfx-tools/shader compiling problems [Re: SoltanGris42] #105981
06/10/16 12:57 AM
06/10/16 12:57 AM
Joined: Apr 2006
Posts: 628
Fort Worth, TX.
D
Dullaron Offline
Senior Member
Dullaron  Offline
Senior Member
D
Joined: Apr 2006
Posts: 628
Fort Worth, TX.
#
# 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 Pro 64-bit / Intel Core i5-4460 3.20 GHz / 8.00 GB RAM / AMD Radeon R9 200 Series
Re: bgfx-tools/shader compiling problems [Re: Dullaron] #105987
06/10/16 08:15 AM
06/10/16 08:15 AM
Joined: May 2009
Posts: 1,747
J
Just Desserts Offline
Very Senior Member
Just Desserts  Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,747
No shit it doesn't show the effect, he said he supplied the shader in uncompiled form. You need to build it first.

Re: bgfx-tools/shader compiling problems [Re: SoltanGris42] #105989
06/10/16 10:04 AM
06/10/16 10:04 AM
Joined: Apr 2006
Posts: 628
Fort Worth, TX.
D
Dullaron Offline
Senior Member
Dullaron  Offline
Senior Member
D
Joined: Apr 2006
Posts: 628
Fort Worth, TX.
Oh ok.


Windows 10 Pro 64-bit / Intel Core i5-4460 3.20 GHz / 8.00 GB RAM / AMD Radeon R9 200 Series
Re: bgfx-tools/shader compiling problems [Re: SoltanGris42] #105990
06/10/16 10:13 AM
06/10/16 10:13 AM
Joined: Jul 2015
Posts: 88
Serbo-Croatian MF living in Ge...
u-man Offline
Member
u-man  Offline
Member
Joined: Jul 2015
Posts: 88
Serbo-Croatian MF living in Ge...
thats awesome cgwg... will try as soon as i am home... sounds promising.


I live... I die... I live again.
Re: bgfx-tools/shader compiling problems [Re: cgwg] #105991
06/10/16 05:35 PM
06/10/16 05:35 PM
Joined: May 2011
Posts: 41
S
SoltanGris42 Offline OP
Member
SoltanGris42  Offline OP
Member
S
Joined: May 2011
Posts: 41
Originally Posted By cgwg
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
    Code:
    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.html

and you'll see:
Code:
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:
Code:
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.

Page 2 of 5 1 2 3 4 5

Who's Online Now
3 registered members (Vas Crabb, Richard Bannister, 1 invisible), 104 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,606
Posts112,515
Members4,827
Most Online296
Dec 5th, 2018
Powered by UBB.threads™ PHP Forum Software 7.6.1.1
(Release build 20180111)
Page Time: 0.049s Queries: 15 (0.028s) Memory: 5.7283 MB (Peak: 5.9531 MB) Zlib enabled. Server Time: 2018-12-15 14:01:28 UTC