mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 18:53:28 +01:00
vk/gl: unite video_out_calibration_pass fragment shader to new glsl
This commit is contained in:
parent
240f80b467
commit
3dac7d16e7
@ -461,87 +461,8 @@ namespace gl
|
||||
;
|
||||
|
||||
fs_src =
|
||||
"#version 420\n\n"
|
||||
"layout(binding=31) uniform sampler2D fs0;\n"
|
||||
"layout(binding=30) uniform sampler2D fs1;\n"
|
||||
"layout(location=0) in vec2 tc0;\n"
|
||||
"layout(location=0) out vec4 ocol;\n"
|
||||
"\n"
|
||||
"#define STEREO_MODE_DISABLED 0\n"
|
||||
"#define STEREO_MODE_ANAGLYPH 1\n"
|
||||
"#define STEREO_MODE_SIDE_BY_SIDE 2\n"
|
||||
"#define STEREO_MODE_OVER_UNDER 3\n"
|
||||
"\n"
|
||||
"vec2 sbs_single_matrix = vec2(2.0,0.4898f);\n"
|
||||
"vec2 sbs_multi_matrix = vec2(2.0,1.0);\n"
|
||||
"vec2 ou_single_matrix = vec2(1.0,0.9796f);\n"
|
||||
"vec2 ou_multi_matrix = vec2(1.0,2.0);\n"
|
||||
"\n"
|
||||
"uniform float gamma;\n"
|
||||
"uniform int limit_range;\n"
|
||||
"uniform int stereo_display_mode;\n"
|
||||
"uniform int stereo_image_count;\n"
|
||||
"\n"
|
||||
"vec4 read_source()\n"
|
||||
"{\n"
|
||||
" if (stereo_display_mode == STEREO_MODE_DISABLED) return texture(fs0, tc0);\n"
|
||||
"\n"
|
||||
" vec4 left, right;\n"
|
||||
" if (stereo_image_count == 1)\n"
|
||||
" {\n"
|
||||
" switch (stereo_display_mode)\n"
|
||||
" {\n"
|
||||
" case STEREO_MODE_ANAGLYPH:\n"
|
||||
" left = texture(fs0, tc0 * vec2(1.f, 0.4898f));\n"
|
||||
" right = texture(fs0, (tc0 * vec2(1.f, 0.4898f)) + vec2(0.f, 0.510204f));\n"
|
||||
" return vec4(left.r, right.g, right.b, 1.f);\n"
|
||||
" case STEREO_MODE_SIDE_BY_SIDE:\n"
|
||||
" if (tc0.x < 0.5) return texture(fs0, tc0* sbs_single_matrix);\n"
|
||||
" else return texture(fs0, (tc0* sbs_single_matrix) + vec2(-1.f, 0.510204f));\n"
|
||||
" case STEREO_MODE_OVER_UNDER:\n"
|
||||
" if (tc0.y < 0.5) return texture(fs0, tc0* ou_single_matrix);\n"
|
||||
" else return texture(fs0, (tc0* ou_single_matrix) + vec2(0.f, 0.020408f) );\n"
|
||||
" default:\n" // undefined behavior
|
||||
" return texture(fs0,tc0);\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else if (stereo_image_count == 2)\n"
|
||||
" {\n"
|
||||
" switch (stereo_display_mode)\n"
|
||||
" {\n"
|
||||
" case STEREO_MODE_ANAGLYPH:\n"
|
||||
" left = texture(fs0, tc0);\n"
|
||||
" right = texture(fs1, tc0);\n"
|
||||
" return vec4(left.r, right.g, right.b, 1.f);\n"
|
||||
" case STEREO_MODE_SIDE_BY_SIDE:\n"
|
||||
" if (tc0.x < 0.5) return texture(fs0,(tc0 * sbs_multi_matrix));\n"
|
||||
" else return texture(fs1,(tc0 * sbs_multi_matrix) + vec2(-1.f,0.f));\n"
|
||||
" case STEREO_MODE_OVER_UNDER:\n"
|
||||
" if (tc0.y < 0.5) return texture(fs0,(tc0 * ou_multi_matrix));\n"
|
||||
" else return texture(fs1,(tc0 * ou_multi_matrix) + vec2(0.f,-1.f));\n"
|
||||
" default:\n" // undefined behavior
|
||||
" return texture(fs0,tc0);\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" vec2 coord_left = tc0 * vec2(1.f, 0.4898f);\n"
|
||||
" vec2 coord_right = coord_left + vec2(0.f, 0.510204f);\n"
|
||||
" left = texture(fs0, coord_left);\n"
|
||||
" right = texture(fs0, coord_right);\n"
|
||||
" return vec4(left.r, right.g, right.b, 1.);\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 color = read_source();\n"
|
||||
" color.rgb = pow(color.rgb, vec3(gamma));\n"
|
||||
" if (limit_range > 0)\n"
|
||||
" ocol = ((color * 220.) + 16.) / 255.;\n"
|
||||
" else\n"
|
||||
" ocol = color;\n"
|
||||
"}\n";
|
||||
#include "../Program/GLSLSnippets/VideoOutCalibrationPass.glsl"
|
||||
;
|
||||
|
||||
m_input_filter = gl::filter::linear;
|
||||
}
|
||||
|
100
rpcs3/Emu/RSX/Program/GLSLSnippets/VideoOutCalibrationPass.glsl
Normal file
100
rpcs3/Emu/RSX/Program/GLSLSnippets/VideoOutCalibrationPass.glsl
Normal file
@ -0,0 +1,100 @@
|
||||
R"(
|
||||
#version 420
|
||||
|
||||
#ifdef VULKAN
|
||||
layout(set=0, binding=1) uniform sampler2D fs0;
|
||||
layout(set=0, binding=2) uniform sampler2D fs1;
|
||||
#else
|
||||
layout(binding=31) uniform sampler2D fs0;
|
||||
layout(binding=30) uniform sampler2D fs1;
|
||||
#endif
|
||||
|
||||
layout(location=0) in vec2 tc0;
|
||||
layout(location=0) out vec4 ocol;
|
||||
|
||||
#define STEREO_MODE_DISABLED 0
|
||||
#define STEREO_MODE_ANAGLYPH 1
|
||||
#define STEREO_MODE_SIDE_BY_SIDE 2
|
||||
#define STEREO_MODE_OVER_UNDER 3
|
||||
|
||||
vec2 sbs_single_matrix = vec2(2.0,0.4898f);
|
||||
vec2 sbs_multi_matrix = vec2(2.0,1.0);
|
||||
vec2 ou_single_matrix = vec2(1.0,0.9796f);
|
||||
vec2 ou_multi_matrix = vec2(1.0,2.0);
|
||||
|
||||
#ifdef VULKAN
|
||||
layout(push_constant) uniform static_data
|
||||
{
|
||||
float gamma;
|
||||
int limit_range;
|
||||
int stereo_display_mode;
|
||||
int stereo_image_count;
|
||||
};
|
||||
#else
|
||||
uniform float gamma;
|
||||
uniform int limit_range;
|
||||
uniform int stereo_display_mode;
|
||||
uniform int stereo_image_count;
|
||||
#endif
|
||||
|
||||
vec4 read_source()
|
||||
{
|
||||
if (stereo_display_mode == STEREO_MODE_DISABLED) return texture(fs0, tc0);
|
||||
|
||||
vec4 left, right;
|
||||
if (stereo_image_count == 1)
|
||||
{
|
||||
switch (stereo_display_mode)
|
||||
{
|
||||
case STEREO_MODE_ANAGLYPH:
|
||||
left = texture(fs0, tc0 * vec2(1.f, 0.4898f));
|
||||
right = texture(fs0, (tc0 * vec2(1.f, 0.4898f)) + vec2(0.f, 0.510204f));
|
||||
return vec4(left.r, right.g, right.b, 1.f);
|
||||
case STEREO_MODE_SIDE_BY_SIDE:
|
||||
if (tc0.x < 0.5) return texture(fs0, tc0* sbs_single_matrix);
|
||||
else return texture(fs0, (tc0* sbs_single_matrix) + vec2(-1.f, 0.510204f));
|
||||
case STEREO_MODE_OVER_UNDER:
|
||||
if (tc0.y < 0.5) return texture(fs0, tc0* ou_single_matrix);
|
||||
else return texture(fs0, (tc0* ou_single_matrix) + vec2(0.f, 0.020408f) );
|
||||
default: // undefined behavior
|
||||
return texture(fs0,tc0);
|
||||
}
|
||||
}
|
||||
else if (stereo_image_count == 2)
|
||||
{
|
||||
switch (stereo_display_mode)
|
||||
{
|
||||
case STEREO_MODE_ANAGLYPH:
|
||||
left = texture(fs0, tc0);
|
||||
right = texture(fs1, tc0);
|
||||
return vec4(left.r, right.g, right.b, 1.f);
|
||||
case STEREO_MODE_SIDE_BY_SIDE:
|
||||
if (tc0.x < 0.5) return texture(fs0,(tc0 * sbs_multi_matrix));
|
||||
else return texture(fs1,(tc0 * sbs_multi_matrix) + vec2(-1.f,0.f));
|
||||
case STEREO_MODE_OVER_UNDER:
|
||||
if (tc0.y < 0.5) return texture(fs0,(tc0 * ou_multi_matrix));
|
||||
else return texture(fs1,(tc0 * ou_multi_matrix) + vec2(0.f,-1.f));
|
||||
default: // undefined behavior
|
||||
return texture(fs0,tc0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vec2 coord_left = tc0 * vec2(1.f, 0.4898f);
|
||||
vec2 coord_right = coord_left + vec2(0.f, 0.510204f);
|
||||
left = texture(fs0, coord_left);
|
||||
right = texture(fs0, coord_right);
|
||||
return vec4(left.r, right.g, right.b, 1.);
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = read_source();
|
||||
color.rgb = pow(color.rgb, vec3(gamma));
|
||||
if (limit_range > 0)
|
||||
ocol = ((color * 220.) + 16.) / 255.;
|
||||
else
|
||||
ocol = color;
|
||||
}
|
||||
)"
|
@ -870,90 +870,8 @@ namespace vk
|
||||
"}\n";
|
||||
|
||||
fs_src =
|
||||
"#version 420\n\n"
|
||||
"layout(set=0, binding=1) uniform sampler2D fs0;\n"
|
||||
"layout(set=0, binding=2) uniform sampler2D fs1;\n"
|
||||
"layout(location=0) in vec2 tc0;\n"
|
||||
"layout(location=0) out vec4 ocol;\n"
|
||||
"\n"
|
||||
"#define STEREO_MODE_DISABLED 0\n"
|
||||
"#define STEREO_MODE_ANAGLYPH 1\n"
|
||||
"#define STEREO_MODE_SIDE_BY_SIDE 2\n"
|
||||
"#define STEREO_MODE_OVER_UNDER 3\n"
|
||||
"\n"
|
||||
"vec2 sbs_single_matrix = vec2(2.0,0.4898f);\n"
|
||||
"vec2 sbs_multi_matrix = vec2(2.0,1.0);\n"
|
||||
"vec2 ou_single_matrix = vec2(1.0,0.9796f);\n"
|
||||
"vec2 ou_multi_matrix = vec2(1.0,2.0);\n"
|
||||
"\n"
|
||||
"layout(push_constant) uniform static_data\n"
|
||||
"{\n"
|
||||
" float gamma;\n"
|
||||
" int limit_range;\n"
|
||||
" int stereo_display_mode;\n"
|
||||
" int stereo_image_count;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"vec4 read_source()\n"
|
||||
"{\n"
|
||||
" if (stereo_display_mode == STEREO_MODE_DISABLED) return texture(fs0, tc0);\n"
|
||||
"\n"
|
||||
" vec4 left, right;\n"
|
||||
" if (stereo_image_count == 1)\n"
|
||||
" {\n"
|
||||
" switch (stereo_display_mode)\n"
|
||||
" {\n"
|
||||
" case STEREO_MODE_ANAGLYPH:\n"
|
||||
" left = texture(fs0, tc0 * vec2(1.f, 0.4898f));\n"
|
||||
" right = texture(fs0, (tc0 * vec2(1.f, 0.4898f)) + vec2(0.f, 0.510204f));\n"
|
||||
" return vec4(left.r, right.g, right.b, 1.f);\n"
|
||||
" case STEREO_MODE_SIDE_BY_SIDE:\n"
|
||||
" if (tc0.x < 0.5) return texture(fs0, tc0* sbs_single_matrix);\n"
|
||||
" else return texture(fs0, (tc0* sbs_single_matrix) + vec2(-1.f, 0.510204f));\n"
|
||||
" case STEREO_MODE_OVER_UNDER:\n"
|
||||
" if (tc0.y < 0.5) return texture(fs0, tc0* ou_single_matrix);\n"
|
||||
" else return texture(fs0, (tc0* ou_single_matrix) + vec2(0.f, 0.020408f) );\n"
|
||||
" default:\n" // undefined behavior
|
||||
" return texture(fs0,tc0);\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else if (stereo_image_count == 2)\n"
|
||||
" {\n"
|
||||
" switch (stereo_display_mode)\n"
|
||||
" {\n"
|
||||
" case STEREO_MODE_ANAGLYPH:\n"
|
||||
" left = texture(fs0, tc0);\n"
|
||||
" right = texture(fs1, tc0);\n"
|
||||
" return vec4(left.r, right.g, right.b, 1.f);\n"
|
||||
" case STEREO_MODE_SIDE_BY_SIDE:\n"
|
||||
" if (tc0.x < 0.5) return texture(fs0,(tc0 * sbs_multi_matrix));\n"
|
||||
" else return texture(fs1,(tc0 * sbs_multi_matrix) + vec2(-1.f,0.f));\n"
|
||||
" case STEREO_MODE_OVER_UNDER:\n"
|
||||
" if (tc0.y < 0.5) return texture(fs0,(tc0 * ou_multi_matrix));\n"
|
||||
" else return texture(fs1,(tc0 * ou_multi_matrix) + vec2(0.f,-1.f));\n"
|
||||
" default:\n" // undefined behavior
|
||||
" return texture(fs0,tc0);\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" vec2 coord_left = tc0 * vec2(1.f, 0.4898f);\n"
|
||||
" vec2 coord_right = coord_left + vec2(0.f, 0.510204f);\n"
|
||||
" left = texture(fs0, coord_left);\n"
|
||||
" right = texture(fs0, coord_right);\n"
|
||||
" return vec4(left.r, right.g, right.b, 1.);\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 color = read_source();\n"
|
||||
" color.rgb = pow(color.rgb, vec3(gamma));\n"
|
||||
" if (limit_range > 0)\n"
|
||||
" ocol = ((color * 220.) + 16.) / 255.;\n"
|
||||
" else\n"
|
||||
" ocol = color;\n"
|
||||
"}\n";
|
||||
#include "../Program/GLSLSnippets/VideoOutCalibrationPass.glsl"
|
||||
;
|
||||
|
||||
renderpass_config.set_depth_mask(false);
|
||||
renderpass_config.set_color_mask(0, true, true, true, true);
|
||||
|
@ -137,7 +137,7 @@ namespace vk
|
||||
bool m_pulse_glow = false;
|
||||
bool m_clip_enabled = false;
|
||||
bool m_disable_vertex_snap = false;
|
||||
rsx::overlays::texture_sampling_mode m_texture_type;
|
||||
rsx::overlays::texture_sampling_mode m_texture_type = rsx::overlays::texture_sampling_mode::none;
|
||||
areaf m_clip_region;
|
||||
coordf m_viewport;
|
||||
|
||||
|
@ -938,6 +938,7 @@
|
||||
<None Include="Emu\RSX\Program\GLSLSnippets\RSXProg\RSXVertexFetch.glsl" />
|
||||
<None Include="Emu\RSX\Program\GLSLSnippets\RSXProg\RSXVertexPrologue.glsl" />
|
||||
<None Include="Emu\RSX\Program\GLSLSnippets\ShuffleBytes.glsl" />
|
||||
<None Include="Emu\RSX\Program\GLSLSnippets\VideoOutCalibrationPass.glsl" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
@ -2496,5 +2496,8 @@
|
||||
<None Include="Emu\RSX\Program\GLSLSnippets\RSXProg\RSXROPPrologue.glsl">
|
||||
<Filter>Emu\GPU\RSX\Program\Snippets\RSXProg</Filter>
|
||||
</None>
|
||||
<None Include="Emu\RSX\Program\GLSLSnippets\VideoOutCalibrationPass.glsl">
|
||||
<Filter>Emu\GPU\RSX\Program\Snippets</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user