[SPIR-V] Mesh shader output writes are dropped or produce invalid SPIR-V

Abierto
#9,033 1 comentario 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
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cpp
Área
compilers

Línea de trabajo

Reproduce each numbered case separately with the dxc command in the issue, using repro.hlsl and one numbered line at a time. The four failures are dropped out-parameter writes, invalid SPIR-V for a single-component SV_Position write under -fvk-invert-y, invalid SPIR-V for bool2 outputs, and dropped inherited struct fields in mesh output writes. Done means each case produces valid SPIR-V with the write reaching the output variable.

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

Descripción

bug needs-triage spirv

Description
Four kinds of write to mesh shader out vertices elements are mishandled:

  1. Passing an output to an out parameter silently drops the write.
  2. With  -fvk-invert-y, writing one component of  SV_Position  produces invalid SPIR-V.
  3. Writing a  bool2  output produces invalid SPIR-V.
  4. Writing a vertex or primitive output whose struct inherits fields from a base struct silently drops the inherited fields.

Steps to Reproduce

struct V { float4 pos : SV_Position; bool2 flag : FLAG; };
void setPos(out float4 p) { p = float4(1, 2, 3, 1); }
[numthreads(1, 1, 1)] [outputtopology("triangle")]
void main(out vertices V v[3], out indices uint3 t[1]) {
  SetMeshOutputCounts(3, 1);
  t[0] = uint3(0, 1, 2);
  setPos(v[0].pos);               // (1)
  v[1].pos.x = 4;                 // (2)
  v[2].flag = bool2(true, false); // (3)
}

struct Base { float a : A; };
struct V : Base { float4 pos : SV_Position; };
[numthreads(1, 1, 1)] [outputtopology("triangle")]
void main(out vertices V v[3], out indices uint3 t[1]) {
  SetMeshOutputCounts(3, 1);
  t[0] = uint3(0, 1, 2);
  V e = (V)0;
  e.a = 1;
  v[0] = e;                       // (4)

}

 dxc -T ms_6_5 -E main -spirv -fspv-target-env=vulkan1.3 -fvk-invert-y -fcgl repro.hlsl 
Keep only one numbered line at a time to see each failure on its own.

Actual Behavior

  1.  setPos writes to a function-local copy of v, and nothing is stored to gl_Position.
  2.  fatal error: generated SPIR-V is invalid: Reached non-composite type while indexes still remain to be traversed. 
  3.  fatal error: generated SPIR-V is invalid: OpAccessChain result type ... %v2bool ... does not match ... %v2uint 
  4.  out.var.A  is declared, but nothing is ever stored to it; only gl_Position is written.

Environment
• DXC version:  1.10.2609.0
• Host Operating System: Windows

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.