Skip to content

Expose more information on compiled entry points #374

@LoKolbasz

Description

@LoKolbasz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions