mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d: Pass descriptor offset info to vkd3d-shader for compute pipelines.
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
6a88c57f5d
commit
1edbd3d698
@ -91,6 +91,7 @@ static void d3d12_root_signature_cleanup(struct d3d12_root_signature *root_signa
|
|||||||
|
|
||||||
if (root_signature->descriptor_mapping)
|
if (root_signature->descriptor_mapping)
|
||||||
vkd3d_free(root_signature->descriptor_mapping);
|
vkd3d_free(root_signature->descriptor_mapping);
|
||||||
|
vkd3d_free(root_signature->descriptor_offsets);
|
||||||
if (root_signature->root_constants)
|
if (root_signature->root_constants)
|
||||||
vkd3d_free(root_signature->root_constants);
|
vkd3d_free(root_signature->root_constants);
|
||||||
|
|
||||||
@ -713,10 +714,11 @@ static HRESULT d3d12_root_signature_init_descriptor_array_binding(struct d3d12_r
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void d3d12_root_signature_map_vk_unbounded_binding(struct d3d12_root_signature *root_signature,
|
static void d3d12_root_signature_map_vk_unbounded_binding(struct d3d12_root_signature *root_signature,
|
||||||
const struct d3d12_root_descriptor_table_range *range, bool buffer_descriptor,
|
const struct d3d12_root_descriptor_table_range *range, unsigned int descriptor_offset, bool buffer_descriptor,
|
||||||
enum vkd3d_shader_visibility shader_visibility, struct vkd3d_descriptor_set_context *context)
|
enum vkd3d_shader_visibility shader_visibility, struct vkd3d_descriptor_set_context *context)
|
||||||
{
|
{
|
||||||
struct vkd3d_shader_resource_binding *mapping = &root_signature->descriptor_mapping[context->descriptor_index++];
|
struct vkd3d_shader_resource_binding *mapping = &root_signature->descriptor_mapping[context->descriptor_index];
|
||||||
|
unsigned int *offset = &root_signature->descriptor_offsets[context->descriptor_index++];
|
||||||
|
|
||||||
mapping->type = range->type;
|
mapping->type = range->type;
|
||||||
mapping->register_space = range->register_space;
|
mapping->register_space = range->register_space;
|
||||||
@ -727,18 +729,21 @@ static void d3d12_root_signature_map_vk_unbounded_binding(struct d3d12_root_sign
|
|||||||
|| range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV) && !buffer_descriptor);
|
|| range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV) && !buffer_descriptor);
|
||||||
mapping->binding.binding = range->binding;
|
mapping->binding.binding = range->binding;
|
||||||
mapping->binding.count = range->vk_binding_count;
|
mapping->binding.count = range->vk_binding_count;
|
||||||
|
*offset = descriptor_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d12_root_signature_map_descriptor_unbounded_binding(struct d3d12_root_signature *root_signature,
|
static void d3d12_root_signature_map_descriptor_unbounded_binding(struct d3d12_root_signature *root_signature,
|
||||||
const struct d3d12_root_descriptor_table_range *range,
|
const struct d3d12_root_descriptor_table_range *range, unsigned int descriptor_offset,
|
||||||
enum vkd3d_shader_visibility shader_visibility, struct vkd3d_descriptor_set_context *context)
|
enum vkd3d_shader_visibility shader_visibility, struct vkd3d_descriptor_set_context *context)
|
||||||
{
|
{
|
||||||
bool is_buffer = range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_CBV;
|
bool is_buffer = range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_CBV;
|
||||||
|
|
||||||
if (range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_SRV || range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV)
|
if (range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_SRV || range->type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV)
|
||||||
d3d12_root_signature_map_vk_unbounded_binding(root_signature, range, true, shader_visibility, context);
|
d3d12_root_signature_map_vk_unbounded_binding(root_signature, range,
|
||||||
|
descriptor_offset, true, shader_visibility, context);
|
||||||
|
|
||||||
d3d12_root_signature_map_vk_unbounded_binding(root_signature, range, is_buffer, shader_visibility, context);
|
d3d12_root_signature_map_vk_unbounded_binding(root_signature, range,
|
||||||
|
descriptor_offset, is_buffer, shader_visibility, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare_register_range(const void *a, const void *b)
|
static int compare_register_range(const void *a, const void *b)
|
||||||
@ -882,7 +887,7 @@ static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_roo
|
|||||||
range->binding = base_range->binding;
|
range->binding = base_range->binding;
|
||||||
range->vk_binding_count = base_range->vk_binding_count - rel_offset;
|
range->vk_binding_count = base_range->vk_binding_count - rel_offset;
|
||||||
d3d12_root_signature_map_descriptor_unbounded_binding(root_signature, range,
|
d3d12_root_signature_map_descriptor_unbounded_binding(root_signature, range,
|
||||||
shader_visibility, context);
|
rel_offset, shader_visibility, context);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (range->descriptor_count == UINT_MAX)
|
else if (range->descriptor_count == UINT_MAX)
|
||||||
@ -1165,6 +1170,9 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
|||||||
if (!(root_signature->descriptor_mapping = vkd3d_calloc(root_signature->binding_count,
|
if (!(root_signature->descriptor_mapping = vkd3d_calloc(root_signature->binding_count,
|
||||||
sizeof(*root_signature->descriptor_mapping))))
|
sizeof(*root_signature->descriptor_mapping))))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
if (!(root_signature->descriptor_offsets = vkd3d_calloc(root_signature->binding_count,
|
||||||
|
sizeof(*root_signature->descriptor_offsets))))
|
||||||
|
goto fail;
|
||||||
root_signature->root_constant_count = info.root_constant_count;
|
root_signature->root_constant_count = info.root_constant_count;
|
||||||
if (!(root_signature->root_constants = vkd3d_calloc(root_signature->root_constant_count,
|
if (!(root_signature->root_constants = vkd3d_calloc(root_signature->root_constant_count,
|
||||||
sizeof(*root_signature->root_constants))))
|
sizeof(*root_signature->root_constants))))
|
||||||
@ -1878,6 +1886,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
|
|||||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
||||||
struct vkd3d_shader_scan_descriptor_info shader_info;
|
struct vkd3d_shader_scan_descriptor_info shader_info;
|
||||||
struct vkd3d_shader_interface_info shader_interface;
|
struct vkd3d_shader_interface_info shader_interface;
|
||||||
|
struct vkd3d_shader_descriptor_offset_info offset_info;
|
||||||
const struct d3d12_root_signature *root_signature;
|
const struct d3d12_root_signature *root_signature;
|
||||||
struct vkd3d_shader_spirv_target_info target_info;
|
struct vkd3d_shader_spirv_target_info target_info;
|
||||||
VkPipelineLayout vk_pipeline_layout;
|
VkPipelineLayout vk_pipeline_layout;
|
||||||
@ -1917,6 +1926,15 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
|
|||||||
target_info.extensions = device->vk_info.shader_extensions;
|
target_info.extensions = device->vk_info.shader_extensions;
|
||||||
target_info.extension_count = device->vk_info.shader_extension_count;
|
target_info.extension_count = device->vk_info.shader_extension_count;
|
||||||
|
|
||||||
|
if (root_signature->descriptor_offsets)
|
||||||
|
{
|
||||||
|
offset_info.type = VKD3D_SHADER_STRUCTURE_TYPE_DESCRIPTOR_OFFSET_INFO;
|
||||||
|
offset_info.next = NULL;
|
||||||
|
offset_info.binding_offsets = root_signature->descriptor_offsets;
|
||||||
|
offset_info.uav_counter_offsets = NULL;
|
||||||
|
vkd3d_prepend_struct(&target_info, &offset_info);
|
||||||
|
}
|
||||||
|
|
||||||
shader_interface.type = VKD3D_SHADER_STRUCTURE_TYPE_INTERFACE_INFO;
|
shader_interface.type = VKD3D_SHADER_STRUCTURE_TYPE_INTERFACE_INFO;
|
||||||
shader_interface.next = &target_info;
|
shader_interface.next = &target_info;
|
||||||
shader_interface.bindings = root_signature->descriptor_mapping;
|
shader_interface.bindings = root_signature->descriptor_mapping;
|
||||||
|
@ -736,6 +736,7 @@ struct d3d12_root_signature
|
|||||||
|
|
||||||
unsigned int binding_count;
|
unsigned int binding_count;
|
||||||
struct vkd3d_shader_resource_binding *descriptor_mapping;
|
struct vkd3d_shader_resource_binding *descriptor_mapping;
|
||||||
|
unsigned int *descriptor_offsets;
|
||||||
|
|
||||||
unsigned int root_constant_count;
|
unsigned int root_constant_count;
|
||||||
struct vkd3d_shader_push_constant_buffer *root_constants;
|
struct vkd3d_shader_push_constant_buffer *root_constants;
|
||||||
|
@ -35105,7 +35105,6 @@ static void test_unbounded_resource_arrays(void)
|
|||||||
D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||||
get_buffer_readback_with_command_list(output_buffers[i], DXGI_FORMAT_R32_UINT, &rb, queue, command_list);
|
get_buffer_readback_with_command_list(output_buffers[i], DXGI_FORMAT_R32_UINT, &rb, queue, command_list);
|
||||||
/* Buffers at index >= 64 are aliased. */
|
/* Buffers at index >= 64 are aliased. */
|
||||||
todo_if(i != 74 && i > 63)
|
|
||||||
check_readback_data_uint(&rb, NULL, (i < 64 ? 63 - i : 127 - i) ^ 0x35, 0);
|
check_readback_data_uint(&rb, NULL, (i < 64 ? 63 - i : 127 - i) ^ 0x35, 0);
|
||||||
release_resource_readback(&rb);
|
release_resource_readback(&rb);
|
||||||
reset_command_list(command_list, context.allocator);
|
reset_command_list(command_list, context.allocator);
|
||||||
|
Reference in New Issue
Block a user