HLSL tiled resources exposure
New Microsoft High Level Shader Language (HLSL) syntax is required to support tiled resources in Shader Model 5.
The new HLSL syntax is allowed only on devices with tiled resources support. Each relevant HLSL method for tiled resources in the following table accepts either one (feedback) or two (clamp and feedback in this order) additional optional parameters. For example, a Sample method is:
Sample(sampler, location [, offset [, clamp [, feedback] ] ])
An example of a Sample method is Texture2D.Sample(S,float,int,float,uint).
The offset, clamp and feedback parameters are optional. You must specify all optional parameters up to the one you need, which is consistent with the C++ rules for default function arguments. For example, if the feedback status is needed, both offset and clamp parameters need to be explicitly supplied to Sample, even though they may not be logically needed.
The clamp parameter is a scalar float value. The literal value of clamp=0.0f indicates that the clamp operation isn't performed.
The feedback parameter is a uint variable that you can supply to the memory-access querying intrinsic CheckAccessFullyMapped function. You must not modify or interpret the value of the feedback parameter; but, the compiler doesn't provide any advanced analysis and diagnostics to detect whether you modified the value.
Here is the syntax of CheckAccessFullyMapped:
bool CheckAccessFullyMapped(in uint FeedbackVar);
CheckAccessFullyMapped interprets the value of FeedbackVar and returns true if all data being accessed was mapped in the resource; otherwise, CheckAccessFullyMapped returns false.
If either the clamp or feedback parameter is present, the compiler emits a variant of the basic instruction. For example, sample of a tiled resource generates the
sample_cl_s instruction. If neither clamp nor feedback is specified, the compiler emits the basic instruction, so that there is no change from the current behavior. The clamp value of 0.0f indicates that no clamp is performed; thus, the driver compiler can further tailor the instruction to the target hardware. If feedback is a NULL register in an instruction, the feedback is unused; thus, the driver compiler can further tailor the instruction to the target architecture.
If the HLSL compiler infers that clamp is 0.0f and feedback is unused, the compiler emits the corresponding basic instruction (for example,
sample rather than
If a tiled resource access consists of several constituent byte code instructions, for example, for structured resources, the compiler aggregates individual feedback values via the OR operation to produce the final feedback value. Therefore, you see a single feedback value for such a complex access.
This is the summary table of HLSL methods that are changed to support feedback and/or clamp. These all work on tiled and non-tiled resources of all dimensions. Non-tiled resources always appear to be fully mapped.
|HLSL objects||Intrinsic methods with feedback option (*) - also has clamp option|