Skip to content

Commit 3c4f14a

Browse files
committed
Add geometryshader rust shaders
1 parent e93d523 commit 3c4f14a

File tree

16 files changed

+211
-0
lines changed

16 files changed

+211
-0
lines changed

shaders/rust/Cargo.lock

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

shaders/rust/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ members = [
3939
"dynamicrendering/texture",
4040
"dynamicuniformbuffer/base",
4141
"gears",
42+
"geometryshader/base",
43+
"geometryshader/mesh",
44+
"geometryshader/normaldebug",
4245
"gltfloading/mesh",
4346
"gltfscenerendering/scene",
4447
"gltfskinning/skinnedmodel",

shaders/rust/compileshaders.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ def compile_shader(shader_dir):
5757
shader_type = "frag"
5858
elif entry_point == "main_cs" or "compute" in entry_point.lower():
5959
shader_type = "comp"
60+
elif entry_point == "main_gs" or "geometry" in entry_point.lower():
61+
shader_type = "geom"
62+
elif entry_point == "main_tcs" or "tesscontrol" in entry_point.lower():
63+
shader_type = "tesc"
64+
elif entry_point == "main_tes" or "tesseval" in entry_point.lower():
65+
shader_type = "tese"
6066
else:
6167
# Skip unknown entry points
6268
continue
@@ -83,6 +89,9 @@ def compile_shader(shader_dir):
8389
("main_vs.spv", f"{shader_name}.vert.spv"),
8490
("main_fs.spv", f"{shader_name}.frag.spv"),
8591
("main_cs.spv", f"{shader_name}.comp.spv"),
92+
("main_gs.spv", f"{shader_name}.geom.spv"),
93+
("main_tcs.spv", f"{shader_name}.tesc.spv"),
94+
("main_tes.spv", f"{shader_name}.tese.spv"),
8695
]
8796

8897
for old_name, new_name in renames:
416 Bytes
Binary file not shown.
520 Bytes
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "geometryshader-base"
3+
version = "0.1.0"
4+
edition.workspace = true
5+
6+
[lib]
7+
crate-type = ["dylib"]
8+
9+
[dependencies]
10+
spirv-std = { workspace = true }
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![cfg_attr(target_arch = "spirv", no_std)]
2+
#![allow(clippy::missing_safety_doc)]
3+
4+
use spirv_std::{spirv, glam::{Vec3, Vec4}};
5+
6+
#[spirv(vertex)]
7+
pub fn main_vs(
8+
in_pos: Vec3,
9+
in_normal: Vec3,
10+
#[spirv(position)] out_position: &mut Vec4,
11+
out_normal: &mut Vec3,
12+
) {
13+
*out_normal = in_normal;
14+
*out_position = Vec4::new(in_pos.x, in_pos.y, in_pos.z, 1.0);
15+
}
16+
17+
#[spirv(fragment)]
18+
pub fn main_fs(
19+
in_color: Vec3,
20+
out_frag_color: &mut Vec4,
21+
) {
22+
*out_frag_color = Vec4::new(in_color.x, in_color.y, in_color.z, 1.0);
23+
}
2.15 KB
Binary file not shown.
5.77 KB
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "geometryshader-mesh"
3+
version = "0.1.0"
4+
edition.workspace = true
5+
6+
[lib]
7+
crate-type = ["dylib"]
8+
9+
[dependencies]
10+
spirv-std = { workspace = true }

0 commit comments

Comments
 (0)