Project

General

Profile

mypatch.diff

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

View differences:

Source/Core/VideoBackends/OGL/StreamBuffer.cpp
14 14
#include "VideoCommon/DriverDetails.h"
15 15
#include "VideoCommon/OnScreenDisplay.h"
16 16

  
17
#include "Common/Assert.h"
18
#include <assert.h>
19

  
17 20
namespace OGL
18 21
{
19 22
// moved out of constructor, so m_buffer is allowed to be const
......
69 72
  for (int i = 0; i < SYNC_POINTS; i++)
70 73
  {
71 74
    m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
75
    m_fences_check[i] = true;
72 76
  }
73 77
}
74 78
void StreamBuffer::DeleteFences()
......
76 80
  for (int i = Slot(m_free_iterator) + 1; i < SYNC_POINTS; i++)
77 81
  {
78 82
    glDeleteSync(m_fences[i]);
83
    m_fences_check[i] = false;
79 84
  }
80 85
  for (int i = 0; i < Slot(m_iterator); i++)
81 86
  {
82 87
    glDeleteSync(m_fences[i]);
88
    m_fences_check[i] = false;
89
  }
90
  for (int i = 0; i < SYNC_POINTS; i++)
91
  {
92
    assert( !m_fences_check[i] );
83 93
  }
84 94
}
85 95
void StreamBuffer::AllocMemory(u32 size)
......
87 97
  // insert waiting slots for used memory
88 98
  for (int i = Slot(m_used_iterator); i < Slot(m_iterator); i++)
89 99
  {
100
      assert( !m_fences_check[i] );
101
      if( m_fences_check[i] )
102
          glDeleteSync( m_fences[i] );
90 103
    m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
104
    m_fences_check[i] = true;
91 105
  }
92 106
  m_used_iterator = m_iterator;
93 107

  
94 108
  // wait for new slots to end of buffer
95 109
  for (int i = Slot(m_free_iterator) + 1; i <= Slot(m_iterator + size) && i < SYNC_POINTS; i++)
96 110
  {
97
    glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
111
      assert( m_fences_check[i] );
112
    GLenum waitRet = glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
113
    assert( waitRet != GL_WAIT_FAILED );
98 114
    glDeleteSync(m_fences[i]);
115
    m_fences_check[i] = false;
99 116
  }
100 117

  
101 118
  // If we allocate a large amount of memory (A), commit a smaller amount, then allocate memory
......
111 128
    // insert waiting slots in unused space at the end of the buffer
112 129
    for (int i = Slot(m_used_iterator); i < SYNC_POINTS; i++)
113 130
    {
131
        assert( !m_fences_check[i] );
114 132
      m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
133
      m_fences_check[i] = true;
115 134
    }
116 135

  
136
    u32 oldUsed = m_used_iterator;
137

  
138
    //glFlush(); ---> UNCOMENT THIS TO FIX THE HANGS
139

  
117 140
    // move to the start
118 141
    m_used_iterator = m_iterator = 0;  // offset 0 is always aligned
119 142

  
120 143
    // wait for space at the start
121 144
    for (int i = 0; i <= Slot(m_iterator + size); i++)
122 145
    {
123
      glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
146
        assert( m_fences_check[i] );
147
        if( i == 7 )
148
        {
149
            static int count = 0;
150
            printf( "i==7 %i\n", count );
151
            ++count;
152
        }
153
        GLenum waitRet = glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
154
        assert( waitRet != GL_WAIT_FAILED );
124 155
      glDeleteSync(m_fences[i]);
156
      m_fences_check[i] = false;
125 157
    }
126 158
    m_free_iterator = m_iterator + size;
127 159
  }
Source/Core/VideoBackends/OGL/StreamBuffer.h
61 61
  const int m_bit_per_slot;
62 62

  
63 63
  std::array<GLsync, SYNC_POINTS> m_fences{};
64
  std::array<bool, SYNC_POINTS> m_fences_check{};
64 65
};
65 66
}
Source/Core/VideoCommon/DriverDetails.cpp
70 70
    {API_OPENGL, OS_ALL, VENDOR_MESA, DRIVER_I965, Family::UNKNOWN, BUG_BROKEN_UBO, 900, 920, true},
71 71
    {API_OPENGL, OS_ALL, VENDOR_MESA, DRIVER_ALL, Family::UNKNOWN, BUG_BROKEN_COPYIMAGE, -1.0,
72 72
     1064.0, true},
73
    {API_OPENGL, OS_LINUX, VENDOR_MESA, DRIVER_ALL, Family::UNKNOWN, BUG_BROKEN_PINNED_MEMORY, -1.0,
74
     -1.0, true},
73 75
    {API_OPENGL, OS_LINUX, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN, BUG_BROKEN_PINNED_MEMORY, -1.0,
74 76
     -1.0, true},
75 77
    {API_OPENGL, OS_ALL, VENDOR_MESA, DRIVER_R600, Family::UNKNOWN, BUG_BROKEN_PINNED_MEMORY, -1.0,