Previous Thread
Next Thread
Print Thread
Joined: Feb 2014
Posts: 1,024
Likes: 112
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,024
Likes: 112
Hi all,

I got interested in trying out the ntsc shader again and wondered if I could make it go a bit faster on my system's integrated graphics (an old core i5-3570)

So if I change some of the settings in bgfx/chains/hlsl.json to use the "guest" resolution instead of "native" resolution and changing the scale to 1.0 it goes a whole lot faster.


Code
                // mode (required): The mode of the target. Can be used for different implicit and explicit sizing options.
                // values:
                //     "guest": Use the size of the emulated screen that is being processed (e.g. 256x256 when running "targ")
                //     "native": Use the size of the displayed screen inside the window that is being displayed (the same size as the window size, for single-screen games with no artwork)
                //     "custom": Use a custom size.
                //
                // bilinear (optional): Whether or not to apply bilinear filtering to this render target.
                // values: true, false
                // default: true
                //
                // doublebuffer (optional): Whether or not this render target will be needed as a source texture. If you don't know what this means, omit it or set it to true.
                // values: true, false
                // default: true
                //
                // scale (optional): Multiply the internal size of this render target by this amount. Certain effects benefit from operating at a higher internal resolution. If you're not sure, omit it.
                // values: Any integer value
                // default: 1
                {
                        "name": "ntsc",
                        "mode": "guest",
                        "scale":1.0,
                        "doublebuffer": true
                },
                {
                        "name": "guest",
                        "mode": "guest",
                        "scale":1.0,
                        "bilinear": false,
                        "doublebuffer": true
                },
                {       "name": "internal",
                        "mode": "guest",
                        "bilinear": false,
                        "scale": 1.0,
                        "doublebuffer": true
                },
                {       "name": "previous",
                        "mode": "guest",
                        "scale": 1.0,
                        "doublebuffer": true
                }
        ],



Also, I got tired of selecting "white" as the shadow mask, so I changed src/osd/modules/lib/osdobj_common.cpp:

// { OSDOPTION_BGFX_SHADOW_MASK, "slot-mask.png", core_options::option_type::STRING, "shadow mask texture name" },
{ OSDOPTION_BGFX_SHADOW_MASK, "white.png", core_options::option_type::STRING, "shadow mask texture name" },

the other shadow masks make it look dimmer, I prefer the brightest possible.


and I changed it for the apple II, ntsc a and b set to 0, and scanline duration 39.11, (Y bandwidth to 4.38 removes much of the banding)
Code
                { "type": "float",   "name": "a_value",         "text": "NTSC A Value",                          "default":  0.0,    "max":   1.00,    "min": 0.00,    "step": 0.01,    "format": "%1.2f", "screen": "raster" },
                { "type": "float",   "name": "b_value",         "text": "NTSC B Value",                          "default":  0.0,    "max":   1.00,    "min": 0.00,    "step": 0.01,    "format": "%1.2f", "screen": "raster" },
                { "type": "float",   "name": "cc_value",        "text": "NTSC Color Carrier (MHz)",              "default": 3.5795455,"max":   3.67954, "min": 3.47954, "step": 0.000001, "format": "%1.7f", "screen": "raster" },
                { "type": "float",   "name": "o_value",         "text": "NTSC Outgoing Phase Offset (radians)",  "default":  0.00,    "max":   3.14,    "min":-3.14,    "step": 0.01,    "format": "%1.2f", "screen": "raster" },
                { "type": "float",   "name": "p_value",         "text": "NTSC Incoming Phase Pixel Clock Scale", "default":  1.00,    "max":   2.00,    "min": 0.00,    "step": 0.01,    "format": "%1.2f", "screen": "raster" },
                { "type": "float",   "name": "scan_time",       "text": "NTSC Scanline Duration (uSec)",         "default": 39.11,    "max": 150.00,    "min": 1.00,    "step": 0.01,     "format": "%3.2f", "screen": "raster" },

                { "type": "float",   "name": "notch_width",     "text": "NTSC Color Notch Filter Width (MHz)",   "default":  2.00,    "max":   4.00,    "min": 1.00,    "step": 0.01,    "format": "%1.2f", "screen": "raster" },
                { "type": "float",   "name": "y_freq_response", "text": "NTSC Y Signal Bandwidth (MHz)",         "default":  4.40,    "max":  21.00,    "min": 0.00,    "step": 0.01,    "format": "%2.2f", "screen": "raster" },

