Skip to content

[SPIR-V] invalid matrix-vector multiplication output #7246

@4teapo

Description

@4teapo

Description

There's a problem with matrix-vector multiplication that causes invalid SPIR-V output.

Steps to Reproduce

Run dxc -spirv -T vs_6_9 -E mesh_vertex -Fo <output>.spv <input>.hlsl where the input file contains the following (generated by slang):

#pragma pack_matrix(column_major) #ifdef SLANG_HLSL_ENABLE_NVAPI #include "nvHLSLExtns.h" #endif #ifndef __DXC_VERSION_MAJOR // warning X3557: loop doesn't seem to do anything, forcing loop to unroll #pragma warning(disable : 3557) #endif #line 12 "src/mesh.slang" StructuredBuffer<float3 > entryPointParams_positions_0; #line 12 StructuredBuffer<float3 > entryPointParams_normals_0; #line 12 StructuredBuffer<float2 > entryPointParams_texture_positions_0; #line 12 struct _S1 { float4x4 _S2; }; #line 12 StructuredBuffer<_S1 > entryPointParams_instance_transforms_0; #line 12 struct _S3 { float3x3 _S2; }; #line 12 StructuredBuffer<_S3 > entryPointParams_instance_normal_transforms_0; #line 12 StructuredBuffer<vector<half,3> > entryPointParams_instance_colors_0; #line 3 "src/camera.slang" struct Camera_Uniform_0 { float4x4 view_projection_0; float3x3 world_normal_transform_0; }; #line 3 cbuffer entryPointParams_cam_0 { float4x4 view_projection_0; float3x3 world_normal_transform_0; } #line 4 "src/mesh.slang" struct VertexOutput_0 { float4 position_0 : SV_Position; float3 normal_0 : NORMAL; vector<half,3> color_0 : COLOR; float2 texture_position_0 : TEXTURE_POSITION; }; VertexOutput_0 mesh_vertex(uint vertex_id_0 : SV_VertexID, uint instance_id_0 : SV_InstanceID) { #line 24 VertexOutput_0 output_0; float4 _S4 = mul(entryPointParams_instance_transforms_0.Load(instance_id_0)._S2, float4(entryPointParams_positions_0.Load(vertex_id_0), 1.0f)); #line 26 output_0.position_0 = _S4; output_0.position_0 = mul(view_projection_0, _S4); float3 _S5 = mul(entryPointParams_instance_normal_transforms_0.Load(instance_id_0)._S2, entryPointParams_normals_0.Load(vertex_id_0)); #line 28 output_0.normal_0 = _S5; output_0.normal_0 = mul(world_normal_transform_0, _S5); output_0.color_0 = entryPointParams_instance_colors_0.Load(instance_id_0); output_0.texture_position_0 = entryPointParams_texture_positions_0.Load(vertex_id_0); return output_0; }

Actual Behavior

fatal error: generated SPIR-V is invalid: Expected float vector type as left operand: VectorTimesMatrix %74 = OpVectorTimesMatrix %v3float %73 %72 note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible 

Environment

  • DXC version: libdxcompiler.dylib: 1.9(dev;4806-75a029d9)
  • Host Operating System: macOS 15.2

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashspirvWork related to SPIR-V

Type

No type

Projects

Status

Done

Status

Triaged

Relationships

None yet

Development

No branches or pull requests

Issue actions