GSdx: psx plugin works again, the removal of _aligned_realloc broke it when I was making it gcc compatible.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4604 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2011-04-30 00:31:35 +00:00
parent 033ecabcf2
commit 157c6ef432
3 changed files with 29 additions and 11 deletions

View File

@ -114,11 +114,17 @@ protected:
void GrowVertexBuffer()
{
if(m_vertices != NULL) _aligned_free(m_vertices);
int maxcount = std::max<int>(m_maxcount * 3 / 2, 10000);
Vertex* vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * maxcount, 16);
m_maxcount = max(10000, m_maxcount * 3/2);
m_vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * m_maxcount, 16);
m_maxcount -= 100;
if(m_vertices != NULL)
{
memcpy(vertices, m_vertices, sizeof(Vertex) * m_maxcount);
_aligned_free(m_vertices);
}
m_vertices = vertices;
m_maxcount = maxcount - 100;
}
__forceinline Vertex* DrawingKick(int& count)

View File

@ -706,11 +706,17 @@ void GPUState::Buffer::Reserve(int size)
{
if(size > maxbytes)
{
maxbytes = (maxbytes + size + 1023) & ~1023;
int new_maxbytes = (maxbytes + size + 1023) & ~1023;
uint8* new_buff = (uint8*)_aligned_malloc(new_maxbytes, 16);
if(buff != NULL) _aligned_free(buff);
if(buff != NULL)
{
memcpy(new_buff, buff, maxbytes);
_aligned_free(buff);
}
buff = (uint8*)_aligned_malloc(maxbytes, 16);
maxbytes = new_maxbytes;
buff = new_buff;
}
}

View File

@ -137,11 +137,17 @@ protected:
void GrowVertexBuffer()
{
if(m_vertices != NULL) _aligned_free(m_vertices);
int maxcount = std::max<int>(m_maxcount * 3 / 2, 10000);
Vertex* vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * maxcount, 16);
m_maxcount = std::max<int>(10000, m_maxcount * 3 / 2);
m_vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * m_maxcount, 32);
m_maxcount -= 100;
if(m_vertices != NULL)
{
memcpy(vertices, m_vertices, sizeof(Vertex) * m_maxcount);
_aligned_free(m_vertices);
}
m_vertices = vertices;
m_maxcount = maxcount - 100;
}
// Returns a pointer to the drawing vertex. Can return NULL!