Getting closer towards a working D3D

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2638 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-03-09 23:24:53 +00:00
parent 220c11a3d5
commit 79e14b4077
2 changed files with 13 additions and 23 deletions

View File

@ -455,31 +455,21 @@ void BPWritten(int addr, int changes, int newval)
VertexShaderManager::SetViewportChanged(); VertexShaderManager::SetViewportChanged();
// clear color // Since clear operations use the source rectangle, we have to do
u32 clearColor = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB; // regular renders
if (bpmem.blendmode.colorupdate) if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
{ {
D3DRECT drc; D3DCOLOR col = 0;
drc.x1 = rc.left; if (bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate)
drc.x2 = rc.right; col = (bpmem.clearcolorAR << 16) | bpmem.clearcolorGB;
drc.y1 = rc.top;
drc.y2 = rc.bottom; D3D::dev->Clear(0, NULL, NULL, col, 0, 0);
//D3D::dev->Clear(1, &drc, D3DCLEAR_STENCIL|D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,clearColor,1.0f,0);
//if ((clearColor>>24) == 255)
D3D::dev->ColorFill(D3D::GetBackBufferSurface(), &rc, clearColor);
}
else
{
// TODO:
// bpmem.blendmode.alphaupdate
// bpmem.blendmode.colorupdate
// i dunno how to implement a clear on alpha only or color only
} }
// clear z-buffer // clear z-buffer
if (bpmem.zmode.updateenable) if (bpmem.zmode.updateenable)
{ {
float clearZ = (float)bpmem.clearZValue / float(0xFFFFFF); float clearZ = (float)(bpmem.clearZValue & 0xFFFFFF) / float(0xFFFFFF);
if (clearZ > 1.0f) clearZ = 1.0f; if (clearZ > 1.0f) clearZ = 1.0f;
if (clearZ < 0.0f) clearZ = 0.0f; if (clearZ < 0.0f) clearZ = 0.0f;

View File

@ -88,7 +88,7 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
if (_vtx_decl.normal_offset[i] >= 0) if (_vtx_decl.normal_offset[i] > 0)
{ {
elems[elem_idx].Offset = _vtx_decl.normal_offset[i]; elems[elem_idx].Offset = _vtx_decl.normal_offset[i];
elems[elem_idx].Type = VarToD3D(_vtx_decl.normal_gl_type); elems[elem_idx].Type = VarToD3D(_vtx_decl.normal_gl_type);
@ -100,7 +100,7 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (_vtx_decl.color_offset[i] >= 0) if (_vtx_decl.color_offset[i] > 0)
{ {
elems[elem_idx].Offset = _vtx_decl.color_offset[i]; elems[elem_idx].Offset = _vtx_decl.color_offset[i];
elems[elem_idx].Type = VarToD3D(_vtx_decl.color_gl_type); elems[elem_idx].Type = VarToD3D(_vtx_decl.color_gl_type);
@ -112,7 +112,7 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
if (_vtx_decl.texcoord_offset[i] >= 0) if (_vtx_decl.texcoord_offset[i] > 0)
{ {
elems[elem_idx].Offset = _vtx_decl.texcoord_offset[i]; elems[elem_idx].Offset = _vtx_decl.texcoord_offset[i];
elems[elem_idx].Type = VarToD3D(_vtx_decl.texcoord_gl_type[i]); elems[elem_idx].Type = VarToD3D(_vtx_decl.texcoord_gl_type[i]);