I know shinra358 is banned, but does anyone know how I could go about getting his shader to work with the latest builds? It works fine on the latest master build, but I just downloaded 4.0-2826 (the latest build as of this post), and I'm getting compilation errors when trying to use this shader:
Code:
Fragment shader failed to compile with the following errors:
ERROR: 1:43: error(#198) Redefinition error: samp9
ERROR: 1:45: error(#198) Redefinition error: ocol0
ERROR: 1:46: error(#198) Redefinition error: uv0
ERROR: 1:48: error(#198) Redefinition error: resolution
ERROR: error(#273) 4 compilation errors. No code generated
The full shader is as follows:
Code:
#version 150
#extension GL_ARB_shader_image_load_store : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_ARB_sample_shading : enable
#define SAMPLER_BINDING(x) layout(binding = x)
#define float2 vec2
#define float3 vec3
#define float4 vec4
#define uint2 uvec2
#define uint3 uvec3
#define uint4 uvec4
#define int2 ivec2
#define int3 ivec3
#define int4 ivec4
#define frac fract
#define lerp mix
SAMPLER_BINDING(8) uniform sampler2D samp8;
SAMPLER_BINDING(9) uniform sampler2D samp9;
out float4 ocol0;
in float2 uv0;
uniform float4 resolution;
uniform uint time;
float4 Sample()
{
return texture(samp9, uv0);
}
float4 SampleLocation(float2 location)
{
return texture(samp9, location);
}
#define SampleOffset(offset) textureOffset(samp9, uv0, offset)
float4 SampleFontLocation(float2 location)
{
return texture(samp8, location);
}
float2 GetResolution()
{
return resolution.xy;
}
float2 GetInvResolution()
{
return resolution.zw;
}
float2 GetCoordinates()
{
return uv0;
}
uint GetTime()
{
return time;
}
void SetOutput(float4 color)
{
ocol0 = color;
}
#define GetOption(x) (option_##x)
#define OptionEnabled(x) (option_##x != 0)
//Fullscreen Smoothing + Scanlines Filter by ShinRa358 (Edited from nightvision2scanlines)
uniform sampler2D samp9;
out vec4 ocol0;
in vec2 uv0;
uniform vec4 resolution;
void main()
{
//variables
float4 c0 = texture(samp9, uv0).rgba;
//FullScreen Smoothing
float4 smoothing_total = float4(0, 0, 0, 0);
float smoothing_size = 0; // <--- # = [Higher# = MORE SMOOTHING / Lower# = LESS SMOOTHING] ***0 = SMOOTHING OFF***
smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, -smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( smoothing_size, -smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( smoothing_size, smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, 0)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( smoothing_size, 0)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( 0, -smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( 0, smoothing_size)*resolution.zw);
smoothing_total *= 0.125;
c0 = smoothing_total;
// Horizontal Scanlines
float vPos = uv0.y*resolution.y / 3; // <--- # to the left of the ';' for scanline thickness [Higher# = THICKER / Lower# = THINNER] ***DON'T GO BELOW 2*** | ***9999 = SCANLINES OFF***
float line_intensity = (((vPos - floor(vPos)) * 9) - 4) / 50; // <--- # to the left of the ';' for scanline darkness [Higher# = LIGHTER / Lower# = DARKER] ***DON'T GO BELOW 25***
// output
ocol0 = float4(c0.r, c0.g, c0.b, 1.0) + line_intensity;
}
If I can't get this to work, does anyone know of any other shaders out there that work with the latest dev builds that support scanline emulation? That's the whole reason I've been using this one.
Thanks in advance!
I figured it out. Love it when I do that right after making a post!
Anyway, the clue was in the compilation errors that Dolphin was throwing: redefinition of the variables samp9, ocol0, uv0, and resolution. Commenting out the variable declarations in the shader itself fixes the errors and the shader appears to be working in the latest dev builds. See the code below for the working shader:
Code:
//Fullscreen Smoothing + Scanlines Filter by ShinRa358 (Edited from nightvision2scanlines)
// Fixes redefinition errors.
/*
uniform sampler2D samp9;
out vec4 ocol0;
in vec2 uv0;
uniform vec4 resolution;
*/
void main()
{
//variables
float4 c0 = texture(samp9, uv0).rgba;
//FullScreen Smoothing
float4 smoothing_total = float4(0, 0, 0, 0);
float smoothing_size = 0; // <--- # = [Higher# = MORE SMOOTHING / Lower# = LESS SMOOTHING] ***0 = SMOOTHING OFF***
smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, -smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( smoothing_size, -smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( smoothing_size, smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, 0)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( smoothing_size, 0)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( 0, -smoothing_size)*resolution.zw);
smoothing_total += texture(samp9, uv0 + float2( 0, smoothing_size)*resolution.zw);
smoothing_total *= 0.125;
c0 = smoothing_total;
// Horizontal Scanlines
float vPos = uv0.y*resolution.y / 3; // <--- # to the left of the ';' for scanline thickness [Higher# = THICKER / Lower# = THINNER] ***DON'T GO BELOW 2*** | ***9999 = SCANLINES OFF***
float line_intensity = (((vPos - floor(vPos)) * 9) - 4) / 50; // <--- # to the left of the ';' for scanline darkness [Higher# = LIGHTER / Lower# = DARKER] ***DON'T GO BELOW 25***
// output
ocol0 = float4(c0.r, c0.g, c0.b, 1.0) + line_intensity;
}