fix for point rendering in dx9 backend, that will teach me to read the full documentation. if someone founs a games that use points a lot i will try to implement a faster path for point rendering.
now the map in twin snakes is functional in all the backends.
This commit is contained in:
parent
3936c06ee8
commit
0809ba79ae
|
@ -64,6 +64,7 @@ static int s_fps = 0;
|
||||||
static u32 s_blendMode;
|
static u32 s_blendMode;
|
||||||
static u32 s_LastAA;
|
static u32 s_LastAA;
|
||||||
static bool IS_AMD;
|
static bool IS_AMD;
|
||||||
|
static float m_fMaxPointSize;
|
||||||
|
|
||||||
static char *st;
|
static char *st;
|
||||||
|
|
||||||
|
@ -329,6 +330,9 @@ Renderer::Renderer()
|
||||||
D3D::BeginFrame();
|
D3D::BeginFrame();
|
||||||
D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, true);
|
D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, true);
|
||||||
D3D::dev->CreateOffscreenPlainSurface(s_backbuffer_width,s_backbuffer_height, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &ScreenShootMEMSurface, NULL );
|
D3D::dev->CreateOffscreenPlainSurface(s_backbuffer_width,s_backbuffer_height, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &ScreenShootMEMSurface, NULL );
|
||||||
|
D3D::SetRenderState(D3DRS_POINTSCALEENABLE,false);
|
||||||
|
m_fMaxPointSize = D3D::GetCaps().MaxPointSize;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer::~Renderer()
|
Renderer::~Renderer()
|
||||||
|
@ -1301,7 +1305,15 @@ void Renderer::SetLineWidth()
|
||||||
// We can't change line width in D3D unless we use ID3DXLine
|
// We can't change line width in D3D unless we use ID3DXLine
|
||||||
float fratio = xfregs.viewport.wd != 0 ? Renderer::EFBToScaledXf(1.f) : 1.0f;
|
float fratio = xfregs.viewport.wd != 0 ? Renderer::EFBToScaledXf(1.f) : 1.0f;
|
||||||
float psize = bpmem.lineptwidth.linesize * fratio / 6.0f;
|
float psize = bpmem.lineptwidth.linesize * fratio / 6.0f;
|
||||||
|
//little hack to compensate scalling problems in dx9 must be taken out when scalling is fixed.
|
||||||
|
psize *= 2.0f;
|
||||||
|
if (psize > m_fMaxPointSize)
|
||||||
|
{
|
||||||
|
psize = m_fMaxPointSize;
|
||||||
|
}
|
||||||
D3D::SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&psize));
|
D3D::SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&psize));
|
||||||
|
D3D::SetRenderState(D3DRS_POINTSIZE_MIN, *((DWORD*)&psize));
|
||||||
|
D3D::SetRenderState(D3DRS_POINTSIZE_MAX, *((DWORD*)&psize));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetSamplerState(int stage, int texindex)
|
void Renderer::SetSamplerState(int stage, int texindex)
|
||||||
|
|
|
@ -158,7 +158,7 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
|
||||||
int TdataSize = IndexGenerator::GetTriangleindexLen();
|
int TdataSize = IndexGenerator::GetTriangleindexLen();
|
||||||
int LDataSize = IndexGenerator::GetLineindexLen();
|
int LDataSize = IndexGenerator::GetLineindexLen();
|
||||||
int PDataSize = IndexGenerator::GetPointindexLen();
|
int PDataSize = IndexGenerator::GetPointindexLen();
|
||||||
int IndexDataSize = TdataSize + LDataSize + PDataSize;
|
int IndexDataSize = TdataSize + LDataSize;
|
||||||
DWORD LockMode = D3DLOCK_NOOVERWRITE;
|
DWORD LockMode = D3DLOCK_NOOVERWRITE;
|
||||||
m_vertex_buffer_cursor--;
|
m_vertex_buffer_cursor--;
|
||||||
m_vertex_buffer_cursor = m_vertex_buffer_cursor - (m_vertex_buffer_cursor % stride) + stride;
|
m_vertex_buffer_cursor = m_vertex_buffer_cursor - (m_vertex_buffer_cursor % stride) + stride;
|
||||||
|
@ -199,10 +199,6 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
|
||||||
memcpy(pIndices, LIBuffer, LDataSize * sizeof(u16));
|
memcpy(pIndices, LIBuffer, LDataSize * sizeof(u16));
|
||||||
pIndices += LDataSize;
|
pIndices += LDataSize;
|
||||||
}
|
}
|
||||||
if(PDataSize)
|
|
||||||
{
|
|
||||||
memcpy(pIndices, PIBuffer, PDataSize * sizeof(u16));
|
|
||||||
}
|
|
||||||
m_index_buffers[m_current_index_buffer]->Unlock();
|
m_index_buffers[m_current_index_buffer]->Unlock();
|
||||||
if(m_current_stride != stride || m_vertex_buffer_cursor == 0)
|
if(m_current_stride != stride || m_vertex_buffer_cursor == 0)
|
||||||
{
|
{
|
||||||
|
@ -256,17 +252,20 @@ void VertexManager::DrawVertexBuffer(int stride)
|
||||||
}
|
}
|
||||||
if (points > 0)
|
if (points > 0)
|
||||||
{
|
{
|
||||||
if (FAILED(D3D::dev->DrawIndexedPrimitive(
|
//DrawIndexedPrimitive does not support point list so we have to draw the points one by one
|
||||||
|
for (int i = 0; i < points; i++)
|
||||||
|
{
|
||||||
|
if (FAILED(D3D::dev->DrawPrimitive(
|
||||||
D3DPT_POINTLIST,
|
D3DPT_POINTLIST,
|
||||||
basevertex,
|
basevertex + PIBuffer[i],
|
||||||
0,
|
1)))
|
||||||
numverts,
|
|
||||||
StartIndex,
|
|
||||||
points)))
|
|
||||||
{
|
{
|
||||||
DumpBadShaders();
|
DumpBadShaders();
|
||||||
}
|
}
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numDrawCalls);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue