Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

store_raw (sm5 - asm)

Random-access write of 1-4 32bit components into typeless memory.

store_raw dst0[.write_mask], dstByteOffset[.select_component], src0[.swizzle]




[in] The memory address.


[in] The offset.


[in] The components to write.



This instruction performs 1-4 component *32-bit components written from src0 to dst0 at the offset in dstByteOffset. There is no format conversion.

dst0 must be a UAV (u#), or in the compute shader it can also be thread group shared memory (g#).

dstByteOffset specifies the base 32-bit value in memory for a window of 4 sequential 32-bit values in which data may be written, depending on the swizzle and mask on other parameters.

The location of the data written is equivalent to the following pseudocode which show the address, pointer to the buffer contents, and the data stored linearly.

                    BYTE *BufferContents;          // from src0
                    UINT dstByteOffset;            // source register
                    BYTE *WriteLocation;           // value to calculate

                    // calculate writing location
                    WriteLocation = BufferContents 
                                + dstByteOffset;

                    // calculate the number of components to write
                    switch (dstWriteMask)
                        x:    WriteComponents = 1; break;
                        xy:   WriteComponents = 2; break;
                        xyz:  WriteComponents = 3; break;
                        xyzw: WriteComponents = 4; break;
                        default:  // only these masks are valid                              

                    // copy the data from the the source register with
                    //    the swizzle applied
                    memcpy(WriteLocation, swizzle(src0, src0.swizzle), 
                             WriteComponents * sizeof(UINT32));

This pseudocode shows how the operation functions, but the actual data does not have to be stored linearly. dst0 can only have a write mask that is one of the following: .x, .xy, .xyz, .xyzw. The write mask determines the number of 32bit components to write without gaps.

Out of bounds addressing on u# means nothing is written to the out of bounds memory; any part that is in bounds is written correctly.

Out of bounds addressing on g# (the bounds of that particular g#, as opposed to all shared memory) for any given 32-bit component causes the entire contents of all shared memory to become undefined.

cs_4_0 and cs_4_1 support this instruction for UAV.

This instruction applies to the following shader stages:



Because UAVs are available at all shader stages for Direct3D 11.1, this instruction applies to all shader stages for the Direct3D 11.1 runtime, which is available starting with Windows 8.



Minimum Shader Model

This instruction is supported in the following shader models:

Shader ModelSupported
Shader Model 5 yes
Shader Model 4.1 no
Shader Model 4 no
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no


Related topics

Shader Model 5 Assembly (DirectX HLSL)



© 2017 Microsoft