Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 5e27290

Browse files
committed
Merge branch 'dev/lvengesanam/cleanup_fix_minor_inconsistencies' into 'main'
Cleanup and Minor corrections See merge request lightspeedrtx/bridge-remix-nv!139
2 parents 7c58986 + 27e2cca commit 5e27290

File tree

3 files changed

+103
-108
lines changed

3 files changed

+103
-108
lines changed

src/client/d3d9_device.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2300,7 +2300,16 @@ HRESULT Direct3DDevice9Ex_LSS<EnableSync>::SetSoftwareVertexProcessing(BOOL bSof
23002300
BRIDGE_DEVICE_LOCKGUARD();
23012301
m_bSoftwareVtxProcessing = bSoftware;
23022302
}
2303-
return S_OK;
2303+
UID currentUID = 0;
2304+
{
2305+
ClientMessage c(Commands::IDirect3DDevice9Ex_SetSoftwareVertexProcessing, getId());
2306+
currentUID = c.get_uid();
2307+
c.send_data(bSoftware);
2308+
}
2309+
WAIT_FOR_SERVER_RESPONSE("SetSoftwareVertexProcessing()", D3DERR_INVALIDCALL, currentUID);
2310+
2311+
HRESULT hresult = DeviceBridge::get_data();
2312+
return hresult;
23042313
}
23052314

23062315
template<bool EnableSync>

