D3D11/StreamBuffer: Use WRITE_DISCARD at position 0
This commit is contained in:
parent
e19175edae
commit
99d42c07c2
|
@ -55,24 +55,19 @@ void StreamBuffer::Release()
|
||||||
StreamBuffer::MappingResult StreamBuffer::Map(ID3D11DeviceContext* context, u32 alignment, u32 min_size)
|
StreamBuffer::MappingResult StreamBuffer::Map(ID3D11DeviceContext* context, u32 alignment, u32 min_size)
|
||||||
{
|
{
|
||||||
m_position = Common::AlignUp(m_position, alignment);
|
m_position = Common::AlignUp(m_position, alignment);
|
||||||
|
|
||||||
D3D11_MAP map;
|
|
||||||
if ((m_position + min_size) >= m_size)
|
if ((m_position + min_size) >= m_size)
|
||||||
{
|
{
|
||||||
// wrap around
|
// wrap around
|
||||||
m_position = 0;
|
m_position = 0;
|
||||||
map = D3D11_MAP_WRITE_DISCARD;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
map = D3D11_MAP_WRITE_NO_OVERWRITE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11_MAPPED_SUBRESOURCE sr;
|
D3D11_MAPPED_SUBRESOURCE sr;
|
||||||
const HRESULT hr = context->Map(m_buffer.Get(), 0, map, 0, &sr);
|
const D3D11_MAP map_type = (m_position == 0) ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE;
|
||||||
|
const HRESULT hr = context->Map(m_buffer.Get(), 0, map_type, 0, &sr);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("Map failed: 0x%08X", hr);
|
Log_ErrorPrintf("Map failed: 0x%08X (alignment %u, minsize %u, size %u, position %u, map type %u)", hr, alignment,
|
||||||
|
min_size, m_size, m_position, static_cast<u32>(map_type));
|
||||||
Panic("Map failed");
|
Panic("Map failed");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue