Skip to content

Commit 1c1b2b4

Browse files
tests: Add exploratory test for bindless heap out of bounds.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
1 parent d1a51dd commit 1c1b2b4

File tree

5 files changed

+196
-1
lines changed

5 files changed

+196
-1
lines changed

tests/d3d12_bindless.c

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,4 +1559,115 @@ void test_divergent_buffer_index_varying(void)
15591559
ID3D12Resource_Release(ibo);
15601560
ID3D12Resource_Release(cbv);
15611561
destroy_test_context(&context);
1562+
}
1563+
1564+
void test_resource_heap_out_of_bounds(void)
1565+
{
1566+
#if 1
1567+
/* NV behavior is to mask the index by (1 << 20) - 1, which can read unexpected descriptors as it wraps around.
1568+
* AMD behavior is like RADV, a non-robust load from raw BDA. I observed that it ends up reading random-looking data. */
1569+
skip("Skipping unstable, exploratory test which demonstrates that neither NV nor AMD deal with OOB heap in a deterministic way.\n");
1570+
return;
1571+
#else
1572+
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
1573+
D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc;
1574+
D3D12_ROOT_PARAMETER root_parameters[3];
1575+
ID3D12DescriptorHeap *resource_heap;
1576+
ID3D12Resource *heap_index_buffer;
1577+
D3D12_DESCRIPTOR_RANGE desc_range;
1578+
ID3D12Resource *output_buffer;
1579+
ID3D12Resource *input_buffer;
1580+
struct resource_readback rb;
1581+
struct test_context context;
1582+
unsigned int i;
1583+
1584+
#include "shaders/bindless/headers/resource_heap_out_of_bounds.h"
1585+
1586+
/* Try to break drivers. POT is to try to suss out any u32 overflows in addr computation. */
1587+
static const uint32_t heap_indices[32] = {
1588+
0, 1, 2, 3, 4, 5, 6, 7,
1589+
8, 9, 10, 11, 100, 1000, 10000, 100000,
1590+
10000000, 10000000, UINT32_MAX, 1 << 19, 1 << 20, 1000001, (1 << 20) + 1,
1591+
1u << 23, 1u << 24, 1u << 25, 1u << 26, 1u << 27, 1u << 28, 1u << 29,
1592+
};
1593+
1594+
static const uint32_t input_data[12] = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200 };
1595+
1596+
if (!init_compute_test_context(&context))
1597+
return;
1598+
1599+
heap_index_buffer = create_upload_buffer(context.device, sizeof(heap_indices), heap_indices);
1600+
input_buffer = create_upload_buffer(context.device, sizeof(input_data), input_data);
1601+
output_buffer = create_default_buffer(context.device, 256 * 2 * sizeof(uint32_t),
1602+
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COMMON);
1603+
resource_heap = create_gpu_descriptor_heap(context.device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 12);
1604+
1605+
for (i = 0; i < ARRAY_SIZE(input_data); i++)
1606+
{
1607+
memset(&srv_desc, 0, sizeof(srv_desc));
1608+
srv_desc.Format = DXGI_FORMAT_UNKNOWN;
1609+
srv_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
1610+
srv_desc.ViewDimension = D3D12_SRV_DIMENSION_BUFFER;
1611+
srv_desc.Buffer.FirstElement = i;
1612+
srv_desc.Buffer.NumElements = 1;
1613+
srv_desc.Buffer.StructureByteStride = 4;
1614+
ID3D12Device_CreateShaderResourceView(context.device, input_buffer, &srv_desc, get_cpu_descriptor_handle(&context, resource_heap, i));
1615+
}
1616+
1617+
memset(&root_signature_desc, 0, sizeof(root_signature_desc));
1618+
root_signature_desc.Flags =
1619+
D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED;
1620+
root_signature_desc.pParameters = root_parameters;
1621+
root_signature_desc.NumParameters = ARRAY_SIZE(root_parameters);
1622+
memset(root_parameters, 0, sizeof(root_parameters));
1623+
root_parameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
1624+
root_parameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
1625+
root_parameters[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
1626+
root_parameters[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_SRV;
1627+
root_parameters[2].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
1628+
root_parameters[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
1629+
root_parameters[2].DescriptorTable.NumDescriptorRanges = 1;
1630+
root_parameters[2].DescriptorTable.pDescriptorRanges = &desc_range;
1631+
desc_range.BaseShaderRegister = 0;
1632+
desc_range.NumDescriptors = UINT32_MAX;
1633+
desc_range.OffsetInDescriptorsFromTableStart = 0;
1634+
desc_range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
1635+
desc_range.RegisterSpace = 1;
1636+
1637+
create_root_signature(context.device, &root_signature_desc, &context.root_signature);
1638+
context.pipeline_state = create_compute_pipeline_state(context.device, context.root_signature, resource_heap_out_of_bounds_dxil);
1639+
ID3D12GraphicsCommandList_SetDescriptorHeaps(context.list, 1, &resource_heap);
1640+
ID3D12GraphicsCommandList_SetComputeRootSignature(context.list, context.root_signature);
1641+
ID3D12GraphicsCommandList_SetPipelineState(context.list, context.pipeline_state);
1642+
ID3D12GraphicsCommandList_SetComputeRootUnorderedAccessView(context.list, 0, ID3D12Resource_GetGPUVirtualAddress(output_buffer));
1643+
ID3D12GraphicsCommandList_SetComputeRootShaderResourceView(context.list, 1, ID3D12Resource_GetGPUVirtualAddress(heap_index_buffer));
1644+
ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(context.list, 2, ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(resource_heap));
1645+
ID3D12GraphicsCommandList_Dispatch(context.list, 32, 1, 1);
1646+
1647+
transition_resource_state(context.list, output_buffer, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE);
1648+
get_buffer_readback_with_command_list(output_buffer, DXGI_FORMAT_UNKNOWN, &rb, context.queue, context.list);
1649+
1650+
for (i = 0; i < 256; i++)
1651+
{
1652+
uint32_t expected_group;
1653+
uint32_t expected_nuri;
1654+
uint32_t value_group;
1655+
uint32_t value_nuri;
1656+
1657+
expected_group = heap_indices[i / 8] < ARRAY_SIZE(input_data) ? input_data[heap_indices[i / 8]] : 0;
1658+
expected_nuri = heap_indices[i & 31] < ARRAY_SIZE(input_data) ? input_data[heap_indices[i & 31]] : 0;
1659+
1660+
value_nuri = get_readback_uint(&rb, 2 * i + 0, 0, 0);
1661+
value_group = get_readback_uint(&rb, 2 * i + 1, 0, 0);
1662+
ok(expected_group == value_group, "Group output %u (%u, heap index 0x%x): Expected %u, got %u\n", i, i / 8, heap_indices[i / 8], expected_group, value_group);
1663+
ok(expected_nuri == value_nuri, "NURI output %u (%u, heap index 0x%x): Expected %u, got %u\n", i, i & 31, heap_indices[i & 31], expected_nuri, value_nuri);
1664+
}
1665+
1666+
release_resource_readback(&rb);
1667+
ID3D12DescriptorHeap_Release(resource_heap);
1668+
ID3D12Resource_Release(heap_index_buffer);
1669+
ID3D12Resource_Release(output_buffer);
1670+
ID3D12Resource_Release(input_buffer);
1671+
destroy_test_context(&context);
1672+
#endif
15621673
}

tests/d3d12_sm_advanced.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4808,4 +4808,4 @@ void test_sm67_helper_lane_only_wave_ops(void)
48084808
for (i = 0; i < ARRAY_SIZE(psos); i++)
48094809
ID3D12PipelineState_Release(psos[i]);
48104810
destroy_test_context(&context);
4811-
}
4811+
}

tests/d3d12_tests.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,3 +446,4 @@ decl_test(test_alloca_out_of_bounds_dxbc);
446446
decl_test(test_alloca_out_of_bounds_dxil);
447447
decl_test(test_groupshared_out_of_bounds_dxbc);
448448
decl_test(test_groupshared_out_of_bounds_dxil);
449+
decl_test(test_resource_heap_out_of_bounds);
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
static const BYTE resource_heap_out_of_bounds_code_dxil[] =
2+
{
3+
0x44, 0x58, 0x42, 0x43, 0x46, 0x83, 0xb7, 0x73, 0xc1, 0x25, 0x17, 0xcd, 0x35, 0x8e, 0x7d, 0xd1, 0xd0, 0x7b, 0xb2, 0x77, 0x01, 0x00, 0x00, 0x00, 0x84, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
4+
0x38, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00,
5+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x08, 0x00, 0x00, 0x00,
6+
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x53, 0x56, 0x30, 0x98, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
8+
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
9+
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10+
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69,
11+
0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x53, 0x9f, 0xf2, 0x72, 0x60, 0x30, 0xff, 0xf8, 0x09, 0x74, 0x96,
12+
0x17, 0x32, 0x78, 0xdb, 0x44, 0x58, 0x49, 0x4c, 0x58, 0x06, 0x00, 0x00, 0x60, 0x00, 0x05, 0x00, 0x96, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
13+
0x40, 0x06, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x8d, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91,
14+
0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14,
15+
0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c,
16+
0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x86, 0xf0, 0xff, 0xff,
17+
0xff, 0xff, 0x03, 0x20, 0x01, 0xd5, 0x06, 0x62, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06,
18+
0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14,
19+
0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x23, 0x00, 0x25, 0x00, 0x14, 0xe6, 0x08, 0xc0, 0xa0, 0x0c, 0x63, 0x0c, 0x22, 0x73, 0x04, 0x08, 0x99, 0x7b, 0x86, 0xcb, 0x9f, 0xb0,
20+
0x87, 0x90, 0xfc, 0x10, 0x68, 0x86, 0x85, 0x40, 0xc1, 0x99, 0x23, 0x08, 0x8a, 0x81, 0x86, 0x19, 0x23, 0x91, 0xba, 0x69, 0xb8, 0xfc, 0x09, 0x7b, 0x08, 0xc9, 0x5f, 0x09, 0x69, 0x25, 0x26, 0x1f,
21+
0xb9, 0x6d, 0x54, 0x8c, 0x31, 0xc6, 0x28, 0x05, 0x1b, 0x68, 0x0c, 0x6a, 0x45, 0x01, 0x03, 0x8d, 0x31, 0xc6, 0x18, 0x86, 0xde, 0x40, 0xc0, 0x4c, 0x64, 0x30, 0x0e, 0xec, 0x10, 0x0e, 0xf3, 0x30,
22+
0x0f, 0x6e, 0x30, 0x0b, 0xf4, 0x20, 0x0f, 0xf5, 0x30, 0x0e, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x20, 0x0a, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, 0xc0, 0x07, 0xf5, 0xe0, 0x0e, 0xf3,
23+
0x90, 0x0e, 0xe7, 0xe0, 0x0e, 0xe5, 0x40, 0x0e, 0x60, 0x90, 0x0e, 0xee, 0x40, 0x0f, 0x7e, 0x80, 0x82, 0x41, 0x32, 0x01, 0x24, 0xd1, 0x61, 0x04, 0x61, 0x98, 0x49, 0x0e, 0xc6, 0x81, 0x1d, 0xc2,
24+
0x61, 0x1e, 0xe6, 0xc1, 0x0d, 0x64, 0xe1, 0x16, 0x66, 0x81, 0x1e, 0xe4, 0xa1, 0x1e, 0xc6, 0x81, 0x1e, 0xea, 0x41, 0x1e, 0xca, 0x81, 0x1c, 0x44, 0xa1, 0x1e, 0xcc, 0xc1, 0x1c, 0xca, 0x41, 0x1e,
25+
0xf8, 0xc0, 0x1e, 0xca, 0x61, 0x1c, 0xe8, 0xe1, 0x1d, 0xe4, 0x81, 0x0f, 0xea, 0xc1, 0x1d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xc0, 0x20, 0x1d, 0xdc, 0x81, 0x1e, 0xd8, 0x00,
26+
0x0c, 0xe4, 0xc0, 0x0f, 0xc0, 0xc0, 0x0f, 0x50, 0x60, 0xe9, 0xce, 0x11, 0x80, 0x02, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0,
27+
0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07,
28+
0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90,
29+
0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6,
30+
0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00,
31+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x04, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x08, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32+
0x00, 0x18, 0xf2, 0x28, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x69, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0xf3, 0x00, 0x01,
33+
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x1a,
34+
0x25, 0x30, 0x02, 0x50, 0x10, 0xc5, 0x50, 0x18, 0x85, 0x50, 0x03, 0x94, 0x46, 0x00, 0x28, 0x17, 0x08, 0xd5, 0x19, 0x00, 0xc2, 0x33, 0x00, 0x34, 0x67, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00,
35+
0x40, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0xc4, 0x8e, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x0c, 0x24, 0xc6, 0x05, 0xc7, 0x45, 0x86, 0x06, 0xe6, 0xc6, 0xe5, 0x06, 0x04, 0x85,
36+
0x26, 0xc6, 0xc6, 0x2c, 0x4c, 0xcc, 0x46, 0xac, 0x26, 0x65, 0x43, 0x10, 0x4c, 0x10, 0x06, 0x63, 0x82, 0x30, 0x1c, 0x1b, 0x84, 0x81, 0x98, 0x20, 0x0c, 0xc8, 0x06, 0x61, 0x30, 0x28, 0x8c, 0xcd,
37+
0x4d, 0x10, 0x86, 0x64, 0xc3, 0x80, 0x24, 0xc4, 0x04, 0x61, 0x8a, 0x08, 0x4c, 0x10, 0x06, 0x65, 0x82, 0x30, 0x2c, 0x1b, 0x84, 0xc1, 0xd9, 0x90, 0x10, 0x0b, 0x43, 0x10, 0x43, 0x43, 0x3c, 0x13,
38+
0x84, 0xea, 0x99, 0x20, 0x0c, 0xcc, 0x86, 0x64, 0x88, 0x98, 0x81, 0x90, 0x1a, 0xe2, 0xd9, 0x20, 0x40, 0xd3, 0x04, 0x01, 0x83, 0x26, 0x08, 0x49, 0xb3, 0x61, 0x21, 0x2a, 0x86, 0x20, 0x86, 0xc6,
39+
0xb2, 0xac, 0x63, 0x43, 0x70, 0x6d, 0x20, 0x28, 0x0c, 0x00, 0x26, 0x08, 0x02, 0x40, 0xa2, 0x2d, 0x2c, 0xcd, 0x6d, 0x82, 0x90, 0x39, 0x1b, 0x06, 0x63, 0x18, 0x36, 0x10, 0x04, 0xe7, 0x74, 0x1b,
40+
0x0a, 0x6d, 0x03, 0x32, 0xaf, 0x0a, 0x1b, 0x9b, 0x5d, 0x9b, 0x4b, 0x1a, 0x59, 0x99, 0x1b, 0xdd, 0x94, 0x20, 0xa8, 0x42, 0x86, 0xe7, 0x62, 0x57, 0x26, 0x37, 0x97, 0xf6, 0xe6, 0x36, 0x25, 0x20,
41+
0x9a, 0x90, 0xe1, 0xb9, 0xd8, 0x85, 0xb1, 0xd9, 0x95, 0xc9, 0x4d, 0x09, 0x8c, 0x3a, 0x64, 0x78, 0x2e, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x82, 0xa4, 0x0c,
42+
0x19, 0x9e, 0x8b, 0x5c, 0xd9, 0xdc, 0x5b, 0x9d, 0xdc, 0x58, 0xd9, 0xdc, 0x94, 0x00, 0xab, 0x43, 0x86, 0xe7, 0x52, 0xe6, 0x46, 0x27, 0x97, 0x07, 0xf5, 0x96, 0xe6, 0x46, 0x37, 0x37, 0x25, 0xf0,
43+
0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07,
44+
0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43,
45+
0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76,
46+
0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8,
47+
0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68,
48+
0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71,
49+
0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4,
50+
0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43,
51+
0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19,
52+
0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x30, 0xc3, 0x81, 0xc8, 0x01, 0x1f, 0xdc,
53+
0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xea, 0xc1, 0x1d, 0xd2, 0xc1, 0x1c, 0xde, 0x41, 0x1e, 0xda, 0x01, 0x71, 0x20, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x46, 0x40, 0x0d, 0x97, 0xef, 0x3c, 0x7e, 0x40,
54+
0x15, 0x05, 0x11, 0x95, 0x0e, 0x30, 0xf8, 0xc8, 0x6d, 0x5b, 0x41, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0x01, 0x55, 0x14, 0x44, 0xc4, 0x4e, 0x4e, 0x44, 0xf8, 0xc8, 0x6d, 0xdb, 0x80, 0x34, 0x5c, 0xbe,
55+
0xf3, 0xf8, 0x42, 0x44, 0x00, 0x13, 0x11, 0x02, 0xcd, 0xb0, 0x10, 0x16, 0x10, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x11, 0x39, 0xd4, 0x23, 0x0e, 0x3e, 0x72, 0xdb, 0x26, 0x20, 0x0d, 0x97, 0xef, 0x3c,
56+
0xfe, 0x74, 0x44, 0x04, 0x30, 0x88, 0x83, 0x8f, 0xdc, 0xb6, 0x01, 0x10, 0x0c, 0x80, 0x34, 0x00, 0x61, 0x20, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00,
57+
0x07, 0x00, 0x00, 0x00, 0x34, 0x4a, 0xae, 0x10, 0x03, 0x66, 0x00, 0x8a, 0x37, 0xa0, 0x74, 0x03, 0xca, 0xa7, 0x14, 0x03, 0xc8, 0x8c, 0x00, 0x94, 0x40, 0x19, 0x50, 0xaa, 0x01, 0x00, 0x00, 0x00,
58+
0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0xa0, 0x68, 0xcb, 0x60, 0x59, 0xd0, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x28, 0x1b, 0x53, 0x5c, 0x57, 0x34, 0x62, 0x60, 0x00, 0x20, 0x08, 0x06, 0x84, 0xa7,
59+
0x60, 0x23, 0x06, 0x06, 0x00, 0x82, 0x60, 0x40, 0x78, 0x4a, 0x56, 0x81, 0xa2, 0x23, 0x06, 0x08, 0x00, 0x82, 0x60, 0xd0, 0x78, 0x0f, 0x11, 0x6c, 0xa3, 0x09, 0x01, 0x30, 0x62, 0x80, 0x00, 0x20,
60+
0x08, 0x06, 0x0d, 0x18, 0x44, 0x46, 0xd1, 0x8d, 0x26, 0x04, 0x40, 0x0d, 0x1f, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0x42, 0x06, 0x95, 0x13, 0x06, 0xc1, 0x32, 0x62, 0x80, 0x00, 0x20, 0x08,
61+
0x06, 0x0d, 0x19, 0x54, 0x41, 0x18, 0x84, 0xc1, 0x68, 0x42, 0x00, 0x54, 0x31, 0x06, 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x0a, 0x1a, 0x64, 0x52, 0x19, 0x04, 0xde, 0x88, 0x01, 0x02, 0x80,
62+
0x20, 0x18, 0x34, 0x68, 0x90, 0x05, 0x65, 0x50, 0x06, 0xa3, 0x09, 0x01, 0x30, 0x62, 0xd0, 0x00, 0x20, 0x08, 0x06, 0x4f, 0x1a, 0x58, 0x91, 0x73, 0x06, 0x45, 0xa0, 0x69, 0x13, 0x02, 0x00, 0x00,
63+
0x00, 0x00, 0x00, 0x00,
64+
};
65+
#ifdef __GNUC__
66+
#define UNUSED_ARRAY_ATTR __attribute__((unused))
67+
#else
68+
#define UNUSED_ARRAY_ATTR
69+
#endif
70+
UNUSED_ARRAY_ATTR static const D3D12_SHADER_BYTECODE resource_heap_out_of_bounds_dxil = { resource_heap_out_of_bounds_code_dxil, sizeof(resource_heap_out_of_bounds_code_dxil) };
71+
#undef UNUSED_ARRAY_ATTR
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
RWStructuredBuffer<uint2> Outputs : register(u0);
2+
StructuredBuffer<uint> HeapIndices : register(t0);
3+
4+
StructuredBuffer<uint> HeapBuffers[] : register(t0, space1);
5+
6+
[numthreads(8, 1, 1)]
7+
void main(uint gid : SV_GroupID, uint tid : SV_DispatchThreadID)
8+
{
9+
uint nuri_index = HeapIndices[tid & 31];
10+
uint group_index = HeapIndices[gid];
11+
Outputs[tid] = uint2(HeapBuffers[NonUniformResourceIndex(nuri_index)][0], HeapBuffers[group_index][0]);
12+
}

0 commit comments

Comments
 (0)