src/client/d3d9_device_base.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ BaseDirect3DDevice9Ex_LSS::BaseDirect3DDevice9Ex_LSS(const bool bExtended,
4444
// Initialize WndProc logic
4545
WndProc::set(getWinProcHwnd());
4646

47+
//Setting default value
48+
m_maxFrameLatency = 3;
49+
4750
// D3D9 seems to inialize its state to this
4851
memset(&m_state.renderStates[0], 0xBAADCAFE, sizeof(m_state.renderStates));
4952

@@ -72,6 +75,7 @@ BaseDirect3DDevice9Ex_LSS::BaseDirect3DDevice9Ex_LSS(const bool bExtended,
7275
assert(m_createParams.hFocusWindow || m_presParams.hDeviceWindow);
7376

7477
m_previousPresentParams = presParams;
78+
m_bSoftwareVtxProcessing = (createParams.BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING) ? true : false;
7579
DWORD customBehaviorFlags = createParams.BehaviorFlags | D3DCREATE_NOWINDOWCHANGES;
7680
InitRamp();
7781

src/server/main.cpp

Lines changed: 89 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,11 @@ void ProcessDeviceCommandQueue() {
532532
}
533533
case IDirect3DDevice9Ex_GetDirect3D:
534534
{
535-
if (GlobalOptions::getSendReadOnlyCalls()) {
536-
GET_RES(pD3DDevice, gpD3DDevices);
537-
IDirect3D9* pD3D = nullptr;
538-
const auto hresult = pD3DDevice->GetDirect3D(OUT & pD3D);
539-
assert(SUCCEEDED(hresult));
540-
assert(gpD3D == pD3D); // The two pointers should be identical
541-
}
535+
GET_RES(pD3DDevice, gpD3DDevices);
536+
IDirect3D9* pD3D = nullptr;
537+
const auto hresult = pD3DDevice->GetDirect3D(OUT & pD3D);
538+
assert(SUCCEEDED(hresult));
539+
assert(gpD3D == pD3D); // The two pointers should be identical
542540
break;
543541
}
544542
case IDirect3DDevice9Ex_GetDeviceCaps:
@@ -626,24 +624,20 @@ void ProcessDeviceCommandQueue() {
626624
}
627625
case IDirect3DDevice9Ex_GetSwapChain:
628626
{
629-
if (GlobalOptions::getSendReadOnlyCalls()) {
630-
GET_RES(pD3DDevice, gpD3DDevices);
631-
PULL_U(iSwapChain);
632-
IDirect3DSwapChain9* pSwapChain = nullptr;
633-
const auto hresult = pD3DDevice->GetSwapChain(iSwapChain, &pSwapChain);
634-
assert(SUCCEEDED(hresult));
635-
assert(pSwapChain != nullptr);
636-
}
627+
GET_RES(pD3DDevice, gpD3DDevices);
628+
PULL_U(iSwapChain);
629+
IDirect3DSwapChain9* pSwapChain = nullptr;
630+
const auto hresult = pD3DDevice->GetSwapChain(iSwapChain, &pSwapChain);
631+
assert(SUCCEEDED(hresult));
632+
assert(pSwapChain != nullptr);
637633
break;
638634
}
639635
case IDirect3DDevice9Ex_GetNumberOfSwapChains:
640636
{
641-
if (GlobalOptions::getSendReadOnlyCalls()) {
642-
GET_RES(pD3DDevice, gpD3DDevices);
643-
PULL_U(orig_cnt);
644-
const auto cnt = pD3DDevice->GetNumberOfSwapChains();
645-
assert(orig_cnt == cnt);
646-
}
637+
GET_RES(pD3DDevice, gpD3DDevices);
638+
PULL_U(orig_cnt);
639+
const auto cnt = pD3DDevice->GetNumberOfSwapChains();
640+
assert(orig_cnt == cnt);
647641
break;
648642
}
649643
case IDirect3DDevice9Ex_Reset:
@@ -736,12 +730,10 @@ void ProcessDeviceCommandQueue() {
736730
}
737731
case IDirect3DDevice9Ex_GetGammaRamp:
738732
{
739-
if (GlobalOptions::getSendReadOnlyCalls()) {
740-
GET_RES(pD3DDevice, gpD3DDevices);
741-
PULL_U(iSwapChain);
742-
D3DGAMMARAMP pRamp;
743-
pD3DDevice->GetGammaRamp(iSwapChain, &pRamp);
744-
}
733+
GET_RES(pD3DDevice, gpD3DDevices);
734+
PULL_U(iSwapChain);
735+
D3DGAMMARAMP pRamp;
736+
pD3DDevice->GetGammaRamp(iSwapChain, &pRamp);
745737
break;
746738
}
747739
case IDirect3DDevice9Ex_CreateTexture:
@@ -1263,7 +1255,17 @@ void ProcessDeviceCommandQueue() {
12631255
case IDirect3DDevice9Ex_GetScissorRect:
12641256
break;
12651257
case IDirect3DDevice9Ex_SetSoftwareVertexProcessing:
1258+
{
1259+
GET_RES(pD3DDevice, gpD3DDevices);
1260+
PULL(BOOL, bSoftware);
1261+
const auto hresult = pD3DDevice->SetSoftwareVertexProcessing(bSoftware);
1262+
assert(SUCCEEDED(hresult));
1263+
{
1264+
ServerMessage c(Commands::Bridge_Response, currentUID);
1265+
c.send_data(hresult);
1266+
}
12661267
break;
1268+
}
12671269
case IDirect3DDevice9Ex_GetSoftwareVertexProcessing:
12681270
break;
12691271
case IDirect3DDevice9Ex_SetNPatchMode:
@@ -2000,13 +2002,11 @@ void ProcessDeviceCommandQueue() {
20002002
break;
20012003
case IDirect3DTexture9_GetLevelCount:
20022004
{
2003-
if (GlobalOptions::getSendReadOnlyCalls()) {
2004-
GET_HND(pHandle);
2005-
PULL_D(orig_cnt);
2006-
const auto& pTexture = (IDirect3DTexture9*) gpD3DResources[pHandle];
2007-
const auto cnt = pTexture->GetLevelCount();
2008-
assert(orig_cnt == cnt);
2009-
}
2005+
GET_HND(pHandle);
2006+
PULL_D(orig_cnt);
2007+
const auto& pTexture = (IDirect3DTexture9*) gpD3DResources[pHandle];
2008+
const auto cnt = pTexture->GetLevelCount();
2009+
assert(orig_cnt == cnt);
20102010
break;
20112011
}
20122012
case IDirect3DTexture9_SetAutoGenFilterType:
@@ -2017,15 +2017,13 @@ void ProcessDeviceCommandQueue() {
20172017
break;
20182018
case IDirect3DTexture9_GetLevelDesc:
20192019
{
2020-
if (GlobalOptions::getSendReadOnlyCalls()) {
2021-
GET_HND(pHandle);
2022-
PULL_OBJ(D3DSURFACE_DESC, orig_desc);
2023-
PULL_U(Level);
2024-
const auto& pTexture = (IDirect3DTexture9*) gpD3DResources[pHandle];
2025-
D3DSURFACE_DESC pDesc;
2026-
const auto hresult = pTexture->GetLevelDesc(Level, &pDesc);
2027-
assert(SUCCEEDED(hresult));
2028-
}
2020+
GET_HND(pHandle);
2021+
PULL_OBJ(D3DSURFACE_DESC, orig_desc);
2022+
PULL_U(Level);
2023+
const auto& pTexture = (IDirect3DTexture9*) gpD3DResources[pHandle];
2024+
D3DSURFACE_DESC pDesc;
2025+
const auto hresult = pTexture->GetLevelDesc(Level, &pDesc);
2026+
assert(SUCCEEDED(hresult));
20292027
break;
20302028
}
20312029
case IDirect3DTexture9_GetSurfaceLevel:
@@ -2105,13 +2103,11 @@ void ProcessDeviceCommandQueue() {
21052103
break;
21062104
case IDirect3DVolumeTexture9_GetLevelCount:
21072105
{
2108-
if (GlobalOptions::getSendReadOnlyCalls()) {
2109-
GET_HND(pHandle);
2110-
PULL_D(orig_cnt);
2111-
const auto& pVolumeTexture = (IDirect3DVolumeTexture9*) gpD3DResources[pHandle];
2112-
const auto cnt = pVolumeTexture->GetLevelCount();
2113-
assert(orig_cnt == cnt);
2114-
}
2106+
GET_HND(pHandle);
2107+
PULL_D(orig_cnt);
2108+
const auto& pVolumeTexture = (IDirect3DVolumeTexture9*) gpD3DResources[pHandle];
2109+
const auto cnt = pVolumeTexture->GetLevelCount();
2110+
assert(orig_cnt == cnt);
21152111
break;
21162112
}
21172113
case IDirect3DVolumeTexture9_SetAutoGenFilterType:
@@ -2122,15 +2118,13 @@ void ProcessDeviceCommandQueue() {
21222118
break;
21232119
case IDirect3DVolumeTexture9_GetLevelDesc:
21242120
{
2125-
if (GlobalOptions::getSendReadOnlyCalls()) {
2126-
GET_HND(pHandle);
2127-
PULL_OBJ(D3DVOLUME_DESC, orig_desc);
2128-
PULL_U(Level);
2129-
const auto& pVolumeTexture = (IDirect3DVolumeTexture9*) gpD3DResources[pHandle];
2130-
D3DVOLUME_DESC pDesc;
2131-
const auto hresult = pVolumeTexture->GetLevelDesc(Level, &pDesc);
2132-
assert(SUCCEEDED(hresult));
2133-
}
2121+
GET_HND(pHandle);
2122+
PULL_OBJ(D3DVOLUME_DESC, orig_desc);
2123+
PULL_U(Level);
2124+
const auto& pVolumeTexture = (IDirect3DVolumeTexture9*) gpD3DResources[pHandle];
2125+
D3DVOLUME_DESC pDesc;
2126+
const auto hresult = pVolumeTexture->GetLevelDesc(Level, &pDesc);
2127+
assert(SUCCEEDED(hresult));
21342128
break;
21352129
}
21362130
case IDirect3DVolumeTexture9_GetVolumeLevel:
@@ -2248,13 +2242,11 @@ void ProcessDeviceCommandQueue() {
22482242
break;
22492243
case IDirect3DCubeTexture9_GetLevelCount:
22502244
{
2251-
if (GlobalOptions::getSendReadOnlyCalls()) {
2252-
GET_HND(pHandle);
2253-
PULL_D(orig_cnt);
2254-
const auto& pCubeTexture = (IDirect3DCubeTexture9*) gpD3DResources[pHandle];
2255-
const auto cnt = pCubeTexture->GetLevelCount();
2256-
assert(orig_cnt == cnt);
2257-
}
2245+
GET_HND(pHandle);
2246+
PULL_D(orig_cnt);
2247+
const auto& pCubeTexture = (IDirect3DCubeTexture9*) gpD3DResources[pHandle];
2248+
const auto cnt = pCubeTexture->GetLevelCount();
2249+
assert(orig_cnt == cnt);
22582250
break;
22592251
}
22602252
case IDirect3DCubeTexture9_SetAutoGenFilterType:
@@ -2265,15 +2257,13 @@ void ProcessDeviceCommandQueue() {
22652257
break;
22662258
case IDirect3DCubeTexture9_GetLevelDesc:
22672259
{
2268-
if (GlobalOptions::getSendReadOnlyCalls()) {
2269-
PULL_OBJ(D3DSURFACE_DESC, orig_desc);
2270-
PULL_U(Level);
2271-
GET_HND(pHandle);
2272-
const auto& pCubeTexture = (IDirect3DCubeTexture9*) gpD3DResources[pHandle];
2273-
D3DSURFACE_DESC pDesc;
2274-
const auto hresult = pCubeTexture->GetLevelDesc(Level, &pDesc);
2275-
assert(SUCCEEDED(hresult));
2276-
}
2260+
PULL_OBJ(D3DSURFACE_DESC, orig_desc);
2261+
PULL_U(Level);
2262+
GET_HND(pHandle);
2263+
const auto& pCubeTexture = (IDirect3DCubeTexture9*) gpD3DResources[pHandle];
2264+
D3DSURFACE_DESC pDesc;
2265+
const auto hresult = pCubeTexture->GetLevelDesc(Level, &pDesc);
2266+
assert(SUCCEEDED(hresult));
22772267
break;
22782268
}
22792269
case IDirect3DCubeTexture9_GetCubeMapSurface:
@@ -2390,14 +2380,12 @@ void ProcessDeviceCommandQueue() {
23902380
}
23912381
case IDirect3DVertexBuffer9_GetDesc:
23922382
{
2393-
if (GlobalOptions::getSendReadOnlyCalls()) {
2394-
GET_HND(pHandle);
2395-
PULL_OBJ(D3DVERTEXBUFFER_DESC, orig_desc);
2396-
const auto& pVertexBuffer = (IDirect3DVertexBuffer9*) gpD3DResources[pHandle];
2397-
D3DVERTEXBUFFER_DESC pDesc;
2398-
const auto hresult = pVertexBuffer->GetDesc(OUT & pDesc);
2399-
assert(SUCCEEDED(hresult));
2400-
}
2383+
GET_HND(pHandle);
2384+
PULL_OBJ(D3DVERTEXBUFFER_DESC, orig_desc);
2385+
const auto& pVertexBuffer = (IDirect3DVertexBuffer9*) gpD3DResources[pHandle];
2386+
D3DVERTEXBUFFER_DESC pDesc;
2387+
const auto hresult = pVertexBuffer->GetDesc(OUT & pDesc);
2388+
assert(SUCCEEDED(hresult));
24012389
break;
24022390
}
24032391

@@ -2477,14 +2465,12 @@ void ProcessDeviceCommandQueue() {
24772465
}
24782466
case IDirect3DIndexBuffer9_GetDesc:
24792467
{
2480-
if (GlobalOptions::getSendReadOnlyCalls()) {
2481-
GET_HND(pHandle);
2482-
PULL_OBJ(D3DINDEXBUFFER_DESC, orig_desc);
2483-
const auto& pIndexBuffer = (IDirect3DIndexBuffer9*) gpD3DResources[pHandle];
2484-
D3DINDEXBUFFER_DESC pDesc;
2485-
const auto hresult = pIndexBuffer->GetDesc(OUT & pDesc);
2486-
assert(SUCCEEDED(hresult));
2487-
}
2468+
GET_HND(pHandle);
2469+
PULL_OBJ(D3DINDEXBUFFER_DESC, orig_desc);
2470+
const auto& pIndexBuffer = (IDirect3DIndexBuffer9*) gpD3DResources[pHandle];
2471+
D3DINDEXBUFFER_DESC pDesc;
2472+
const auto hresult = pIndexBuffer->GetDesc(OUT & pDesc);
2473+
assert(SUCCEEDED(hresult));
24882474
break;
24892475
}
24902476

@@ -2528,14 +2514,12 @@ void ProcessDeviceCommandQueue() {
25282514
break;
25292515
case IDirect3DSurface9_GetDesc:
25302516
{
2531-
if (GlobalOptions::getSendReadOnlyCalls()) {
2532-
GET_HND(pHandle);
2533-
PULL_OBJ(D3DSURFACE_DESC, orig_desc);
2534-
const auto& pSurface = (IDirect3DSurface9*) gpD3DResources[pHandle];
2535-
D3DSURFACE_DESC pDesc;
2536-
const auto hresult = pSurface->GetDesc(OUT & pDesc);
2537-
assert(SUCCEEDED(hresult));
2538-
}
2517+
GET_HND(pHandle);
2518+
PULL_OBJ(D3DSURFACE_DESC, orig_desc);
2519+
const auto& pSurface = (IDirect3DSurface9*) gpD3DResources[pHandle];
2520+
D3DSURFACE_DESC pDesc;
2521+
const auto hresult = pSurface->GetDesc(OUT & pDesc);
2522+
assert(SUCCEEDED(hresult));
25392523
break;
25402524
}
25412525
case IDirect3DSurface9_LockRect:
@@ -2624,14 +2608,12 @@ void ProcessDeviceCommandQueue() {
26242608
break;
26252609
case IDirect3DVolume9_GetDesc:
26262610
{
2627-
if (GlobalOptions::getSendReadOnlyCalls()) {
2628-
GET_HND(pHandle);
2629-
PULL_OBJ(D3DVOLUME_DESC, orig_desc);
2630-
const auto& pVolume = gpD3DVolumes[pHandle];
2631-
D3DVOLUME_DESC pDesc;
2632-
const auto hresult = pVolume->GetDesc(OUT & pDesc);
2633-
assert(SUCCEEDED(hresult));
2634-
}
2611+
GET_HND(pHandle);
2612+
PULL_OBJ(D3DVOLUME_DESC, orig_desc);
2613+
const auto& pVolume = gpD3DVolumes[pHandle];
2614+
D3DVOLUME_DESC pDesc;
2615+
const auto hresult = pVolume->GetDesc(OUT & pDesc);
2616+
assert(SUCCEEDED(hresult));
26352617
break;
26362618
}
26372619
case IDirect3DVolume9_LockBox:

0 commit comments

Comments
 (0)