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

Implement GPU types and methods #759

Open
dfellis opened this issue Jun 11, 2024 · 2 comments
Open

Implement GPU types and methods #759

dfellis opened this issue Jun 11, 2024 · 2 comments

Comments

@dfellis
Copy link
Member

dfellis commented Jun 11, 2024

The exact shape of this isn't super clear, yet, but either a set of opaque types and bound functions, or pure Alan code on top of a thin wrapper over wgpu/WebGPU is needed to construct an AST to serialize to wgsl and then execute on the GPU.

This is the purpose of Alan v0.2

@dfellis
Copy link
Member Author

dfellis commented Nov 13, 2024

Remaining built-in functions of wgsl to bind using this as the reference:

  • countLeadingZeros
  • countOneBits
  • countTrailingZeros
  • cross
  • degrees
  • determinant
  • distance and length (these will get different names. length has become magnitude, not yet decided on distance)
  • dot
  • exp2 (maybe? Not sure if I need to include this when pow exists. I did include exp but only because that's actually pretty commonly used)
  • extractBits
  • faceForward (this appears to be a composite function on its own, unsure if I should include it)
  • firstLeadingBit
  • firstTrailingBit
  • fma
  • fract
  • frexp (including it in the list as considered, but I don't see any value in it)
  • insertBits
  • inverseSqrt
  • ldexp (also doesn't seem necessary? it's the inverse of frexp but I don't see the expressive value here)
  • mix
  • modf (also weird to include when the other functions already exist)
  • normalize
  • radians
  • reflect
  • refract
  • reverseBits
  • round
  • saturate
  • sign (do we need this?)
  • smoothstep (also a compound function, but if its backed by hardware maybe?)
  • step
  • transpose
  • pack4x8snorm
  • pack4x8unorm
  • pack2x16snorm
  • pack2x16unorm
  • pack2x16float
  • unpack4x8snorm
  • unpack4x8unorm
  • unpack2x16snorm
  • unpack2x16unorm
  • unpack2x16float
  • storageBarrier storageBarrier is broken on ARM Macs, it's essentially equivalent to workgroupBarrier may or may not block usage on Mac and Browser because of this.
  • workgroupBarrier (not including this at first, as I have no way to represent the workgroup pointer at the moment)
  • workgroupUniformLoad (not including this at first, as I have no way to represent the workgroup pointer at the moment)

I am not including any of the derivative functions because they're only for pixel shaders, I'm not including any of the texture functions because I do not have any texture functionality at the moment (and I hope to get away with just the copy-buffer-to-shader functionality to do rendering), and I'm not including any atomic operations at the moment as I have no representation of atomics.

This is just the list of things I want to get done for compute shaders, which are the only shaders I'm exposing at the moment.

I also still feel like there's some work to be done on the GBuffer type and its usage, but I'm not going to consider that blocking to close this issue out.

@dfellis
Copy link
Member Author

dfellis commented Jan 8, 2025

I think I have implemented enough of this to unblock a v0.2 beta, so I'm removing that label.

@dfellis dfellis removed this from the v0.2 release milestone Jan 8, 2025
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