upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorkapitche <kapitche@users.noreply.github.com>2026-11-22 14:58:17 -0500
committerkapitche <kapitche@users.noreply.github.com>2026-11-22 19:42:00 -0500
commit5b3eb785cbfaffab362dc7fdd06091a34b4cbddf (patch)
treeecd4836bfd7db2d08dce8162f8db0de70b936683 /runtime
parent03b09a086592a197db64d91655c6e65c30764d96 (diff)
DXGI: RegisterStereoStatusWindow/Event return S_OK with a cookie
Both returned E_NOTIMPL, which Microsoft documents only for the Windows 7 Platform Update. They now return S_OK with a unique cookie for UnregisterStereoStatus; stereo is never enabled so nothing is notified. Test: dxgi_swapchain.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/shims/dxgi_com.cpp16
-rw-r--r--runtime/test/dxgi_swapchain_test.cpp13
2 files changed, 27 insertions, 2 deletions
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp
index 734824e07..07abe5f76 100644
--- a/runtime/shims/dxgi_com.cpp
+++ b/runtime/shims/dxgi_com.cpp
@@ -925,8 +925,19 @@ public:
925 return CreateSwapChainForHwnd(device, hwnd, desc, nullptr, restrict_to_output, out); 925 return CreateSwapChainForHwnd(device, hwnd, desc, nullptr, restrict_to_output, out);
926 } 926 }
927 HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(HANDLE, LUID*) override { return E_NOTIMPL; } 927 HRESULT STDMETHODCALLTYPE GetSharedResourceAdapterLuid(HANDLE, LUID*) override { return E_NOTIMPL; }
928 HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(HWND, UINT, DWORD*) override { return E_NOTIMPL; } 928 // Microsoft documents S_OK with a cookie for UnregisterStereoStatus (E_NOTIMPL is only the answer of the
929 HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(HANDLE, DWORD*) override { return E_NOTIMPL; } 929 // Windows 7 Platform Update). Stereo is never enabled here, so the window or event is never notified.
930 HRESULT STDMETHODCALLTYPE RegisterStereoStatusWindow(HWND hwnd, UINT msg, DWORD* cookie) override {
931 (void)msg;
932 if (!hwnd || !cookie) return DXGI_ERROR_INVALID_CALL;
933 *cookie = next_stereo_cookie_.fetch_add(1, std::memory_order_relaxed);
934 return S_OK;
935 }
936 HRESULT STDMETHODCALLTYPE RegisterStereoStatusEvent(HANDLE event, DWORD* cookie) override {
937 if (!event || !cookie) return DXGI_ERROR_INVALID_CALL;
938 *cookie = next_stereo_cookie_.fetch_add(1, std::memory_order_relaxed);
939 return S_OK;
940 }
930 void STDMETHODCALLTYPE UnregisterStereoStatus(DWORD) override {} 941 void STDMETHODCALLTYPE UnregisterStereoStatus(DWORD) override {}
931 HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(HWND hwnd, UINT msg, DWORD* cookie) override { 942 HRESULT STDMETHODCALLTYPE RegisterOcclusionStatusWindow(HWND hwnd, UINT msg, DWORD* cookie) override {
932 (void)msg; 943 (void)msg;
@@ -1061,6 +1072,7 @@ private:
1061 std::mutex adapters_changed_mutex_; 1072 std::mutex adapters_changed_mutex_;
1062 std::map<DWORD, HANDLE> adapters_changed_events_; 1073 std::map<DWORD, HANDLE> adapters_changed_events_;
1063 DWORD next_adapters_changed_cookie_ = 1; 1074 DWORD next_adapters_changed_cookie_ = 1;
1075 std::atomic<DWORD> next_stereo_cookie_{1};
1064}; 1076};
1065 1077
1066} // namespace 1078} // namespace
diff --git a/runtime/test/dxgi_swapchain_test.cpp b/runtime/test/dxgi_swapchain_test.cpp
index ca1491153..283a2ae1a 100644
--- a/runtime/test/dxgi_swapchain_test.cpp
+++ b/runtime/test/dxgi_swapchain_test.cpp
@@ -1337,6 +1337,19 @@ int main() {
1337 factory->UnregisterOcclusionStatus(cookie1); 1337 factory->UnregisterOcclusionStatus(cookie1);
1338 factory->UnregisterOcclusionStatus(cookie2); 1338 factory->UnregisterOcclusionStatus(cookie2);
1339 CloseHandle(ev); 1339 CloseHandle(ev);
1340
1341 // 4. Stereo status registration (Microsoft: IDXGIFactory2::RegisterStereoStatusWindow / RegisterStereoStatusEvent
1342 // return S_OK with a cookie for UnregisterStereoStatus; stereo is never enabled, so nothing is notified).
1343 DWORD stereo_window = 0, stereo_event = 0;
1344 HANDLE stereo_ev = CreateEventW(nullptr, FALSE, FALSE, nullptr);
1345 if (factory->RegisterStereoStatusWindow(hwnd, WM_USER, &stereo_window) != S_OK || stereo_window == 0)
1346 return fail("RegisterStereoStatusWindow should return S_OK with a cookie");
1347 if (factory->RegisterStereoStatusEvent(stereo_ev, &stereo_event) != S_OK || stereo_event == 0 ||
1348 stereo_event == stereo_window)
1349 return fail("RegisterStereoStatusEvent should return S_OK with a cookie of its own");
1350 factory->UnregisterStereoStatus(stereo_window);
1351 factory->UnregisterStereoStatus(stereo_event);
1352 CloseHandle(stereo_ev);
1340 } 1353 }
1341 1354
1342 // Classic IDXGIFactory::CreateSwapChain delegation 1355 // Classic IDXGIFactory::CreateSwapChain delegation