mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
some fixes for point rendering
This commit is contained in:
@ -1080,6 +1080,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||||||
D3D::dev->SetRenderTarget(0, FramebufferManager::GetEFBColorRTSurface());
|
D3D::dev->SetRenderTarget(0, FramebufferManager::GetEFBColorRTSurface());
|
||||||
D3D::dev->SetDepthStencilSurface(FramebufferManager::GetEFBDepthRTSurface());
|
D3D::dev->SetDepthStencilSurface(FramebufferManager::GetEFBDepthRTSurface());
|
||||||
D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0);
|
D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0);
|
||||||
|
SetLineWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XFBWrited)
|
if (XFBWrited)
|
||||||
@ -1140,8 +1141,8 @@ void Renderer::RestoreState()
|
|||||||
D3D::RefreshRenderState(D3DRS_ZFUNC);
|
D3D::RefreshRenderState(D3DRS_ZFUNC);
|
||||||
}
|
}
|
||||||
// TODO: Enable this code. Caused glitches for me however (neobrain)
|
// TODO: Enable this code. Caused glitches for me however (neobrain)
|
||||||
// for (unsigned int i = 0; i < 8; ++i)
|
// for (unsigned int i = 0; i < 8; ++i)
|
||||||
// D3D::dev->SetTexture(i, NULL);
|
// D3D::dev->SetTexture(i, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ALWAYS call RestoreAPIState for each ResetAPIState call you're doing
|
// ALWAYS call RestoreAPIState for each ResetAPIState call you're doing
|
||||||
@ -1315,9 +1316,8 @@ 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.pointsize * fratio / 6.0f;
|
||||||
//little hack to compensate scaling problems in dx9 must be taken out when scaling is fixed.
|
psize = psize > 0 ? psize : 1.0;
|
||||||
psize *= 2.0f;
|
|
||||||
if (psize > m_fMaxPointSize)
|
if (psize > m_fMaxPointSize)
|
||||||
{
|
{
|
||||||
psize = m_fMaxPointSize;
|
psize = m_fMaxPointSize;
|
||||||
|
@ -37,7 +37,7 @@ inline void DumpBadShaders()
|
|||||||
{
|
{
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
// TODO: Reimplement!
|
// TODO: Reimplement!
|
||||||
/* std::string error_shaders;
|
/* std::string error_shaders;
|
||||||
error_shaders.append(VertexShaderCache::GetCurrentShaderCode());
|
error_shaders.append(VertexShaderCache::GetCurrentShaderCode());
|
||||||
error_shaders.append(PixelShaderCache::GetCurrentShaderCode());
|
error_shaders.append(PixelShaderCache::GetCurrentShaderCode());
|
||||||
char filename[512] = "bad_shader_combo_0.txt";
|
char filename[512] = "bad_shader_combo_0.txt";
|
||||||
@ -144,8 +144,9 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
|
|||||||
int datasize = IndexGenerator::GetNumVerts() * stride;
|
int datasize = IndexGenerator::GetNumVerts() * stride;
|
||||||
int TdataSize = IndexGenerator::GetTriangleindexLen();
|
int TdataSize = IndexGenerator::GetTriangleindexLen();
|
||||||
int LDataSize = IndexGenerator::GetLineindexLen();
|
int LDataSize = IndexGenerator::GetLineindexLen();
|
||||||
int PDataSize = IndexGenerator::GetPointindexLen();
|
|
||||||
int IndexDataSize = TdataSize + LDataSize;
|
int IndexDataSize = TdataSize + LDataSize;
|
||||||
|
if(IndexDataSize)
|
||||||
|
{
|
||||||
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;
|
||||||
@ -187,10 +188,11 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
|
|||||||
pIndices += LDataSize;
|
pIndices += LDataSize;
|
||||||
}
|
}
|
||||||
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)
|
||||||
{
|
{
|
||||||
m_current_stride = stride;
|
m_current_stride = stride;
|
||||||
D3D::SetStreamSource( 0, m_vertex_buffers[m_current_vertex_buffer], 0, stride);
|
D3D::SetStreamSource( 0, m_vertex_buffers[m_current_vertex_buffer], 0, m_current_stride);
|
||||||
}
|
}
|
||||||
if (m_index_buffer_cursor == 0)
|
if (m_index_buffer_cursor == 0)
|
||||||
{
|
{
|
||||||
@ -241,20 +243,26 @@ void VertexManager::DrawVertexBuffer(int stride)
|
|||||||
}
|
}
|
||||||
if (points > 0)
|
if (points > 0)
|
||||||
{
|
{
|
||||||
//DrawIndexedPrimitive does not support point list so we have to draw the points one by one
|
//DrawIndexedPrimitive does not support point list so we have to draw them using DrawPrimitive
|
||||||
for (int i = 0; i < points; i++)
|
u16* PointIndexBuffer = GetPointIndexBuffer();
|
||||||
|
int i = 0;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
|
int count = i + 1;
|
||||||
|
while (count < points && PointIndexBuffer[count - 1] + 1 == PointIndexBuffer[count])
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
if (FAILED(D3D::dev->DrawPrimitive(
|
if (FAILED(D3D::dev->DrawPrimitive(
|
||||||
D3DPT_POINTLIST,
|
D3DPT_POINTLIST,
|
||||||
basevertex + GetPointIndexBuffer()[i],
|
basevertex + PointIndexBuffer[i],
|
||||||
1)))
|
count - i)))
|
||||||
{
|
{
|
||||||
DumpBadShaders();
|
DumpBadShaders();
|
||||||
}
|
}
|
||||||
INCSTAT(stats.thisFrame.numDrawCalls);
|
INCSTAT(stats.thisFrame.numDrawCalls);
|
||||||
}
|
i = count;
|
||||||
|
} while (i < points);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user