Skip to content

[Migrated] Tracking: Collection of issues found when porting HLSL to rust-gpu #122

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

Open
5 of 10 tasks
rust-gpu-bot opened this issue Nov 13, 2024 · 0 comments
Open
5 of 10 tasks

Comments

@rust-gpu-bot
Copy link

Issue automatically imported from old repo: EmbarkStudios/rust-gpu#744
Old labels: a: documentation,t: tracking issue
Originally creatd by hrydgard on 2021-09-02T11:14:16Z


I and some others have been porting a body of HLSL code to rust-gpu. Here's some notes about unexpected differences, pitfalls, and hard-to-port things.

Fixable issues (doesn't mean they're easy!)

    #[spirv(storage_buffer, descriptor_set = 0, binding = 1)] instance_constants_dyn: &[InstanceDynamicParameters],

into:

    instance_constants_dyn: &[InstanceDynamicParameters],

Unintuitive behavior mismatches

  • #895
  • const_mat3! is equivalent to the transpose of HLSL's float3x3. Same goes for the other matrix constructors, of course. Dangerous trap! But probably the right way around, really. const_mat3! is no longer supported in latest glam.
  • (macaw problem) step function is unintuitive: x.step(y) = step(y, x).

Inconveniences that may not be fixable

  • The mix of uint3 for global_invocation_id and int2/int3 for texture fetches is a lot more painful in rust than in HLSL.
    • This currently seems to just work? ~@oisyn
  • a.max(b) instead of max(a, b) is sometimes kinda laborious. though rust-style.
  • Sometimes need to do a lot more parameter passing since inputs are not global. Not necessarily a bad thing though.

Documentation issues

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

No branches or pull requests

1 participant