SUST : Surface Store

Format

SPA 5.0:
        {@{!}Pg}   SUST.D{.BA}.dim{.cop}{.sz}{.clamp}   [Ra], Rb, #tsPtrIdxU13   {&req_6}   {&rdN}   {?sched}   ;   
        {@{!}Pg}   SUST.D{.BA}.dim{.cop}{.sz}{.clamp}   [Ra], Rb, Rc             {&req_6}   {&rdN}   {?sched}   ;   
        {@{!}Pg}   SUST.P.dim{.cop}{.rgba}{.clamp}      [Ra], Rb, #tsPtrIdxU13   {&req_6}   {&rdN}   {?sched}   ;   
        {@{!}Pg}   SUST.P.dim{.cop}{.rgba}{.clamp}      [Ra], Rb, Rc             {&req_6}   {&rdN}   {?sched}   ;   


        .dim    {.1D, .1D_BUFFER, .1D_ARRAY, .2D, .2D_ARRAY, .3D}

        .mode   {.D, .P}
            .D      This mode specifies that surface data is treated as raw data of size .sz, without any format conversion.
                    In this mode, if .BA (ByteAddress) is specified, 
                         the x-coordinate is assumed to be in bytes, aligned on a .sz boundary.
                         Otherwise, x-coordinate is treated as sample coordinate and scaled by .sz in hardware.
            .P      This mode specifies a formatted pixel load from surface. 
                    The x value is a sample coordinate in the target surface.
                    In this mode .rgba specifies the number of components written by the load. 

        .cop    {.WB*, .CG, .CS, .WT}
        .sz     {.U8, .S8, .U16, .S16, .32*, .64, .128}  // used in .D mode, specifes load size of raw data.
        .rgba   {.R, .RG, .RGBA*}                      // used in .P mode, specifies a scalar, vec2 or vec4 destination register.
        .BA     x-coordinate is specified as byte-address. (in .D mode)
        .clamp  {.IGN, .NEAR*, .TRAP}


    Operands
    ------------------------------------
    Ra             Coordinates 
    Rb             Store data 
    #tsPtrIdxU13   This immediate index (word address) is used to fetch the packed header+sampler pointer entry from constant cache.  The bank from which
                   it is fetched  is determined by bundle state. The constant bank entry is 32 bit structure of the form
                   "samplerPtr[31:20] | headerPtr[19:0]". (Surface instructions ignore sample pointers).
                   Any header pointer greater than one specified in SetTexHeaderPoolC.MaximumIndex  will be regarded as an "invalid" texture.
    Rc             In bindless mode, Rc register is used to pass the "samplerPtr[31:20] | headerPtr[19:0]". 
                   Note: Ra/Rc cannot be RZ register.



Description

SUST stores data to pitch or blocklinear surfaces.

Register Ra specifies surface coordinates. The number of coordinates depends upon surface dimension. Ra must follow register alignment rules for given number of coordinates.

Surface Coordinate packing in Ra
.dim Ra Ra+1 Ra+2
1D S32
1D_BUFFER S32/U32
1D_ARRAY S32 U16
2D S32 S32
2D_ARRAY S32 S32 U16
3D S32 S32 S32

For 1D_BUFFER, the coordinate is S32 if .clamp is .NEAR. Otherwise, the coordinate is interpreted as U32. The 1D_ARRAY and 2D_ARRAY array indices are treated as U16, meaning only the 16 LSBs of the register value are used.

The .clamp field specifies how to clamp out of bounds addresses (too high or low).

Sc contains a pointer to texture header. The possible options for Sc are:

Size specifier for byte (.D.BA) and coordinate (.D) addressing.

Size specifier for pixel (.P) addressing.

Examples:

SUST.D.1D [R2], R3, R4;
SUST.P.3D.RG [R4], R6, 0x100; // surface header pointer is in c[state_controlled_bank][0x400]

Back to Index of Instructions