mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
tests/shader-runner: Emit descriptor ranges for consecutive resources.
Shader models >= 5.1 support descriptor indexing, and emit arrayed resource declarations.
This commit is contained in:
committed by
Alexandre Julliard
parent
efddcc9a99
commit
805a4bc1e8
Notes:
Alexandre Julliard
2024-02-07 23:26:28 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/611
@@ -111,7 +111,7 @@ float4 main() : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
todo(sm>=6) draw quad
|
draw quad
|
||||||
probe all rgba (312, 312, 312, 111)
|
probe all rgba (312, 312, 312, 111)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ float4 main() : sv_target
|
|||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
todo(sm>=6) draw quad
|
draw quad
|
||||||
probe all rgba (41.0, 41.0, 41.0, 1089.0)
|
probe all rgba (41.0, 41.0, 41.0, 1089.0)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -241,7 +241,9 @@ static ID3D12RootSignature *d3d12_runner_create_root_signature(struct d3d12_shad
|
|||||||
D3D12_ROOT_SIGNATURE_DESC root_signature_desc = {0};
|
D3D12_ROOT_SIGNATURE_DESC root_signature_desc = {0};
|
||||||
D3D12_ROOT_PARAMETER root_params[17], *root_param;
|
D3D12_ROOT_PARAMETER root_params[17], *root_param;
|
||||||
D3D12_STATIC_SAMPLER_DESC static_samplers[7];
|
D3D12_STATIC_SAMPLER_DESC static_samplers[7];
|
||||||
|
struct d3d12_resource *base_resource = NULL;
|
||||||
ID3D12RootSignature *root_signature;
|
ID3D12RootSignature *root_signature;
|
||||||
|
unsigned int slot;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@@ -274,6 +276,14 @@ static ID3D12RootSignature *d3d12_runner_create_root_signature(struct d3d12_shad
|
|||||||
case RESOURCE_TYPE_BUFFER_UAV:
|
case RESOURCE_TYPE_BUFFER_UAV:
|
||||||
range = &resource->descriptor_range;
|
range = &resource->descriptor_range;
|
||||||
|
|
||||||
|
if (base_resource && resource->r.type == base_resource->r.type && resource->r.slot == slot + 1)
|
||||||
|
{
|
||||||
|
++base_resource->descriptor_range.NumDescriptors;
|
||||||
|
resource->descriptor_range.NumDescriptors = 0;
|
||||||
|
++slot;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
resource->root_index = root_signature_desc.NumParameters++;
|
resource->root_index = root_signature_desc.NumParameters++;
|
||||||
root_param = &root_params[resource->root_index];
|
root_param = &root_params[resource->root_index];
|
||||||
root_param->ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
|
root_param->ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
|
||||||
@@ -289,6 +299,9 @@ static ID3D12RootSignature *d3d12_runner_create_root_signature(struct d3d12_shad
|
|||||||
range->BaseShaderRegister = resource->r.slot;
|
range->BaseShaderRegister = resource->r.slot;
|
||||||
range->RegisterSpace = 0;
|
range->RegisterSpace = 0;
|
||||||
range->OffsetInDescriptorsFromTableStart = 0;
|
range->OffsetInDescriptorsFromTableStart = 0;
|
||||||
|
|
||||||
|
base_resource = resource;
|
||||||
|
slot = resource->r.slot;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESOURCE_TYPE_RENDER_TARGET:
|
case RESOURCE_TYPE_RENDER_TARGET:
|
||||||
@@ -376,12 +389,14 @@ static bool d3d12_runner_dispatch(struct shader_runner *r, unsigned int x, unsig
|
|||||||
switch (resource->r.type)
|
switch (resource->r.type)
|
||||||
{
|
{
|
||||||
case RESOURCE_TYPE_TEXTURE:
|
case RESOURCE_TYPE_TEXTURE:
|
||||||
|
if (resource->descriptor_range.NumDescriptors)
|
||||||
ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(command_list, resource->root_index,
|
ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(command_list, resource->root_index,
|
||||||
get_gpu_descriptor_handle(test_context, runner->heap, resource->r.slot));
|
get_gpu_descriptor_handle(test_context, runner->heap, resource->r.slot));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESOURCE_TYPE_UAV:
|
case RESOURCE_TYPE_UAV:
|
||||||
case RESOURCE_TYPE_BUFFER_UAV:
|
case RESOURCE_TYPE_BUFFER_UAV:
|
||||||
|
if (resource->descriptor_range.NumDescriptors)
|
||||||
ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(command_list, resource->root_index,
|
ID3D12GraphicsCommandList_SetComputeRootDescriptorTable(command_list, resource->root_index,
|
||||||
get_gpu_descriptor_handle(test_context, runner->heap, resource->r.slot + MAX_RESOURCES));
|
get_gpu_descriptor_handle(test_context, runner->heap, resource->r.slot + MAX_RESOURCES));
|
||||||
break;
|
break;
|
||||||
@@ -517,12 +532,14 @@ static bool d3d12_runner_draw(struct shader_runner *r,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RESOURCE_TYPE_TEXTURE:
|
case RESOURCE_TYPE_TEXTURE:
|
||||||
|
if (resource->descriptor_range.NumDescriptors)
|
||||||
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(command_list, resource->root_index,
|
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(command_list, resource->root_index,
|
||||||
get_gpu_descriptor_handle(test_context, runner->heap, resource->r.slot));
|
get_gpu_descriptor_handle(test_context, runner->heap, resource->r.slot));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESOURCE_TYPE_UAV:
|
case RESOURCE_TYPE_UAV:
|
||||||
case RESOURCE_TYPE_BUFFER_UAV:
|
case RESOURCE_TYPE_BUFFER_UAV:
|
||||||
|
if (resource->descriptor_range.NumDescriptors)
|
||||||
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(command_list, resource->root_index,
|
ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(command_list, resource->root_index,
|
||||||
get_gpu_descriptor_handle(test_context, runner->heap, resource->r.slot + MAX_RESOURCES));
|
get_gpu_descriptor_handle(test_context, runner->heap, resource->r.slot + MAX_RESOURCES));
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user