mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 04:29:15 +01:00
[d3d8] Minor static analysis nits
This commit is contained in:
parent
3f7460931a
commit
b1c0ea1ba0
@ -33,16 +33,16 @@ namespace dxvk {
|
||||
UINT OffsetToLock,
|
||||
UINT SizeToLock,
|
||||
BYTE** ppbData,
|
||||
DWORD Flags) {
|
||||
DWORD Flags) final {
|
||||
*ppbData = m_data.data() + OffsetToLock;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Unlock() {
|
||||
HRESULT STDMETHODCALLTYPE Unlock() final {
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDesc(D3DVERTEXBUFFER_DESC* pDesc) {
|
||||
HRESULT STDMETHODCALLTYPE GetDesc(D3DVERTEXBUFFER_DESC* pDesc) final {
|
||||
if (unlikely(pDesc == nullptr))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
@ -56,7 +56,7 @@ namespace dxvk {
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE PreLoad() {
|
||||
void STDMETHODCALLTYPE PreLoad() final {
|
||||
}
|
||||
|
||||
const void* GetPtr(UINT byteOffset = 0) const {
|
||||
|
@ -47,7 +47,7 @@ namespace dxvk {
|
||||
, m_behaviorFlags(BehaviorFlags)
|
||||
, m_multithread(BehaviorFlags & D3DCREATE_MULTITHREADED) {
|
||||
// Get the bridge interface to D3D9.
|
||||
if (FAILED(GetD3D9()->QueryInterface(__uuidof(IDxvkD3D8Bridge), (void**)&m_bridge))) {
|
||||
if (FAILED(GetD3D9()->QueryInterface(__uuidof(IDxvkD3D8Bridge), reinterpret_cast<void**>(&m_bridge)))) {
|
||||
throw DxvkError("D3D8Device: ERROR! Failed to get D3D9 Bridge. d3d9.dll might not be DXVK!");
|
||||
}
|
||||
|
||||
@ -578,11 +578,11 @@ namespace dxvk {
|
||||
bool compressed = isDXT(srcDesc.Format);
|
||||
|
||||
res = src->LockRect(&srcLocked, &srcRect, D3DLOCK_READONLY);
|
||||
if (FAILED(res))
|
||||
if (unlikely(FAILED(res)))
|
||||
return res;
|
||||
|
||||
res = dst->LockRect(&dstLocked, &dstRect, 0);
|
||||
if (FAILED(res)) {
|
||||
if (unlikely(FAILED(res))) {
|
||||
src->UnlockRect();
|
||||
return res;
|
||||
}
|
||||
@ -629,8 +629,8 @@ namespace dxvk {
|
||||
size_t srcOffset = 0, dstOffset = 0;
|
||||
for (auto i = 0; i < rows; i++) {
|
||||
std::memcpy(
|
||||
(uint8_t*)dstLocked.pBits + dstOffset,
|
||||
(uint8_t*)srcLocked.pBits + srcOffset,
|
||||
reinterpret_cast<uint8_t*>(dstLocked.pBits) + dstOffset,
|
||||
reinterpret_cast<uint8_t*>(srcLocked.pBits) + srcOffset,
|
||||
amplitude);
|
||||
srcOffset += srcLocked.Pitch;
|
||||
dstOffset += dstLocked.Pitch;
|
||||
@ -638,7 +638,13 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
res = dst->UnlockRect();
|
||||
if (unlikely(FAILED(res))) {
|
||||
src->UnlockRect();
|
||||
return res;
|
||||
}
|
||||
|
||||
res = src->UnlockRect();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1559,7 +1565,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D8Device::GetVertexShaderConstant(DWORD Register, void* pConstantData, DWORD ConstantCount) {
|
||||
return GetD3D9()->GetVertexShaderConstantF(Register, (float*)pConstantData, ConstantCount);
|
||||
return GetD3D9()->GetVertexShaderConstantF(Register, reinterpret_cast<float*>(pConstantData), ConstantCount);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D8Device::SetStreamSource(
|
||||
@ -1657,7 +1663,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D8Device::GetPixelShaderConstant(DWORD Register, void* pConstantData, DWORD ConstantCount) {
|
||||
return GetD3D9()->GetPixelShaderConstantF(Register, (float*)pConstantData, ConstantCount);
|
||||
return GetD3D9()->GetPixelShaderConstantF(Register, reinterpret_cast<float*>(pConstantData), ConstantCount);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D8Device::SetPixelShaderConstant(
|
||||
@ -1967,11 +1973,8 @@ namespace dxvk {
|
||||
if (!info)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
if (info->pVertexDecl != nullptr)
|
||||
info->pVertexDecl = nullptr;
|
||||
if (info->pVertexShader != nullptr)
|
||||
info->pVertexShader = nullptr;
|
||||
|
||||
info->pVertexDecl = nullptr;
|
||||
info->pVertexShader = nullptr;
|
||||
info->declaration.clear();
|
||||
info->function.clear();
|
||||
|
||||
|
@ -7,11 +7,10 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
D3D8Interface::D3D8Interface() {
|
||||
m_d3d9 = d3d9::Direct3DCreate9(D3D_SDK_VERSION);
|
||||
|
||||
D3D8Interface::D3D8Interface()
|
||||
: m_d3d9(d3d9::Direct3DCreate9(D3D_SDK_VERSION)) {
|
||||
// Get the bridge interface to D3D9.
|
||||
if (FAILED(m_d3d9->QueryInterface(__uuidof(IDxvkD3D8InterfaceBridge), (void**)&m_bridge))) {
|
||||
if (FAILED(m_d3d9->QueryInterface(__uuidof(IDxvkD3D8InterfaceBridge), reinterpret_cast<void**>(&m_bridge)))) {
|
||||
throw DxvkError("D3D8Interface: ERROR! Failed to get D3D9 Bridge. d3d9.dll might not be DXVK!");
|
||||
}
|
||||
|
||||
|
@ -96,11 +96,11 @@ namespace dxvk {
|
||||
|
||||
virtual IUnknown* GetInterface(REFIID riid) override try {
|
||||
return D3D8DeviceChild<D3D9, D3D8>::GetInterface(riid);
|
||||
} catch (HRESULT err) {
|
||||
} catch (const DxvkError& e) {
|
||||
if (riid == __uuidof(IDirect3DResource8))
|
||||
return this;
|
||||
|
||||
throw err;
|
||||
throw e;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -71,8 +71,11 @@ namespace dxvk {
|
||||
m_indices = m_device->m_indices.ptr();
|
||||
}
|
||||
|
||||
if (m_capture.swvp)
|
||||
m_device->GetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING, (DWORD*)&m_isSWVP);
|
||||
if (m_capture.swvp) {
|
||||
DWORD swvpState;
|
||||
m_device->GetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING, &swvpState);
|
||||
m_isSWVP = static_cast<bool>(swvpState);
|
||||
}
|
||||
|
||||
return m_stateBlock->Capture();
|
||||
}
|
||||
@ -101,7 +104,7 @@ namespace dxvk {
|
||||
|
||||
// This was a very easy footgun for D3D8 applications.
|
||||
if (m_capture.swvp)
|
||||
m_device->SetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING, m_isSWVP);
|
||||
m_device->SetRenderState(D3DRS_SOFTWAREVERTEXPROCESSING, static_cast<DWORD>(m_isSWVP));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ namespace dxvk {
|
||||
NULL);
|
||||
|
||||
if (FAILED(res))
|
||||
throw new DxvkError("D3D8: Failed to create blit image");
|
||||
throw DxvkError("D3D8: Failed to create blit image");
|
||||
|
||||
return image;
|
||||
}
|
||||
|
@ -30,17 +30,16 @@ namespace dxvk {
|
||||
|
||||
~D3D8BaseTexture() {
|
||||
for (size_t i = 0; i < m_subresources.size(); i++)
|
||||
if (m_subresources[i] != nullptr)
|
||||
m_subresources[i] = nullptr;
|
||||
m_subresources[i] = nullptr;
|
||||
}
|
||||
|
||||
virtual IUnknown* GetInterface(REFIID riid) final override try {
|
||||
return D3D8Resource<D3D9, D3D8>::GetInterface(riid);
|
||||
} catch (HRESULT err) {
|
||||
} catch (const DxvkError& e) {
|
||||
if (riid == __uuidof(IDirect3DBaseTexture8))
|
||||
return this;
|
||||
|
||||
throw err;
|
||||
throw e;
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE PreLoad() final {
|
||||
@ -76,8 +75,9 @@ namespace dxvk {
|
||||
|
||||
// Cache the subresource
|
||||
m_subresources[Index] = new SubresourceType(this->m_parent, this->m_pool, this, std::move(subresource));
|
||||
} catch (HRESULT res) {
|
||||
return res;
|
||||
} catch (const DxvkError& e) {
|
||||
Logger::warn(e.message());
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,8 +97,10 @@ namespace dxvk {
|
||||
} else if constexpr (std::is_same_v<D3D8, IDirect3DCubeTexture8>) {
|
||||
res = this->GetD3D9()->GetCubeMapSurface(d3d9::D3DCUBEMAP_FACES(Index % CUBE_FACES), Index / CUBE_FACES, &ptr);
|
||||
}
|
||||
|
||||
if (FAILED(res))
|
||||
throw res;
|
||||
throw DxvkError(str::format("D3D8BaseTexture::GetSubresource: Failed to retrieve index ", Index));
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace dxvk {
|
||||
if (riid == __uuidof(D3D8))
|
||||
return this;
|
||||
|
||||
throw E_NOINTERFACE;
|
||||
throw DxvkError("D3D8WrappedObject::QueryInterface: Unknown interface query");
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final {
|
||||
@ -51,10 +51,10 @@ namespace dxvk {
|
||||
try {
|
||||
*ppvObject = ref(this->GetInterface(riid));
|
||||
return S_OK;
|
||||
} catch (HRESULT err) {
|
||||
Logger::warn("D3D8WrappedObject::QueryInterface: Unknown interface query");
|
||||
} catch (const DxvkError& e) {
|
||||
Logger::warn(e.message());
|
||||
Logger::warn(str::format(riid));
|
||||
return err;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user