-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: D3D11 XXSet*
functions incorrectly project optional array of optional objects as optional array of required objects
#2286
Comments
I think this bug was introduced in #2233 |
Also related: #2105 While it may seem to make sense passing nulls in if you know your inputs are non-null beforehand, it's certainly possible in a shader (and not UB) to have some values bound and some values unbound accidentally if you don't. My use care requires that I don't know what resources can be bound beforehand, so some of them can be null. The new projection makes it impossible to unset certain resources. While As a side note, it is UB to transmute |
Without null entries it's impossible to unbind shader resources without invoking UB via violating the |
Fair enough - I can revert this behavior. Is there a minimal standalone repro I can use to add a permanent test to ensure this behavior is preserved? |
I have a DX11 hello triangle based off the DX12 example in this repo here (for windows 0.43.0 currently, I've ported it to windows 0.44 but that version includes some extraneous things for my own use) It probably needs some cleaning up for which I don't immediately have time to attend to right now but as a base it should be OK to work with. The repository is MPL2/GPL3, but I hereby release the contents of |
Thanks, I'm really just looking for a single API call to use as part of automated testing. Not a complete sample. Not to worry, I'll dig around for one. 😊 |
fyi @Muon |
I'll use
PSSetShaderResources
as an example but this applies to mostXXSet*
functions.PSSetShaderResources
has the following signatureIn 0.43 this was projected as
This signatured allowed Rust to express the following C++ pattern
This pattern is inexpressible in 0.44 without transmute because
PSSetShaderResources
is projected asi.e. every
ID3D11ShaderResourceView
must be valid.The workaround is to use the following transmute
Which, given that
IUnknown
isNonNull<c_void>
, smells like UB to me, even if it "works".The text was updated successfully, but these errors were encountered: