diff options
author | Kissaki <kissaki@gmx.de> | 2012-10-20 00:52:45 +0400 |
---|---|---|
committer | Kissaki <kissaki@gmx.de> | 2012-10-24 21:24:33 +0400 |
commit | 9bd10b0001187cbd6da36c3bb6f0fc36eb6209fc (patch) | |
tree | 64dccb30c2513869a0c210f1c3151fe68e3e7cec /overlay/d3d10.cpp | |
parent | d74ea838095c5104235ba1986d6e1da4f26517af (diff) |
refacs; initialization, var-scope reduction, replace c-style casts, rm unused
* DBus.h, AudioOutputSpeech.cpp: initialize uninitialized members,
* d3d10.cpp: actually use assigned results for a dbg output
* lib.cpp, link.cpp: c-style to c++-style casts
* SpeexMark.cpp, ResampMark.cpp: rm unused var
* AGC.cpp, ResampMark.cpp:
rm unused var (ineffective return statement after prior return;
thus removing unused code - but someone check if sth. was missed there)
Diffstat (limited to 'overlay/d3d10.cpp')
-rw-r--r-- | overlay/d3d10.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/overlay/d3d10.cpp b/overlay/d3d10.cpp index 229f2d6f1..de05440e2 100644 --- a/overlay/d3d10.cpp +++ b/overlay/d3d10.cpp @@ -271,6 +271,8 @@ void D10State::init() { ID3D10Texture2D* pBackBuffer = NULL; hr = pSwapChain->GetBuffer(0, __uuidof(*pBackBuffer), (LPVOID*)&pBackBuffer); + if (FAILED(hr)) + ods("D3D10: pSwapChain->GetBuffer failure!"); pDevice->ClearState(); @@ -287,6 +289,8 @@ void D10State::init() { pDevice->RSSetViewports(1, &vp); hr = pDevice->CreateRenderTargetView(pBackBuffer, NULL, &pRTV); + if (FAILED(hr)) + ods("D3D10: pDevice->CreateRenderTargetView failure!"); pDevice->OMSetRenderTargets(1, &pRTV, NULL); @@ -324,6 +328,8 @@ void D10State::init() { D3D10_PASS_DESC PassDesc; pTechnique->GetPassByIndex(0)->GetDesc(&PassDesc); hr = pDevice->CreateInputLayout(layout, numElements, PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize, &pVertexLayout); + if (FAILED(hr)) + ods("D3D10: pDevice->CreateInputLayout failure!"); pDevice->IASetInputLayout(pVertexLayout); D3D10_BUFFER_DESC bd; @@ -334,6 +340,8 @@ void D10State::init() { bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; bd.MiscFlags = 0; hr = pDevice->CreateBuffer(&bd, NULL, &pVertexBuffer); + if (FAILED(hr)) + ods("D3D10: pDevice->CreateBuffer failure!"); DWORD indices[] = { 0,1,3, @@ -349,6 +357,8 @@ void D10State::init() { ZeroMemory(&InitData, sizeof(InitData)); InitData.pSysMem = indices; hr = pDevice->CreateBuffer(&bd, &InitData, &pIndexBuffer); + if (FAILED(hr)) + ods("D3D10: pDevice->CreateBuffer failure!"); // Set index buffer pDevice->IASetIndexBuffer(pIndexBuffer, DXGI_FORMAT_R32_UINT, 0); @@ -616,9 +626,10 @@ extern "C" __declspec(dllexport) void __cdecl PrepareDXGI() { CreateDXGIFactoryType pCreateDXGIFactory = reinterpret_cast<CreateDXGIFactoryType>(GetProcAddress(hDXGI, "CreateDXGIFactory")); ods("Got %p", pCreateDXGIFactory); if (pCreateDXGIFactory) { - HRESULT hr; IDXGIFactory * pFactory; - hr = pCreateDXGIFactory(__uuidof(IDXGIFactory), (void**)(&pFactory)); + HRESULT hr = pCreateDXGIFactory(__uuidof(IDXGIFactory), (void**)(&pFactory)); + if (FAILED(hr)) + ods("D3D10: pCreateDXGIFactory failure!"); if (pFactory) { HWND hwnd = CreateWindowW(L"STATIC", L"Mumble DXGI Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, 0, @@ -662,6 +673,8 @@ extern "C" __declspec(dllexport) void __cdecl PrepareDXGI() { desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; hr = pD3D10CreateDeviceAndSwapChain(pAdapter, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &desc, &pSwapChain, &pDevice); + if (FAILED(hr)) + ods("D3D10: pD3D10CreateDeviceAndSwapChain failure!"); if (pDevice && pSwapChain) { HMODULE hRef; |