Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
0622940
[spv-out] Support for mesh shaders
cwfitzgerald Dec 12, 2025
dc69d86
Update mesh_shader.rs
inner-daemons Dec 13, 2025
dfd360f
Tried one thing
inner-daemons Dec 14, 2025
c1973fe
Updated snapshots
inner-daemons Dec 14, 2025
50c2aa9
Tried another thing
inner-daemons Dec 14, 2025
7749867
Removed per primitive stuff + cull primitive
inner-daemons Dec 14, 2025
ca3f93a
Testing new thing
inner-daemons Dec 14, 2025
4fbfc60
Ahh well I think I'm done for the night
inner-daemons Dec 14, 2025
7551f6a
Slight improvements
inner-daemons Dec 14, 2025
3225030
Fixed another comment
inner-daemons Dec 14, 2025
c34c474
Added note on feature
inner-daemons Dec 14, 2025
18164ee
Preparing for merge as is
inner-daemons Dec 14, 2025
0b9bf09
Ok I'm tired
inner-daemons Dec 14, 2025
da72786
Blah blah blah
inner-daemons Dec 14, 2025
8862d56
Updated loop logic
inner-daemons Dec 14, 2025
0286af7
Tried something else
inner-daemons Dec 14, 2025
7cc51c9
Tried another little fix
inner-daemons Dec 14, 2025
3818efe
Tried something new
inner-daemons Dec 14, 2025
ea50cb0
Told it to skip instead of expect a failure
inner-daemons Dec 14, 2025
8d9a451
Redocumented feature, made tests run on AMD
inner-daemons Dec 15, 2025
3edc37c
Removed obseleted files, updated changelog, updated shaders
inner-daemons Dec 15, 2025
6ffd2d5
Added task shader to the changelog entry
inner-daemons Dec 15, 2025
094a5ac
Enabled debugigng
inner-daemons Dec 15, 2025
6417327
Fixed typo
inner-daemons Dec 15, 2025
2e863e2
Trying with better aligned task payload stuff
inner-daemons Dec 15, 2025
05eada6
Made the tests actually run on LLVMPIPE
inner-daemons Dec 15, 2025
6dc1fd0
Testing on LLVMPIPE if removing task payload reads does anything
inner-daemons Dec 15, 2025
883a443
Undid test that didnt work
inner-daemons Dec 15, 2025
3457ed5
Tried making it write a barrier
inner-daemons Dec 15, 2025
cad1bdf
Wrote another barrier I guess
inner-daemons Dec 15, 2025
4927043
Gonna see if this one does anything
inner-daemons Dec 15, 2025
19af909
Jeez im stupid
inner-daemons Dec 15, 2025
3d7327f
Removed debugging files
inner-daemons Dec 15, 2025
c4574e7
Fixed the example shader sorta
inner-daemons Dec 15, 2025
ff46752
Blah blah blah
inner-daemons Dec 15, 2025
a5324ee
Merge remote-tracking branch 'upstream/trunk' into mesh-shading/spv-w…
inner-daemons Dec 15, 2025
c36f9f8
Final cleanup
inner-daemons Dec 15, 2025
4c29d13
Added new mesh shader tasks
inner-daemons Dec 16, 2025
c08d00a
Fixed test
inner-daemons Dec 16, 2025
7703aef
Fixed some test shenanigans
inner-daemons Dec 16, 2025
90624c8
Seeing if this breaks anything
inner-daemons Dec 16, 2025
307f908
Tried to fix one issue
inner-daemons Dec 16, 2025
69a1d50
Initial setup
inner-daemons Dec 17, 2025
3611377
More scaffolding
inner-daemons Dec 17, 2025
f0235fb
Temporary changes while I pivot
inner-daemons Dec 17, 2025
1e33465
A little more progress made here
inner-daemons Dec 17, 2025
f09af9b
Task shaders are now good I think
inner-daemons Dec 17, 2025
03b46f7
Some more work, it mostly compiles now
inner-daemons Dec 17, 2025
e8188cb
Merge remote-tracking branch 'upstream/trunk' into mesh-shading/hlsl-…
inner-daemons Dec 17, 2025
12551f4
Fixed warnings
inner-daemons Dec 17, 2025
445382b
Ran taplo fmt, fixed a warning
inner-daemons Dec 17, 2025
1b48851
Many shaders now build properly
inner-daemons Dec 18, 2025
dbdff84
It flippin works!!
inner-daemons Dec 18, 2025
c875a58
Merge remote-tracking branch 'upstream/trunk' into mesh-shading/hlsl-…
inner-daemons Dec 18, 2025
e31b4f9
Hahaha its valid
inner-daemons Dec 18, 2025
82db42d
Final tweaks
inner-daemons Dec 18, 2025
f47a220
Fixed missing commas in some shaders
inner-daemons Dec 18, 2025
85f65a5
Fixed final test
inner-daemons Dec 18, 2025
2a8396f
Zero initialized stuff
inner-daemons Dec 18, 2025
cb41edd
Amazing stuff here on display
inner-daemons Dec 18, 2025
28b684d
Undid barrier generation
inner-daemons Dec 19, 2025
b91d24b
Fixed some stuff up
inner-daemons Dec 19, 2025
12158d3
Fixed the thing
inner-daemons Dec 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/features/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ impl ExampleContext {
async fn init_async<E: Example>(surface: &mut SurfaceWrapper, window: Arc<Window>) -> Self {
log::info!("Initializing wgpu...");

let instance_descriptor = wgpu::InstanceDescriptor::from_env_or_default();
let mut instance_descriptor = wgpu::InstanceDescriptor::from_env_or_default();
instance_descriptor.backend_options.dx12.shader_compiler = wgpu::Dx12Compiler::StaticDxc;
let instance = wgpu::Instance::new(&instance_descriptor);
surface.pre_adapter(&instance, window);
let adapter = get_adapter_with_capabilities_or_from_env(
Expand Down
42 changes: 1 addition & 41 deletions examples/features/src/mesh_shader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,6 @@ fn compile_wgsl(device: &wgpu::Device) -> wgpu::ShaderModule {
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
})
}
fn compile_hlsl(device: &wgpu::Device, entry: &str, stage_str: &str) -> wgpu::ShaderModule {
let out_path = format!(
"{}/src/mesh_shader/shader.{stage_str}.cso",
env!("CARGO_MANIFEST_DIR")
);
let cmd = std::process::Command::new("dxc")
.args([
"-T",
&format!("{stage_str}_6_5"),
"-E",
entry,
&format!("{}/src/mesh_shader/shader.hlsl", env!("CARGO_MANIFEST_DIR")),
"-Fo",
&out_path,
])
.output()
.unwrap();
if !cmd.status.success() {
panic!("DXC failed:\n{}", String::from_utf8(cmd.stderr).unwrap());
}
let file = std::fs::read(&out_path).unwrap();
std::fs::remove_file(out_path).unwrap();
unsafe {
device.create_shader_module_passthrough(wgpu::ShaderModuleDescriptorPassthrough {
entry_point: entry.to_owned(),
label: None,
num_workgroups: (1, 1, 1),
dxil: Some(std::borrow::Cow::Owned(file)),
..Default::default()
})
}
}

fn compile_msl(device: &wgpu::Device, entry: &str) -> wgpu::ShaderModule {
unsafe {
Expand All @@ -61,22 +29,14 @@ impl crate::framework::Example for Example {
_queue: &wgpu::Queue,
) -> Self {
let (ts, ms, fs, ts_name, ms_name, fs_name) = match adapter.get_info().backend {
wgpu::Backend::Vulkan => (
wgpu::Backend::Vulkan | wgpu::Backend::Dx12 => (
compile_wgsl(device),
compile_wgsl(device),
compile_wgsl(device),
"ts_main",
"ms_main",
"fs_main",
),
wgpu::Backend::Dx12 => (
compile_hlsl(device, "Task", "as"),
compile_hlsl(device, "Mesh", "ms"),
compile_hlsl(device, "Frag", "ps"),
"main",
"main",
"main",
),
wgpu::Backend::Metal => (
compile_msl(device, "taskShader"),
compile_msl(device, "meshShader"),
Expand Down
53 changes: 0 additions & 53 deletions examples/features/src/mesh_shader/shader.hlsl

This file was deleted.

12 changes: 11 additions & 1 deletion naga/hlsl-snapshots/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub struct Config {
pub vertex: Vec<ConfigItem>,
pub fragment: Vec<ConfigItem>,
pub compute: Vec<ConfigItem>,
pub task: Vec<ConfigItem>,
pub mesh: Vec<ConfigItem>,
}

impl Config {
Expand All @@ -59,6 +61,8 @@ impl Config {
vertex: Default::default(),
fragment: Default::default(),
compute: Default::default(),
task: Default::default(),
mesh: Default::default(),
}
}

Expand All @@ -85,8 +89,14 @@ impl Config {
vertex,
fragment,
compute,
task,
mesh,
} = self;
vertex.is_empty() && fragment.is_empty() && compute.is_empty()
vertex.is_empty()
&& fragment.is_empty()
&& compute.is_empty()
&& task.is_empty()
&& mesh.is_empty()
}
}

Expand Down
12 changes: 7 additions & 5 deletions naga/src/back/hlsl/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ impl crate::StorageFormat {
}

impl crate::BuiltIn {
pub(super) fn to_hlsl_str(self) -> Result<&'static str, Error> {
Ok(match self {
pub(super) fn to_hlsl_str(self) -> Result<Option<&'static str>, Error> {
Ok(Some(match self {
Self::Position { .. } => "SV_Position",
// vertex
Self::ClipDistance => "SV_ClipDistance",
Expand Down Expand Up @@ -186,13 +186,15 @@ impl crate::BuiltIn {
return Err(Error::Custom(format!("Unsupported builtin {self:?}")))
}
Self::CullPrimitive => "SV_CullPrimitive",
Self::PointIndex | Self::LineIndices | Self::TriangleIndices => unimplemented!(),
Self::MeshTaskSize
| Self::VertexCount
| Self::PrimitiveCount
| Self::Vertices
| Self::Primitives => unreachable!(),
})
| Self::Primitives
| Self::PointIndex
| Self::LineIndices
| Self::TriangleIndices => return Ok(None),
}))
}
}

Expand Down
Loading