tests: Add SM 6.6 bindless heap test.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
1a57aa841a
commit
ae185271ff
|
@ -22,6 +22,441 @@
|
|||
#define VKD3D_DBG_CHANNEL VKD3D_DBG_CHANNEL_API
|
||||
#include "d3d12_crosstest.h"
|
||||
|
||||
void test_bindless_heap_sm66(void)
|
||||
{
|
||||
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
|
||||
D3D12_FEATURE_DATA_SHADER_MODEL shader_model;
|
||||
D3D12_UNORDERED_ACCESS_VIEW_DESC uav_desc;
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc;
|
||||
D3D12_CONSTANT_BUFFER_VIEW_DESC cbv_desc;
|
||||
D3D12_ROOT_PARAMETER root_parameters[1];
|
||||
ID3D12DescriptorHeap *cpu_resource_heap;
|
||||
ID3D12GraphicsCommandList *command_list;
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle;
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle;
|
||||
unsigned int descriptor_size_sampler;
|
||||
ID3D12RootSignature *root_signature;
|
||||
ID3D12DescriptorHeap *resource_heap;
|
||||
ID3D12Resource *input_textures[256];
|
||||
ID3D12DescriptorHeap *sampler_heap;
|
||||
unsigned int i, descriptor_size;
|
||||
D3D12_SAMPLER_DESC sampler_desc;
|
||||
ID3D12DescriptorHeap *heaps[2];
|
||||
ID3D12Resource *output_buffer;
|
||||
ID3D12Resource *input_buffer;
|
||||
struct resource_readback rb;
|
||||
struct test_context context;
|
||||
ID3D12PipelineState *pso;
|
||||
ID3D12Device *device;
|
||||
FLOAT clear_values[4];
|
||||
unsigned int x, y;
|
||||
D3D12_RECT rect;
|
||||
HRESULT hr;
|
||||
|
||||
static const BYTE cs_code[] =
|
||||
{
|
||||
#if 0
|
||||
cbuffer heap_offsets : register(b0)
|
||||
{
|
||||
uint src_uav_tex_offset;
|
||||
uint src_srv_tex_offset;
|
||||
uint src_srv_buffer_offset;
|
||||
uint dst_uav_buffer_offset;
|
||||
};
|
||||
|
||||
struct Dummy { uint v; };
|
||||
|
||||
[numthreads(64, 1, 1)]
|
||||
void main(uint thr : SV_DispatchThreadID)
|
||||
{
|
||||
uint input_value = 0;
|
||||
|
||||
if (thr % 2 == 0)
|
||||
{
|
||||
Texture2D<float> src = ResourceDescriptorHeap[NonUniformResourceIndex(src_srv_tex_offset + thr)];
|
||||
SamplerState samp = SamplerDescriptorHeap[NonUniformResourceIndex(thr)];
|
||||
input_value += uint(src.SampleLevel(samp, float2(1.25, 1.25), 0.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
RWTexture2D<float> src = ResourceDescriptorHeap[NonUniformResourceIndex(src_uav_tex_offset + thr)];
|
||||
input_value += uint(src[int2(0, 0)]);
|
||||
}
|
||||
|
||||
// Test different descriptor types.
|
||||
if (thr % 16 == 0)
|
||||
{
|
||||
ConstantBuffer<Dummy> src = ResourceDescriptorHeap[NonUniformResourceIndex(src_srv_buffer_offset + thr)];
|
||||
input_value += src.v;
|
||||
}
|
||||
else if (thr % 4 == 0)
|
||||
{
|
||||
ByteAddressBuffer src = ResourceDescriptorHeap[NonUniformResourceIndex(src_srv_buffer_offset + thr)];
|
||||
input_value += src.Load(0);
|
||||
}
|
||||
else if (thr % 4 == 1)
|
||||
{
|
||||
Buffer<uint> src = ResourceDescriptorHeap[NonUniformResourceIndex(src_srv_buffer_offset + thr)];
|
||||
input_value += src[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
StructuredBuffer<uint> dst = ResourceDescriptorHeap[NonUniformResourceIndex(src_srv_buffer_offset + thr)];
|
||||
input_value += dst[0];
|
||||
}
|
||||
|
||||
// Test different descriptor types.
|
||||
if (thr % 4 == 0)
|
||||
{
|
||||
RWByteAddressBuffer dst = ResourceDescriptorHeap[NonUniformResourceIndex(dst_uav_buffer_offset + thr)];
|
||||
dst.Store(0, input_value);
|
||||
}
|
||||
else if (thr % 4 == 1)
|
||||
{
|
||||
RWBuffer<uint> dst = ResourceDescriptorHeap[NonUniformResourceIndex(dst_uav_buffer_offset + thr)];
|
||||
dst[0] = input_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
RWStructuredBuffer<uint> dst = ResourceDescriptorHeap[NonUniformResourceIndex(dst_uav_buffer_offset + thr)];
|
||||
dst[0] = input_value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
0x44, 0x58, 0x42, 0x43, 0x3a, 0x81, 0x6c, 0xe3, 0x19, 0x63, 0x28, 0xb7, 0x92, 0x22, 0xd1, 0x43, 0xf7, 0xac, 0x2d, 0x5a, 0x01, 0x00, 0x00, 0x00, 0x4c, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
|
||||
0x38, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x06, 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,
|
||||
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x53, 0x56, 0x30, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1, 0x83, 0xbb, 0x3e,
|
||||
0xbd, 0xf9, 0x98, 0xb8, 0x80, 0xde, 0x7f, 0x96, 0x9b, 0x08, 0xdb, 0x6f, 0x44, 0x58, 0x49, 0x4c, 0x58, 0x09, 0x00, 0x00, 0x66, 0x00, 0x05, 0x00, 0x56, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c,
|
||||
0x06, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x4d, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02,
|
||||
0x42, 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90,
|
||||
0x11, 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x31, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84,
|
||||
0x04, 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, 0xa4, 0xc1, 0x08, 0x40, 0x09, 0x00, 0x0a, 0xe6, 0x08, 0xc0, 0xa0, 0x0c, 0xc3, 0x30, 0x10,
|
||||
0x31, 0x47, 0x80, 0x90, 0x71, 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x38, 0xe6, 0x08, 0x82, 0x52, 0x20, 0xc3, 0x90, 0x24, 0xa4, 0x1c, 0x35, 0x5c, 0xfe,
|
||||
0x84, 0x3d, 0x84, 0xe4, 0x73, 0x1b, 0x55, 0xac, 0xc4, 0xe4, 0x23, 0xb7, 0x8d, 0x88, 0x61, 0x18, 0x86, 0x42, 0x30, 0x03, 0x32, 0x50, 0x33, 0x03, 0x70, 0xd3, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92,
|
||||
0xbf, 0x12, 0xd2, 0x4a, 0x4c, 0x7e, 0x71, 0xdb, 0xa8, 0x78, 0x9e, 0xe7, 0x19, 0x0a, 0x03, 0x0d, 0x08, 0xf2, 0x3c, 0xcf, 0x33, 0x0c, 0xc3, 0x43, 0x51, 0x51, 0xa0, 0x01, 0x19, 0x86, 0x61, 0x18,
|
||||
0x86, 0x81, 0xa6, 0x9b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, 0x62, 0xf2, 0x91, 0xdb, 0x46, 0xc5, 0x30, 0x0c, 0xc3, 0x50, 0x8e, 0x6a, 0x40, 0x86, 0xc1, 0x18, 0xc8, 0x2a,
|
||||
0x0b, 0x30, 0x20, 0xc3, 0x30, 0x0c, 0xc3, 0x60, 0x0c, 0x84, 0x15, 0x05, 0x18, 0x90, 0x61, 0x18, 0x86, 0x61, 0x30, 0x48, 0x2b, 0x45, 0x35, 0x20, 0xc3, 0x40, 0xdc, 0x6d, 0xc3, 0xe5, 0x4f, 0xd8,
|
||||
0x43, 0x48, 0xfe, 0x4a, 0x48, 0x0e, 0x15, 0x09, 0x44, 0x1a, 0x39, 0x0f, 0x11, 0x4d, 0x08, 0x21, 0x21, 0x61, 0x18, 0x0a, 0x81, 0x0c, 0x88, 0x47, 0xdf, 0x41, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48,
|
||||
0xfe, 0x4a, 0x48, 0x1b, 0xd2, 0x0c, 0x88, 0x18, 0x86, 0xc1, 0x28, 0x05, 0x32, 0x84, 0x43, 0x42, 0xe2, 0x40, 0xc0, 0x31, 0x07, 0x01, 0x3c, 0xbf, 0x53, 0x14, 0x12, 0x31, 0x49, 0x88, 0x18, 0x86,
|
||||
0x61, 0xa0, 0x72, 0x8e, 0x00, 0x14, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x86, 0x3c, 0x04, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x14, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34,
|
||||
0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x89, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x20, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x0f, 0x06, 0x04, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43,
|
||||
0x1e, 0x0d, 0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x1c, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x3e, 0x20, 0x00, 0x02, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x88, 0x01, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x81, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14,
|
||||
0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x1a, 0x4a, 0xa0, 0x18, 0x46, 0x00, 0x0a, 0xa4, 0x10, 0x0a, 0x30, 0x80, 0xce, 0x02, 0x04, 0x04, 0x04, 0xc4, 0x20, 0x73, 0x06,
|
||||
0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b,
|
||||
0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9,
|
||||
0x10, 0x04, 0x13, 0x84, 0x81, 0x99, 0x20, 0x0c, 0xcd, 0x06, 0x61, 0x20, 0x28, 0x8c, 0xcd, 0x6d, 0x18, 0x0c, 0x82, 0x98, 0x20, 0x0c, 0xce, 0x04, 0xc1, 0x0c, 0x26, 0x02, 0x13, 0x84, 0xe1, 0xd9,
|
||||
0x80, 0x20, 0x89, 0x82, 0x20, 0xc3, 0x02, 0x6c, 0x08, 0x98, 0x0d, 0x04, 0x00, 0x34, 0xc0, 0x04, 0x41, 0x00, 0x48, 0xb4, 0x85, 0xa5, 0xb9, 0x4d, 0x10, 0xce, 0x40, 0x9a, 0x20, 0x0c, 0xd0, 0x04,
|
||||
0x61, 0x88, 0x36, 0x0c, 0xd3, 0x30, 0x6c, 0x20, 0x90, 0x48, 0xa2, 0x36, 0x14, 0x0f, 0x04, 0x38, 0x55, 0x15, 0x36, 0x36, 0xbb, 0x36, 0x97, 0x34, 0xb2, 0x32, 0x37, 0xba, 0x29, 0x41, 0x50, 0x85,
|
||||
0x0c, 0xcf, 0xc5, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x6d, 0x4a, 0x40, 0x34, 0x21, 0xc3, 0x73, 0xb1, 0x0b, 0x63, 0xb3, 0x2b, 0x93, 0x9b, 0x12, 0x10, 0x75, 0xc8, 0xf0, 0x5c, 0xe6, 0xd0, 0xc2,
|
||||
0xc8, 0xca, 0xe4, 0x9a, 0xde, 0xc8, 0xca, 0xd8, 0xa6, 0x04, 0x46, 0x19, 0x32, 0x3c, 0x17, 0xb9, 0xb2, 0xb9, 0xb7, 0x3a, 0xb9, 0xb1, 0xb2, 0xb9, 0x29, 0x41, 0x53, 0x87, 0x0c, 0xcf, 0xa5, 0xcc,
|
||||
0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0x50, 0x01, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66,
|
||||
0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xea, 0xc1, 0x1d, 0xd2, 0xc1, 0x1c, 0xde, 0x41, 0x1e, 0xda, 0x61, 0x06, 0x13, 0x91, 0x03,
|
||||
0x3e, 0xb8, 0x81, 0x38, 0xc8, 0x43, 0x39, 0x84, 0xc3, 0x3a, 0xb8, 0x81, 0x38, 0xc8, 0x03, 0x00, 0x71, 0x20, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0xa6, 0x40, 0x0d, 0x97, 0xef, 0x3c, 0x3e, 0xd0,
|
||||
0x34, 0xce, 0x04, 0x4c, 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0x02, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0x01, 0x55, 0x14, 0x44, 0x54, 0x3a, 0xc0, 0xe0, 0x23, 0xb7, 0x6d, 0x08, 0xd5, 0x70, 0xf9, 0xce,
|
||||
0xe3, 0x07, 0x54, 0x51, 0x10, 0x11, 0x3b, 0x39, 0x11, 0xe1, 0x23, 0xb7, 0x6d, 0x03, 0xdb, 0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x01, 0x55, 0x14, 0x44, 0x54, 0x3a, 0xc0, 0x50, 0x12, 0x06, 0x20, 0x60,
|
||||
0x3e, 0x72, 0xdb, 0xb6, 0xd0, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, 0x84, 0x40, 0x33, 0x2c, 0xc4, 0x17, 0x39, 0xcc, 0x86, 0x34, 0x03, 0xd2, 0x18, 0x26, 0xa0, 0x0d, 0x97, 0xef,
|
||||
0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, 0x84, 0x40, 0x33, 0x2c, 0xc4, 0x17, 0x39, 0x4c, 0x48, 0x00, 0x8f, 0x19, 0x5c, 0xc3, 0xe5, 0x3b, 0x8f, 0x1f, 0x01, 0xd6, 0x46, 0x15, 0x05, 0x11, 0x95, 0x0e,
|
||||
0x30, 0xf8, 0xc8, 0x6d, 0xdb, 0x01, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, 0x11, 0x60, 0x6d, 0x54, 0x51, 0x10, 0x11, 0x3b, 0x39, 0x11, 0xe1, 0x23, 0xb7, 0x6d, 0x04, 0xd5, 0x70, 0xf9, 0xce, 0xe3, 0x4b,
|
||||
0x00, 0xf3, 0x2c, 0x44, 0x49, 0x54, 0xc4, 0xe2, 0x17, 0xb7, 0x6d, 0x05, 0xd5, 0x70, 0xf9, 0xce, 0xe3, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0x51, 0x3a, 0xc0, 0xe0, 0x17, 0xb7, 0x6d, 0x01, 0xd2, 0x70,
|
||||
0xf9, 0xce, 0xe3, 0x4f, 0x47, 0x44, 0x00, 0x83, 0x38, 0xf8, 0xc8, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x13, 0x04, 0x50, 0x2c,
|
||||
0x10, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x34, 0xcc, 0x00, 0x14, 0xec, 0x40, 0xd1, 0x0e, 0x94, 0x5d, 0x69, 0x94, 0x24, 0x41, 0x59, 0x0a, 0x94, 0x22, 0x41, 0x61, 0x0a, 0x94, 0xec, 0x40,
|
||||
0xe9, 0x06, 0x14, 0x41, 0x71, 0x14, 0x5f, 0x11, 0x02, 0x15, 0x61, 0x40, 0x79, 0x94, 0x41, 0x59, 0x14, 0x45, 0x21, 0x06, 0x14, 0x46, 0x59, 0x02, 0x15, 0x25, 0x50, 0x29, 0x06, 0x14, 0x26, 0x10,
|
||||
0x19, 0x25, 0x50, 0x04, 0xe5, 0x41, 0x49, 0x0d, 0x8c, 0x00, 0xd0, 0x33, 0x46, 0x00, 0x82, 0x20, 0xa8, 0x7f, 0x33, 0x00, 0x23, 0x00, 0xe4, 0xcd, 0x21, 0x60, 0xcf, 0x1c, 0xc2, 0x97, 0xcd, 0x21,
|
||||
0x80, 0x81, 0x33, 0x87, 0x20, 0x06, 0xd9, 0x1c, 0x02, 0x06, 0xcd, 0x21, 0x98, 0x81, 0x33, 0x87, 0x70, 0x06, 0xdb, 0x1c, 0x42, 0x1a, 0x40, 0x73, 0x08, 0x6a, 0xe0, 0xcc, 0x21, 0xac, 0xc1, 0x36,
|
||||
0x87, 0xd0, 0x06, 0x10, 0x85, 0x73, 0x10, 0x8e, 0xe3, 0xbc, 0x01, 0x00, 0x23, 0x06, 0x08, 0x00, 0x82, 0x60, 0x20, 0x06, 0x77, 0x50, 0x06, 0x01, 0x1d, 0x40, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60,
|
||||
0xf0, 0xe5, 0x81, 0x1b, 0x04, 0xcd, 0x88, 0x81, 0x01, 0x80, 0x20, 0x18, 0x10, 0xa3, 0x60, 0x06, 0x76, 0x50, 0x41, 0x1e, 0xe8, 0x70, 0x43, 0x80, 0x07, 0x60, 0x30, 0x62, 0x70, 0x00, 0x20, 0x08,
|
||||
0x06, 0x0d, 0x29, 0xc0, 0x01, 0x91, 0x07, 0xb3, 0x0c, 0x81, 0x20, 0x8c, 0x26, 0x04, 0x41, 0x05, 0x05, 0x8c, 0x18, 0x20, 0x00, 0x08, 0x82, 0x81, 0x82, 0x0a, 0x74, 0x10, 0x60, 0xd9, 0x88, 0xc1,
|
||||
0x01, 0x80, 0x20, 0x18, 0x7c, 0xa1, 0x60, 0x07, 0x01, 0x35, 0x62, 0x80, 0x00, 0x20, 0x08, 0x06, 0x8a, 0x2a, 0xd8, 0x01, 0xb2, 0x6d, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xf0, 0x8d, 0x02, 0x1e,
|
||||
0x04, 0xd5, 0x88, 0xc1, 0x03, 0x80, 0x20, 0x18, 0x44, 0xaa, 0xd0, 0x06, 0x43, 0xb0, 0x6d, 0x9a, 0x06, 0x0a, 0xa0, 0xa0, 0x07, 0xd9, 0x68, 0x42, 0x00, 0xcc, 0x12, 0x0c, 0xa3, 0x09, 0x09, 0x50,
|
||||
0x41, 0x03, 0x23, 0x06, 0x08, 0x00, 0x82, 0x60, 0xa0, 0xc0, 0x02, 0x1f, 0x04, 0x60, 0x10, 0x06, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xf0, 0xa5, 0x82, 0x1f, 0x04, 0xda, 0x88, 0x41, 0x03, 0x80,
|
||||
0x20, 0x18, 0x4c, 0xaf, 0x10, 0x07, 0x01, 0x28, 0x98, 0x82, 0x29, 0x80, 0x02, 0x28, 0x80, 0x02, 0x28, 0x8c, 0x26, 0x04, 0xc0, 0x2c, 0xc1, 0x30, 0x50, 0xf1, 0x38, 0x81, 0x20, 0x5c, 0x30, 0x4c,
|
||||
0x51, 0x74, 0xa0, 0xc3, 0x0d, 0xc1, 0x2a, 0x80, 0x41, 0x59, 0x75, 0xa0, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, 0xe0, 0x02, 0x29, 0x60, 0xad, 0x30, 0x9a, 0x10, 0x08, 0x15, 0x64, 0x30, 0x62,
|
||||
0x80, 0x00, 0x20, 0x08, 0x06, 0x0a, 0x2f, 0xa0, 0x42, 0xc0, 0x06, 0x6d, 0x30, 0xcb, 0x40, 0x14, 0xc6, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x7c, 0xb5, 0xa0, 0x0a, 0x41, 0x19, 0x8c, 0x18, 0x1c,
|
||||
0x00, 0x08, 0x82, 0x41, 0xd3, 0x0b, 0xa9, 0x10, 0xc8, 0xc2, 0x68, 0x42, 0x00, 0xcc, 0x12, 0x28, 0xc3, 0x0d, 0x08, 0x2d, 0x80, 0xc1, 0x2c, 0x83, 0x71, 0x04, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60,
|
||||
0xf0, 0xe5, 0x82, 0x2b, 0x14, 0x68, 0x30, 0x62, 0xa0, 0x00, 0x20, 0x08, 0x06, 0x96, 0x2f, 0xa8, 0x42, 0x60, 0x0b, 0xb0, 0x60, 0x07, 0xb4, 0x30, 0x9a, 0x10, 0x00, 0xb3, 0x04, 0xca, 0x70, 0x03,
|
||||
0xa3, 0x0b, 0x60, 0x30, 0xcb, 0x80, 0x24, 0xc1, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x7c, 0xbd, 0x20, 0x0b, 0xc9, 0x1a, 0x8c, 0x18, 0x20, 0x00, 0x08, 0x82, 0x01, 0xf7, 0x0b, 0xa0, 0x10, 0xe8,
|
||||
0x02, 0x2d, 0x8c, 0x26, 0x04, 0xc0, 0x2c, 0x81, 0x32, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x1f, 0x38, 0xd4, 0x02, 0xd3, 0x06, 0x23, 0x06, 0x0a, 0x00, 0x82, 0x60, 0x60, 0x95, 0x43, 0x2c, 0x04,
|
||||
0xbd, 0xd0, 0x0b, 0x7d, 0xb0, 0x0b, 0xa3, 0x09, 0x01, 0x30, 0x4b, 0xa0, 0x0c, 0x94, 0x0c, 0x7e, 0x61, 0x98, 0x41, 0x22, 0x1a, 0x88, 0x19, 0x10, 0x03, 0x25, 0x83, 0x64, 0x10, 0x89, 0x82, 0x68,
|
||||
0x44, 0x05, 0x18, 0x0c, 0x37, 0x0c, 0xe2, 0x00, 0x06, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, 0xb8, 0x83, 0x2e, 0xb8, 0xc1, 0x38, 0x8c, 0x26, 0x04, 0x43, 0x05, 0x6f, 0x00, 0x23, 0x06, 0x08,
|
||||
0x00, 0x82, 0x60, 0xa0, 0xc8, 0x83, 0x2f, 0x04, 0xa2, 0x30, 0x0a, 0xb3, 0x0c, 0x0b, 0x53, 0x8c, 0x18, 0x1c, 0x00, 0x08, 0x82, 0xc1, 0xb7, 0x0e, 0xe0, 0x10, 0xdc, 0xc1, 0x88, 0x81, 0x03, 0x80,
|
||||
0x20, 0x18, 0x60, 0xef, 0xa0, 0x0b, 0x01, 0x3a, 0x88, 0xc3, 0x21, 0x0e, 0xe2, 0x20, 0x0e, 0xa8, 0x60, 0x0e, 0xb3, 0x04, 0xcf, 0x70, 0x43, 0xa2, 0x0e, 0x60, 0x30, 0xcb, 0xd0, 0x38, 0xc1, 0x88,
|
||||
0xc1, 0x01, 0x80, 0x20, 0x18, 0x7c, 0xed, 0x20, 0x0e, 0x03, 0x1e, 0x8c, 0x18, 0x34, 0x00, 0x08, 0x82, 0x81, 0x06, 0x0f, 0xac, 0x10, 0xa8, 0x03, 0x39, 0x24, 0x49, 0x92, 0xa0, 0xc2, 0x2c, 0xc1,
|
||||
0x33, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x9f, 0x3b, 0x8c, 0x03, 0x81, 0x07, 0x23, 0x06, 0x0e, 0x00, 0x82, 0x60, 0x80, 0xc9, 0x43, 0x2f, 0x04, 0xeb, 0xb0, 0x0e, 0x4a, 0x39, 0x94, 0x43, 0x39,
|
||||
0xac, 0x42, 0x3a, 0xcc, 0x12, 0x3c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const D3D12_SHADER_BYTECODE cs_code_dxil = SHADER_BYTECODE(cs_code);
|
||||
uint32_t initial_buffer_data[ARRAY_SIZE(input_textures)];
|
||||
|
||||
if (!init_compute_test_context(&context))
|
||||
return;
|
||||
|
||||
device = context.device;
|
||||
command_list = context.list;
|
||||
descriptor_size = ID3D12Device_GetDescriptorHandleIncrementSize(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
||||
descriptor_size_sampler = ID3D12Device_GetDescriptorHandleIncrementSize(device, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
|
||||
|
||||
shader_model.HighestShaderModel = D3D_SHADER_MODEL_6_6;
|
||||
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_SHADER_MODEL,
|
||||
&shader_model, sizeof(shader_model));
|
||||
if (FAILED(hr) || shader_model.HighestShaderModel < D3D_SHADER_MODEL_6_6)
|
||||
{
|
||||
skip("Shader model 6.6 not supported by device.\n");
|
||||
destroy_test_context(&context);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&root_signature_desc, 0, sizeof(root_signature_desc));
|
||||
root_signature_desc.Flags =
|
||||
D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED |
|
||||
D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED;
|
||||
root_signature_desc.pParameters = root_parameters;
|
||||
root_signature_desc.NumParameters = ARRAY_SIZE(root_parameters);
|
||||
memset(root_parameters, 0, sizeof(root_parameters));
|
||||
root_parameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
|
||||
root_parameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
|
||||
root_parameters[0].Constants.ShaderRegister = 0;
|
||||
root_parameters[0].Constants.RegisterSpace = 0;
|
||||
root_parameters[0].Constants.Num32BitValues = 4;
|
||||
|
||||
hr = create_root_signature(device, &root_signature_desc, &root_signature);
|
||||
ok(SUCCEEDED(hr), "Failed to create root signature, hr #%x.\n", hr);
|
||||
|
||||
pso = create_compute_pipeline_state(device, root_signature, cs_code_dxil);
|
||||
cpu_resource_heap = create_cpu_descriptor_heap(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV,
|
||||
ARRAY_SIZE(input_textures) * root_parameters[0].Constants.Num32BitValues);
|
||||
resource_heap = create_gpu_descriptor_heap(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV,
|
||||
ARRAY_SIZE(input_textures) * root_parameters[0].Constants.Num32BitValues);
|
||||
sampler_heap = create_gpu_descriptor_heap(device, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, ARRAY_SIZE(input_textures));
|
||||
|
||||
heaps[0] = resource_heap;
|
||||
heaps[1] = sampler_heap;
|
||||
ID3D12GraphicsCommandList_SetDescriptorHeaps(command_list, ARRAY_SIZE(heaps), heaps);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(input_textures); i++)
|
||||
{
|
||||
input_textures[i] = create_default_texture2d(device, 2, 2, 1, 1,
|
||||
DXGI_FORMAT_R32_FLOAT,
|
||||
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
|
||||
|
||||
memset(&uav_desc, 0, sizeof(uav_desc));
|
||||
uav_desc.Format = DXGI_FORMAT_R32_FLOAT;
|
||||
uav_desc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
|
||||
|
||||
cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(resource_heap);
|
||||
cpu_handle.ptr += i * descriptor_size;
|
||||
ID3D12Device_CreateUnorderedAccessView(device, input_textures[i], NULL, &uav_desc, cpu_handle);
|
||||
|
||||
cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(cpu_resource_heap);
|
||||
cpu_handle.ptr += i * descriptor_size;
|
||||
ID3D12Device_CreateUnorderedAccessView(device, input_textures[i], NULL, &uav_desc, cpu_handle);
|
||||
|
||||
gpu_handle = ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(resource_heap);
|
||||
gpu_handle.ptr += i * descriptor_size;
|
||||
ID3D12Device_CreateUnorderedAccessView(device, input_textures[i], NULL, &uav_desc, cpu_handle);
|
||||
|
||||
memset(clear_values, 0, sizeof(clear_values));
|
||||
|
||||
for (y = 0; y < 2; y++)
|
||||
{
|
||||
for (x = 0; x < 2; x++)
|
||||
{
|
||||
clear_values[0] = i + 1 + 1000 * (y * 2 + x);
|
||||
set_rect(&rect, x, y, x + 1, y + 1);
|
||||
ID3D12GraphicsCommandList_ClearUnorderedAccessViewFloat(command_list, gpu_handle, cpu_handle,
|
||||
input_textures[i], clear_values, 1, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&srv_desc, 0, sizeof(srv_desc));
|
||||
srv_desc.Format = DXGI_FORMAT_R32_FLOAT;
|
||||
srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
srv_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
srv_desc.Texture2D.MipLevels = 1;
|
||||
|
||||
cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(resource_heap);
|
||||
cpu_handle.ptr += (i + 1 * ARRAY_SIZE(input_textures)) * descriptor_size;
|
||||
ID3D12Device_CreateShaderResourceView(device, input_textures[i], &srv_desc, cpu_handle);
|
||||
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
transition_resource_state(command_list, input_textures[i],
|
||||
D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
|
||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
|
||||
memset(&sampler_desc, 0, sizeof(sampler_desc));
|
||||
sampler_desc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT;
|
||||
sampler_desc.AddressU = i % 4 == 0 ? D3D12_TEXTURE_ADDRESS_MODE_CLAMP : D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
||||
sampler_desc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
||||
sampler_desc.AddressW = sampler_desc.AddressU;
|
||||
|
||||
cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(sampler_heap);
|
||||
cpu_handle.ptr += i * descriptor_size_sampler;
|
||||
ID3D12Device_CreateSampler(device, &sampler_desc, cpu_handle);
|
||||
}
|
||||
else
|
||||
uav_barrier(command_list, input_textures[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(input_textures); i++)
|
||||
initial_buffer_data[i] = i + 10000;
|
||||
input_buffer = create_upload_buffer(device, sizeof(initial_buffer_data), initial_buffer_data);
|
||||
|
||||
output_buffer = create_default_buffer(device, ARRAY_SIZE(input_textures) * sizeof(uint32_t),
|
||||
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS,
|
||||
D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(input_textures); i++)
|
||||
{
|
||||
memset(&srv_desc, 0, sizeof(srv_desc));
|
||||
|
||||
srv_desc.ViewDimension = D3D12_SRV_DIMENSION_BUFFER;
|
||||
srv_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
|
||||
cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(resource_heap);
|
||||
cpu_handle.ptr += (i + 2 * ARRAY_SIZE(input_textures)) * descriptor_size;
|
||||
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
memset(&cbv_desc, 0, sizeof(cbv_desc));
|
||||
cbv_desc.SizeInBytes = 256;
|
||||
cbv_desc.BufferLocation = ID3D12Resource_GetGPUVirtualAddress(input_buffer) + (i % 32 == 0 ? 256 : 0);
|
||||
ID3D12Device_CreateConstantBufferView(device, &cbv_desc, cpu_handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i % 4 == 0)
|
||||
{
|
||||
srv_desc.Format = DXGI_FORMAT_R32_TYPELESS;
|
||||
srv_desc.Buffer.NumElements = 4;
|
||||
srv_desc.Buffer.FirstElement = i;
|
||||
srv_desc.Buffer.Flags = D3D12_BUFFER_SRV_FLAG_RAW;
|
||||
}
|
||||
else if (i % 4 == 1)
|
||||
{
|
||||
srv_desc.Format = DXGI_FORMAT_R32_UINT;
|
||||
srv_desc.Buffer.NumElements = 1;
|
||||
srv_desc.Buffer.FirstElement = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
srv_desc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srv_desc.Buffer.StructureByteStride = 4;
|
||||
srv_desc.Buffer.FirstElement = i;
|
||||
srv_desc.Buffer.NumElements = 1;
|
||||
}
|
||||
|
||||
ID3D12Device_CreateShaderResourceView(device, input_buffer, &srv_desc, cpu_handle);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(input_textures); i++)
|
||||
{
|
||||
memset(&uav_desc, 0, sizeof(uav_desc));
|
||||
|
||||
uav_desc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER;
|
||||
if (i % 4 == 0)
|
||||
{
|
||||
uav_desc.Format = DXGI_FORMAT_R32_TYPELESS;
|
||||
uav_desc.Buffer.NumElements = 4;
|
||||
uav_desc.Buffer.FirstElement = i;
|
||||
uav_desc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_RAW;
|
||||
}
|
||||
else if (i % 4 == 1)
|
||||
{
|
||||
uav_desc.Format = DXGI_FORMAT_R32_UINT;
|
||||
uav_desc.Buffer.NumElements = 1;
|
||||
uav_desc.Buffer.FirstElement = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
uav_desc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
uav_desc.Buffer.StructureByteStride = 4;
|
||||
uav_desc.Buffer.FirstElement = i;
|
||||
uav_desc.Buffer.NumElements = 1;
|
||||
}
|
||||
|
||||
cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(resource_heap);
|
||||
cpu_handle.ptr += (i + 3 * ARRAY_SIZE(input_textures)) * descriptor_size;
|
||||
ID3D12Device_CreateUnorderedAccessView(device, output_buffer, NULL, &uav_desc, cpu_handle);
|
||||
}
|
||||
|
||||
ID3D12GraphicsCommandList_SetComputeRootSignature(command_list, root_signature);
|
||||
ID3D12GraphicsCommandList_SetPipelineState(command_list, pso);
|
||||
for (i = 0; i < root_parameters[0].Constants.Num32BitValues; i++)
|
||||
ID3D12GraphicsCommandList_SetComputeRoot32BitConstant(command_list, 0, i * ARRAY_SIZE(input_textures), i);
|
||||
ID3D12GraphicsCommandList_Dispatch(command_list, ARRAY_SIZE(input_textures) / 64, 1, 1);
|
||||
|
||||
transition_resource_state(command_list, output_buffer, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
get_buffer_readback_with_command_list(output_buffer, DXGI_FORMAT_R32_UINT, &rb, context.queue, command_list);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(input_textures); i++)
|
||||
{
|
||||
UINT value, expected;
|
||||
value = get_readback_uint(&rb, i, 0, 0);
|
||||
expected = 0;
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
expected += i + 1; /* SRV texture reads. */
|
||||
if (i % 4 == 0)
|
||||
expected += 3000; /* CLAMP sampler used, we'll sample pixel (1, 1). */
|
||||
else
|
||||
expected += 2000; /* WRAP, CLAMP used, sample pixel (0, 1). */
|
||||
}
|
||||
else
|
||||
{
|
||||
expected += i + 1; /* UAV texture reads. */
|
||||
}
|
||||
|
||||
if (i % 16 == 0)
|
||||
{
|
||||
/* CBV reads. */
|
||||
if (i % 32 == 0)
|
||||
expected += 64 + 10000;
|
||||
else
|
||||
expected += 10000;
|
||||
}
|
||||
else
|
||||
expected += i + 10000; /* Buffer reads. */
|
||||
ok(expected == value, "Value %u mismatch, expected %u, got %u.\n", i, expected, value);
|
||||
}
|
||||
|
||||
release_resource_readback(&rb);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(input_textures); i++)
|
||||
ID3D12Resource_Release(input_textures[i]);
|
||||
ID3D12Resource_Release(input_buffer);
|
||||
ID3D12Resource_Release(output_buffer);
|
||||
ID3D12DescriptorHeap_Release(cpu_resource_heap);
|
||||
ID3D12DescriptorHeap_Release(resource_heap);
|
||||
ID3D12DescriptorHeap_Release(sampler_heap);
|
||||
ID3D12RootSignature_Release(root_signature);
|
||||
ID3D12PipelineState_Release(pso);
|
||||
destroy_test_context(&context);
|
||||
}
|
||||
|
||||
static void test_bindless_srv(bool use_dxil)
|
||||
{
|
||||
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
|
||||
|
|
|
@ -222,6 +222,7 @@ decl_test(test_bindless_uav_counter_sm51);
|
|||
decl_test(test_bindless_uav_counter_dxil);
|
||||
decl_test(test_bindless_bufinfo_sm51);
|
||||
decl_test(test_bindless_bufinfo_dxil);
|
||||
decl_test(test_bindless_heap_sm66);
|
||||
decl_test(test_stencil_export_dxbc);
|
||||
decl_test(test_stencil_export_dxil);
|
||||
decl_test(test_raytracing);
|
||||
|
|
Loading…
Reference in New Issue