Custom Shaders for GSdx
FYI, modern glsl can use this kind of output on the fragment shader:
For example, here write to SV_Target1 will be directed to draw buffer at location 1
Code:
layout(location = 0) out vec4 SV_Target0;
layout(location = 1) out vec4 SV_Target1;
Then you can configure how you map your location to which buffer (from your GL code)
Code:
GLenum targets[2] = {GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT2};
gl_DrawBuffers(2, targets);
In the end, write to SV_Target1, will be write in GL_COLOR_ATTACHMENT2
Reply

Sponsored links

(11-01-2013, 09:02 PM)gregory Wrote: FYI, modern glsl can use this kind of output on the fragment shader:
For example, here write to SV_Target1 will be directed to draw buffer at location 1
Code:
layout(location = 0) out vec4 SV_Target0;
layout(location = 1) out vec4 SV_Target1;
Then you can configure how you map your location to which buffer (from your GL code)
Code:
GLenum targets[2] = {GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT2};
gl_DrawBuffers(2, targets);
In the end, write to SV_Target1, will be write in GL_COLOR_ATTACHMENT2

Thanks for the tips Gregory. The PSX Emu doesn't really support modern GL though, so I use a current version in compatibility mode so I can use the newer functions etc, with the old built-in gl_ variables, so it will compile on the emu. If I use modern output methods it will just result in a blank screen Tongue

Any more tips are always welcome. I've hardly any experience with modern GL, because anytime I seem to be using it, it's targeted for an older application that doesn't support the recent versions.
Reply
Can't you modify PSX a bit? gldrawbuffers is GL2.1.

Anyway, I give it a look. Your issue seem to be
Quote:precise out vec4 gl_FragData[gl_MaxDrawBuffers];
vs
Quote:smooth out vec3 normal;
smooth out vec3 tangent;
smooth out vec3 binormal;
smooth out vec4 pos;
smooth out vec4 vertexColor;
I don't understand why you output some variable on fragment shader. Strangely you used them as input!

By the way, precise is only useful for GLES, glsl will drop it.
Reply
The out vars were the result of me moving/cutting stuff around, before I uploaded that last test version when I was attempting to debug the AMD compile problems. Thanks a lot for pointing that out, I wouldn't have spotted it. My GPU seems to be very insensitive to compiler warnings. Makes it annoying to debug for compatibility.

Sorted that much at least, and I'll get rid of the precision qualifiers. Many thanks.
Reply
your welcome Tongue2
Reply
(11-01-2013, 11:29 PM)gregory Wrote: Can't you modify PSX a bit? gldrawbuffers is GL2.1.

Sorry, when I said PSX emu, I meant the GS plugin for the emu, and it's not open source unfortunately. Don't even think Pete Bernert is still active (?) Tongue and I've messaged edgbla a few times, and he doesn't want to release he's code either lol.

The emu: PCSXR
Plugins: gpuBladeSoft 1.41 & pete's OGL2 2.9
Reply
(11-02-2013, 12:16 AM)Asmodean Wrote: Sorry, when I said PSX emu, I meant the GS plugin for the emu, and it's not open source unfortunately. Don't even think Pete Bernert is still active (?) Tongue and I've messaged edgbla a few times, and he doesn't want to release he's code either lol.

The emu: PCSXR
Plugins: gpuBladeSoft 1.41 & pete's OGL2 2.9

Pete hasnt been active in years. People been asking for updated Opengl2.9 of his plugin for 3+ years. Its still one of the better gpu plugins for ps1 imo though. Get the correct shader and you get rather nice output for images.
Reply
Ok, so I've changed a few things around, and managed to get the output via layout qualifier to actually output correctly. So I'm not using gl_FragData[] anymore. I've also tidied up the code, and removed excess unused functions etc which may be disrupting the AMD compiler. And for testing sake I've lowered the GL version to 3.30 compatibility.

So If you want to give it another go, and report back what the compiler says, use the version I've attached below.

I'd also really like to hear from anyone with an Nvidia card, on how it goes for them (OGL 3.0+/GTX 200 series+).

EDIT: I'd also like to hear, if anyone has any suggestions on a good spot to have this released for testing. I did initially mean not to release this, but it would be a bit of a shame now, considering the effort I've put into it, doubt many bother with psx emu stuff anymore though.
Not much other activity in this thread, but sorry I'm spamming it with OT PSX stuff Tongue

Updated with finished test code. Added CRT emulation, improved light attenuation, updated & optimized most other effects.

.zip   PsxFX_1.30_Final.zip (Size: 18,49 KB / Downloads: 293)


Attached Files
.zip   PsxFx 1.3 Test Final.zip (Size: 19,63 KB / Downloads: 183)
.zip   PSXFx 1.30.zip (Size: 18,41 KB / Downloads: 387)
Reply
Quote: I'm using SV_Target
Note: you can use any name actually. It was just an example from GSdx.
Reply
(11-02-2013, 09:18 PM)Asmodean Wrote: So If you want to give it another go, and report back what the compiler says, use the version I've attached below.

Tried it and got the following errors:
   
Reply




Users browsing this thread: 3 Guest(s)