Skip to content

Add derive macros for layout validation and enhance shader compilation#84

Merged
koubaa merged 2 commits intomainfrom
layout-validation
Apr 9, 2026
Merged

Add derive macros for layout validation and enhance shader compilation#84
koubaa merged 2 commits intomainfrom
layout-validation

Conversation

@koubaa
Copy link
Copy Markdown
Owner

@koubaa koubaa commented Apr 9, 2026

  • Introduced a new goldy_derive crate for derive macros, including LayoutCheckable for automatic layout validation of #[repr(C)] structs.
  • Updated Cargo.toml to include the new derive member and dependency.
  • Enhanced shader compilation functions to support layout checks, validating Rust struct layouts against Slang reflection during shader compilation.
  • Added new methods in the backend to handle layout checks and updated existing shader creation functions to accommodate these changes.
  • Implemented layout validation logic in the Slang compiler, allowing for deferred validation during shader compilation.
  • Updated tests to include layout checks, ensuring correctness in shader struct layouts across different backends.

Part of #80

@koubaa koubaa force-pushed the layout-validation branch from f147386 to 3de5e73 Compare April 9, 2026 02:07
- Introduced a new `goldy_derive` crate for derive macros, including `LayoutCheckable` for automatic layout validation of `#[repr(C)]` structs.
- Updated `Cargo.toml` to include the new `derive` member and dependency.
- Enhanced shader compilation functions to support layout checks, validating Rust struct layouts against Slang reflection during shader compilation.
- Added new methods in the backend to handle layout checks and updated existing shader creation functions to accommodate these changes.
- Implemented layout validation logic in the Slang compiler, allowing for deferred validation during shader compilation.
- Updated tests to include layout checks, ensuring correctness in shader struct layouts across different backends.
@koubaa koubaa force-pushed the layout-validation branch from 3de5e73 to ea1aa74 Compare April 9, 2026 02:12
- Added optional layout validation for Rust `#[repr(C)]` structs against Slang during shader compilation using the `GOLDY_VALIDATE_LAYOUTS` environment variable.
- Updated `AGENTS.md`, `DEBUGGING.md`, and `README.md` to include instructions for enabling layout checks and examples of usage.
- Enhanced `shaders.md` and example files (`gradient.rs`, `checkerboard.rs`) to demonstrate the integration of layout validation in shader compilation.
- Introduced `LayoutCheckable` derive macro in examples to ensure uniform buffer data matches the expected layout in shaders.
@koubaa koubaa merged commit 7170698 into main Apr 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant