Skip to content

[SPIR-V] Initialization of template struct with a BufferPointer produces invalid SPIR-V #7890

@Dolkar

Description

@Dolkar

Description
If you wrap vk::BufferPointer in a struct like so:

template <typename T>
struct BufferAccessor {
    vk::BufferPointer<T> ptr;
};

then initializing it with the constructor syntax produces invalid SPIR-V:

BufferAccessor<float> accessor = BufferAccessor<float>(buffer);
// fatal error: generated SPIR-V is invalid: OpConstantNull Result Type <id> '8[%_ptr_PhysicalStorageBuffer_float]' cannot have a null value.
//  %13 = OpConstantNull %_ptr_PhysicalStorageBuffer_float

Setting the member directly works fine as a workaround.

Steps to Reproduce
https://godbolt.org/z/jYaM7c437

Environment

  • DXC version: trunk
  • Host Operating System: Windows 11

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashspirvWork related to SPIR-V

Type

No type

Projects

Status

In review

Status

Triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions