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

Make compile_fxc accept full_stage: &CStr #5836

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

workingjubilee
Copy link
Contributor

As discussed in #5812 (comment) the reason that it's acceptable to pass this String to an LPCSTR argument is because it's secretly a CStr. Make it be what it thinks it is, as otherwise, despite this having only one caller, it's not typesafe.

@workingjubilee
Copy link
Contributor Author

  • ability to write type-safe code
  • ability to remember import paths

@Elabajaba
Copy link
Contributor

Should I cherrypick this one for backporting as well?

@workingjubilee
Copy link
Contributor Author

workingjubilee commented Jun 18, 2024

No idea how a patch for DX12 on Windows is affecting Vulkan on Linux...?

@Elabajaba Unlike the other patch, where any version of wgpu with compile_fxc and without that patch is actively inducing reads of garbage data on Windows (or segfaults, which are much less worse), this one shouldn't affect the actually-compiled programs. Rather, it affects whether compile_fxc is an unsafe fn and whether its callers must have secret magic knowledge. As this function is not public outside this codebase, the change here will have no effect on resulting programs, but will make it less likely a future change incorrectly violates invariants.

Rather, it affects whether compile_fxc is an unsafe fn and whether its callers must have secret magic knowledge.

Currently: compile_fxc is not an unsafe fn, but its callers require secret knowledge of what happens to their strings, so it should be.

With this patch: compile_fxc does not need to be an unsafe fn as its callers no longer require secret knowledge of what happens to their strings.

@workingjubilee
Copy link
Contributor Author

"so is that a yes or no"
"idk lol I don't know what your policy is for backporting type-safety fixes?"

@teoxoy
Copy link
Member

teoxoy commented Jun 18, 2024

No idea how a patch for DX12 on Windows is affecting Vulkan on Linux...?

One of the tests is intermittently failing.

@teoxoy teoxoy merged commit 1ced6c6 into gfx-rs:trunk Jun 18, 2024
25 checks passed
@workingjubilee workingjubilee deleted the full-stage-is-cstr branch June 18, 2024 08:53
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