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

Abierto
#8,990 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C++
Estrellas
3.7k
Forks
926
Merge medio
3 d 22 h
PR fusionados (30 d)
45

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/DirectXShaderCompiler

Todos los issues de microsoft/DirectXShaderCompiler

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.