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