-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor rendering API #66
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
Changes from 1 commit
5ee2f0e
0ad77c0
58577b9
786bd67
87b00d7
3b34c26
c0879ef
df6c102
484b182
a4fb29b
d59603e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,243 @@ | ||||||||||
| //! Pipeline and shader module wrappers/builders for the platform layer. | ||||||||||
|
|
||||||||||
| use crate::wgpu::types as wgpu; | ||||||||||
|
|
||||||||||
| #[derive(Debug)] | ||||||||||
| /// Wrapper around `wgpu::ShaderModule` that preserves a label. | ||||||||||
| pub struct ShaderModule { | ||||||||||
| raw: wgpu::ShaderModule, | ||||||||||
| label: Option<String>, | ||||||||||
| } | ||||||||||
|
|
||||||||||
| impl ShaderModule { | ||||||||||
| /// Create a shader module from SPIR-V words. | ||||||||||
|
vmarcella marked this conversation as resolved.
|
||||||||||
| pub fn from_spirv( | ||||||||||
| device: &wgpu::Device, | ||||||||||
| words: &[u32], | ||||||||||
| label: Option<&str>, | ||||||||||
| ) -> Self { | ||||||||||
| let raw = device.create_shader_module(wgpu::ShaderModuleDescriptor { | ||||||||||
| label, | ||||||||||
| source: wgpu::ShaderSource::SpirV(std::borrow::Cow::Borrowed(words)), | ||||||||||
| }); | ||||||||||
| return Self { | ||||||||||
| raw, | ||||||||||
| label: label.map(|s| s.to_string()), | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /// Borrow the raw shader module. | ||||||||||
| pub fn raw(&self) -> &wgpu::ShaderModule { | ||||||||||
| &self.raw | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| #[derive(Debug)] | ||||||||||
| /// Wrapper around `wgpu::PipelineLayout`. | ||||||||||
|
||||||||||
| #[derive(Debug)] | |
| /// Wrapper around `wgpu::PipelineLayout`. | |
| /// Wrapper around `wgpu::PipelineLayout`. | |
| #[derive(Debug)] |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The builder implements new() but doesn't implement the Default trait. Either implement Default for PipelineLayoutBuilder or add #[allow(clippy::new_without_default)] to suppress the clippy warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc comment should appear before the derive attribute, not between it and the struct declaration. Move the doc comment above line 5.