Project

General

Profile

Emulator Issues #10904 ยป mypatch.diff

Patch to flesh out the bugs - dark_sylinc, 02/22/2018 03:18 AM

View differences:

Source/Core/VideoBackends/OGL/StreamBuffer.cpp
#include "VideoCommon/DriverDetails.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "Common/Assert.h"
#include <assert.h>
namespace OGL
{
// moved out of constructor, so m_buffer is allowed to be const
......
for (int i = 0; i < SYNC_POINTS; i++)
{
m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
m_fences_check[i] = true;
}
}
void StreamBuffer::DeleteFences()
......
for (int i = Slot(m_free_iterator) + 1; i < SYNC_POINTS; i++)
{
glDeleteSync(m_fences[i]);
m_fences_check[i] = false;
}
for (int i = 0; i < Slot(m_iterator); i++)
{
glDeleteSync(m_fences[i]);
m_fences_check[i] = false;
}
for (int i = 0; i < SYNC_POINTS; i++)
{
assert( !m_fences_check[i] );
}
}
void StreamBuffer::AllocMemory(u32 size)
......
// insert waiting slots for used memory
for (int i = Slot(m_used_iterator); i < Slot(m_iterator); i++)
{
assert( !m_fences_check[i] );
if( m_fences_check[i] )
glDeleteSync( m_fences[i] );
m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
m_fences_check[i] = true;
}
m_used_iterator = m_iterator;
// wait for new slots to end of buffer
for (int i = Slot(m_free_iterator) + 1; i <= Slot(m_iterator + size) && i < SYNC_POINTS; i++)
{
glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
assert( m_fences_check[i] );
GLenum waitRet = glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
assert( waitRet != GL_WAIT_FAILED );
glDeleteSync(m_fences[i]);
m_fences_check[i] = false;
}
// If we allocate a large amount of memory (A), commit a smaller amount, then allocate memory
......
// insert waiting slots in unused space at the end of the buffer
for (int i = Slot(m_used_iterator); i < SYNC_POINTS; i++)
{
assert( !m_fences_check[i] );
m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
m_fences_check[i] = true;
}
u32 oldUsed = m_used_iterator;
//glFlush(); ---> UNCOMENT THIS TO FIX THE HANGS
// move to the start
m_used_iterator = m_iterator = 0; // offset 0 is always aligned
// wait for space at the start
for (int i = 0; i <= Slot(m_iterator + size); i++)
{
glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
assert( m_fences_check[i] );
if( i == 7 )
{
static int count = 0;
printf( "i==7 %i\n", count );
++count;
}
GLenum waitRet = glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
assert( waitRet != GL_WAIT_FAILED );
glDeleteSync(m_fences[i]);
m_fences_check[i] = false;
}
m_free_iterator = m_iterator + size;
}
Source/Core/VideoBackends/OGL/StreamBuffer.h
const int m_bit_per_slot;
std::array<GLsync, SYNC_POINTS> m_fences{};
std::array<bool, SYNC_POINTS> m_fences_check{};
};
}
Source/Core/VideoCommon/DriverDetails.cpp
{API_OPENGL, OS_ALL, VENDOR_MESA, DRIVER_I965, Family::UNKNOWN, BUG_BROKEN_UBO, 900, 920, true},
{API_OPENGL, OS_ALL, VENDOR_MESA, DRIVER_ALL, Family::UNKNOWN, BUG_BROKEN_COPYIMAGE, -1.0,
1064.0, true},
{API_OPENGL, OS_LINUX, VENDOR_MESA, DRIVER_ALL, Family::UNKNOWN, BUG_BROKEN_PINNED_MEMORY, -1.0,
-1.0, true},
{API_OPENGL, OS_LINUX, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN, BUG_BROKEN_PINNED_MEMORY, -1.0,
-1.0, true},
{API_OPENGL, OS_ALL, VENDOR_MESA, DRIVER_R600, Family::UNKNOWN, BUG_BROKEN_PINNED_MEMORY, -1.0,
    (1-1/1)