Skip to content
Merged
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3570,6 +3570,9 @@ if(EXISTS "${INTAKE_PYTHON}")
# A typed buffer load of BUF_FMT_16_16_16_16_FLOAT reads four halves from one 8-byte element (#1695).
add_test(NAME startup_gfx2hlsl_tbuffer_16f COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_16f_check.py")
# A typed buffer load of BUF_FMT_2_10_10_10_UNORM reads three 10-bit fields and a 2-bit one from one dword (#1723).
add_test(NAME startup_gfx2hlsl_tbuffer_2101010 COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_tbuffer_2101010_check.py")
Comment thread
tedin7 marked this conversation as resolved.
Resolved
# The draw's DXGI -> FORMAT table for typed views read by buffer_load_format_* matches the translation's switch.
add_test(NAME startup_buffer_format_word3_table COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_buffer_format_word3_table_check.py")
Expand Down
5 changes: 4 additions & 1 deletion docs/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ ctest --preset dev --no-tests=error -R '^startup_vertex_fetch_formats_(controls|

`BUF_FMT_16_16_SNORM` (format 24, DXGI `R16G16_SNORM` 37) sign-extends each half, divides by 32767 and clamps to -1.0, so -32768 and -32767 both give -1.0 (the Direct3D and Vulkan SNORM rule, as in LLVM 15 and Mesa `ac_formats`). The device run compares `round(v * 32767)` against the same byte decode, with a wrong reference that reads the halves unsigned and a mutated translation that does the same. The pattern the harness writes to t0 holds no 0x8000, so `startup_vertex_fetch_formats_controls` also evaluates the emitted expressions on 0x8000, 0x8001, 0x7fff, 0x0000, 0xffff and 0x4000 in each half, and four wrong forms (unsigned read, no clamp, divisor 32768, one half for both) must fail that check. The D3D12 draw has not been run on Linux.

`BUF_FMT_2_10_10_10_UNORM` (gfx10 format 50, DXGI `R10G10B10A2_UNORM` 24) reads one dword with x, y and z as 10-bit fields in bits 9:0, 19:10 and 29:20 and w as the 2-bit field in bits 31:30, each divided by its maximum (1023, 1023, 1023, 3). This is the 10-bit-x layout that Mesa maps R10G10B10A2 to; `BUF_FMT_10_10_10_2_UNORM` (format 44) has a 2-bit x and is not added here. It is checked on Linux by the Python evaluation `startup_gfx2hlsl_tbuffer_2101010`, which also covers the DXGI table entry; the D3D12 draws `startup_vertex_fetch_formats_warp` and `startup_vertex_fetch_formats_hardware` read it back (stride 6 / offset 2 and through the descriptor path).


In a graphics shader with only forward branches, a 32-bit root-table pointer
can be advanced by a literal byte offset and copied with `s_mov_b32`. At a
join the table and its offset must agree on every incoming path. A later
Expand All @@ -421,7 +424,7 @@ manifest's byte offset changes all 32 pixels and preserves the green values.

A typed buffer view that the title creates through the runtime (`CreateShaderResourceView`, `BUFFER`, no flags, no structure stride) leaves no hardware descriptor in the table. For this case the draw builds word 3 the way the console driver builds it from the view, using `view_word3()` in `src/startup_stubs/buffer_format_word3.h`:

- FORMAT is the code of the DXGI format whose typed read gives the same components. The 14 formats in the switch are covered: `R8_UNORM` 1, `R8_UINT` 5, `R8G8_UNORM` 14, `R32_FLOAT` 22, `R16G16_UNORM` 23, `R16G16_SNORM` 24, `R16G16_UINT` 27, `R16G16_FLOAT` 29, `R8G8B8A8_UNORM` 56, `R8G8B8A8_UINT` 60, `R32G32_FLOAT` 64, `R16G16B16A16_FLOAT` 71, `R32G32B32_FLOAT` 74 and `R32G32B32A32_FLOAT` 77. The codes are the LLVM 15 `llvm-mc -mcpu=gfx1013` encodings of the tbuffer `format:` operand.
- FORMAT is the code of the DXGI format whose typed read gives the same components. The 15 formats in the switch are covered: `R8_UNORM` 1, `R8_UINT` 5, `R8G8_UNORM` 14, `R32_FLOAT` 22, `R16G16_UNORM` 23, `R16G16_SNORM` 24, `R16G16_UINT` 27, `R16G16_FLOAT` 29, `R10G10B10A2_UNORM` 50, `R8G8B8A8_UNORM` 56, `R8G8B8A8_UINT` 60, `R32G32_FLOAT` 64, `R16G16B16A16_FLOAT` 71, `R32G32B32_FLOAT` 74 and `R32G32B32A32_FLOAT` 77. The codes are the LLVM 15 `llvm-mc -mcpu=gfx1013` encodings of the tbuffer `format:` operand.
- DST_SEL comes from `Shader4ComponentMapping`: a channel becomes 4 to 7, a forced 0 becomes 0 and a forced 1 becomes 1.

The draw is refused, not read as zeros, whenever a translated formatted load has no resolved word 3:
Expand Down
4 changes: 2 additions & 2 deletions docs/startup-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ The translation is refused when:
- either header has another size;
- the code reads an attribute the table does not list.

The shader cache revision is `x2w-startup-shader-19`. Revision 19 folds `s_mov_b32` from a scalar register that
The shader cache revision is `x2w-startup-shader-20`. Revision 20 decodes MTBUF/MUBUF format 50 (`R10G10B10A2_UNORM`) in the run-time FORMAT switch, so cached shaders from revision 19 are not reused. Revision 19 folds `s_mov_b32` from a scalar register that
holds a plain constant, so later reads of the copy use the constant word. The matching compute
(`x2w-startup-shader-19cs`) key advances because that stage uses the shared lowering. The fixed slot 57 mesh
(`x2w-startup-shader-20cs`) key advances because that stage uses the shared lowering. The fixed slot 57 mesh
(`x2w-startup-mesh-57-3`) key stays, because that shader is not translated from guest code.
Revisions before 19 read a register copied from a constant as a run-time value.
Revision 18 preserves the sign of zero in floating-point min, max, min3, max3 and med3.
Expand Down
1 change: 1 addition & 0 deletions src/startup_stubs/buffer_format_word3.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ inline std::uint32_t buffer_format_code(DXGI_FORMAT format)
case DXGI_FORMAT_R16G16_SNORM: return 24;
case DXGI_FORMAT_R16G16_UINT: return 27;
case DXGI_FORMAT_R16G16_FLOAT: return 29;
case DXGI_FORMAT_R10G10B10A2_UNORM: return 50;
case DXGI_FORMAT_R8G8B8A8_UNORM: return 56;
case DXGI_FORMAT_R8G8B8A8_UINT: return 60;
case DXGI_FORMAT_R32G32_FLOAT: return 64;
Expand Down
4 changes: 2 additions & 2 deletions src/startup_stubs/d3d12_draw.inl
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ Translation* cached_translation(const void* a, std::size_t a_bytes, const void*
{
// Keep pre-fix desktop bytecode and manifests out of this ABI's cache.
// tools/startup/gfx2hlsl.py hashes the same bytes, without a trailing NUL.
constexpr char revision[] = "x2w-startup-shader-19";
constexpr char revision[] = "x2w-startup-shader-20";
const u64 seed = fnv_bytes(revision, sizeof(revision) - 1);
u64 key = fnv_bytes(root_blob.data(), root_blob.size(), fnv_bytes(b, b_bytes, fnv_bytes(a, a_bytes, seed)));
// A stream's input layout (stream_input_layout) feeds the vertex fetch, so it is part of the key.
Expand Down Expand Up @@ -474,7 +474,7 @@ u64 publish_compute_request(const void* desc)
std::vector<unsigned char> fields(sizeof(words));
words[0] = words[1] = words[3] = words[5] = words[7] = words[9] = words[10] = 0;
std::memcpy(fields.data(), words, sizeof(words));
constexpr char compute_revision[] = "x2w-startup-shader-19cs"; // tools/startup/gfx2hlsl.py compute_key
constexpr char compute_revision[] = "x2w-startup-shader-20cs"; // tools/startup/gfx2hlsl.py compute_key
u64 key = fnv_bytes(compute_revision, sizeof(compute_revision) - 1);
const std::vector<unsigned char>* order[] = {&code, &data, &root_blob, &fields, &state_a, &state_b};
for (const auto* part : order) key = fnv_part(*part, key);
Expand Down
2 changes: 1 addition & 1 deletion src/startup_stubs/formatted_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ constexpr bool formatted_buffer_supported(std::uint32_t code)
{
switch (code) {
case 1: case 5: case 14: case 22: case 23: case 24: case 27:
case 29: case 56: case 60: case 64: case 71: case 74: case 77:
case 29: case 50: case 56: case 60: case 64: case 71: case 74: case 77:
return true;
default:
return false;
Expand Down
4 changes: 3 additions & 1 deletion tests/startup_buffer_format_word3_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ int main(int argc, char** argv)
std::uint32_t word = 0;
check("float4 identity", !x2w_startup::view_word3(typed(DXGI_FORMAT_R32G32B32A32_FLOAT), word) &&
word == (77u << 12 | identity));
check("R10G10B10A2 unorm identity", !x2w_startup::view_word3(typed(DXGI_FORMAT_R10G10B10A2_UNORM), word) &&
word == (50u << 12 | identity));
check("half2 identity", !x2w_startup::view_word3(typed(DXGI_FORMAT_R16G16_FLOAT), word) && word == (29u << 12 | identity));
check("snorm2 identity", !x2w_startup::view_word3(typed(DXGI_FORMAT_R16G16_SNORM), word) && word == (24u << 12 | identity));
check("uint8 identity", !x2w_startup::view_word3(typed(DXGI_FORMAT_R8_UINT), word) && word == (5u << 12 | identity));
Expand All @@ -59,7 +61,7 @@ int main(int argc, char** argv)
const DXGI_FORMAT decoded[] = {DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R32_FLOAT,
DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT,
DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R8G8B8A8_UINT};
DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R10G10B10A2_UNORM};
for (DXGI_FORMAT f : decoded) {
const std::uint32_t code = x2w_startup::buffer_format_code(f);
if (!code || !x2w_startup::formatted_buffer_supported(code)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/startup_buffer_format_word3_table_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Public DXGI_FORMAT values (dxgiformat.h) for the names the header uses.
DXGI = {'R32G32B32A32_FLOAT': 2, 'R32G32B32_FLOAT': 6, 'R16G16B16A16_FLOAT': 10, 'R32G32_FLOAT': 16,
'R8G8B8A8_UNORM': 28, 'R16G16_FLOAT': 34, 'R16G16_UNORM': 35, 'R16G16_UINT': 36, 'R16G16_SNORM': 37, 'R8G8B8A8_UINT': 30, 'R32_FLOAT': 41,
'R8G8B8A8_UNORM': 28, 'R10G10B10A2_UNORM': 24, 'R16G16_FLOAT': 34, 'R16G16_UNORM': 35, 'R16G16_UINT': 36, 'R16G16_SNORM': 37, 'R8G8B8A8_UINT': 30, 'R32_FLOAT': 41,
'R8G8_UNORM': 49, 'R8_UNORM': 61, 'R8_UINT': 62}
# The buffer format each DXGI format reads as: FETCH_DXGI, plus the three formats it does not list.
EXPECTED = {**{dxgi: name for dxgi, (name, _) in gfx2hlsl.FETCH_DXGI.items()},
Expand Down
4 changes: 2 additions & 2 deletions tests/startup_compute_request_offline_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
DESC = struct.pack('<12Q', 0, 0, 24, 0, 20, 0, len(CODE), 0, len(DATA), 0, 0, 11)
STATE_A = struct.pack('<3Q', 1, 0x2c, 0xfff0000000000003)
STATE_B = struct.pack('<5I', 0x1234abcd, 0xffff0000, 0, 0, 0)
KEY = 0x63ac0aa21c46da1c # framed key at revision 19cs
KEY = 0x88e751913fcbf7a8 # framed key at revision 20cs


def framed_key():
h = 1469598103934665603
for b in b'x2w-startup-shader-19cs':
for b in b'x2w-startup-shader-20cs':
h = ((h ^ b) * 1099511628211) & 0xffffffffffffffff
for part in (CODE, DATA, ROOT, DESC, STATE_A, STATE_B):
for b in struct.pack('<Q', len(part)) + part:
Expand Down
2 changes: 1 addition & 1 deletion tests/startup_gfx2hlsl_buffer_store_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def main():

# 8. The cache revision moved, so a translation from before the store lowering is never loaded.
check('cache key uses revision 19', G.pipeline_key(b'a', b'b', ROOT) ==
G.fnv(ROOT, G.fnv(b'b', G.fnv(b'a', G.fnv(b'x2w-startup-shader-19')))))
G.fnv(ROOT, G.fnv(b'b', G.fnv(b'a', G.fnv(b'x2w-startup-shader-20')))))

if failures:
print('FAILED: ' + ', '.join(failures))
Expand Down
2 changes: 1 addition & 1 deletion tests/startup_gfx2hlsl_const_copy_join_check.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""`s_mov_b32` copy of a plain constant SGPR in tools/startup/gfx2hlsl.py: run-time write and join.

The copy folds the constant into later reads (revision x2w-startup-shader-19), and these two cases pin what must
The copy folds the constant into later reads (revision x2w-startup-shader-20), and these two cases pin what must
stay true next to the fold:
- the copy still assigns its register at run time (`s12 = ...;` is emitted), so a reader the fold does not reach
(a branch target after a join) sees a real value;
Expand Down
4 changes: 2 additions & 2 deletions tests/startup_gfx2hlsl_fract_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def float_capped(word):
repr((seed and seed.group(1), literal and literal.group(1))))
check('the two literals are identical', seed and literal and seed.group(1) == literal.group(1),
repr((seed and seed.group(1), literal and literal.group(1))))
check('the revision is x2w-startup-shader-19, after the fold of a copy of a plain constant scalar register',
bool(seed and seed.group(1) == 'x2w-startup-shader-19'), repr(seed and seed.group(1)))
check('the revision is x2w-startup-shader-20, after format 50 (R10G10B10A2_UNORM) joined the FORMAT switch',
bool(seed and seed.group(1) == 'x2w-startup-shader-20'), repr(seed and seed.group(1)))


def key_from_seed(word):
Expand Down
125 changes: 125 additions & 0 deletions tests/startup_gfx2hlsl_tbuffer_2101010_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
"""Packed 2-10-10-10 UNORM typed buffer loads in tools/startup/gfx2hlsl.py (Part of #1723).

usage: startup_gfx2hlsl_tbuffer_2101010_check.py

`BUF_FMT_2_10_10_10_UNORM` stores x, y and z as 10-bit fields and w as a 2-bit field in one dword, lowest bits
first. The format table did not name it, so a typed load of it was refused with
`buffer format BUF_FMT_2_10_10_10_UNORM`. DXGI_FORMAT_R10G10B10A2_UNORM (24) in an input layout maps to it.

The instruction bytes are constructed here from the field layout the checked-in decoder reads
(`tools/disasm_rdna2.py`, the MTBUF branch): no game-derived bytes are used. Each case encodes the instruction,
decodes it, translates it, and then evaluates the emitted component expressions against a reference that
decodes the same dword from the format definition (UNORM n / (2^bits - 1)).
"""
import os
import re
import struct
import sys

here = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(here, '..', 'tools'))
sys.path.insert(0, os.path.join(here, '..', 'tools', 'startup'))
import gfx2hlsl as G # noqa: E402

failures = []


def check(label, condition, detail=''):
print(f"{label}: {'ok' if condition else 'MISMATCH'}")
if not condition:
failures.append(label)
if detail:
print(' ' + detail)


MTBUF_LOAD = {'x': 0, 'xy': 1, 'xyz': 2, 'xyzw': 3}
MTBUF_FORMAT_2_10_10_10_UNORM = 50
MTBUF_FORMAT_2_10_10_10_SNORM = 51 # a sibling the table must keep refusing


def encode_mtbuf(op, fmt, *, vdata=0, vaddr=0, srsrc=4, soffset=128):
"""Encode one MTBUF instruction (idxen); returns the 8 bytes the decoder reads."""
w0 = (0b111010 << 26) | ((fmt & 0x7f) << 19) | ((op & 0x7) << 16) | (1 << 13)
w1 = (vaddr & 0xff) | ((vdata & 0xff) << 8) | (((srsrc // 4) & 0x1f) << 16) | (((op >> 3) & 1) << 21) | (soffset << 24)
return struct.pack('<II', w0, w1)


class Pipeline:
def __init__(self):
self.resources, self.notes, self.modified = {}, set(), set()

def resource(self, key, kind):
entry = self.resources.setdefault(key, dict(index=len(self.resources), kind=kind))
return 'r%d' % entry['index']

def ud(self, source):
return 0


class Stage(G.Stage):
def __init__(self):
self.lines, self.sym = [], {}
self.used_s, self.used_v, self.uniform_v = set(), set(), set()
self.exec_known = True
self.exports = {}
self.pipe = Pipeline()

def descriptor(self, tok):
return ('buffer', tok)


def translate_bytes(code):
decoded = G.decode(code)
stage = Stage()
for _offset, _size, name, asm in decoded:
stage.one(name, asm)
return [asm for _o, _s, _n, asm in decoded], stage.lines


def run_components(lines, word):
"""Evaluate the emitted `vN = <expr>;` lines with `w` bound to the loaded dword; returns {N: value}."""
out = {}
for line in lines:
m = re.fullmatch(r'v(\d+) = (.*);', line.strip())
if m:
out[int(m.group(1))] = eval(m.group(2), {'U': lambda x: x, 'ldu': lambda *_: 0}, {'w': word})
return out


def reference(word):
return [(word & 1023) / 1023.0, ((word >> 10) & 1023) / 1023.0, ((word >> 20) & 1023) / 1023.0, (word >> 30) / 3.0]


code = encode_mtbuf(MTBUF_LOAD['xyzw'], MTBUF_FORMAT_2_10_10_10_UNORM, vdata=1, vaddr=2, srsrc=4)
asm, lines = translate_bytes(code)
check('decodes the named format', 'BUF_FMT_2_10_10_10_UNORM' in asm[0], repr(asm))
check('the word is loaded with ldu', any('w = ldu(r0, a)' in l for l in lines), repr(lines))

for word in (0x00000000, 0xffffffff, 0x4012a3ff, 0x8007fc01, 0xc0000000, 0x2aaaaaaa, 0x155ff3d1):
got = run_components(lines, word)
want = reference(word)
check('all four components for 0x%08x' % word, [got.get(1 + i) for i in range(4)] == want,
'got %r want %r' % (got, want))

# Fewer components read the same leading fields.
_, lines_xy = translate_bytes(encode_mtbuf(MTBUF_LOAD['xy'], MTBUF_FORMAT_2_10_10_10_UNORM, vdata=1, vaddr=2))
got = run_components(lines_xy, 0x4012a3ff)
check('the xy form reads two components', sorted(got) == [1, 2] and [got[1], got[2]] == reference(0x4012a3ff)[:2], repr(got))

# The input-layout mapping: DXGI_FORMAT_R10G10B10A2_UNORM is 24, one dword per element.
check('DXGI 24 maps to the format', G.FETCH_DXGI.get(24) == ('BUF_FMT_2_10_10_10_UNORM', 4), repr(G.FETCH_DXGI.get(24)))

# A sibling format stays refused.
try:
translate_bytes(encode_mtbuf(MTBUF_LOAD['xyzw'], MTBUF_FORMAT_2_10_10_10_SNORM, vdata=1, vaddr=2))
refused = False
except G.Unsupported:
refused = True
check('the SNORM sibling stays refused', refused)

if failures:
print('FAIL')
for text in failures:
print(' ' + text)
sys.exit(1)
print('PASS')
2 changes: 1 addition & 1 deletion tests/startup_indirect_draw_indexed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ ComPtr<IUnknown> translated_pipeline(ID3D12Device* guest, ID3D12RootSignature* r
bool needs_start, bool table_buffer = false, bool indexed = false, bool rect = false)
{
// The opaque guest programs identify synthetic cache entries. The actual bound shaders are source-built DXBC.
constexpr char revision[] = "x2w-startup-shader-19";
constexpr char revision[] = "x2w-startup-shader-20";
static std::uint32_t vertex_ids[]{0xe0000101, 0xe0000102, 0xe0000103};
static std::uint32_t pixel_ids[]{0xe0000202, 0xe0000203, 0xe0000204};
auto& vertex_id = vertex_ids[indexed ? 2 : needs_start];
Expand Down
2 changes: 1 addition & 1 deletion tests/startup_packed_position_provenance_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def refused(label, cache, key, reason):
cache = Path(tmp)
bare = G.pipeline_key(VS_WORDS, ps_words(4), root_blob())
check('without a description the key is unchanged',
bare == G.fnv(root_blob(), G.fnv(ps_words(4), G.fnv(VS_WORDS, G.fnv(b'x2w-startup-shader-19')))))
bare == G.fnv(root_blob(), G.fnv(ps_words(4), G.fnv(VS_WORDS, G.fnv(b'x2w-startup-shader-20')))))
keys = [put_request(cache, ps_words(4), masks) for masks in (TARGET, SAME_V4, DECOY)]
check('same stages, root and layout with three mask pairs: three request identities',
len(set(keys)) == 3 and bare not in keys
Expand Down
2 changes: 1 addition & 1 deletion tests/startup_resource_retire_title.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ constexpr UINT draw_side = 4; // 4x4 R8G8B8A8_UNORM target
constexpr UINT draw_covered = 3; // scissor leaves the last row and column untouched as the sentinel
constexpr int draw_seed = 77;
constexpr UINT draw_clear_pixel = 0xffff00ffu; // ClearRenderTargetView({1, 0, 1, 1}) in R8G8B8A8_UNORM
constexpr char draw_revision[] = "x2w-startup-shader-19"; // d3d12_draw.inl cached_translation
constexpr char draw_revision[] = "x2w-startup-shader-20"; // d3d12_draw.inl cached_translation

constexpr char draw_vertex_shader[] = R"(
struct Varying { float4 position : SV_Position; };
Expand Down
6 changes: 3 additions & 3 deletions tests/startup_shader_cache_key_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def check_request(blobs, key, diagnostic=None, rtv_request=None, layout=None):

def main():
# Independently executed C++ runtime fnv_bytes/cached_translation known-answer vector.
# Revision x2w-startup-shader-19 excludes NUL. Stored order is a, b, root, then optional input layout.
# Revision x2w-startup-shader-20 excludes NUL. Stored order is a, b, root, then optional input layout.
vector = (b"\x00VS\xff", b"PS\x00\x80", b"RTS0\x00")
assert gfx2hlsl.pipeline_key(*vector) == 0xf3444b13fe09b4df
assert gfx2hlsl.pipeline_key(*vector, b"ia\x00\xfe") == 0x2039e248f9cad09f
assert gfx2hlsl.pipeline_key(*vector) == 0x4564b4bb15aa0b9b
assert gfx2hlsl.pipeline_key(*vector, b"ia\x00\xfe") == 0x8a4952a88d16d6e3
blobs = (VERTEX, PIXEL, ROOT)
canonical = gfx2hlsl.pipeline_key(*blobs)
check_request(blobs, canonical)
Expand Down
Loading
Loading