Skip to content

ByteAddressBuffer typed load of struct with enum class value fails to compile #3860

@gkaerts

Description

@gkaerts

Not sure if this is by design or not, but ByteAddressBuffer typed loads currently fail when the type being loaded contains an enum class field, even when said enum class has a specified integer underlying type.

Minimal repro here: http://shader-playground.timjones.io/d722f459ff15eae92df7c752a52b9bdb

enum class EnumClassType : uint
{
    ValueA,
    ValueB,
    ValueC
};

struct TypeWithEnumClassMember
{
    EnumClassType enumValue;
    uint uintValue;
};

ByteAddressBuffer buffer : register(t0);

[numthreads(1,1,1)]
void CSMain()
{
    TypeWithEnumClassMember value = buffer.Load<TypeWithEnumClassMember>(0);
}

This fails with the following error:

 error: Explicit template arguments on intrinsic Load must be a single numeric type
    TypeWithEnumClassMember value = buffer.Load<TypeWithEnumClassMember>(0);

I was experimenting with using enum class types as strongly typed handles to use with bindless resource indexing (not using SM6.6 descriptor heap indexing).

Not a huge deal, but thought I'd flag it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions