[SPIR-V] GetVertexAttribute with -pack-optmized does not generate good type

Aperta
#8,990 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Start with the Godbolt reproduction and compare the generated SPIR-V with and without --pack-optimized, focusing on the type of %in_var_GPUSCENE_VERTEXTOTRIBITMASKS. Trace the type from the SPIR-V emitVisitor into the optimization pass suspected in the report; done means the optimized output uses the expected array type and passes SPIR-V validation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug needs-triage spirv

Hi everyone, me again 😄

Description
Our shaders does not compile well with --pack-optimized. I don't know if it supposed to work or if it is a bug.
I had different errors. The reproduction on godbolt is this one PerVertexKHR must be declared as arrays. I also had validation errors on CompositeExtract : generated SPIR-V is invalid: Result type (OpTypeVector) does not match the type that results from indexing into the composite (OpTypeInt)

The issue is that my non interpolated variable fetched with GetVertexAtAttribute has a type OpTypePointer->OpTypeVector OpTypeInteger 4 but it should be OpTypePointer-> OptypeArray (OpTypeVector OpTypeInteger 4) 3. I tried to step into dxc but the type was good in the spirv emitVisitor so I suspect an optimization pass but I did not dive more :/

Without validation it is easy to see the difference between with and without --pack-optimized.

Steps to Reproduce
https://godbolt.org/z/nx5ozWrfW
It does not compile. Check with -Vd to see the actual type of %in_var_GPUSCENE_VERTEXTOTRIBITMASKS that is %_ptr_Input_v4uint and not %_ptr_Input__arr_v4uint_uint_3 if --pack-optimized is not used.

Actual Behavior

fatal error: generated SPIR-V is invalid: [VUID-StandaloneSpirv-Input-06778] PerVertexKHR must be declared as arrays
  %in_var_GPUSCENE_VERTEXTOTRIBITMASKS = OpVariable %_ptr_Input_v4uint Input
Compiler returned: 5

Environment
DXC trunk on godbolt
Reproduce also on windows 11 and custom fork of 1.10.2605.24.

As usual, if I did not understand something, please tell me :)

Have a wonderful day.
Cheers,
Robin.

Lingua principale
C++
Stelle
3.7k
Fork
926
Merge medio
3g 22h
PR unite (30g)
45

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/DirectXShaderCompiler

Tutte le issue di microsoft/DirectXShaderCompiler

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.