Fix rendering on Adreno and Mali. This adds a new DriverDetails bug to know if the bufferstreaming is broken. Thanks degasus for fixing this.

This commit is contained in:
Ryan Houdek 2013-10-16 11:27:58 +00:00
parent c234dc97c0
commit f0bf5aa113
4 changed files with 47 additions and 21 deletions

View File

@ -198,12 +198,29 @@ void ProgramShaderCache::UploadConstants()
if(PixelShaderManager::dirty || VertexShaderManager::dirty)
{
s_buffer->Alloc(s_ubo_buffer_size);
size_t offset = s_buffer->Upload((u8*)&PixelShaderManager::constants, ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align));
glBindBufferRange(GL_UNIFORM_BUFFER, 1, s_buffer->getBuffer(), offset, sizeof(PixelShaderConstants));
offset = s_buffer->Upload((u8*)&VertexShaderManager::constants, ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align));
glBindBufferRange(GL_UNIFORM_BUFFER, 2, s_buffer->getBuffer(), offset, sizeof(VertexShaderConstants));
if (DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM))
{
// This is just a hack to support our BUFFERDATA upload method
// as it's broken to uploaded in a splited way
static u8 *tmpbuffer = new u8[s_ubo_buffer_size];
memcpy(tmpbuffer, &PixelShaderManager::constants, sizeof(PixelShaderConstants));
memcpy(tmpbuffer+ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align), &VertexShaderManager::constants, sizeof(VertexShaderConstants));
size_t offset = s_buffer->Upload(tmpbuffer, s_ubo_buffer_size);
glBindBufferRange(GL_UNIFORM_BUFFER, 1,
s_buffer->getBuffer(), offset, sizeof(PixelShaderConstants));
glBindBufferRange(GL_UNIFORM_BUFFER, 2,
s_buffer->getBuffer(), offset+ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align), sizeof(VertexShaderConstants));
}
else
{
size_t offset = s_buffer->Upload((u8*)&PixelShaderManager::constants, ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align));
glBindBufferRange(GL_UNIFORM_BUFFER, 1,
s_buffer->getBuffer(), offset, sizeof(PixelShaderConstants));
offset = s_buffer->Upload((u8*)&VertexShaderManager::constants, ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align));
glBindBufferRange(GL_UNIFORM_BUFFER, 2,
s_buffer->getBuffer(), offset, sizeof(VertexShaderConstants));
}
PixelShaderManager::dirty = false;
VertexShaderManager::dirty = false;

View File

@ -34,8 +34,7 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType)
}
if(!g_ogl_config.bSupportsGLBaseVertex && (m_uploadtype & BUFFERDATA)
&& !DriverDetails::HasBug(DriverDetails::BUG_ISPOWERVR)
&& !DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA))
|| DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM))
m_uploadtype = BUFFERDATA;
else if(!g_ogl_config.bSupportsGLBaseVertex && (m_uploadtype & BUFFERSUBDATA))
m_uploadtype = BUFFERSUBDATA;

View File

@ -27,19 +27,21 @@ namespace DriverDetails
// This is a list of all known bugs for each vendor
// We use this to check if the device and driver has a issue
BugInfo m_known_bugs[] = {
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_NODYNUBOACCESS, 14.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENCENTROID, 14.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENINFOLOG, -1.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_ANNIHILATEDUBOS, 41.0, 46.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENSWAP, -1.0, -1.0, true},
{VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENUBO, 900, 916, true},
{VENDOR_MESA, DRIVER_R600, BUG_BROKENUBO, 900, 913, true},
{VENDOR_MESA, DRIVER_I965, BUG_BROKENUBO, 900, 920, true},
{VENDOR_ATI, DRIVER_ATI, BUG_BROKENHACKEDBUFFER, -1.0, -1.0, true},
{VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENHACKEDBUFFER, -1.0, -1.0, true},
{VENDOR_ATI, DRIVER_ATI, BUG_BROKENPINNEDMEMORY, -1.0, -1.0, true},
{VENDOR_TEGRA, DRIVER_NVIDIA, BUG_ISTEGRA, -1.0, -1.0, true},
{VENDOR_IMGTEC, DRIVER_IMGTEC, BUG_ISPOWERVR, -1.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_NODYNUBOACCESS, 14.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENCENTROID, 14.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENINFOLOG, -1.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_ANNIHILATEDUBOS, 41.0, 46.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENSWAP, -1.0, -1.0, true},
{VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
{VENDOR_ARM, DRIVER_ARM_T6XX, BUG_BROKENBUFFERSTREAM, -1.0, -1.0, true},
{VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENUBO, 900, 916, true},
{VENDOR_MESA, DRIVER_R600, BUG_BROKENUBO, 900, 913, true},
{VENDOR_MESA, DRIVER_I965, BUG_BROKENUBO, 900, 920, true},
{VENDOR_ATI, DRIVER_ATI, BUG_BROKENHACKEDBUFFER, -1.0, -1.0, true},
{VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENHACKEDBUFFER, -1.0, -1.0, true},
{VENDOR_ATI, DRIVER_ATI, BUG_BROKENPINNEDMEMORY, -1.0, -1.0, true},
{VENDOR_TEGRA, DRIVER_NVIDIA, BUG_ISTEGRA, -1.0, -1.0, true},
{VENDOR_IMGTEC, DRIVER_IMGTEC, BUG_ISPOWERVR, -1.0, -1.0, true},
};
std::map<Bug, BugInfo> m_bugs;

View File

@ -129,6 +129,14 @@ namespace DriverDetails
// PowerVR 5 hardware limitations don't allow it to support OpenGL ES 3
// This is fixed in PowerVR6
BUG_ISPOWERVR,
// Bug: glBufferSubData/glMapBufferRange stalls + OOM
// Affected devices: Adreno a3xx/Mali-t6xx
// Started Version: -1
// Ended Version: -1
// Both Adreno and Mali have issues when you call glBufferSubData or glMapBufferRange
// The driver stalls in each instance no matter what you do
// Apparently Mali and Adreno share code in this regard since it was wrote by the same person.
BUG_BROKENBUFFERSTREAM,
};
// Initializes our internal vendor, device family, and driver version