just code indentation
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4280 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ef6e574ea1
commit
3117bde5fb
|
@ -89,8 +89,8 @@ void EnableAlphaToCoverage()
|
|||
D3D::SetRenderState(D3DRS_ADAPTIVETESS_Y, (D3DFORMAT)MAKEFOURCC('A', 'T', 'O', 'C'));
|
||||
}
|
||||
|
||||
void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp)
|
||||
{
|
||||
void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp)
|
||||
{
|
||||
int FSResX = adapters[adapter].resolutions[resolution].xres;
|
||||
int FSResY = adapters[adapter].resolutions[resolution].yres;
|
||||
|
||||
|
@ -129,10 +129,10 @@ void EnableAlphaToCoverage()
|
|||
pp->PresentationInterval = g_Config.bVSync ? D3DPRESENT_INTERVAL_DEFAULT : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
pp->Windowed = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Enumerate()
|
||||
{
|
||||
void Enumerate()
|
||||
{
|
||||
numAdapters = D3D::D3D->GetAdapterCount();
|
||||
for (int i = 0; i < std::min(MAX_ADAPTERS, numAdapters); i++)
|
||||
{
|
||||
|
@ -219,10 +219,10 @@ void EnableAlphaToCoverage()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT Create(int adapter, HWND wnd, bool _fullscreen, int _resolution, int aa_mode, bool auto_depth)
|
||||
{
|
||||
HRESULT Create(int adapter, HWND wnd, bool _fullscreen, int _resolution, int aa_mode, bool auto_depth)
|
||||
{
|
||||
hWnd = wnd;
|
||||
fullScreen = _fullscreen;
|
||||
nextFullScreen = _fullscreen;
|
||||
|
@ -267,13 +267,13 @@ void EnableAlphaToCoverage()
|
|||
|
||||
// Device state would normally be set here
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
void Close()
|
||||
{
|
||||
void Close()
|
||||
{
|
||||
dev->Release();
|
||||
dev = 0;
|
||||
}
|
||||
}
|
||||
|
||||
const D3DCAPS9 &GetCaps()
|
||||
{
|
||||
|
@ -318,10 +318,12 @@ void ShowD3DError(HRESULT err)
|
|||
}
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
void Reset()
|
||||
{
|
||||
if (dev)
|
||||
{
|
||||
ForgetCachedState();
|
||||
|
||||
// Can't keep a pointer around to the backbuffer surface when resetting.
|
||||
if (back_buffer_z)
|
||||
back_buffer_z->Release();
|
||||
|
@ -338,30 +340,30 @@ void ShowD3DError(HRESULT err)
|
|||
if (dev->GetDepthStencilSurface(&back_buffer_z) == D3DERR_NOTFOUND)
|
||||
back_buffer_z = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IsFullscreen()
|
||||
{
|
||||
bool IsFullscreen()
|
||||
{
|
||||
return fullScreen;
|
||||
}
|
||||
}
|
||||
|
||||
int GetBackBufferWidth()
|
||||
{
|
||||
int GetBackBufferWidth()
|
||||
{
|
||||
return xres;
|
||||
}
|
||||
}
|
||||
|
||||
int GetBackBufferHeight()
|
||||
{
|
||||
int GetBackBufferHeight()
|
||||
{
|
||||
return yres;
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchFullscreen(bool fullscreen)
|
||||
{
|
||||
void SwitchFullscreen(bool fullscreen)
|
||||
{
|
||||
nextFullScreen = fullscreen;
|
||||
}
|
||||
}
|
||||
|
||||
bool BeginFrame()
|
||||
{
|
||||
bool BeginFrame()
|
||||
{
|
||||
if (bFrameInProgress)
|
||||
{
|
||||
PanicAlert("BeginFrame WTF");
|
||||
|
@ -375,10 +377,10 @@ void ShowD3DError(HRESULT err)
|
|||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void EndFrame()
|
||||
{
|
||||
void EndFrame()
|
||||
{
|
||||
if (!bFrameInProgress)
|
||||
{
|
||||
PanicAlert("EndFrame WTF");
|
||||
|
@ -397,7 +399,15 @@ void ShowD3DError(HRESULT err)
|
|||
fullScreen = nextFullScreen;
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ForgetCachedState()
|
||||
{
|
||||
memset(m_Textures, 0, sizeof(m_Textures));
|
||||
memset(m_RenderStates, 0xFF, sizeof(m_RenderStates));
|
||||
memset(m_TextureStageStates, 0xFF, sizeof(m_TextureStageStates));
|
||||
memset(m_SamplerStates, 0xFF, sizeof(m_SamplerStates));
|
||||
}
|
||||
|
||||
void SetTexture(DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture)
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@ void SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture);
|
|||
void SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
|
||||
void SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
|
||||
void SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
|
||||
void ForgetCachedState();
|
||||
|
||||
// Utility functions for vendor specific hacks. So far, just the one.
|
||||
void EnableAlphaToCoverage();
|
||||
|
|
|
@ -23,34 +23,35 @@
|
|||
|
||||
namespace D3D
|
||||
{
|
||||
CD3DFont font;
|
||||
CD3DFont font;
|
||||
|
||||
#define MAX_NUM_VERTICES 50*6
|
||||
struct FONT2DVERTEX {
|
||||
struct FONT2DVERTEX {
|
||||
float x,y,z;
|
||||
float rhw;
|
||||
u32 color;
|
||||
float tu, tv;
|
||||
};
|
||||
};
|
||||
|
||||
#define D3DFVF_FONT2DVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
|
||||
#define D3DFVF_FONT3DVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_NORMAL|D3DFVF_TEX1)
|
||||
|
||||
inline FONT2DVERTEX InitFont2DVertex(float x, float y, u32 color, float tu, float tv)
|
||||
{
|
||||
inline FONT2DVERTEX InitFont2DVertex(float x, float y, u32 color, float tu, float tv)
|
||||
{
|
||||
FONT2DVERTEX v; v.x=x; v.y=y; v.z=0; v.rhw=1.0f; v.color = color; v.tu = tu; v.tv = tv;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
CD3DFont::CD3DFont()
|
||||
{
|
||||
CD3DFont::CD3DFont()
|
||||
{
|
||||
m_pTexture = NULL;
|
||||
m_pVB = NULL;
|
||||
}
|
||||
enum {m_dwTexWidth = 512, m_dwTexHeight = 512};
|
||||
}
|
||||
|
||||
int CD3DFont::Init()
|
||||
{
|
||||
enum {m_dwTexWidth = 512, m_dwTexHeight = 512};
|
||||
|
||||
int CD3DFont::Init()
|
||||
{
|
||||
// Create vertex buffer for the letters
|
||||
HRESULT hr;
|
||||
if (FAILED(hr = dev->CreateVertexBuffer(MAX_NUM_VERTICES*sizeof(FONT2DVERTEX),
|
||||
|
@ -155,45 +156,45 @@ namespace D3D
|
|||
DeleteObject(hFont);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
int CD3DFont::Shutdown()
|
||||
{
|
||||
int CD3DFont::Shutdown()
|
||||
{
|
||||
m_pVB->Release();
|
||||
m_pVB = NULL;
|
||||
m_pTexture->Release();
|
||||
m_pTexture = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const int RS[6][2] =
|
||||
{
|
||||
const int RS[6][2] =
|
||||
{
|
||||
{D3DRS_ALPHABLENDENABLE, TRUE},
|
||||
{D3DRS_SRCBLEND, D3DBLEND_SRCALPHA},
|
||||
{D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA},
|
||||
{D3DRS_CULLMODE, D3DCULL_NONE},
|
||||
{D3DRS_ZENABLE, FALSE},
|
||||
{D3DRS_FOGENABLE, FALSE},
|
||||
};
|
||||
const int TS[6][2] =
|
||||
{
|
||||
};
|
||||
const int TS[6][2] =
|
||||
{
|
||||
{D3DTSS_COLOROP, D3DTOP_MODULATE},
|
||||
{D3DTSS_COLORARG1, D3DTA_TEXTURE},
|
||||
{D3DTSS_COLORARG2, D3DTA_DIFFUSE },
|
||||
{D3DTSS_ALPHAOP, D3DTOP_MODULATE },
|
||||
{D3DTSS_ALPHAARG1, D3DTA_TEXTURE },
|
||||
{D3DTSS_ALPHAARG2, D3DTA_DIFFUSE },
|
||||
};
|
||||
};
|
||||
|
||||
static DWORD RS_old[6];
|
||||
static DWORD TS_old[6];
|
||||
static LPDIRECT3DBASETEXTURE9 texture_old;
|
||||
static LPDIRECT3DPIXELSHADER9 ps_old;
|
||||
static LPDIRECT3DVERTEXSHADER9 vs_old;
|
||||
static DWORD RS_old[6];
|
||||
static DWORD TS_old[6];
|
||||
static LPDIRECT3DBASETEXTURE9 texture_old;
|
||||
static LPDIRECT3DPIXELSHADER9 ps_old;
|
||||
static LPDIRECT3DVERTEXSHADER9 vs_old;
|
||||
|
||||
void SaveRenderStates()
|
||||
{
|
||||
void SaveRenderStates()
|
||||
{
|
||||
// TODO: Get rid of these Gets so we can potentially switch to Pure Device
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
|
@ -203,10 +204,10 @@ namespace D3D
|
|||
dev->GetTexture(0, &texture_old);
|
||||
dev->GetPixelShader(&ps_old);
|
||||
dev->GetVertexShader(&vs_old);
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreRenderStates()
|
||||
{
|
||||
void RestoreRenderStates()
|
||||
{
|
||||
D3D::SetTexture(0, texture_old);
|
||||
|
||||
dev->SetPixelShader(ps_old);
|
||||
|
@ -217,10 +218,10 @@ namespace D3D
|
|||
D3D::SetRenderState((_D3DRENDERSTATETYPE)RS[i][0], RS_old[i]);
|
||||
D3D::SetTextureStageState(0, (_D3DTEXTURESTAGESTATETYPE)int(TS[i][0]), TS_old[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CD3DFont::SetRenderStates()
|
||||
{
|
||||
void CD3DFont::SetRenderStates()
|
||||
{
|
||||
D3D::SetTexture(0, m_pTexture);
|
||||
|
||||
dev->SetPixelShader(0);
|
||||
|
@ -233,11 +234,11 @@ namespace D3D
|
|||
D3D::SetRenderState((_D3DRENDERSTATETYPE)RS[i][0], RS[i][1]);
|
||||
D3D::SetTextureStageState(0, (_D3DTEXTURESTAGESTATETYPE)int(TS[i][0]), TS[i][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int CD3DFont::DrawTextScaled(float x, float y, float fXScale, float fYScale, float spacing, u32 dwColor, const char* strText, bool center)
|
||||
{
|
||||
int CD3DFont::DrawTextScaled(float x, float y, float fXScale, float fYScale, float spacing, u32 dwColor, const char* strText, bool center)
|
||||
{
|
||||
if (!m_pVB)
|
||||
return 0;
|
||||
|
||||
|
@ -350,10 +351,10 @@ namespace D3D
|
|||
dev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, dwNumTriangles);
|
||||
RestoreRenderStates();
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1, float v1, float u2, float v2)
|
||||
{
|
||||
void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1, float v1, float u2, float v2)
|
||||
{
|
||||
SaveRenderStates();
|
||||
struct Q2DVertex { float x,y,z,rhw; u32 color; float u, v; } coords[4] = {
|
||||
{x1-0.5f, y1-0.5f, 0, 1, color, u1, v1},
|
||||
|
@ -369,6 +370,6 @@ namespace D3D
|
|||
dev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, coords, sizeof(Q2DVertex));
|
||||
|
||||
RestoreRenderStates();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in New Issue