mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +01:00
Compare commits
9 Commits
97c8ce9558
...
2ab24880e7
Author | SHA1 | Date | |
---|---|---|---|
|
2ab24880e7 | ||
|
e2c20a39ef | ||
|
db0ed011d3 | ||
|
fe8cebb125 | ||
|
79bae3960e | ||
|
09bb3e773a | ||
|
e5052ba17d | ||
|
5515b9d9b3 | ||
|
0c45ccf96c |
@ -49,13 +49,9 @@ namespace dxvk {
|
|||||||
& ~D3DPRASTERCAPS_DEPTHBIAS
|
& ~D3DPRASTERCAPS_DEPTHBIAS
|
||||||
& ~D3DPRASTERCAPS_MULTISAMPLE_TOGGLE;
|
& ~D3DPRASTERCAPS_MULTISAMPLE_TOGGLE;
|
||||||
|
|
||||||
pCaps8->SrcBlendCaps &= ~D3DPBLENDCAPS_BLENDFACTOR
|
pCaps8->SrcBlendCaps &= ~D3DPBLENDCAPS_BLENDFACTOR;
|
||||||
& ~D3DPBLENDCAPS_INVSRCCOLOR2
|
|
||||||
& ~D3DPBLENDCAPS_SRCCOLOR2;
|
|
||||||
|
|
||||||
pCaps8->DestBlendCaps &= ~D3DPBLENDCAPS_BLENDFACTOR
|
pCaps8->DestBlendCaps &= ~D3DPBLENDCAPS_BLENDFACTOR;
|
||||||
& ~D3DPBLENDCAPS_INVSRCCOLOR2
|
|
||||||
& ~D3DPBLENDCAPS_SRCCOLOR2;
|
|
||||||
|
|
||||||
pCaps8->LineCaps &= ~D3DLINECAPS_ANTIALIAS;
|
pCaps8->LineCaps &= ~D3DLINECAPS_ANTIALIAS;
|
||||||
|
|
||||||
|
@ -413,8 +413,8 @@ namespace dxvk {
|
|||||||
| D3DPBLENDCAPS_BOTHSRCALPHA
|
| D3DPBLENDCAPS_BOTHSRCALPHA
|
||||||
| D3DPBLENDCAPS_BOTHINVSRCALPHA
|
| D3DPBLENDCAPS_BOTHINVSRCALPHA
|
||||||
| D3DPBLENDCAPS_BLENDFACTOR
|
| D3DPBLENDCAPS_BLENDFACTOR
|
||||||
| D3DPBLENDCAPS_INVSRCCOLOR2
|
| D3DPBLENDCAPS_SRCCOLOR2
|
||||||
| D3DPBLENDCAPS_SRCCOLOR2;
|
| D3DPBLENDCAPS_INVSRCCOLOR2;
|
||||||
// Destination Blend Caps
|
// Destination Blend Caps
|
||||||
pCaps->DestBlendCaps = pCaps->SrcBlendCaps;
|
pCaps->DestBlendCaps = pCaps->SrcBlendCaps;
|
||||||
// Alpha Comparison Caps
|
// Alpha Comparison Caps
|
||||||
|
@ -309,6 +309,14 @@ namespace dxvk {
|
|||||||
|
|
||||||
// When in SWVP mode, 256 matrices can be used for indexed vertex blending
|
// When in SWVP mode, 256 matrices can be used for indexed vertex blending
|
||||||
pCaps->MaxVertexBlendMatrixIndex = m_isSWVP ? 255 : 8;
|
pCaps->MaxVertexBlendMatrixIndex = m_isSWVP ? 255 : 8;
|
||||||
|
// Only 9Ex devices advertise D3DPBLENDCAPS_SRCCOLOR2 and D3DPBLENDCAPS_INVSRCCOLOR2
|
||||||
|
if (!IsExtended()) {
|
||||||
|
pCaps->SrcBlendCaps &= ~D3DPBLENDCAPS_SRCCOLOR2
|
||||||
|
& ~D3DPBLENDCAPS_INVSRCCOLOR2;
|
||||||
|
|
||||||
|
pCaps->DestBlendCaps &= ~D3DPBLENDCAPS_SRCCOLOR2
|
||||||
|
& ~D3DPBLENDCAPS_INVSRCCOLOR2;
|
||||||
|
}
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@ -514,7 +522,8 @@ namespace dxvk {
|
|||||||
if (unlikely(m_losableResourceCounter.load() != 0 && !IsExtended() && m_d3d9Options.countLosableResources)) {
|
if (unlikely(m_losableResourceCounter.load() != 0 && !IsExtended() && m_d3d9Options.countLosableResources)) {
|
||||||
Logger::warn(str::format("Device reset failed because device still has alive losable resources: Device not reset. Remaining resources: ", m_losableResourceCounter.load()));
|
Logger::warn(str::format("Device reset failed because device still has alive losable resources: Device not reset. Remaining resources: ", m_losableResourceCounter.load()));
|
||||||
m_deviceLostState = D3D9DeviceLostState::NotReset;
|
m_deviceLostState = D3D9DeviceLostState::NotReset;
|
||||||
return D3DERR_DEVICELOST;
|
// D3D8 expects a D3DERR_DEVICELOST error code
|
||||||
|
return m_isD3D8Compatible ? D3DERR_DEVICELOST : D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = ResetSwapChain(pPresentationParameters, nullptr);
|
hr = ResetSwapChain(pPresentationParameters, nullptr);
|
||||||
@ -2025,10 +2034,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
const uint32_t idx = GetTransformIndex(TransformState);
|
const uint32_t idx = GetTransformIndex(TransformState);
|
||||||
|
|
||||||
// D3D8 state blocks ignore capturing calls to MultiplyTransform().
|
|
||||||
if (unlikely(!m_isD3D8Compatible && ShouldRecord()))
|
|
||||||
return m_recorder->MultiplyStateTransform(idx, pMatrix);
|
|
||||||
|
|
||||||
m_state.transforms[idx] = m_state.transforms[idx] * ConvertMatrix(pMatrix);
|
m_state.transforms[idx] = m_state.transforms[idx] * ConvertMatrix(pMatrix);
|
||||||
|
|
||||||
m_flags.set(D3D9DeviceFlag::DirtyFFVertexData);
|
m_flags.set(D3D9DeviceFlag::DirtyFFVertexData);
|
||||||
@ -2191,9 +2196,13 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::SetClipPlane(DWORD Index, const float* pPlane) {
|
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::SetClipPlane(DWORD Index, const float* pPlane) {
|
||||||
D3D9DeviceLock lock = LockDevice();
|
D3D9DeviceLock lock = LockDevice();
|
||||||
|
|
||||||
if (unlikely(Index >= caps::MaxClipPlanes || !pPlane))
|
if (unlikely(!pPlane))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
// Higher indexes will be capped to the last valid index
|
||||||
|
if (unlikely(Index >= caps::MaxClipPlanes))
|
||||||
|
Index = caps::MaxClipPlanes - 1;
|
||||||
|
|
||||||
if (unlikely(ShouldRecord()))
|
if (unlikely(ShouldRecord()))
|
||||||
return m_recorder->SetClipPlane(Index, pPlane);
|
return m_recorder->SetClipPlane(Index, pPlane);
|
||||||
|
|
||||||
@ -2217,9 +2226,13 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::GetClipPlane(DWORD Index, float* pPlane) {
|
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::GetClipPlane(DWORD Index, float* pPlane) {
|
||||||
D3D9DeviceLock lock = LockDevice();
|
D3D9DeviceLock lock = LockDevice();
|
||||||
|
|
||||||
if (unlikely(Index >= caps::MaxClipPlanes || !pPlane))
|
if (unlikely(!pPlane))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
// Higher indexes will be capped to the last valid index
|
||||||
|
if (unlikely(Index >= caps::MaxClipPlanes))
|
||||||
|
Index = caps::MaxClipPlanes - 1;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 4; i++)
|
for (uint32_t i = 0; i < 4; i++)
|
||||||
pPlane[i] = m_state.clipPlanes[Index].coeff[i];
|
pPlane[i] = m_state.clipPlanes[Index].coeff[i];
|
||||||
|
|
||||||
@ -2586,6 +2599,10 @@ namespace dxvk {
|
|||||||
IDirect3DStateBlock9** ppSB) {
|
IDirect3DStateBlock9** ppSB) {
|
||||||
D3D9DeviceLock lock = LockDevice();
|
D3D9DeviceLock lock = LockDevice();
|
||||||
|
|
||||||
|
// A state block can not be created while another is being recorded
|
||||||
|
if (unlikely(ShouldRecord()))
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
InitReturnPtr(ppSB);
|
InitReturnPtr(ppSB);
|
||||||
|
|
||||||
if (unlikely(ppSB == nullptr))
|
if (unlikely(ppSB == nullptr))
|
||||||
@ -2609,7 +2626,7 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::BeginStateBlock() {
|
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::BeginStateBlock() {
|
||||||
D3D9DeviceLock lock = LockDevice();
|
D3D9DeviceLock lock = LockDevice();
|
||||||
|
|
||||||
if (unlikely(m_recorder != nullptr))
|
if (unlikely(ShouldRecord()))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
m_recorder = new D3D9StateBlock(this, D3D9StateBlockType::None);
|
m_recorder = new D3D9StateBlock(this, D3D9StateBlockType::None);
|
||||||
@ -2621,11 +2638,11 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::EndStateBlock(IDirect3DStateBlock9** ppSB) {
|
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::EndStateBlock(IDirect3DStateBlock9** ppSB) {
|
||||||
D3D9DeviceLock lock = LockDevice();
|
D3D9DeviceLock lock = LockDevice();
|
||||||
|
|
||||||
InitReturnPtr(ppSB);
|
if (unlikely(ppSB == nullptr || !ShouldRecord()))
|
||||||
|
|
||||||
if (unlikely(ppSB == nullptr || m_recorder == nullptr))
|
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
InitReturnPtr(ppSB);
|
||||||
|
|
||||||
*ppSB = m_recorder.ref();
|
*ppSB = m_recorder.ref();
|
||||||
if (!m_isD3D8Compatible)
|
if (!m_isD3D8Compatible)
|
||||||
m_losableResourceCounter++;
|
m_losableResourceCounter++;
|
||||||
@ -4626,21 +4643,18 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool D3D9DeviceEx::ShouldRecord() {
|
|
||||||
return m_recorder != nullptr && !m_recorder->IsApplying();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
D3D9_VK_FORMAT_MAPPING D3D9DeviceEx::LookupFormat(
|
D3D9_VK_FORMAT_MAPPING D3D9DeviceEx::LookupFormat(
|
||||||
D3D9Format Format) const {
|
D3D9Format Format) const {
|
||||||
return m_adapter->GetFormatMapping(Format);
|
return m_adapter->GetFormatMapping(Format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const DxvkFormatInfo* D3D9DeviceEx::UnsupportedFormatInfo(
|
const DxvkFormatInfo* D3D9DeviceEx::UnsupportedFormatInfo(
|
||||||
D3D9Format Format) const {
|
D3D9Format Format) const {
|
||||||
return m_adapter->GetUnsupportedFormatInfo(Format);
|
return m_adapter->GetUnsupportedFormatInfo(Format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool D3D9DeviceEx::WaitForResource(
|
bool D3D9DeviceEx::WaitForResource(
|
||||||
const DxvkPagedResource& Resource,
|
const DxvkPagedResource& Resource,
|
||||||
uint64_t SequenceNumber,
|
uint64_t SequenceNumber,
|
||||||
|
@ -1020,6 +1020,13 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
void RemoveMappedTexture(D3D9CommonTexture* pTexture);
|
void RemoveMappedTexture(D3D9CommonTexture* pTexture);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Returns whether the device is currently recording a StateBlock
|
||||||
|
*/
|
||||||
|
bool ShouldRecord() const {
|
||||||
|
return m_recorder != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsD3D8Compatible() const {
|
bool IsD3D8Compatible() const {
|
||||||
return m_isD3D8Compatible;
|
return m_isD3D8Compatible;
|
||||||
}
|
}
|
||||||
@ -1160,11 +1167,6 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
void WaitStagingBuffer();
|
void WaitStagingBuffer();
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Returns whether the device is currently recording a StateBlock
|
|
||||||
*/
|
|
||||||
inline bool ShouldRecord();
|
|
||||||
|
|
||||||
HRESULT CreateShaderModule(
|
HRESULT CreateShaderModule(
|
||||||
D3D9CommonShader* pShaderModule,
|
D3D9CommonShader* pShaderModule,
|
||||||
uint32_t* pLength,
|
uint32_t* pLength,
|
||||||
|
@ -25,6 +25,10 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ULONG STDMETHODCALLTYPE Release() {
|
ULONG STDMETHODCALLTYPE Release() {
|
||||||
|
// ignore Release calls on objects with 0 refCount
|
||||||
|
if(unlikely(!this->m_refCount))
|
||||||
|
return this->m_refCount;
|
||||||
|
|
||||||
uint32_t refCount = --this->m_refCount;
|
uint32_t refCount = --this->m_refCount;
|
||||||
if (unlikely(!refCount)) {
|
if (unlikely(!refCount)) {
|
||||||
auto* pDevice = GetDevice();
|
auto* pDevice = GetDevice();
|
||||||
|
@ -255,4 +255,16 @@ namespace dxvk {
|
|||||||
|| format == D3D9Format::DXT5;
|
|| format == D3D9Format::DXT5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// D3D9 documentation says: IDirect3DSurface9::GetDC is valid on the following formats only:
|
||||||
|
// D3DFMT_R5G6B5, D3DFMT_X1R5G5B5, D3DFMT_R8G8B8, and D3DFMT_X8R8G8B8. However,
|
||||||
|
// the equivalent formats of D3DFMT_A1R5G5B5 and D3DFMT_A8R8G8B8 are also supported.
|
||||||
|
inline bool IsSurfaceGetDCCompatibleFormat(D3D9Format format) {
|
||||||
|
return format == D3D9Format::R5G6B5
|
||||||
|
|| format == D3D9Format::X1R5G5B5
|
||||||
|
|| format == D3D9Format::A1R5G5B5
|
||||||
|
|| format == D3D9Format::R8G8B8
|
||||||
|
|| format == D3D9Format::X8R8G8B8
|
||||||
|
|| format == D3D9Format::A8R8G8B8;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -243,9 +243,20 @@ namespace dxvk {
|
|||||||
UINT Adapter,
|
UINT Adapter,
|
||||||
D3DDEVTYPE DeviceType,
|
D3DDEVTYPE DeviceType,
|
||||||
D3DCAPS9* pCaps) {
|
D3DCAPS9* pCaps) {
|
||||||
if (auto* adapter = GetAdapter(Adapter))
|
if (auto* adapter = GetAdapter(Adapter)) {
|
||||||
return adapter->GetDeviceCaps(
|
adapter->GetDeviceCaps(DeviceType, pCaps);
|
||||||
DeviceType, pCaps);
|
|
||||||
|
// Only 9Ex interfaces advertise D3DPBLENDCAPS_SRCCOLOR2 and D3DPBLENDCAPS_INVSRCCOLOR2
|
||||||
|
if (!IsExtended()) {
|
||||||
|
pCaps->SrcBlendCaps &= ~D3DPBLENDCAPS_SRCCOLOR2
|
||||||
|
& ~D3DPBLENDCAPS_INVSRCCOLOR2;
|
||||||
|
|
||||||
|
pCaps->DestBlendCaps &= ~D3DPBLENDCAPS_SRCCOLOR2
|
||||||
|
& ~D3DPBLENDCAPS_INVSRCCOLOR2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
@ -438,8 +449,8 @@ namespace dxvk {
|
|||||||
&& pPresentationParameters->BackBufferCount > 1))
|
&& pPresentationParameters->BackBufferCount > 1))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
// 3 is the highest supported back buffer count.
|
// 3 is the highest supported back buffer count for non-Ex devices.
|
||||||
if (unlikely(pPresentationParameters->BackBufferCount > 3))
|
if (unlikely(!m_extended && pPresentationParameters->BackBufferCount > 3))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
// Valid fullscreen presentation intervals must be known values.
|
// Valid fullscreen presentation intervals must be known values.
|
||||||
|
@ -46,6 +46,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE D3D9StateBlock::Capture() {
|
HRESULT STDMETHODCALLTYPE D3D9StateBlock::Capture() {
|
||||||
|
if (unlikely(m_parent->ShouldRecord()))
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
if (m_captures.flags.test(D3D9CapturedStateFlag::VertexDecl))
|
if (m_captures.flags.test(D3D9CapturedStateFlag::VertexDecl))
|
||||||
SetVertexDeclaration(m_deviceState->vertexDecl.ptr());
|
SetVertexDeclaration(m_deviceState->vertexDecl.ptr());
|
||||||
|
|
||||||
@ -56,13 +59,13 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE D3D9StateBlock::Apply() {
|
HRESULT STDMETHODCALLTYPE D3D9StateBlock::Apply() {
|
||||||
m_applying = true;
|
if (unlikely(m_parent->ShouldRecord()))
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
if (m_captures.flags.test(D3D9CapturedStateFlag::VertexDecl) && m_state.vertexDecl != nullptr)
|
if (m_captures.flags.test(D3D9CapturedStateFlag::VertexDecl) && m_state.vertexDecl != nullptr)
|
||||||
m_parent->SetVertexDeclaration(m_state.vertexDecl.ptr());
|
m_parent->SetVertexDeclaration(m_state.vertexDecl.ptr());
|
||||||
|
|
||||||
ApplyOrCapture<D3D9StateFunction::Apply, false>();
|
ApplyOrCapture<D3D9StateFunction::Apply, false>();
|
||||||
m_applying = false;
|
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@ -243,15 +246,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT D3D9StateBlock::MultiplyStateTransform(uint32_t idx, const D3DMATRIX* pMatrix) {
|
|
||||||
m_state.transforms[idx] = m_state.transforms[idx] * ConvertMatrix(pMatrix);
|
|
||||||
|
|
||||||
m_captures.flags.set(D3D9CapturedStateFlag::Transforms);
|
|
||||||
m_captures.transforms.set(idx, true);
|
|
||||||
return D3D_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HRESULT D3D9StateBlock::SetViewport(const D3DVIEWPORT9* pViewport) {
|
HRESULT D3D9StateBlock::SetViewport(const D3DVIEWPORT9* pViewport) {
|
||||||
m_state.viewport = *pViewport;
|
m_state.viewport = *pViewport;
|
||||||
|
|
||||||
|
@ -141,8 +141,6 @@ namespace dxvk {
|
|||||||
D3D9TextureStageStateTypes Type,
|
D3D9TextureStageStateTypes Type,
|
||||||
DWORD Value);
|
DWORD Value);
|
||||||
|
|
||||||
HRESULT MultiplyStateTransform(uint32_t idx, const D3DMATRIX* pMatrix);
|
|
||||||
|
|
||||||
HRESULT SetViewport(const D3DVIEWPORT9* pViewport);
|
HRESULT SetViewport(const D3DVIEWPORT9* pViewport);
|
||||||
|
|
||||||
HRESULT SetScissorRect(const RECT* pRect);
|
HRESULT SetScissorRect(const RECT* pRect);
|
||||||
@ -390,10 +388,6 @@ namespace dxvk {
|
|||||||
HRESULT SetVertexBoolBitfield(uint32_t idx, uint32_t mask, uint32_t bits);
|
HRESULT SetVertexBoolBitfield(uint32_t idx, uint32_t mask, uint32_t bits);
|
||||||
HRESULT SetPixelBoolBitfield (uint32_t idx, uint32_t mask, uint32_t bits);
|
HRESULT SetPixelBoolBitfield (uint32_t idx, uint32_t mask, uint32_t bits);
|
||||||
|
|
||||||
inline bool IsApplying() {
|
|
||||||
return m_applying;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void CapturePixelRenderStates();
|
void CapturePixelRenderStates();
|
||||||
@ -409,9 +403,7 @@ namespace dxvk {
|
|||||||
D3D9CapturableState m_state;
|
D3D9CapturableState m_state;
|
||||||
D3D9StateCaptures m_captures;
|
D3D9StateCaptures m_captures;
|
||||||
|
|
||||||
D3D9DeviceState* m_deviceState;
|
D3D9DeviceState* m_deviceState;
|
||||||
|
|
||||||
bool m_applying = false;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE D3D9Surface::QueryInterface(REFIID riid, void** ppvObject) {
|
HRESULT STDMETHODCALLTYPE D3D9Surface::QueryInterface(REFIID riid, void** ppvObject) {
|
||||||
if (ppvObject == nullptr)
|
if (unlikely(ppvObject == nullptr))
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
*ppvObject = nullptr;
|
*ppvObject = nullptr;
|
||||||
@ -101,7 +101,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE D3D9Surface::GetDesc(D3DSURFACE_DESC *pDesc) {
|
HRESULT STDMETHODCALLTYPE D3D9Surface::GetDesc(D3DSURFACE_DESC *pDesc) {
|
||||||
if (pDesc == nullptr)
|
if (unlikely(pDesc == nullptr))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
auto& desc = *(m_texture->Desc());
|
auto& desc = *(m_texture->Desc());
|
||||||
@ -190,11 +190,14 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE D3D9Surface::GetDC(HDC *phDC) {
|
HRESULT STDMETHODCALLTYPE D3D9Surface::GetDC(HDC *phDC) {
|
||||||
if (phDC == nullptr)
|
if (unlikely(phDC == nullptr))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
const D3D9_COMMON_TEXTURE_DESC& desc = *m_texture->Desc();
|
const D3D9_COMMON_TEXTURE_DESC& desc = *m_texture->Desc();
|
||||||
|
|
||||||
|
if (unlikely(!IsSurfaceGetDCCompatibleFormat(desc.Format)))
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
D3DLOCKED_RECT lockedRect;
|
D3DLOCKED_RECT lockedRect;
|
||||||
HRESULT hr = LockRect(&lockedRect, nullptr, 0);
|
HRESULT hr = LockRect(&lockedRect, nullptr, 0);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
@ -228,7 +231,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE D3D9Surface::ReleaseDC(HDC hDC) {
|
HRESULT STDMETHODCALLTYPE D3D9Surface::ReleaseDC(HDC hDC) {
|
||||||
if (m_dcDesc.hDC == nullptr || m_dcDesc.hDC != hDC)
|
if (unlikely(m_dcDesc.hDC == nullptr || m_dcDesc.hDC != hDC))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
D3DKMTDestroyDCFromMemory(&m_dcDesc);
|
D3DKMTDestroyDCFromMemory(&m_dcDesc);
|
||||||
|
Loading…
Reference in New Issue
Block a user