Skip to content

shader type coherence #80

@koubaa

Description

@koubaa

Runtime layout validation. Slang provides a reflection API that reports struct layouts (size, field offsets, field types) after compilation. Goldy could query this at shader load time and compare against the Rust-side layout (derivable via std::mem::size_of, std::mem::offset_of!, etc.). A mismatch would produce a clear error at startup rather than silent corruption. This is the most practical near-term improvement.

Static reflection and compile-time checking. If Rust's type metadata (field names, types, offsets) could be compared against Slang's reflection data at compile time — perhaps via a build script that compiles the shader, extracts reflection, and asserts layout compatibility — the mismatch would become a build error. This is the ideal end state but requires tooling that doesn't exist yet.

The cross-language type coherence problem is fundamental to any multi-language GPU stack. Goldy's current approach (convention + testing) works but scales poorly as the number of shared types grows. Runtime reflection validation is the likely next step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions