Skip to content

Commit

Permalink
[d3d9] Only advertise SRCCOLOR2 & INVSRCCOLOR2 with 9Ex
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSnowfall committed Nov 25, 2024
1 parent d7bd3cd commit 0c45ccf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
8 changes: 2 additions & 6 deletions src/d3d8/d3d8_d3d9_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ namespace dxvk {
& ~D3DPRASTERCAPS_DEPTHBIAS
& ~D3DPRASTERCAPS_MULTISAMPLE_TOGGLE;

pCaps8->SrcBlendCaps &= ~D3DPBLENDCAPS_BLENDFACTOR
& ~D3DPBLENDCAPS_INVSRCCOLOR2
& ~D3DPBLENDCAPS_SRCCOLOR2;
pCaps8->SrcBlendCaps &= ~D3DPBLENDCAPS_BLENDFACTOR;

pCaps8->DestBlendCaps &= ~D3DPBLENDCAPS_BLENDFACTOR
& ~D3DPBLENDCAPS_INVSRCCOLOR2
& ~D3DPBLENDCAPS_SRCCOLOR2;
pCaps8->DestBlendCaps &= ~D3DPBLENDCAPS_BLENDFACTOR;

pCaps8->LineCaps &= ~D3DLINECAPS_ANTIALIAS;

Expand Down
4 changes: 2 additions & 2 deletions src/d3d9/d3d9_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ namespace dxvk {
| D3DPBLENDCAPS_BOTHSRCALPHA
| D3DPBLENDCAPS_BOTHINVSRCALPHA
| D3DPBLENDCAPS_BLENDFACTOR
| D3DPBLENDCAPS_INVSRCCOLOR2
| D3DPBLENDCAPS_SRCCOLOR2;
| D3DPBLENDCAPS_SRCCOLOR2
| D3DPBLENDCAPS_INVSRCCOLOR2;
// Destination Blend Caps
pCaps->DestBlendCaps = pCaps->SrcBlendCaps;
// Alpha Comparison Caps
Expand Down
8 changes: 8 additions & 0 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ namespace dxvk {

// When in SWVP mode, 256 matrices can be used for indexed vertex blending
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;
}
Expand Down
17 changes: 14 additions & 3 deletions src/d3d9/d3d9_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,20 @@ namespace dxvk {
UINT Adapter,
D3DDEVTYPE DeviceType,
D3DCAPS9* pCaps) {
if (auto* adapter = GetAdapter(Adapter))
return adapter->GetDeviceCaps(
DeviceType, pCaps);
if (auto* adapter = GetAdapter(Adapter)) {
adapter->GetDeviceCaps(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;
}
Expand Down

0 comments on commit 0c45ccf

Please sign in to comment.