Skip to content

[SPIR-V] Struct within Mesh Shader Vetex Output crashes spirv generation #8475

Open

Description

@ahoughtoncig

Hello 🙂

We've got a crash when building mesh shaders for spirv related to how our output vertex setup is constructed. I've got a repro here showing the issue: https://godbolt.org/z/9jYY3z1eE - I took the DX12 sample project and simply moved a few attributes out of the VertexOut and in to another struct and the spirv generation now crashes.

// Adding this struct causes DXC to crash with SPIR-V
struct VertexAttributes
{
    float3 PositionVS   : POSITION0;
    float3 Normal       : NORMAL0;
};

struct VertexOut
{
    float4 PositionHS   : SV_Position;
    VertexAttributes attributes;
    uint   MeshletIndex : COLOR0;
};

The original code looked like this, which does not crash:

struct VertexOut
{
    float4 PositionHS   : SV_Position;
    float3 PositionVS   : POSITION0;
    float3 Normal       : NORMAL0;
    uint   MeshletIndex : COLOR0;
};

I believe this is the callstack on the crash:

dxcompiler.dll!hlsl::NodeFlags::operator unsigned int(void)
dxcompiler.dll!clang::spirv::SpirvEmitter::assignToMSOutAttribute(class clang::DeclaratorDecl const *,class clang::spirv::SpirvInstruction *,class llvm::SmallVector<class clang::spirv::SpirvInstruction *,4> const &)
dxcompiler.dll!clang::spirv::SpirvEmitter::tryToAssignToMSOutAttrsOrIndices(class clang::Expr const *,class clang::spirv::SpirvInstruction *,class clang::spirv::SpirvInstruction *,bool)
dxcompiler.dll!clang::spirv::SpirvEmitter::processAssignment(class clang::Expr const *,class clang::spirv::SpirvInstruction *,bool,class clang::spirv::SpirvInstruction *,class clang::SourceRange)
dxcompiler.dll!clang::spirv::SpirvEmitter::doBinaryOperator(class clang::BinaryOperator const *)
dxcompiler.dll!clang::spirv::SpirvEmitter::doExpr(class clang::Expr const *,class clang::SourceRange)
dxcompiler.dll!clang::spirv::SpirvEmitter::doStmt(class clang::Stmt const *,class llvm::ArrayRef<class clang::Attr const *>)
dxcompiler.dll!clang::spirv::SpirvEmitter::doStmt(class clang::Stmt const *,class llvm::ArrayRef<class clang::Attr const *>)
dxcompiler.dll!clang::spirv::SpirvEmitter::doIfStmt(class clang::IfStmt const *,class llvm::ArrayRef<class clang::Attr const *>)
dxcompiler.dll!clang::spirv::SpirvEmitter::doStmt(class clang::Stmt const *,class llvm::ArrayRef<class clang::Attr const *>)
dxcompiler.dll!clang::spirv::SpirvEmitter::doStmt(class clang::Stmt const *,class llvm::ArrayRef<class clang::Attr const *>)
dxcompiler.dll!clang::spirv::SpirvEmitter::doFunctionDecl(class clang::FunctionDecl const *)
dxcompiler.dll!clang::spirv::SpirvEmitter::doDecl(class clang::Decl const *)
dxcompiler.dll!clang::spirv::SpirvEmitter::HandleTranslationUnit(class clang::ASTContext &)
dxcompiler.dll!clang::ParseAST(class clang::Sema &,bool,bool)
dxcompiler.dll!clang::ASTFrontendAction::ExecuteAction(void)
dxcompiler.dll!clang::FrontendAction::Execute(void)

As a workaround, we can attempt to try and move our additional vertex data out of the structure but it's a bit of a pain for us to do.

Any support would be greatly appreciated.

I'm running on PC on DXC version dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727)

Thanks!

Alex

Activity

  1. added
    bug
    spirv
    needs-triage
    on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triagespirv

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions