GPUDevice: Fix swap chain clear colour normalization

This commit is contained in:
Stenzek 2025-01-22 18:23:11 +10:00
parent af58740f5d
commit be75a97efe
No known key found for this signature in database
5 changed files with 5 additions and 5 deletions

View File

@ -675,7 +675,7 @@ GPUDevice::PresentResult D3D11Device::BeginPresent(GPUSwapChain* swap_chain, u32
EndTimestampQuery();
}
m_context->ClearRenderTargetView(SC->GetRTV(), GSVector4::rgba32(clear_color).F32);
m_context->ClearRenderTargetView(SC->GetRTV(), GSVector4::unorm8(clear_color).F32);
m_context->OMSetRenderTargets(1, SC->GetRTVArray(), nullptr);
s_stats.num_render_passes++;
m_num_current_render_targets = 0;

View File

@ -1219,7 +1219,7 @@ GPUDevice::PresentResult D3D12Device::BeginPresent(GPUSwapChain* swap_chain, u32
D3D12_RENDER_PASS_RENDER_TARGET_DESC rt_desc = {swap_chain_buf.second,
{D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR, {}},
{D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE, {}}};
GSVector4::store<false>(rt_desc.BeginningAccess.Clear.ClearValue.Color, GSVector4::rgba32(clear_color));
GSVector4::store<false>(rt_desc.BeginningAccess.Clear.ClearValue.Color, GSVector4::unorm8(clear_color));
cmdlist->BeginRenderPass(1, &rt_desc, nullptr, D3D12_RENDER_PASS_FLAG_NONE);
std::memset(m_current_render_targets.data(), 0, sizeof(m_current_render_targets));

View File

@ -2595,7 +2595,7 @@ GPUDevice::PresentResult MetalDevice::BeginPresent(GPUSwapChain* swap_chain, u32
SetViewportAndScissor(m_current_framebuffer_size);
// Set up rendering to layer.
const GSVector4 clear_color_v = GSVector4::rgba32(clear_color);
const GSVector4 clear_color_v = GSVector4::unorm8(clear_color);
id<MTLTexture> layer_texture = [m_layer_drawable texture];
MTLRenderPassDescriptor* desc = [MTLRenderPassDescriptor renderPassDescriptor];
desc.colorAttachments[0].texture = layer_texture;

View File

@ -797,7 +797,7 @@ GPUDevice::PresentResult OpenGLDevice::BeginPresent(GPUSwapChain* swap_chain, u3
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDisable(GL_SCISSOR_TEST);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearBufferfv(GL_COLOR, 0, GSVector4::rgba32(clear_color).F32);
glClearBufferfv(GL_COLOR, 0, GSVector4::unorm8(clear_color).F32);
glColorMask(m_last_blend_state.write_r, m_last_blend_state.write_g, m_last_blend_state.write_b,
m_last_blend_state.write_a);
glEnable(GL_SCISSOR_TEST);

View File

@ -3399,7 +3399,7 @@ void VulkanDevice::BeginSwapChainRenderPass(VulkanSwapChain* swap_chain, u32 cle
}
VkClearValue clear_value;
GSVector4::store<false>(&clear_value.color.float32, GSVector4::rgba32(clear_color));
GSVector4::store<false>(&clear_value.color.float32, GSVector4::unorm8(clear_color));
if (m_optional_extensions.vk_khr_dynamic_rendering)
{
VkRenderingAttachmentInfo ai = {VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO_KHR,