Rust-GPU / Rust-GPU/rust-gpu

Expose more information on compiled entry points

Open
#374 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Problem

Right now the entry_points in CompileResult contains names only. This limits limits our/the users ability to generate code.

Proposal

Exposing some additional information on them could help with generating code, without prior knowledge of how each entry point works (like having a dictionary of graphics and compute shaders).

Expose SpirV representation

Right now I am thinking of putting a version of the generated EntryPoint spirv lang struct into rustc_codegen_spirv_types because of how easy it is to implement.

pub struct EntryPoint {
    pub execution_model: spirv::ExecutionModel,
    pub entry_point: spirv::Word,
    pub name: String,
    pub interface: Vec<spirv::Word>,
}
Use naga

Another idea I had was using naga::ir::EntryPoint

pub struct EntryPoint {
    pub name: String,
    pub stage: ShaderStage,
    pub early_depth_test: Option<EarlyDepthTest>,
    pub workgroup_size: [u32; 3],
    pub workgroup_size_overrides: Option<[Option<Handle<Expression>>; 3]>,
    pub function: Function,
}

but this is a bit detached from the underlying spirv (harder to parse from spirv code + less shader stages etc)

Unique struct

The best version would probably be a combination of the 2.

Even if it doesn't end up getting merged, I'll do it for my own project. All insights are welcome.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at CompileResult.entry_points and review the proposed EntryPoint in rustc_codegen_spirv_types alongside naga::ir::EntryPoint. First resolve which representation and metadata the project should expose; done means CompileResult provides agreed entry-point information sufficient for code generation without prior shader knowledge.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.