Skip to content

Odd compiliation error with ResourceDescriptorHeap and type deduction #4036

Open

Description

struct PSInput
{
	float4 color : COLOR;
};

float4 PSMain(PSInput input) : SV_TARGET
{
	return ((StructuredBuffer<float>)ResourceDescriptorHeap[int(input.color.x)]).Load(0);
}

https://shader-playground.timjones.io/27ac5c864a447a7014ae267711a86d4a

Error:

D:\local\Temp\178b99bf-6e48-4e9f-88b4-102b65301c33.hlsl:8:79: error: no member named 'Load' in 'StructuredBuffer<float>'
        return ((StructuredBuffer<float>)ResourceDescriptorHeap[int(input.color.x)]).Load(0);
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

Somehow the right type is deduced, but we can't call it's functions?

Activity

  1. changed the title [-][hlsl 2021] Odd compiliation error[/-] [+][hlsl 2021] Odd compiliation error with ResourceDescriptorHeap and type deduction[/+] on Oct 25, 2021
  2. changed the title [-][hlsl 2021] Odd compiliation error with ResourceDescriptorHeap and type deduction[/-] [+]Odd compiliation error with ResourceDescriptorHeap and type deduction[/+] on Nov 8, 2021
  3. pow2clk commented on Nov 8, 2021

    @pow2clk
    Collaborator

    Hi Jasper Bekkers (@Jasper-Bekkers)

    Thanks for the report. The expected usage of this is to assign to a local variable. However, we agree that this usage should be supported. Given that there's a workaround and the compiler can be expected to optimize any extra copies away, it won't be a priority

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions