Skip to content

[SPIR-V] Crash when accessing buffer from array of buffers #6110

@jaoel

Description

@jaoel

Description
The SPIR-V optimizer crashes when accessing a buffer from an array of buffers which has been assigned to a variable.

Steps to Reproduce
Minimal example derived from a real world shader that suffers from the crash:

ByteAddressBuffer inputBuffers[16] : register(t0);

struct MyStruct
{
	ByteAddressBuffer myBuffers[16];
};

[numthreads(32, 1, 1)]
void main()
{
	MyStruct ms;
	ms.myBuffers = inputBuffers;
	ByteAddressBuffer buffer = ms.myBuffers[0]; // < This line causes crash
}

I managed to strip the example even more to just these two lines, but the location of the crash is slightly different so I'll include both examples for completeness:

[numthreads(32, 1, 1)]
void main()
{
	ByteAddressBuffer buffers[16];
	ByteAddressBuffer buffer = buffers[0]; // < This line causes crash
}

Everything is compiled with command line options: -E "main" -T cs_6_0 -spirv

Actual Behavior
Both examples causes a crash in SPIRV-Tools Pass::GenerateCopy()
The first example produces an assert "Don't know how to copy this type. Code is likely illegal."
The second example attempts to read nullptr.

Environment

  • DXC version dxcompiler.dll: 1.8 - 1.7.0.14383 (main, ad3958c2d)
  • Host Operating System Windows 10 64-bit

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashspirvWork related to SPIR-V

Type

No type
No fields configured for issues without a type.

Projects

Status

Triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions