All notable changes to this project will be documented in this file. Breaking changes in the generated code will be considered as breaking changes when versioning wgsl_to_wgpu itself.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Added option to write options for performing naga shader validation.
- Added
emit_to_stderr
andemit_to_stderr_with_path
methods toCreateModuleError
for printing colored and formatted shader errors. - Added PUSH_CONSTANT_STAGES constant to generated code.
- Changed
create_shader_module
andcreate_shader_module_embedded
to return naga parse errors instead of panic.
- Exposed shader source string as a public constant in generated code.
- Fixed an issue where shader stage visibility would not correctly account for function calls.
- Changed visibility for bind groups and push constants to only include stages that actually use the resource in WGSL code.
- Added support for scalar, vector, and matrix bindings.
- Added support for texture arrays.
- Added a
rustfmt
option for formatting the output code with the executable used forcargo fmt
.
- Changed generated bind groups and bind group layouts to use labels with the group index like "BindGroup0" or "BindGroupLayout0".
- Changed bind group set methods to be generic over the pass type to better support mixed entry function stages.
- Fixed an issue where vertex entry code would only be generated for the first vertex entry.
- Fixed an issue where
wgpu::ShaderStages
stages would not be correctly generated for modules with both compute and vertex or fragment entries.
- Fixed an issue where push constants would not work on Metal due to setting unused shader stages.
- Added support for a single push constant range used by all shader stages.
- Fixed an issue where texture sample types of
u32
andi32
did not generate the correctwgpu::TextureSampleType
.
- Added support for pipeline-overrideable constants.
- Added
fragment_state
and fragment entry functions for more easily initializingwgpu::FragmentState
.
- Changed vertex entry functions to take
&OverrideConstants
if needed to intialize overrides.
- Split derives for bytemuck into
derive_bytemuck_vertex
andderive_bytemuck_host_shareable
toWriteOptions
. - Renamed
derive_encase
toderive_encase_host_shareable
forWriteOptions
and adjusted encase derive to not apply to vertex input structs to avoid memory layout mismatches. - Changed vertex input field offsets to use
std::mem::offset_of!
instead ofmemoffset::offset_of!
. This requires Rust 1.77 or later.
- Added
BindGroups::set
method for setting all bind groups from a struct.
- Moved vertex input methods from vertex module to top level.
- Moved
set_bind_groups
to top level and changed parameters to directly take bind group references to simplify code.
- Fixed an issue where
@builtin()
attributes were not supported in struct definitions.
- Added
create_shader_module_embedded
for including the source as a string literal instead of usinginclude_str!
. - Added
#[derive(Debug)]
to generated types for easier debugging and profiling.
- Adjusted code generation to skip structs that are only used internally in the shader.
- Update naga to 0.12.0 to match wgpu 0.16.
- Added vertex buffer layout function to each vertex input struct.
- Added support for nalgebra for matrix and vector types.
- Added const asserts to check approriate Rust struct memory layouts with WGSL when deriving bytemuck.
- Added support for storage textures.
- Added support for multisampled textures.
- Added a function for creating compute pipelines.
- Added optional derives for
serde::Serialize
andserde::Deserialize
. - Added functions to initialize vertex state for pipeline descriptors.
- Skip generating structs for shader stage outputs since they aren't needed.
- Updated documentation.
- Added a check to force bind groups to be consecutive.
- Added a check for repeated bind groups or bindings.
- Added an example project.
- Added support for array bindings.
- Added support for depth textures.
- Added support for additional WGSL scalar types.
- Added
WriteOptions
to control generated derives. - Added support for
glam
or Rust types for vectors and matrices. - Added the workgroup size for generated code for compute shaders.
- Changed the return type of
create_shader_module
toString
instead of writing to a file. - Changed the visibility of resources to match the shader stages present in the module.
- Changed shader source parameter of
create_shader_module
take&str
instead of a path. - Changed bind groups to be more flexible by taking
wgpu::BufferBinding
instead ofwgpu::Buffer
. - Changed project to depend on
wgpu-types
instead ofwgpu
itself.
- Removed the notice for generated code from the generated module string.
- Removed vertex attribute location code.
- Removed inaccurate generated struct size code.
- Added create_pipeline_layout function.
- Added create_shader_module function.
- Added constants for vertex input locations.
- Added functions to set all bind groups or individual bind groups.
- Added Rust structs for global types like uniforms and vertex inputs.
- Added code to generate vertex state from vertex input structs.
- Added
#[derive(PartialEq)]
to generated structs.
- Fixed an issue where the generated code would not use
wgpu::ComputePass
for compute only modules.
- Moved bindgroup layout descriptors to constants.
- Converted the procedural macro to a function to be used in build scripts.
- Always generate Rust types like arrays instead of forcing glam.
Initial release!