1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

rsx: Clarify OGL and VK difference when handling border texels

This commit is contained in:
kd-11 2024-10-03 04:34:13 +03:00 committed by kd-11
parent 497b9ba55b
commit e9a45a6d06
2 changed files with 13 additions and 4 deletions

View File

@ -81,11 +81,13 @@ namespace gl
if (rsx::is_border_clamped_texture(tex))
{
const auto border_color = tex.remapped_border_color();
const auto encoded_color = rsx::encode_color_to_storage_key(border_color);
// NOTE: In OpenGL, the border texels are processed by the pipeline and will be swizzled by the texture view.
// Therefore, we pass the raw value here, and the texture view will handle the rest for us.
const auto encoded_color = tex.border_color();
if (get_parameteri(GL_TEXTURE_BORDER_COLOR) != encoded_color)
{
m_propertiesi[GL_TEXTURE_BORDER_COLOR] = encoded_color;
const auto border_color = rsx::decode_border_color(encoded_color);
glSamplerParameterfv(sampler_handle, GL_TEXTURE_BORDER_COLOR, border_color.rgba);
}
}
@ -154,11 +156,13 @@ namespace gl
{
if (rsx::is_border_clamped_texture(tex))
{
const auto border_color = tex.remapped_border_color();
const auto encoded_color = rsx::encode_color_to_storage_key(border_color);
// NOTE: In OpenGL, the border texels are processed by the pipeline and will be swizzled by the texture view.
// Therefore, we pass the raw value here, and the texture view will handle the rest for us.
const auto encoded_color = tex.border_color();
if (get_parameteri(GL_TEXTURE_BORDER_COLOR) != encoded_color)
{
m_propertiesi[GL_TEXTURE_BORDER_COLOR] = encoded_color;
const auto border_color = rsx::decode_border_color(encoded_color);
glSamplerParameterfv(sampler_handle, GL_TEXTURE_BORDER_COLOR, border_color.rgba);
}
}

View File

@ -303,6 +303,9 @@ void VKGSRender::load_texture_env()
const auto wrap_s = vk::vk_wrap_mode(tex.wrap_s());
const auto wrap_t = vk::vk_wrap_mode(tex.wrap_t());
const auto wrap_r = vk::vk_wrap_mode(tex.wrap_r());
// NOTE: In vulkan, the border color bypasses the swizzling defined in the image view.
// It is a direct texel replacement and must be remapped before attaching to the sampler.
const auto border_color = rsx::is_border_clamped_texture(tex)
? vk::border_color_t(tex.remapped_border_color())
: vk::border_color_t(VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK);
@ -446,6 +449,8 @@ void VKGSRender::load_texture_env()
const auto wrap_s = vk::vk_wrap_mode(tex.wrap_s());
const auto wrap_t = vk::vk_wrap_mode(tex.wrap_t());
// NOTE: In vulkan, the border color bypasses the swizzling defined in the image view.
// It is a direct texel replacement and must be remapped before attaching to the sampler.
const auto border_color = is_border_clamped_texture(tex)
? vk::border_color_t(tex.remapped_border_color())
: vk::border_color_t(VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK);