mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-01 10:31:31 +02:00
OGL: Use coherent mapping on Qualcomm devices.
This commit is contained in:
parent
7517d126c8
commit
bca0e06a95
@ -210,7 +210,7 @@ public:
|
|||||||
class BufferStorage : public StreamBuffer
|
class BufferStorage : public StreamBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BufferStorage(u32 type, u32 size) : StreamBuffer(type, size)
|
BufferStorage(u32 type, u32 size, bool _coherent = false) : StreamBuffer(type, size), coherent(_coherent)
|
||||||
{
|
{
|
||||||
CreateFences();
|
CreateFences();
|
||||||
glBindBuffer(m_buffertype, m_buffer);
|
glBindBuffer(m_buffertype, m_buffer);
|
||||||
@ -219,9 +219,9 @@ public:
|
|||||||
// COHERENT_BIT is set so we don't have to use a MemoryBarrier on write
|
// COHERENT_BIT is set so we don't have to use a MemoryBarrier on write
|
||||||
// CLIENT_STORAGE_BIT is set since we access the buffer more frequently on the client side then server side
|
// CLIENT_STORAGE_BIT is set since we access the buffer more frequently on the client side then server side
|
||||||
glBufferStorage(m_buffertype, m_size, nullptr,
|
glBufferStorage(m_buffertype, m_size, nullptr,
|
||||||
GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT);
|
GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | (coherent ? GL_MAP_COHERENT_BIT : 0));
|
||||||
m_pointer = (u8*)glMapBufferRange(m_buffertype, 0, m_size,
|
m_pointer = (u8*)glMapBufferRange(m_buffertype, 0, m_size,
|
||||||
GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
|
GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | (coherent ? GL_MAP_COHERENT_BIT : GL_MAP_FLUSH_EXPLICIT_BIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
~BufferStorage()
|
~BufferStorage()
|
||||||
@ -239,11 +239,13 @@ public:
|
|||||||
|
|
||||||
void Unmap(u32 used_size) override
|
void Unmap(u32 used_size) override
|
||||||
{
|
{
|
||||||
glFlushMappedBufferRange(m_buffertype, m_iterator, used_size);
|
if (!coherent)
|
||||||
|
glFlushMappedBufferRange(m_buffertype, m_iterator, used_size);
|
||||||
m_iterator += used_size;
|
m_iterator += used_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* m_pointer;
|
u8* m_pointer;
|
||||||
|
const bool coherent;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* --- AMD only ---
|
/* --- AMD only ---
|
||||||
@ -377,10 +379,11 @@ std::unique_ptr<StreamBuffer> StreamBuffer::Create(u32 type, u32 size)
|
|||||||
return std::make_unique<PinnedMemory>(type, size);
|
return std::make_unique<PinnedMemory>(type, size);
|
||||||
|
|
||||||
// buffer storage works well in most situations
|
// buffer storage works well in most situations
|
||||||
|
bool coherent = DriverDetails::HasBug(DriverDetails::BUG_BROKENEXPLICITFLUSH);
|
||||||
if (g_ogl_config.bSupportsGLBufferStorage &&
|
if (g_ogl_config.bSupportsGLBufferStorage &&
|
||||||
!(DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTORAGE) && type == GL_ARRAY_BUFFER) &&
|
!(DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTORAGE) && type == GL_ARRAY_BUFFER) &&
|
||||||
!(DriverDetails::HasBug(DriverDetails::BUG_INTELBROKENBUFFERSTORAGE) && type == GL_ELEMENT_ARRAY_BUFFER))
|
!(DriverDetails::HasBug(DriverDetails::BUG_INTELBROKENBUFFERSTORAGE) && type == GL_ELEMENT_ARRAY_BUFFER))
|
||||||
return std::make_unique<BufferStorage>(type, size);
|
return std::make_unique<BufferStorage>(type, size, coherent);
|
||||||
|
|
||||||
// don't fall back to MapAnd* for Nvidia drivers
|
// don't fall back to MapAnd* for Nvidia drivers
|
||||||
if (DriverDetails::HasBug(DriverDetails::BUG_BROKENUNSYNCMAPPING))
|
if (DriverDetails::HasBug(DriverDetails::BUG_BROKENUNSYNCMAPPING))
|
||||||
|
@ -44,6 +44,7 @@ namespace DriverDetails
|
|||||||
static BugInfo m_known_bugs[] = {
|
static BugInfo m_known_bugs[] = {
|
||||||
{OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM, Family::UNKNOWN, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
|
{OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM, Family::UNKNOWN, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
|
||||||
{OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM, Family::UNKNOWN, BUG_BROKENNEGATEDBOOLEAN,-1.0, -1.0, true},
|
{OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM, Family::UNKNOWN, BUG_BROKENNEGATEDBOOLEAN,-1.0, -1.0, true},
|
||||||
|
{OS_ALL, VENDOR_QUALCOMM, DRIVER_QUALCOMM, Family::UNKNOWN, BUG_BROKENEXPLICITFLUSH, -1.0, -1.0, true},
|
||||||
{OS_ALL, VENDOR_ARM, DRIVER_ARM, Family::UNKNOWN, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
|
{OS_ALL, VENDOR_ARM, DRIVER_ARM, Family::UNKNOWN, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
|
||||||
{OS_ALL, VENDOR_ARM, DRIVER_ARM, Family::UNKNOWN, BUG_BROKENVSYNC, -1.0, -1.0, true},
|
{OS_ALL, VENDOR_ARM, DRIVER_ARM, Family::UNKNOWN, BUG_BROKENVSYNC, -1.0, -1.0, true},
|
||||||
{OS_ALL, VENDOR_IMGTEC, DRIVER_IMGTEC, Family::UNKNOWN, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
|
{OS_ALL, VENDOR_IMGTEC, DRIVER_IMGTEC, Family::UNKNOWN, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
|
||||||
|
@ -176,6 +176,14 @@ namespace DriverDetails
|
|||||||
// Mesa introduced geometry shader support for radeon and sandy bridge devices and failed to test it with us.
|
// Mesa introduced geometry shader support for radeon and sandy bridge devices and failed to test it with us.
|
||||||
// Causes misrenderings on a large amount of things that draw lines.
|
// Causes misrenderings on a large amount of things that draw lines.
|
||||||
BUG_BROKENGEOMETRYSHADERS,
|
BUG_BROKENGEOMETRYSHADERS,
|
||||||
|
|
||||||
|
// Bug: Explicit flush is very slow on Qualcomm
|
||||||
|
// Started Version: -1
|
||||||
|
// Ended Version: -1
|
||||||
|
// Our ARB_buffer_storage code uses explicit flush to avoid coherent mapping.
|
||||||
|
// Qualcomm seems to have lots of overhead on exlicit flushing, but the coherent mapping path is fine.
|
||||||
|
// So let's use coherent mapping there.
|
||||||
|
BUG_BROKENEXPLICITFLUSH,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initializes our internal vendor, device family, and driver version
|
// Initializes our internal vendor, device family, and driver version
|
||||||
|
Loading…
Reference in New Issue
Block a user