locked
Reading from RWTexture2D<float2> in compute shader RRS feed

  • Question

  • Hi all,

    Below is my code:

    RWTexture2D<float> tex1 : register(u0);
    RWTexture2D<float2> tex2: register(u1);

    [numthreads(16, 16, 1)]
    void main( uint3 DTid : SV_DispatchThreadID )
    {
        float a;
        float2 b;
        a = tex1[DTid.xy];        //OK
        b = tex2[DTid.xy];        //Error
    }

    HLSL compiler returns an error "typed UAV loads are only allowed for single-component 32-bit element types".

    Does anyone know how to read data from RWTexture2D<float2> in compute shader v5.0?
    Tuesday, July 2, 2013 8:18 PM

Answers

  • I believe you have to read it as Texture2D<float2>, or perform multiple reads of the same resource as RWTexture2D<float>.
    • Marked as answer by Ivar2010 Tuesday, July 2, 2013 8:37 PM
    Tuesday, July 2, 2013 8:32 PM