The unofficial BSNES pixel shader thread

Anything else related to bsnes goes there.
Locked
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

Just curious; someone mentioned a while back that HQ2X is too complicated to implement as a shader, is that true? Not that I expect you to tackle a monster like that, but it'd be really damn awesome. Especially awesome if it's combined with OpenGL renderer shader support in the near future.
No. HQ2x texture scaling can be done on the video card. All it takes is a multipass shader, and a HQ2x lookup texture.

2xSai should be quite straightforward, same with Super2xSai.
Verdauga Greeneyes
Regular
Posts: 347
Joined: Tue Mar 07, 2006 10:32 am
Location: The Netherlands

Post by Verdauga Greeneyes »

mudlord wrote:
Just curious; someone mentioned a while back that HQ2X is too complicated to implement as a shader, is that true? Not that I expect you to tackle a monster like that, but it'd be really damn awesome. Especially awesome if it's combined with OpenGL renderer shader support in the near future.
No. HQ2x texture scaling can be done on the video card. All it takes is a multipass shader, and a HQ2x lookup texture.

2xSai should be quite straightforward, same with Super2xSai.
That someone was me, though I said (or atleast meant, I can't remember my exact words) it looked like it would be too complicated to get 60fps even on today's fastest cards. But that was from the perspective of only having worked with single-pass shaders, without much knowledge of lookup textures. I applaud the people who made that shader! By the way, you're right that 2xSaI is straightforward; the only reason I haven't converted the version I've worked on for OpenGl is that byuu mentioned not including 2xSaI in bsnes because of licensing issues, and I don't know where shaders stand with those.
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

By the way, you're right that 2xSaI is straightforward; the only reason I haven't converted the version I've worked on for OpenGl is that byuu mentioned not including 2xSaI in bsnes because of licensing issues, and I don't know where shaders stand with those.
Well, Pete's plugin is proprietary, yet guest(r)'s shaders are GPLed... So I don't know the legalese either.....
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

If you really wanted to you could probably get away with using some shaders in a seperate library of sorts if you licensed it differently. Of course that might lead to plugin hell. So it might not be the best option.
Watering ur plants.
byuu

Post by byuu »

The GPL is a distribution license only. Something only counts as a derivative work once it's linked with another application. You could argue that compiling and attaching shaders counts as linking, but this happens at runtime.

Now, you are allowed to distribute GPL licensed files with non-GPL licensed files, they just cannot be linked.

So technically, as far as I can see, it would be legal for me to include a shader/ folder in the bsnes distribution; but questionable to make the executable itself aware of those files by default (eg to add manual coded menu entries for them, or embed them inside the executable.)

You run into a gray area when software depends upon GPL files to work, even doing something such as dynamic linking. See all the nVidia binary driver hoopla, and constant blacklisting of NDISwrapper and such in the Linux kernel. But it hasn't really been tried in court yet.

However, with bsnes, it would not depend upon the shaders. In fact, the software itself wouldn't even have knowledge of them. The user would have to browse for the shader file and select it by hand. The software is fully independent of the shaders otherwise. As they won't be linked to bsnes until the user manually selects them (and even that link is questionable), ones personal use at that point is not a violation of the GPL.

I'll be including any shaders I like with the default archive, and I may even add a directory scanner to make actual menu entries dynamically. If an author (or copyright holder) of a shader has a problem, they can ask me to remove them. If anyone else has a problem, they can go jump off a cliff.
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

You could argue that compiling and attaching shaders counts as linking, but this happens at runtime.
Correct, once the shader is "compiled" by D3DXCreateEffectFromFile(), thats it.
Now, you are allowed to distribute GPL licensed files with non-GPL licensed files, they just cannot be linked.
Interesting, so basically, with me specifying a common filename for the shaders to be loaded, thats fine? Or am I misunderstanding something?

PostPosted: Thu Mar 27, 2008 5:22 pm Post subject:
The GPL is a distribution license only. Something only counts as a derivative work once it's linked with another application. You could argue that compiling and attaching shaders counts as linking, but this happens at runtime.

Now, you are allowed to distribute GPL licensed files with non-GPL licensed files, they just cannot be linked.

So technically, as far as I can see, it would be legal for me to include a shader/ folder in the bsnes distribution; but questionable to make the executable itself aware of those files by default (eg to add manual coded menu entries for them, or embed them inside the executable.)
Hmmmmz...
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

I'd very much like to try a scanline shader if someone can make it.

BTW I notice no "sharpening" of the image when I use the sharpen shader. Perhaps it doesn't work with point filtering?

I did confirm the shaders do work on my system by testing the drunken wave one. That's a Vista 64-bit test done for ya
Thanks for testing, I'm glad it works under 64 bit Windows :P

As for the scanline shader, Verdauga Greeneyes wrote quite a accurate one compared to byuu's scanline CPU filter. It should be in the monster thread, somewhere....
Y~K
Hazed
Posts: 54
Joined: Mon Jan 22, 2007 3:27 am

Post by Y~K »

creaothceann wrote:A GoodSNES ROM name! :o
I was shocked too :o
GoodSNES = shit

On topic, so this filter is supposed to make the emulation faster in theory, but is slower in practice?
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

On topic, so this filter is supposed to make the emulation faster in theory, but is slower in practice?
Sorry for taking so long to respond.

Yes, thats the issue. On my card, I dont notice a speed hit at all. Considering though its a PCI-E one...

Part of the problem lies with how the DLL works. The DLL copies rendered frames, does shader calculation, than renders it back. With it all self contained though in BSNES, byuu could just post process the main D3D texture or OpenGL one, which saves a possible texture copy operation if byuu doesn't use a render target surface as a frame storage area.

I really need to fix that first link though, which broke during my site update, as well as upload VG's scanline shader into the pack...

So basically, if your video card is recent, you shouldnt notice that much of a speed hit, or one at all.
joebells
Rookie
Posts: 29
Joined: Thu Apr 17, 2008 10:27 pm

Post by joebells »

hey mudlord I am interested in trying out the shader pack as I have a fairly recent system(c2d 2.2, radeon 3650, 4 gig ram, x64 vista) but I output to a 1280x720 hdtv and so bsnes doesn't run at full speed with hq2x and such enabled. I wanted to see what help it might hopefully give. I realize most are saying a bit of slowdown but you aren't seeing any you said.

So to get to the point :D I was wondering if you had the new link to the shader pack please. I would appreciate it.

Thanks
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

I will, when I get a spare moment.
joebells
Rookie
Posts: 29
Joined: Thu Apr 17, 2008 10:27 pm

Post by joebells »

cool, thank you
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

Uploaded.

Unfortunately, I lost my updated source code to add timing events, so the uploaded pack is of a older version.
joebells
Rookie
Posts: 29
Joined: Thu Apr 17, 2008 10:27 pm

Post by joebells »

Thank you mudlord. I hate to be a pain but I copied the d3d9.dll to the same folder as bsnes.exe and then copied a shader fakehdr.fx to the same folder and it won't work. bsnes starts up but then immediately shuts right back down. I dont see mention of any special settings needed for bsnes to use them properly?

Sorry to be a pain. I am using vista x64 version so maybe that affects it? Also using a ati radeon 3650
Ph4n70m
Rookie
Posts: 15
Joined: Tue Apr 22, 2008 4:38 am
Location: Porto Alegre, Brazil

Post by Ph4n70m »

joebells wrote:Thank you mudlord. I hate to be a pain but I copied the d3d9.dll to the same folder as bsnes.exe and then copied a shader fakehdr.fx to the same folder and it won't work. bsnes starts up but then immediately shuts right back down. I dont see mention of any special settings needed for bsnes to use them properly?

Sorry to be a pain. I am using vista x64 version so maybe that affects it? Also using a ati radeon 3650
Here too...
Isn't this plugin compatible with version 0.031 of the bsnes?

I'm using a Ge-Force 6200
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

Very strange...

I'll do some testing...
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

Here too...
Isn't this plugin compatible with version 0.031 of the bsnes?

I'm using a Ge-Force 6200
In the next few days, I will be uploading a new version. It has proper logging support, so it should be able to find where the issue is....:)

And it should work on any version of BSNES.


And...I am writing some new shaders, too.

EDIT: Uploaded.
Verdauga Greeneyes
Regular
Posts: 347
Joined: Tue Mar 07, 2006 10:32 am
Location: The Netherlands

Post by Verdauga Greeneyes »

Hey, thanks for the update. My new card (9800GX2) crashes with the patched executable. How do I enable logging?

Edit: by the way, if you're interested in non-bsnes related issues, I tried it with TrackMania Nations Forever and it complains about 'D3DPERF_SetOptions' not being found in d4rk.dll ;) (then again, the game probably uses a million shaders of its own so I dunno if it'd be in the least compatible)
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

How do I enable logging?
It should spit out a log, "debug.txt", so logging should not be enabled.

Strange it crashes for you. What OS are you using? You could try just renaming d4rk.dll to d3d9.dll and then place it where BSNES or whatever is...
Verdauga Greeneyes
Regular
Posts: 347
Joined: Tue Mar 07, 2006 10:32 am
Location: The Netherlands

Post by Verdauga Greeneyes »

mudlord wrote:
How do I enable logging?
It should spit out a log, "debug.txt", so logging should not be enabled.

Strange it crashes for you. What OS are you using? You could try just renaming d4rk.dll to d3d9.dll and then place it where BSNES or whatever is...
It doesn't create any files, so I guess it crashes before it's even able to. I'll try the d3d9.dll approach.

Edit: nope, that crashes too. For the record, it worked on my previous card, a GeForce 6600 GT AGP. My OS is Windows XP (x86) with SP3.
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

Okay, I will upgrade to SP3 and see if I can reproduce the bug. :)
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

Shit. Can't reproduce.

I really should hack the last version that had PGO and modify its renderer so it supports shaders....

Thats if byuu wouldn't mind me making a build that does such a thing. :P
byuu

Post by byuu »

I really should hack the last version that had PGO and modify its renderer so it supports shaders....

Thats if byuu wouldn't mind me making a build that does such a thing. :P
Honestly, I'd prefer you didn't. I don't want to encourage people to cling to older, buggier versions just because they're faster. If you want to use bsnes v016, you might as well use SNESGT v230. In fact, the latter is probably more accurate.

But if you insist, you have my permission, of course.

Perhaps you could help get PGO working with the new versions, instead? :)
mudlord
has wat u liek
Posts: 559
Joined: Tue Sep 11, 2007 2:54 pm
Location: Banland.

Post by mudlord »

Perhaps you could help get PGO working with the new versions, instead? :)
We need to find which code messed it up first. And which build had it last working. Sorry that I haven't been paying much attention to the dev process to find where. :(
Verdauga Greeneyes
Regular
Posts: 347
Joined: Tue Mar 07, 2006 10:32 am
Location: The Netherlands

Post by Verdauga Greeneyes »

mudlord wrote:Shit. Can't reproduce.
Hmm. Can I help you test this?
Locked