Skip to content

ByteAddressBuffer.Load<T> doesn't work if T contains a templated type #4735

@mcbouterse

Description

@mcbouterse

Hi, I ran into an issue with templated loads from ByteAddressBuffer using the latest official release (July 2022). Basically the following works as expected:

struct MyStructA { float m_0; }; struct MyStructB { MyStructA m_a; float m_1; float m_2; float m_3; }; ByteAddressBuffer g_bab; RWBuffer<float> result; [numthreads(1,1,1)] void CSMain() { MyStructB b = g_bab.Load<MyStructB>(0); result[0] = b.m_a.m_0; } 

But if MyStructA is a templated struct it fails to compile:

template<typename T> struct MyStructA { float m_0; }; struct MyStructB { MyStructA<float> m_a; float m_1; float m_2; float m_3; }; ByteAddressBuffer g_bab; RWBuffer<float> result; [numthreads(1,1,1)] void CSMain() { MyStructB b = g_bab.Load<MyStructB>(0); result[0] = b.m_a.m_0; } 

This will raise the following error: "Explicit template arguments on intrinsic Load must be a single numeric type"

Is this expected and not supported or is this a bug that can be fixed?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions