glsl: use textureSize instead of height

This commit is contained in:
Megamouse 2024-01-31 15:15:07 +01:00
parent 00c9321b1d
commit 4e8130bd99
4 changed files with 2 additions and 7 deletions

View File

@ -479,7 +479,6 @@ namespace gl
program_handle.uniforms["limit_range"] = limited_rgb + 0;
program_handle.uniforms["stereo_display_mode"] = static_cast<u8>(stereo_mode);
program_handle.uniforms["stereo_image_count"] = (source[1] == GL_NONE? 1 : 2);
program_handle.uniforms["height"] = viewport.height();
saved_sampler_state saved(31, m_sampler);
cmd->bind_texture(31, GL_TEXTURE_2D, source[0]);

View File

@ -37,14 +37,12 @@ layout(push_constant) uniform static_data
int limit_range;
int stereo_display_mode;
int stereo_image_count;
int height;
};
#else
uniform float gamma;
uniform int limit_range;
uniform int stereo_display_mode;
uniform int stereo_image_count;
uniform int height;
#endif
vec4 anaglyph(const in vec4 left, const in vec4 right)
@ -101,7 +99,7 @@ vec4 read_source()
? texture(fs0, tc0 * ou_single_matrix)
: texture(fs0, (tc0 * ou_single_matrix) + vec2(0.f, 0.020408f));
case STEREO_MODE_INTERLACED:
return (mod(height * tc0.y, 2.f) < 1.f)
return (mod(textureSize(fs0, 0).y * tc0.y, 2.f) < 1.f)
? texture(fs0, tc0 * left_single_matrix)
: texture(fs0, (tc0 * left_single_matrix) + right_single_matrix);
default: // undefined behavior
@ -128,7 +126,7 @@ vec4 read_source()
? texture(fs0, (tc0 * ou_multi_matrix))
: texture(fs1, (tc0 * ou_multi_matrix) + vec2(0.f, -1.f));
case STEREO_MODE_INTERLACED:
return (mod(height * tc0.y, 2.f) < 1.f)
return (mod(textureSize(fs0, 0).y * tc0.y, 2.f) < 1.f)
? texture(fs0, tc0)
: texture(fs1, tc0);
default: // undefined behavior

View File

@ -902,7 +902,6 @@ namespace vk
config.limit_range = limited_rgb? 1 : 0;
config.stereo_display_mode = static_cast<u8>(stereo_mode);
config.stereo_image_count = std::min(::size32(src), 2u);
config.height = src.empty() ? 720 : src.front()->height();
std::vector<vk::image_view*> views;
views.reserve(2);

View File

@ -212,7 +212,6 @@ namespace vk
int limit_range;
int stereo_display_mode;
int stereo_image_count;
int height;
};
float data[4];