mirror of https://github.com/PCSX2/pcsx2.git
GS/OpenGL: Get rid of interface blocks for convert shaders
This commit is contained in:
parent
4e1b2792c9
commit
a2ae4ba441
|
@ -12,21 +12,11 @@
|
|||
[GLOBALS|FUNCTIONS]
|
||||
------------------------------------------------------------------------------*/
|
||||
#if (FXAA_GLSL_130 == 1)
|
||||
in SHADER
|
||||
{
|
||||
vec4 p;
|
||||
vec2 t;
|
||||
vec4 c;
|
||||
} PSin;
|
||||
|
||||
in vec2 PSin_t;
|
||||
|
||||
layout(location = 0) out vec4 SV_Target0;
|
||||
|
||||
layout(std140, binding = 14) uniform cb14
|
||||
{
|
||||
vec2 _xyFrame;
|
||||
vec4 _rcpFrame;
|
||||
};
|
||||
|
||||
#elif (SHADER_MODEL >= 0x400)
|
||||
Texture2D Texture : register(t0);
|
||||
SamplerState TextureSampler : register(s0);
|
||||
|
@ -511,9 +501,9 @@ float4 FxaaPass(float4 FxaaColor : COLOR0, float2 uv0 : TEXCOORD0)
|
|||
|
||||
void ps_main()
|
||||
{
|
||||
vec4 color = texture(TextureSampler, PSin.t);
|
||||
color = PreGammaPass(color, PSin.t);
|
||||
color = FxaaPass(color, PSin.t);
|
||||
vec4 color = texture(TextureSampler, PSin_t);
|
||||
color = PreGammaPass(color, PSin_t);
|
||||
color = FxaaPass(color, PSin_t);
|
||||
|
||||
SV_Target0 = color;
|
||||
}
|
||||
|
|
|
@ -15,18 +15,15 @@ layout(location = 7) in vec4 COLOR;
|
|||
// smooth, the default, means to do perspective-correct interpolation.
|
||||
//
|
||||
// The centroid qualifier only matters when multisampling. If this qualifier is not present, then the value is interpolated to the pixel's center, anywhere in the pixel, or to one of the pixel's samples. This sample may lie outside of the actual primitive being rendered, since a primitive can cover only part of a pixel's area. The centroid qualifier is used to prevent this; the interpolation point must fall within both the pixel's area and the primitive's area.
|
||||
out SHADER
|
||||
{
|
||||
vec4 p;
|
||||
vec2 t;
|
||||
vec4 c;
|
||||
} VSout;
|
||||
out vec4 PSin_p;
|
||||
out vec2 PSin_t;
|
||||
out vec4 PSin_c;
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
VSout.p = vec4(POSITION, 0.5f, 1.0f);
|
||||
VSout.t = TEXCOORD0;
|
||||
VSout.c = COLOR;
|
||||
PSin_p = vec4(POSITION, 0.5f, 1.0f);
|
||||
PSin_t = TEXCOORD0;
|
||||
PSin_c = COLOR;
|
||||
gl_Position = vec4(POSITION, 0.5f, 1.0f); // NOTE I don't know if it is possible to merge POSITION_OUT and gl_Position
|
||||
}
|
||||
|
||||
|
@ -34,12 +31,9 @@ void vs_main()
|
|||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in SHADER
|
||||
{
|
||||
vec4 p;
|
||||
vec2 t;
|
||||
vec4 c;
|
||||
} PSin;
|
||||
in vec4 PSin_p;
|
||||
in vec2 PSin_t;
|
||||
in vec4 PSin_c;
|
||||
|
||||
// Give a different name so I remember there is a special case!
|
||||
#if defined(ps_convert_rgba8_16bits) || defined(ps_convert_float32_32bits)
|
||||
|
@ -50,7 +44,7 @@ layout(location = 0) out vec4 SV_Target0;
|
|||
|
||||
vec4 sample_c()
|
||||
{
|
||||
return texture(TextureSampler, PSin.t);
|
||||
return texture(TextureSampler, PSin_t);
|
||||
}
|
||||
|
||||
vec4 ps_crt(uint i)
|
||||
|
@ -281,7 +275,7 @@ void ps_convert_rgba_8i()
|
|||
#ifdef ps_osd
|
||||
void ps_osd()
|
||||
{
|
||||
SV_Target0 = PSin.c * vec4(1.0, 1.0, 1.0, sample_c().r);
|
||||
SV_Target0 = PSin_c * vec4(1.0, 1.0, 1.0, sample_c().r);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -349,11 +343,11 @@ void ps_filter_complex()
|
|||
vec2 texdim = vec2(textureSize(TextureSampler, 0));
|
||||
|
||||
vec4 c;
|
||||
if (dFdy(PSin.t.y) * PSin.t.y > 0.5f) {
|
||||
if (dFdy(PSin_t.y) * PSin_t.y > 0.5f) {
|
||||
c = sample_c();
|
||||
} else {
|
||||
float factor = (0.9f - 0.4f * cos(2.0f * PI * PSin.t.y * texdim.y));
|
||||
c = factor * texture(TextureSampler, vec2(PSin.t.x, (floor(PSin.t.y * texdim.y) + 0.5f) / texdim.y));
|
||||
float factor = (0.9f - 0.4f * cos(2.0f * PI * PSin_t.y * texdim.y));
|
||||
c = factor * texture(TextureSampler, vec2(PSin_t.x, (floor(PSin_t.y * texdim.y) + 0.5f) / texdim.y));
|
||||
}
|
||||
|
||||
SV_Target0 = c;
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
//#version 420 // Keep it for editor detection
|
||||
|
||||
in SHADER
|
||||
{
|
||||
vec4 p;
|
||||
vec2 t;
|
||||
vec4 c;
|
||||
} PSin;
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in vec4 PSin_p;
|
||||
in vec2 PSin_t;
|
||||
in vec4 PSin_c;
|
||||
|
||||
uniform vec2 ZrH;
|
||||
uniform float hH;
|
||||
|
||||
|
@ -17,38 +14,38 @@ layout(location = 0) out vec4 SV_Target0;
|
|||
// TODO ensure that clip (discard) is < 0 and not <= 0 ???
|
||||
void ps_main0()
|
||||
{
|
||||
if (fract(PSin.t.y * hH) - 0.5 < 0.0)
|
||||
if (fract(PSin_t.y * hH) - 0.5 < 0.0)
|
||||
discard;
|
||||
// I'm not sure it impact us but be safe to lookup texture before conditional if
|
||||
// see: http://www.opengl.org/wiki/GLSL_Sampler#Non-uniform_flow_control
|
||||
vec4 c = texture(TextureSampler, PSin.t);
|
||||
vec4 c = texture(TextureSampler, PSin_t);
|
||||
|
||||
SV_Target0 = c;
|
||||
}
|
||||
|
||||
void ps_main1()
|
||||
{
|
||||
if (0.5 - fract(PSin.t.y * hH) < 0.0)
|
||||
if (0.5 - fract(PSin_t.y * hH) < 0.0)
|
||||
discard;
|
||||
// I'm not sure it impact us but be safe to lookup texture before conditional if
|
||||
// see: http://www.opengl.org/wiki/GLSL_Sampler#Non-uniform_flow_control
|
||||
vec4 c = texture(TextureSampler, PSin.t);
|
||||
vec4 c = texture(TextureSampler, PSin_t);
|
||||
|
||||
SV_Target0 = c;
|
||||
}
|
||||
|
||||
void ps_main2()
|
||||
{
|
||||
vec4 c0 = texture(TextureSampler, PSin.t - ZrH);
|
||||
vec4 c1 = texture(TextureSampler, PSin.t);
|
||||
vec4 c2 = texture(TextureSampler, PSin.t + ZrH);
|
||||
vec4 c0 = texture(TextureSampler, PSin_t - ZrH);
|
||||
vec4 c1 = texture(TextureSampler, PSin_t);
|
||||
vec4 c2 = texture(TextureSampler, PSin_t + ZrH);
|
||||
|
||||
SV_Target0 = (c0 + c1 * 2.0f + c2) / 4.0f;
|
||||
}
|
||||
|
||||
void ps_main3()
|
||||
{
|
||||
SV_Target0 = texture(TextureSampler, PSin.t);
|
||||
SV_Target0 = texture(TextureSampler, PSin_t);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
//#version 420 // Keep it for editor detection
|
||||
|
||||
in SHADER
|
||||
{
|
||||
vec4 p;
|
||||
vec2 t;
|
||||
vec4 c;
|
||||
} PSin;
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in vec4 PSin_p;
|
||||
in vec2 PSin_t;
|
||||
in vec4 PSin_c;
|
||||
|
||||
uniform vec4 BGColor;
|
||||
|
||||
layout(location = 0) out vec4 SV_Target0;
|
||||
|
||||
void ps_main0()
|
||||
{
|
||||
vec4 c = texture(TextureSampler, PSin.t);
|
||||
vec4 c = texture(TextureSampler, PSin_t);
|
||||
// Note: clamping will be done by fixed unit
|
||||
c.a *= 2.0f;
|
||||
SV_Target0 = c;
|
||||
|
@ -23,7 +20,7 @@ void ps_main0()
|
|||
|
||||
void ps_main1()
|
||||
{
|
||||
vec4 c = texture(TextureSampler, PSin.t);
|
||||
vec4 c = texture(TextureSampler, PSin_t);
|
||||
c.a = BGColor.a;
|
||||
SV_Target0 = c;
|
||||
}
|
||||
|
|
|
@ -11,12 +11,9 @@
|
|||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
in SHADER
|
||||
{
|
||||
vec4 p;
|
||||
vec2 t;
|
||||
vec4 c;
|
||||
} PSin;
|
||||
in vec4 PSin_p;
|
||||
in vec2 PSin_t;
|
||||
in vec4 PSin_c;
|
||||
|
||||
layout(location = 0) out vec4 SV_Target0;
|
||||
|
||||
|
@ -48,7 +45,7 @@ vec4 ContrastSaturationBrightness(vec4 color)
|
|||
|
||||
void ps_main()
|
||||
{
|
||||
vec4 c = texture(TextureSampler, PSin.t);
|
||||
vec4 c = texture(TextureSampler, PSin_t);
|
||||
SV_Target0 = ContrastSaturationBrightness(c);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,12 +40,8 @@
|
|||
#define saturate(x) clamp(x, 0.0, 1.0)
|
||||
#define SamplerState sampler2D
|
||||
|
||||
in SHADER
|
||||
{
|
||||
vec4 p;
|
||||
vec2 t;
|
||||
vec4 c;
|
||||
} PSin;
|
||||
in vec4 PSin_p;
|
||||
in vec2 PSin_t;
|
||||
|
||||
layout(location = 0) out vec4 SV_Target0;
|
||||
|
||||
|
@ -2412,8 +2408,8 @@ PS_OUTPUT ps_main(VS_OUTPUT input)
|
|||
#endif
|
||||
{
|
||||
#if GLSL == 1
|
||||
float2 texcoord = PSin.t;
|
||||
float4 position = PSin.p;
|
||||
float2 texcoord = PSin_t;
|
||||
float4 position = PSin_p;
|
||||
float4 color = texture(TextureSampler, texcoord);
|
||||
#else
|
||||
PS_OUTPUT output;
|
||||
|
|
Loading…
Reference in New Issue