mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
GPUDevice: Fix swap chain clear colour normalization
This commit is contained in:
parent
af58740f5d
commit
be75a97efe
@ -675,7 +675,7 @@ GPUDevice::PresentResult D3D11Device::BeginPresent(GPUSwapChain* swap_chain, u32
|
|||||||
EndTimestampQuery();
|
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);
|
m_context->OMSetRenderTargets(1, SC->GetRTVArray(), nullptr);
|
||||||
s_stats.num_render_passes++;
|
s_stats.num_render_passes++;
|
||||||
m_num_current_render_targets = 0;
|
m_num_current_render_targets = 0;
|
||||||
|
@ -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_RENDER_TARGET_DESC rt_desc = {swap_chain_buf.second,
|
||||||
{D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR, {}},
|
{D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR, {}},
|
||||||
{D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE, {}}};
|
{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);
|
cmdlist->BeginRenderPass(1, &rt_desc, nullptr, D3D12_RENDER_PASS_FLAG_NONE);
|
||||||
|
|
||||||
std::memset(m_current_render_targets.data(), 0, sizeof(m_current_render_targets));
|
std::memset(m_current_render_targets.data(), 0, sizeof(m_current_render_targets));
|
||||||
|
@ -2595,7 +2595,7 @@ GPUDevice::PresentResult MetalDevice::BeginPresent(GPUSwapChain* swap_chain, u32
|
|||||||
SetViewportAndScissor(m_current_framebuffer_size);
|
SetViewportAndScissor(m_current_framebuffer_size);
|
||||||
|
|
||||||
// Set up rendering to layer.
|
// 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];
|
id<MTLTexture> layer_texture = [m_layer_drawable texture];
|
||||||
MTLRenderPassDescriptor* desc = [MTLRenderPassDescriptor renderPassDescriptor];
|
MTLRenderPassDescriptor* desc = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||||
desc.colorAttachments[0].texture = layer_texture;
|
desc.colorAttachments[0].texture = layer_texture;
|
||||||
|
@ -797,7 +797,7 @@ GPUDevice::PresentResult OpenGLDevice::BeginPresent(GPUSwapChain* swap_chain, u3
|
|||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
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,
|
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);
|
m_last_blend_state.write_a);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
@ -3399,7 +3399,7 @@ void VulkanDevice::BeginSwapChainRenderPass(VulkanSwapChain* swap_chain, u32 cle
|
|||||||
}
|
}
|
||||||
|
|
||||||
VkClearValue clear_value;
|
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)
|
if (m_optional_extensions.vk_khr_dynamic_rendering)
|
||||||
{
|
{
|
||||||
VkRenderingAttachmentInfo ai = {VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO_KHR,
|
VkRenderingAttachmentInfo ai = {VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO_KHR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user