Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Some methods on ID3D11DeviceContext seem to be returning inappropriate Results #3322

Closed
sagacity opened this issue Oct 12, 2024 · 4 comments
Closed
Labels
question Further information is requested

Comments

@sagacity
Copy link

Summary

ID3D11DeviceContext has the RSGetState and IAGetInputLayout methods (and perhaps others) that return their results wrapped in a windows_core::Result. However, unwrapping this result panics like so:

called `Result::unwrap()` on an `Err` value: Error { code: HRESULT(0x00000000), message: "The operation completed successfully." }

It seems like there should not be an Err here, since the HRESULT indicates everything is fine. Additionally, I'm not sure why there is a Result involved here in the first place, since RSGetState and IAGetInputLayout return void.

Creating a reproduction scenario is quite involved, since it requires a window, a swapchain, a Direct3D device and so on. If it's necessary I can whip up a repro scenario, of course! But maybe you can already spot the issue. Let me know if you'd like more details.

Crate manifest

windows = { /* path to master repo */, default-features = false, features = [
"Win32_Graphics_Direct3D",
"Win32_Graphics_Direct3D11",
"Win32_Graphics_Dxgi_Common",
"Win32_Graphics_Gdi",
"Win32_System_LibraryLoader",
"Win32_System_Memory",
"Win32_System_Threading",
"Win32_UI_HiDpi",
"Win32_UI_WindowsAndMessaging",
]}

Crate code

No response

@sagacity sagacity added the bug Something isn't working label Oct 12, 2024
@kennykerr
Copy link
Collaborator

An error code of zero - S_OK - just means that the API returned a null pointer value on the ABI so there was no interface to populate the Ok variant of Result.

@kennykerr kennykerr added question Further information is requested and removed bug Something isn't working labels Oct 12, 2024
@sagacity
Copy link
Author

Ah, fair enough. So I should probably interpret it as an empty Option, in that case. Thanks for the info!

@kennykerr
Copy link
Collaborator

Yes there's #2856 tracking that although it doesn't apply to most APIs which is why its hard to implement in practice.

@sagacity
Copy link
Author

Argh, sorry. I did a search but I apparently messed that up. Thanks for the great support, btw.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants