libs/vkd3d: Implement d3d12_command_list_SetComputeRoot32BitConstant().
This commit is contained in:
parent
4d8dea80ae
commit
72f723522e
|
@ -2337,11 +2337,42 @@ static void STDMETHODCALLTYPE d3d12_command_list_SetGraphicsRootDescriptorTable(
|
||||||
root_parameter_index, base_descriptor);
|
root_parameter_index, base_descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void d3d12_command_list_set_root_constants(struct d3d12_command_list *list,
|
||||||
|
struct d3d12_root_signature *root_signature, unsigned int root_parameter_index,
|
||||||
|
unsigned int offset, unsigned int count, const void *data)
|
||||||
|
{
|
||||||
|
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
|
||||||
|
struct d3d12_root_constant *constant = NULL;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < root_signature->constant_count; ++i)
|
||||||
|
{
|
||||||
|
if (root_signature->constants[i].root_parameter_index == root_parameter_index)
|
||||||
|
{
|
||||||
|
constant = &root_signature->constants[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!constant)
|
||||||
|
{
|
||||||
|
WARN("Invalid root parameter index %u.\n", root_parameter_index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VK_CALL(vkCmdPushConstants(list->vk_command_buffer, root_signature->vk_pipeline_layout,
|
||||||
|
constant->stage_flags, constant->offset + offset * sizeof(uint32_t), count * sizeof(uint32_t), data));
|
||||||
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d12_command_list_SetComputeRoot32BitConstant(ID3D12GraphicsCommandList *iface,
|
static void STDMETHODCALLTYPE d3d12_command_list_SetComputeRoot32BitConstant(ID3D12GraphicsCommandList *iface,
|
||||||
UINT root_parameter_index, UINT data, UINT dst_offset)
|
UINT root_parameter_index, UINT data, UINT dst_offset)
|
||||||
{
|
{
|
||||||
FIXME("iface %p, root_parameter_index %u, data 0x%08x, dst_offset %u stub!\n",
|
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
|
||||||
|
|
||||||
|
TRACE("iface %p, root_parameter_index %u, data 0x%08x, dst_offset %u.\n",
|
||||||
iface, root_parameter_index, data, dst_offset);
|
iface, root_parameter_index, data, dst_offset);
|
||||||
|
|
||||||
|
d3d12_command_list_set_root_constants(list, list->compute_root_signature,
|
||||||
|
root_parameter_index, dst_offset, 1, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d12_command_list_SetGraphicsRoot32BitConstant(ID3D12GraphicsCommandList *iface,
|
static void STDMETHODCALLTYPE d3d12_command_list_SetGraphicsRoot32BitConstant(ID3D12GraphicsCommandList *iface,
|
||||||
|
|
|
@ -74,6 +74,8 @@ 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);
|
||||||
|
if (root_signature->constants)
|
||||||
|
vkd3d_free(root_signature->constants);
|
||||||
|
|
||||||
for (i = 0; i < root_signature->static_sampler_count; ++i)
|
for (i = 0; i < root_signature->static_sampler_count; ++i)
|
||||||
{
|
{
|
||||||
|
@ -335,6 +337,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
||||||
root_signature->pool_sizes = NULL;
|
root_signature->pool_sizes = NULL;
|
||||||
root_signature->vk_set_layout = VK_NULL_HANDLE;
|
root_signature->vk_set_layout = VK_NULL_HANDLE;
|
||||||
root_signature->descriptor_mapping = NULL;
|
root_signature->descriptor_mapping = NULL;
|
||||||
|
root_signature->constants = NULL;
|
||||||
root_signature->static_sampler_count = 0;
|
root_signature->static_sampler_count = 0;
|
||||||
root_signature->static_samplers = NULL;
|
root_signature->static_samplers = NULL;
|
||||||
|
|
||||||
|
@ -396,6 +399,13 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
root_signature->constant_count = push_count;
|
||||||
|
if (!(root_signature->constants = vkd3d_calloc(root_signature->constant_count,
|
||||||
|
sizeof(*root_signature->constants))))
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
/* Map root constants to push constants. */
|
/* Map root constants to push constants. */
|
||||||
for (i = 0, j = 0; i < desc->NumParameters; ++i)
|
for (i = 0, j = 0; i < desc->NumParameters; ++i)
|
||||||
|
@ -414,7 +424,12 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
||||||
|
|
||||||
push_constants[j].stageFlags = stage_flags_from_visibility(p->ShaderVisibility);
|
push_constants[j].stageFlags = stage_flags_from_visibility(p->ShaderVisibility);
|
||||||
push_constants[j].offset = 0;
|
push_constants[j].offset = 0;
|
||||||
push_constants[j].size = 4 * p->u.Constants.Num32BitValues;
|
push_constants[j].size = p->u.Constants.Num32BitValues * sizeof(uint32_t);
|
||||||
|
|
||||||
|
root_signature->constants[j].root_parameter_index = i;
|
||||||
|
root_signature->constants[j].stage_flags = push_constants[j].stageFlags;
|
||||||
|
root_signature->constants[j].offset = push_constants[j].offset;
|
||||||
|
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,13 @@ struct d3d12_query_heap
|
||||||
HRESULT d3d12_query_heap_create(struct d3d12_device *device,
|
HRESULT d3d12_query_heap_create(struct d3d12_device *device,
|
||||||
struct d3d12_query_heap **heap) DECLSPEC_HIDDEN;
|
struct d3d12_query_heap **heap) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
struct d3d12_root_constant
|
||||||
|
{
|
||||||
|
unsigned int root_parameter_index;
|
||||||
|
VkShaderStageFlags stage_flags;
|
||||||
|
uint32_t offset;
|
||||||
|
};
|
||||||
|
|
||||||
/* ID3D12RootSignature */
|
/* ID3D12RootSignature */
|
||||||
struct d3d12_root_signature
|
struct d3d12_root_signature
|
||||||
{
|
{
|
||||||
|
@ -277,6 +284,9 @@ struct d3d12_root_signature
|
||||||
unsigned int descriptor_count;
|
unsigned int descriptor_count;
|
||||||
struct vkd3d_shader_resource_binding *descriptor_mapping;
|
struct vkd3d_shader_resource_binding *descriptor_mapping;
|
||||||
|
|
||||||
|
unsigned int constant_count;
|
||||||
|
struct d3d12_root_constant *constants;
|
||||||
|
|
||||||
unsigned int static_sampler_count;
|
unsigned int static_sampler_count;
|
||||||
VkSampler *static_samplers;
|
VkSampler *static_samplers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue