Skip to content
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

Backport Do not feed &"" to D3DCompile (#5812) to 0.19 #5833

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

Elabajaba
Copy link
Contributor

@Elabajaba Elabajaba commented Jun 17, 2024

Backport Do not feed &"" to D3DCompile (#5812) to 0.19.

Testing was just running the water example with dx12+fxc, and it worked.

Bevy uses this version of wgpu for its current stable version.

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

A recent change by rustc, now in 1.79-stable, makes empty str constants
point to the same location: 0x01. This is an optimization of sorts, not
stable behavior. Code must not rely on constants having stable addresses
nor should it pass &"" to APIs expecting CStrs or NULL addresses.
D3DCompile will segfault if you give it such a pointer, or worse:
read random garbage addresses!

Pass the NULL pointer to D3DCompile if wgpu lacks a decent CString.

refs:
- https://learn.microsoft.com/en-us/windows/win32/api/d3dcompiler/nf-d3dcompiler-d3dcompile

Co-authored-by: Jan Hohenheim <[email protected]>
Co-authored-by: Brezak <[email protected]>
@ErichDonGubler
Copy link
Member

LGTM!

Current failures in CI were already accepted previously, so I don't see a reason they should hold back merging.

@ErichDonGubler ErichDonGubler merged commit 410d87e into gfx-rs:v0.19 Jul 16, 2024
23 of 25 checks passed
ErichDonGubler added a commit to erichdongubler-mozilla/wgpu that referenced this pull request Jul 16, 2024
cwfitzgerald pushed a commit that referenced this pull request Jul 16, 2024
* docs(CHANGELOG): add entry for #5812/#5833

Permalinks:
* <#5812>
* <#5833>

* chore: `wgpu-hal` 0.19.5 release

* docs(CHANGELOG): add `Unreleased` again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants