You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: llvm/docs/DirectX/DXContainer.rst
+72Lines changed: 72 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -400,3 +400,75 @@ SFI0 Part
400
400
The SFI0 part encodes a 64-bit unsigned integer bitmask of the feature flags.
401
401
This denotes which optional features the shader requires. The flag values are
402
402
defined in `llvm/include/llvm/BinaryFormat/DXContainerConstants.def <https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/BinaryFormat/DXContainerConstants.def>`_.
403
+
404
+
405
+
Root Signature (RST0) Part
406
+
---------
407
+
.. _RST0:
408
+
409
+
The Root Signature defines the interface between the shader and the pipeline, specifying which resources are bound to the shader and how they are accessed. This structure serves as a contract between the application and the GPU, establishing a layout for resource binding that both the shader compiler and the runtime can understand.
410
+
411
+
The Root Signature consists of a header followed by a collection of root parameters and static samplers. The structure uses a versioned design with offset-based references to allow for flexible serialization and deserialization.
412
+
413
+
Root Signature Header
414
+
~~~~~~~~~~~~~~~~~~~~~~~
415
+
416
+
.. code-block:: c
417
+
418
+
struct RootSignatureHeader {
419
+
uint32_t Version;
420
+
uint32_t NumParameters;
421
+
uint32_t ParametersOffset;
422
+
uint32_t NumStaticSamplers;
423
+
uint32_t StaticSamplerOffset;
424
+
uint32_t Flags;
425
+
}
426
+
427
+
428
+
The `RootSignatureHeader` structure contains the top-level information about a root signature:
429
+
430
+
- **Version**: Specifies the version of the root signature format. This allows for backward compatibility as the format evolves.
431
+
- **NumParameters**: The number of root parameters contained in this root signature.
432
+
- **ParametersOffset**: Byte offset from the beginning to the array of root parameters header.
433
+
- **NumStaticSamplers**: The number of static samplers defined in the root signature.
434
+
- **StaticSamplerOffset**: Byte offset from the beginning to the array of static samplers.
435
+
- **Flags**: Bit flags that define global behaviors for the root signature, such as whether to deny vertex shader access to certain resources.
436
+
437
+
This header allows readers to navigate the binary representation of the root signature by providing counts and offsets to locate each component within the serialized data.
438
+
439
+
Root Parameter Header
440
+
~~~~~~~~~~~~~~~~~~~~~~~
441
+
442
+
.. code-block:: c
443
+
444
+
struct RootParameterHeader {
445
+
dxbc::RootParameterType ParameterType;
446
+
dxbc::ShaderVisibility ShaderVisibility;
447
+
uint32_t ParameterOffset;
448
+
};
449
+
450
+
451
+
Each root parameter in the signature is preceded by a `RootParameterHeader` that describes the parameter's basic attributes:
452
+
453
+
- **ParameterType**: Enumeration indicating what type of parameter this is (e.g., descriptor table, constants, CBV, SRV, UAV).
454
+
- **ShaderVisibility**: Specifies which shader stages can access this parameter (e.g., all stages, vertex shader only, pixel shader only).
455
+
- **ParameterOffset**: Byte offset from the beginning to the specific parameter data structure for this entry.
456
+
457
+
The header uses a parameter type field rather than encoding the version of the parameter through size, allowing for a more explicit representation of the parameter's nature.
458
+
459
+
Root Parameters
460
+
~~~~~~~~~~~~~~~~~~~~~~~
461
+
462
+
.. code-block:: c
463
+
464
+
union RootParameter {
465
+
RootConstants Constants;
466
+
};
467
+
468
+
The `RootParameter` union represents the various types of parameters that can be specified in a root signature. Such includes:
469
+
470
+
- **Constants**: Represents inline root constants that are directly embedded in the root signature and passed to the shader without requiring a constant buffer resource.
471
+
472
+
Each specific parameter type will have its own structure with fields relevant to that parameter type. For example, `RootConstants` would include information about the register binding, count of 32-bit values, and other properties specific to constant parameters.
473
+
474
+
When processing root parameters, readers should first check the `ParameterType` field in the corresponding header to determine which member of the union to access.
0 commit comments