diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-21 15:28:23 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-21 16:55:55 -0500 |
| commit | f43bead2846db862dd0e0aa42ce63cc958bd3203 (patch) | |
| tree | 76c24dd61c44a585516336e646d38ad1d9fd09fd /runtime/src/main.cpp | |
| parent | 3fae38a7a16ef1e9803349495598ff79510a8296 (diff) | |
Runtime: GFX10 T#, S# and V# descriptors (encode, decode, Vulkan mappings)
docs/d3d12_vulkan.md section 5.3 asks for a C++ decoder of the structures the
shaders read from descriptor heaps, and section 3.4 for the layer to write them
in Create*View and CreateSampler. runtime/src/gfx10_descriptors.h is that
piece, as a header with no Windows dependency; nothing uses it yet.
- T# (image, 8 dwords), S# (sampler, 4) and V# (buffer, 4): encode from and
decode to plain structs. Field positions are Mesa's register database
(src/amd/registers/gfx10-rsrc.json, the gfx103 types), enum values its
gfx6.json, and what goes where follows ac_descriptors.c and radv. They agree
with what the translator reads: T# FORMAT at word 1 bits 28:20, the V# base,
stride, NUM_RECORDS, FORMAT and DST_SEL.
- Only what a Vulkan view or sampler needs is encoded; tiling, compression
metadata and tuning fields are written as zero and ignored when decoding.
- decode refuses dwords whose TYPE is not an image's (so a V# in a 32-byte heap
slot is told apart), a reserved DST_SEL, and ranges that end before they
start.
- Format table: GFX10_FORMAT code <-> VkFormat with each format's channel
order as a DST_SEL (BGRA8 is 8_8_8_8 read as Z, Y, X, W), the view format for
a T# on an image, DST_SEL -> VkComponentMapping, S# -> VkSamplerCreateInfo,
T# type -> VkImageViewType (a cube is a 2D array, as the translator samples
it).
Tests: gfx10_descriptors_test (ctest, Vulkan headers only): every field alone
at its bit position, round trips, refusals, the T#s cs_imgstore.asm builds,
the V# as the translator reads it, sampler words as radv writes them, the
format table and the mappings. tests/test_gfx10_descriptors.py reads the
table out of the header and checks each code's name against
tools/gfx10_formats.json and each Vulkan format's layout against that name.
Moving FORMAT by one bit, or giving a row another code, fails them.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/main.cpp')
0 files changed, 0 insertions, 0 deletions