-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
Implement the CheckAccessFullyMapped HLSL function in hlsl_intrinsics.h.
To match DXC when targeting DirectX, this operation can essentially just be a cast from uint to bool - the backend already handles inserting the DXIL op where necessary when the status of a load, gather, or sample is used, as per https://llvm.org/docs/DirectX/DXILResources.html#loads-samples-and-gathers.
For SPIR-V DXC maps this to OpImageSparseTexelsResident (See https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst). In this case it does not appear to behave simply as a cast to bool and might need more work.
DirectX
| DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
|---|---|---|---|
| 71 | CheckAccessFullyMapped | 6.0 | () |
SPIR-V
OpImageSparseTexelsResident:
Description:
Translates a Resident Code into a Boolean. Result is false if any
of the texels were in uncommitted texture memory, and true
otherwise.
Result Type must be a Boolean type scalar.
Resident Code is a value from an OpImageSparse… instruction that
results in a resident code.
Capability:
SparseResidency
| Word Count | Opcode | Results | Operands | |
|---|---|---|---|---|
4 |
316 |
<id> |
<id> |
Test Case(s)
Example 1
//dxc CheckAccessFullyMapped_test.hlsl -T lib_6_8 -enable-16bit-types -O0
RWBuffer<float4> g_buffer;
[numthreads(1, 1, 1)]
[shader("pixel")]
bool fn( ) : SV_Target {
uint p1;
float4 data = g_buffer.Load(0, p1);
return CheckAccessFullyMapped(p1);
}HLSL:
Determines whether all values from a Sample, Gather, or Load operation accessed mapped tiles in a tiled resource.
Syntax
bool CheckAccessFullyMapped(
in uint_only status
);Parameters
-
status [in]
-
Type: uint_only
The status value that is returned from a Sample, Gather, or Load operation. Because you can't access this status value directly, you need to pass it to CheckAccessFullyMapped.
Return value
Type: bool
Returns a Boolean value that indicates whether all values from a Sample, Gather, or Load operation accessed mapped tiles in a tiled resource. Returns TRUE if all values from the operation accessed mapped tiles; otherwise, returns FALSE if any values were taken from an unmapped tile.
Remarks
Minimum Shader Model
This function is supported in the following shader models.
| Shader Model | Supported |
|---|---|
| Shader Model 5 and higher shader models | yes |
This function is supported in the following types of shaders:
| Vertex | Hull | Domain | Geometry | Pixel | Compute |
|---|---|---|---|---|---|
| x | x |
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status