Another thing I did was to set the resolution of the window to 560x384 which makes it run at 77%. Full screen 1920x1080 drops down to around 40%.

./mame -numscreens 1 -nofilter apple2e -gameio joy -sl4 "" -snapsize 560x384 -video bgfx -numscreens 1 choplftr -bgfx_screen_chains hlsl -window -resolution0 560x384


Also I noticed the apple2e driver now has a new configuration option for monochrome (B&W for NTSC shader) which is awesome!


[Linked Image from i.imgur.com]

[Linked Image from i.imgur.com]

1 member likes this: robcfg
Joined: Feb 2014
Posts: 1,024
Likes: 112
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,024
Likes: 112
One thing I realized in reading the comment text is that the scale parameters should be integers, so that should read 1 instead of 1.0.

Of course, if you omit it or use a non integer, I think it will default to 1.

Code
    // scale (optional): Multiply the internal size of this render target by this amount. Certain effects benefit from operating at a higher internal resolution. If you're not sure, omit it.
                // values: Any integer value
                // default: 1
                {
                        "name": "ntsc",
                        "mode": "guest",
                        "scale": 1,
                        "doublebuffer": true
                },


I had a system around that uses an AMD A6-9225 (which is a dual core amd 2C+3G) that I've heard people refer to as "e-waste" since it's not so fast.


For experimentation, I grabbed the pre-release daily builds of Ubuntu 24.04 and downloaded the live iso (used dd to write it to a usb flash drive as it's bigger than 4.7GB) to install mame 0.261 with "sudo apt update" and "sudo apt install mame".

Locating the bgfx/chains/hlsl under the /usr/share/games/mame directory and making the edits as above, I was pleased to be able to get 100% speed (140% unthrottled) on the A6-9225 with the apple2e driver and hlsl.

1 member likes this: robcfg
Joined: Feb 2014
Posts: 1,024
Likes: 112
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,024
Likes: 112
If you copy the file bgfx/chains/hlsl.json to bgfx/chains/hlsl_low.json then you can make the modifications for lower resolution scaling in a second file without modifying the original hlsl.json.

Then you have the ability to choose between hlsl and hlsl_low "on the fly" to compare speed and image quality.




Also, the lower resolution makes distortion look bad, so it's probably better to set the default values to 0
Code
                { "type": "float", "name": "distortion",       "text": "Quadric Distortion Amount", "default": 0.0, "max": 2.00, "min": -2.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
                { "type": "float", "name": "cubic_distortion", "text": "Cubic Distortion Amount",   "default": 0.0, "max": 2.00, "min": -2.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
                { "type": "float", "name": "distort_corner",   "text": "Distorted Corner Amount",   "default": 0.0, "max": 2.00, "min":  0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
                { "type": "float", "name": "round_corner",     "text": "Rounded Corner Amount",     "default": 0.0, "max": 2.00, "min":  0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
                { "type": "float", "name": "smooth_border",    "text": "Smooth Border Amount",      "default": 0.0, "max": 2.00, "min":  0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
                { "type": "float", "name": "vignetting",       "text": "Vignetting Amount",         "default": 0.0, "max": 2.00, "min":  0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },
                { "type": "float", "name": "reflection",       "text": "Reflection Amount",         "default": 0.0, "max": 2.00, "min":  0.00, "step": 0.01, "format": "%1.2f", "screen": "crt" },

Last edited by Golden Child; 02/26/24 07:16 AM.
Joined: Feb 2014
Posts: 1,024
Likes: 112
G
Very Senior Member
OP Online Content
Very Senior Member
G
Joined: Feb 2014
Posts: 1,024
Likes: 112
I was fiddling with an MSX machine trying to make the TMS9918 look like an actual screenshot and it was cool to see that the NTSC shader would recreate the vertical banding in the solid background.

[Linked Image from i.imgur.com]


Link Copied to Clipboard
Who's Online Now
1 members (box), 44 guests, and 6 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,273
Posts121,387
Members5,064
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com