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.18 #5834

Closed
wants to merge 2 commits into from

Conversation

Elabajaba
Copy link
Contributor

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

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

Veloren seems to be on 0.18 (specifically a custom branch that includes some fixes from newer wgpu versions).

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 <jan@hohenheim.ch>
Co-authored-by: Brezak <bezak.adam@proton.me>
@Elabajaba
Copy link
Contributor Author

I'm not 100% sure about the wasm-bindgen bump here, as iirc there's issues around having mismatched versions of it (though the 2.88 version wgpu 0.18 uses was yanked).

@cwfitzgerald
Copy link
Member

I'm going ot close this for now as there's not significant interest in getting this in. If it comes back, we can push it forward.

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