I would also like to know this info, I could put it in my bounty description. Might help if people knew where to look.mudlord wrote: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.Perhaps you could help get PGO working with the new versions, instead?
The unofficial BSNES pixel shader thread
-
- Regular
- Posts: 347
- Joined: Tue Mar 07, 2006 10:32 am
- Location: The Netherlands
Yes, it was between v018 and v019. I don't have anything prior to v019's release, either, except the oldest copy I have -- v002 ir9. Accidentally erased the backup drive I kept them on, forgot I didn't have copies on my main PC.
But anyway, it was already semi-broken long before. Only the first two or three releases since I started using it (around v011 or v012) worked correctly. After that, more and more games would break it if they were profiled, and I had to try more and more profile runs to get a working binary.
Right now, it always bombs out after the switch(opcode) { ... } in the CPU and SMP cores. Tells me to simplify the line below it, which is "status.in_opcode=false;" ... yeah.
I've tried using both a switch table and a function pointer table there, no difference. I'm using the switch table now because it makes the binary smaller, it compiles faster, and there's no perceptible speed loss.
But anyway, it was already semi-broken long before. Only the first two or three releases since I started using it (around v011 or v012) worked correctly. After that, more and more games would break it if they were profiled, and I had to try more and more profile runs to get a working binary.
Right now, it always bombs out after the switch(opcode) { ... } in the CPU and SMP cores. Tells me to simplify the line below it, which is "status.in_opcode=false;" ... yeah.
I've tried using both a switch table and a function pointer table there, no difference. I'm using the switch table now because it makes the binary smaller, it compiles faster, and there's no perceptible speed loss.
-
- Regular
- Posts: 347
- Joined: Tue Mar 07, 2006 10:32 am
- Location: The Netherlands
Here's the scanline filter again, as requested
It uses 224 for the vertical resolution, right now. I tried using rcpres (reciprocal of the resolution?), but it didn't work the way I expected..

Code: Select all
texture tex1;
float2 rcpres;
sampler s0 = sampler_state{ texture = <tex1>; };
float4 NormalColourPass(in float2 Tex : TEXCOORD0): COLOR0
{ float4 color = tex2D(s0, Tex);
color.a = 1.;
return color;
}
float4 PixelPass( in float2 Tex : TEXCOORD0 ) : COLOR0
{ float4 color = tex2D(s0, Tex);
if(frac(Tex.y * 224.) >= .5) color.rgb *= .5;
color.a = 1.;
return color;
}
Technique T0
{ pass p0{ PixelShader = compile ps_2_0 NormalColourPass(); }
pass p1{ PixelShader = compile ps_2_0 PixelPass(); }
}
Missing bsnes sources
byuu, if you want I can give you your original bsnes bin/source's zips of V's 0.13, 0.16, 0.17, and 0.18I don't have anything prior to v019's release, either, except the oldest copy I have -- v002 ir9.
Just say If you would like these, and I will give you a link to them =D
P.S did you ever try out my opengl 2.0 glx/wgl post process shader pack I P.M'd you?
(Just a bit of fun if you are bored!)

mudlord I have given you a P.M if you want to see how I converted your shader pack to work in linux and windows.
You might also like some of the shaders I converted from other sources

Holy crap! They are amazing! Thanks so much!I have given you a P.M if you want to see how I converted your shader pack to work in linux and windows.
You might also like some of the shaders I converted from other sources


Thanks for the updated Ruby GL files, too!
Nes emu
Of course you can, I would love to try out your NES emu =DIf its okay, is it alright if I implement these in the NES emulator I am writing?
Coolness!
Currently there is only one issue with it: Colour output.
Namely, I need to convert 16-bit RGB colour to 24-bit RGB, then I render the data from the NES video buffer to a OpenGL texture. From there, I am all sorted.
The emulator is based on Nervegas's NESCore, mainly due to me wanting to have very low system requirements. And plus, its interface fits nicely in what I want to accomplish.
Anywayz, back to the main issue. I am having issues determining the best code to render:
Currently, thats how I am getting the texture data and converting 16-bit RGB to 24-bit RGB. Then, GLTexture (the texture buffer), is used to update a texture via glTexSubImage2D. Problem is, I am having major problems in getting it to work correctly, with proper colours. Blargg wrote a sample here with SDL, if that helps. If I could have a code sample as to how to properly convert this texture info to a useful texture with correct colours, that would be a massive help, as I was trying GL_RGB and setting 24-bit colours in the PFD, and it made no difference at all. 
Currently there is only one issue with it: Colour output.
Namely, I need to convert 16-bit RGB colour to 24-bit RGB, then I render the data from the NES video buffer to a OpenGL texture. From there, I am all sorted.
The emulator is based on Nervegas's NESCore, mainly due to me wanting to have very low system requirements. And plus, its interface fits nicely in what I want to accomplish.
Anywayz, back to the main issue. I am having issues determining the best code to render:
Code: Select all
void NESCore_Callback_OutputFrame(word *WorkFrame) {
register int x;
register int y;
byte *MyDisplay = (byte*)GLTexture;
for (y = 0; y < NES_DISP_HEIGHT; y++)
{
for (x = 0; x < NES_DISP_WIDTH; x++)
{
word pixel = WorkFrame[( y << 8 ) + x];
*(MyDisplay++) = ( ( pixel & 0x7c00 ) >> 7 );
*(MyDisplay++) = ( ( pixel & 0x03e0 ) >> 2 );
*(MyDisplay++) = ( ( pixel & 0x001f ) << 3 );
}
}
}

-
- Rookie
- Posts: 19
- Joined: Mon Sep 04, 2006 4:03 pm
This site appears to have several backups of the source:byuu wrote:Yes, it was between v018 and v019. I don't have anything prior to v019's release, either, except the oldest copy I have -- v002 ir9. Accidentally erased the backup drive I kept them on, forgot I didn't have copies on my main PC.
Code: Select all
http://snesemu.black-ship.net/emus/
Yes, I couldn't get any of them working on Linux (well, I noticed slight color shifts on some, but the actual pixels were always the same), but I didn't try the Windows one.P.S did you ever try out my opengl 2.0 glx/wgl post process shader pack I P.M'd you?
Yes, tukuyomi's page is awesome. The only problem is that we need the WIP releases in-between to pin-point the exact change that broke PGO. But honestly, I don't think it'd be helpful, anyway. The compiler tells us where the problem is, and I can't simplify that section any further.This site appears to have several backups of the source:
-
- Regular
- Posts: 347
- Joined: Tue Mar 07, 2006 10:32 am
- Location: The Netherlands
If all you're asking for is the correct colour conversion, this was discussed at length in the old monster bsnes topic.mudlord wrote:*(MyDisplay++) = ( ( pixel & 0x7c00 ) >> 7 );
*(MyDisplay++) = ( ( pixel & 0x03e0 ) >> 2 );
*(MyDisplay++) = ( ( pixel & 0x001f ) << 3 );
RGB565 -> RGB888:
Code: Select all
*(MyDisplay++) = (255 * ((pixel ) >> 11) + 15) / 31;
*(MyDisplay++) = (255 * ((pixel & 0x7E0) >> 5) + 31) / 63;
*(MyDisplay++) = (255 * ((pixel & 0x01F) ) + 15) / 31;
Code: Select all
*(MyDisplay++) = (255 * ((pixel ) >> 10) + 15) / 31;
*(MyDisplay++) = (255 * ((pixel & 0x3E0) >> 5) + 15) / 31;
*(MyDisplay++) = (255 * ((pixel & 0x01F) ) + 15) / 31;
Yeah, I am asking for the correct colour conversion of 16-bit RGB to 24-bit RGB colour. Then in my glTexSubImage2D, I use GL_UNSIGNED_BYTE and GL_RGB (at least, that is what I am using.)If all you're asking for is the correct colour conversion, this was discussed at length in the old monster bsnes topic. RGB565 -> RGB888, right?
I will test your code out and see how I fare.
Thanks for helping by the way!
-
- Regular
- Posts: 347
- Joined: Tue Mar 07, 2006 10:32 am
- Location: The Netherlands
opengl 2.0 glx driver probs
Ah, that is a real shame, I have tested on a gforce 6800 in ubuntu 7 linux/windows xp, and an 8800 in windows xp... oh well back to the drawing board!Yes, I couldn't get any of them working on Linux (well, I noticed slight color shifts on some, but the actual pixels were always the same)
-
- Regular
- Posts: 347
- Joined: Tue Mar 07, 2006 10:32 am
- Location: The Netherlands
Linux Shaders
Heya byuu,
Just an update to my above post.
I upgraded ubuntu to 8.04 and tried running my bsnes opengl 2.0 driver with visual effects set to normal and extra, and it did not work, It just showed me a white screen!
I have to set my visual effects to none in ubuntu by going to the: System/Preferences/Appearance/Visual Effects menu to get the shaders to run.
So if you are running your visual effects on anything other than none, it will not work correctly...
mudlord I like what you have done with mario and a cube!
Just an update to my above post.
I upgraded ubuntu to 8.04 and tried running my bsnes opengl 2.0 driver with visual effects set to normal and extra, and it did not work, It just showed me a white screen!
I have to set my visual effects to none in ubuntu by going to the: System/Preferences/Appearance/Visual Effects menu to get the shaders to run.
So if you are running your visual effects on anything other than none, it will not work correctly...
mudlord I like what you have done with mario and a cube!
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
You could use a buffer of 2^16 items to store the final 24-bit values.mudlord wrote:Code: Select all
void NESCore_Callback_OutputFrame(word *WorkFrame) { register int x; register int y; byte *MyDisplay = (byte*)GLTexture; for (y = 0; y < NES_DISP_HEIGHT; y++) { for (x = 0; x < NES_DISP_WIDTH; x++) { word pixel = WorkFrame[( y << 8 ) + x]; *(MyDisplay++) = ( ( pixel & 0x7c00 ) >> 7 ); *(MyDisplay++) = ( ( pixel & 0x03e0 ) >> 2 ); *(MyDisplay++) = ( ( pixel & 0x001f ) << 3 ); } } }
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
bsnes launcher with recent files list
-
- ZSNES Shake Shake Prinny
- Posts: 5632
- Joined: Wed Jul 28, 2004 4:15 pm
- Location: PAL50, dood !
64kcreaothceann wrote:2^16
way less intimidating
皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Code: Select all
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)