2011-11-30 21:42:41 +00:00
|
|
|
//#version 420 // Keep it for editor detection
|
2011-11-21 22:36:03 +00:00
|
|
|
|
2012-01-02 20:08:11 +00:00
|
|
|
struct vertex_basic
|
|
|
|
{
|
|
|
|
vec4 p;
|
|
|
|
vec2 t;
|
|
|
|
};
|
|
|
|
|
2014-01-11 15:01:13 +00:00
|
|
|
#if !pGL_ES && __VERSION__ > 140
|
2013-07-11 17:08:42 +00:00
|
|
|
|
|
|
|
in SHADER
|
|
|
|
{
|
|
|
|
vec4 p;
|
|
|
|
vec2 t;
|
|
|
|
} PSin;
|
|
|
|
|
2013-05-26 13:05:03 +00:00
|
|
|
#define PSin_p (PSin.p)
|
|
|
|
#define PSin_t (PSin.t)
|
2013-07-11 17:08:42 +00:00
|
|
|
|
2013-05-26 13:05:03 +00:00
|
|
|
#else
|
2013-07-11 17:08:42 +00:00
|
|
|
|
2013-05-27 16:53:38 +00:00
|
|
|
#ifdef DISABLE_SSO
|
|
|
|
in vec4 SHADERp;
|
|
|
|
in vec2 SHADERt;
|
|
|
|
#else
|
|
|
|
layout(location = 0) in vec4 SHADERp;
|
|
|
|
layout(location = 1) in vec2 SHADERt;
|
2013-05-26 13:05:03 +00:00
|
|
|
#endif
|
2013-05-27 16:53:38 +00:00
|
|
|
#define PSin_p SHADERp
|
|
|
|
#define PSin_t SHADERt
|
2013-07-11 17:08:42 +00:00
|
|
|
|
2013-05-27 16:53:38 +00:00
|
|
|
#endif
|
2013-07-11 17:08:42 +00:00
|
|
|
|
2013-05-27 16:53:38 +00:00
|
|
|
#ifdef FRAGMENT_SHADER
|
2011-11-21 22:36:03 +00:00
|
|
|
|
2011-12-07 22:05:46 +00:00
|
|
|
layout(location = 0) out vec4 SV_Target0;
|
2011-11-21 22:36:03 +00:00
|
|
|
|
2013-04-19 19:16:26 +00:00
|
|
|
#ifdef DISABLE_GL42
|
|
|
|
layout(std140) uniform cb11
|
|
|
|
#else
|
|
|
|
layout(std140, binding = 11) uniform cb11
|
|
|
|
#endif
|
2011-11-21 22:36:03 +00:00
|
|
|
{
|
2011-11-30 21:42:41 +00:00
|
|
|
vec2 ZrH;
|
|
|
|
float hH;
|
2011-11-21 22:36:03 +00:00
|
|
|
};
|
|
|
|
|
2013-10-24 20:54:27 +00:00
|
|
|
#ifdef ENABLE_BINDLESS_TEX
|
|
|
|
layout(bindless_sampler, location = 0) uniform sampler2D TextureSampler;
|
|
|
|
#else
|
2013-05-25 14:28:16 +00:00
|
|
|
#ifdef DISABLE_GL42
|
|
|
|
uniform sampler2D TextureSampler;
|
|
|
|
#else
|
2011-11-30 21:42:41 +00:00
|
|
|
layout(binding = 0) uniform sampler2D TextureSampler;
|
2013-05-25 14:28:16 +00:00
|
|
|
#endif
|
2013-10-24 20:54:27 +00:00
|
|
|
#endif
|
2011-11-30 21:42:41 +00:00
|
|
|
|
|
|
|
// TODO ensure that clip (discard) is < 0 and not <= 0 ???
|
|
|
|
void ps_main0()
|
2011-11-21 22:36:03 +00:00
|
|
|
{
|
2013-07-11 17:08:42 +00:00
|
|
|
if (fract(PSin_t.y * hH) - 0.5 < 0.0)
|
|
|
|
discard;
|
2011-11-30 21:42:41 +00:00
|
|
|
// 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
|
2013-05-26 13:05:03 +00:00
|
|
|
vec4 c = texture(TextureSampler, PSin_t);
|
2011-11-21 22:36:03 +00:00
|
|
|
|
2011-11-30 21:42:41 +00:00
|
|
|
SV_Target0 = c;
|
2011-11-21 22:36:03 +00:00
|
|
|
}
|
|
|
|
|
2011-11-30 21:42:41 +00:00
|
|
|
void ps_main1()
|
2011-11-21 22:36:03 +00:00
|
|
|
{
|
2013-07-11 17:08:42 +00:00
|
|
|
if (0.5 - fract(PSin_t.y * hH) < 0.0)
|
|
|
|
discard;
|
2011-11-30 21:42:41 +00:00
|
|
|
// 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
|
2013-05-26 13:05:03 +00:00
|
|
|
vec4 c = texture(TextureSampler, PSin_t);
|
2011-11-21 22:36:03 +00:00
|
|
|
|
2011-11-30 21:42:41 +00:00
|
|
|
SV_Target0 = c;
|
2011-11-21 22:36:03 +00:00
|
|
|
}
|
|
|
|
|
2011-11-30 21:42:41 +00:00
|
|
|
void ps_main2()
|
2011-11-21 22:36:03 +00:00
|
|
|
{
|
2013-05-26 13:05:03 +00:00
|
|
|
vec4 c0 = texture(TextureSampler, PSin_t - ZrH);
|
|
|
|
vec4 c1 = texture(TextureSampler, PSin_t);
|
|
|
|
vec4 c2 = texture(TextureSampler, PSin_t + ZrH);
|
2011-11-21 22:36:03 +00:00
|
|
|
|
2013-07-12 21:12:34 +00:00
|
|
|
SV_Target0 = (c0 + c1 * 2.0f + c2) / 4.0f;
|
2011-11-21 22:36:03 +00:00
|
|
|
}
|
|
|
|
|
2011-11-30 21:42:41 +00:00
|
|
|
void ps_main3()
|
2011-11-21 22:36:03 +00:00
|
|
|
{
|
2013-05-26 13:05:03 +00:00
|
|
|
SV_Target0 = texture(TextureSampler, PSin_t);
|
2011-11-21 22:36:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|