Skip to content

Commit 2701c19

Browse files
committed
fix frontpage example
1 parent 527f5f8 commit 2701c19

4 files changed

Lines changed: 90 additions & 7 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules/
44
build/
55
.docusaurus
66
target/
7+
.idea/

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
4+
utils.url = "github:numtide/flake-utils";
5+
};
6+
7+
outputs = { self, nixpkgs, utils }:
8+
utils.lib.eachDefaultSystem (system:
9+
let
10+
pkgs = import nixpkgs { inherit system; };
11+
in {
12+
devShell = with pkgs;
13+
mkShell {
14+
buildInputs = [
15+
yarn
16+
];
17+
};
18+
});
19+
}

src/pages/index.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ const HeroCode: React.FC<HeroCodeProps> = ({ className = "" }) => {
2323
use glam::UVec3;
2424
use spirv_std::spirv;
2525
26-
enum Outcome {
27-
Fizz,
28-
Buzz,
29-
FizzBuzz,
26+
#[repr(u32)]
27+
pub enum Outcome {
28+
Fizz,
29+
Buzz,
30+
FizzBuzz,
3031
}
3132
3233
trait Game {
3334
fn fizzbuzz(&self) -> Option<Outcome>;
3435
}
3536
36-
impl Game for u32 {
37+
impl Game for usize {
3738
fn fizzbuzz(&self) -> Option<Outcome> {
3839
match (self % 3 == 0, self % 5 == 0) {
3940
(true, true) => Some(Outcome::FizzBuzz),
@@ -47,9 +48,10 @@ impl Game for u32 {
4748
#[spirv(compute(threads(64)))]
4849
pub fn main(
4950
#[spirv(global_invocation_id)] id: UVec3,
50-
#[spirv(storage_buffer)] output: &mut [Option<Outcome>; 64],
51+
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)]
52+
output: &mut [Option<Outcome>; 64],
5153
) {
52-
let index = id.x as u32;
54+
let index = id.x as usize;
5355
output[index] = index.fizzbuzz();
5456
}\
5557
`;

0 commit comments

Comments
 (0)