mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
vk: Add checks for alphaToOne support
- This feature is very rarely used, as alphaToCoverage is commonly used as a replacement for blending, not in addition to it.
This commit is contained in:
parent
f41f5054f7
commit
35794dc3f2
4 changed files with 22 additions and 2 deletions
|
@ -38,6 +38,7 @@ GLGSRender::GLGSRender() : GSRender()
|
|||
m_vertex_cache = std::make_unique<gl::weak_vertex_cache>();
|
||||
|
||||
backend_config.supports_hw_a2c = false;
|
||||
backend_config.supports_hw_a2one = false;
|
||||
backend_config.supports_multidraw = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -469,6 +469,7 @@ namespace rsx
|
|||
bool supports_multidraw; // Draw call batching
|
||||
bool supports_hw_a2c; // Alpha to coverage
|
||||
bool supports_hw_renormalization; // Should be true on NV hardware which matches PS3 texture renormalization behaviour
|
||||
bool supports_hw_a2one; // Alpha to one
|
||||
};
|
||||
|
||||
struct sampled_image_descriptor_base;
|
||||
|
|
|
@ -529,7 +529,11 @@ VKGSRender::VKGSRender() : GSRender()
|
|||
|
||||
// NOTE: We do not actually need multiple sample support for A2C to work
|
||||
// This is here for visual consistency - will be removed when AA problems due to mipmaps are fixed
|
||||
backend_config.supports_hw_a2c = (g_cfg.video.antialiasing_level != msaa_level::none);
|
||||
if (g_cfg.video.antialiasing_level != msaa_level::none)
|
||||
{
|
||||
backend_config.supports_hw_a2c = VK_TRUE;
|
||||
backend_config.supports_hw_a2one = m_device->get_alpha_to_one_support();
|
||||
}
|
||||
|
||||
// NOTE: On NVIDIA cards going back decades (including the PS3) there is a slight normalization inaccuracy in compressed formats.
|
||||
// Confirmed in BLES01916 (The Evil Within) which uses RGB565 for some virtual texturing data.
|
||||
|
@ -2587,12 +2591,14 @@ bool VKGSRender::load_program()
|
|||
const auto rasterization_samples = u8((m_current_renderpass_key >> 16) & 0xF);
|
||||
if (backend_config.supports_hw_a2c || rasterization_samples > 1)
|
||||
{
|
||||
const bool alpha_to_one_enable = rsx::method_registers.msaa_alpha_to_one_enabled() && backend_config.supports_hw_a2one;
|
||||
|
||||
properties.state.set_multisample_state(
|
||||
rasterization_samples,
|
||||
rsx::method_registers.msaa_sample_mask(),
|
||||
rsx::method_registers.msaa_enabled(),
|
||||
rsx::method_registers.msaa_alpha_to_coverage_enabled(),
|
||||
rsx::method_registers.msaa_alpha_to_one_enabled());
|
||||
alpha_to_one_enable);
|
||||
}
|
||||
|
||||
properties.renderpass_key = m_current_renderpass_key;
|
||||
|
|
|
@ -809,6 +809,13 @@ private:
|
|||
enabled_features.depthBounds = VK_FALSE;
|
||||
}
|
||||
|
||||
if (!pgpu->features.alphaToOne && enabled_features.alphaToOne)
|
||||
{
|
||||
// AMD proprietary drivers do not expose alphaToOne support
|
||||
LOG_ERROR(RSX, "Your GPU does not support alpha-to-one for multisampling. Graphics may be inaccurate when MSAA is enabled.");
|
||||
enabled_features.alphaToOne = VK_FALSE;
|
||||
}
|
||||
|
||||
VkDeviceCreateInfo device = {};
|
||||
device.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||
device.pNext = nullptr;
|
||||
|
@ -931,6 +938,11 @@ private:
|
|||
return pgpu->features.depthBounds != VK_FALSE;
|
||||
}
|
||||
|
||||
bool get_alpha_to_one_support() const
|
||||
{
|
||||
return pgpu->features.alphaToOne != VK_FALSE;
|
||||
}
|
||||
|
||||
mem_allocator_base* get_allocator() const
|
||||
{
|
||||
return m_allocator.get();
|
||||
|
|
Loading…
Add table
Reference in a new issue