mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-16 23:17:29 +00:00
vk: push back border color to sampler (#1832)
* vk: push back border color to sampler * use approximate color * Add TODO for VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK
This commit is contained in:
parent
4a08e8cd0b
commit
d69a4173fa
@ -65,6 +65,16 @@ VkFilter get_mag_filter(rsx::texture_magnify_filter mag_filter)
|
||||
throw EXCEPTION("Invalid mag filter (0x%x)", mag_filter);
|
||||
}
|
||||
|
||||
VkBorderColor get_border_color(u8 color)
|
||||
{
|
||||
if ((color / 0x10) >= 0x8)
|
||||
return VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
||||
else
|
||||
return VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK;
|
||||
|
||||
// TODO: VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK
|
||||
}
|
||||
|
||||
VkSamplerAddressMode vk_wrap_mode(rsx::texture_wrap_mode gcm_wrap)
|
||||
{
|
||||
switch (gcm_wrap)
|
||||
|
@ -15,6 +15,7 @@ namespace vk
|
||||
VkStencilOp get_stencil_op(u32 op);
|
||||
VkLogicOp get_logic_op(u32 op);
|
||||
VkFrontFace get_front_face_ccw(u32 ffv);
|
||||
VkBorderColor get_border_color(u8 color);
|
||||
|
||||
std::tuple<VkFilter, VkSamplerMipmapMode> get_min_filter_and_mip(rsx::texture_minify_filter min_filter);
|
||||
VkFilter get_mag_filter(rsx::texture_magnify_filter mag_filter);
|
||||
|
@ -655,7 +655,7 @@ void VKGSRender::end()
|
||||
vk::vk_wrap_mode(textures[i].wrap_s()), vk::vk_wrap_mode(textures[i].wrap_t()), vk::vk_wrap_mode(textures[i].wrap_r()),
|
||||
!!(textures[i].format() & CELL_GCM_TEXTURE_UN),
|
||||
textures[i].bias(), vk::max_aniso(textures[i].max_aniso()), textures[i].min_lod(), textures[i].max_lod(),
|
||||
min_filter, vk::get_mag_filter(textures[i].mag_filter()), mip_mode
|
||||
min_filter, vk::get_mag_filter(textures[i].mag_filter()), mip_mode, vk::get_border_color(textures[i].border_color())
|
||||
));
|
||||
m_program->bind_uniform({ m_sampler_to_clean.back()->value, texture0->value, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL }, "tex" + std::to_string(i), descriptor_sets);
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ namespace vk
|
||||
|
||||
sampler(VkDevice dev, VkSamplerAddressMode clamp_u, VkSamplerAddressMode clamp_v, VkSamplerAddressMode clamp_w,
|
||||
bool unnormalized_coordinates, float mipLodBias, float max_anisotropy, float min_lod, float max_lod,
|
||||
VkFilter min_filter, VkFilter mag_filter, VkSamplerMipmapMode mipmap_mode)
|
||||
VkFilter min_filter, VkFilter mag_filter, VkSamplerMipmapMode mipmap_mode, VkBorderColor border_color)
|
||||
: m_device(dev)
|
||||
{
|
||||
VkSamplerCreateInfo info = {};
|
||||
@ -571,7 +571,7 @@ namespace vk
|
||||
info.minFilter = min_filter;
|
||||
info.mipmapMode = mipmap_mode;
|
||||
info.compareOp = VK_COMPARE_OP_NEVER;
|
||||
info.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK;
|
||||
info.borderColor = border_color;
|
||||
|
||||
CHECK_RESULT(vkCreateSampler(m_device, &info, nullptr, &value));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user