mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d: Store view properties in vkd3d_view.
The additional data is needed to implement UAV clears. Moving this out of d3d12_desc also helps make copying and traversing descriptor arrays more CPU cache-friendly. Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1d955506a3
commit
4a191a27dc
@ -4818,14 +4818,14 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
|
||||
|
||||
if (d3d12_resource_is_buffer(resource_impl))
|
||||
{
|
||||
if (!cpu_descriptor->uav.buffer.size)
|
||||
if (cpu_descriptor->u.view->format->vk_format != VK_FORMAT_R32_UINT)
|
||||
{
|
||||
FIXME("Not supported for UAV descriptor %p.\n", cpu_descriptor);
|
||||
return;
|
||||
}
|
||||
|
||||
VK_CALL(vkCmdFillBuffer(list->vk_command_buffer, resource_impl->u.vk_buffer,
|
||||
cpu_descriptor->uav.buffer.offset, cpu_descriptor->uav.buffer.size, values[0]));
|
||||
cpu_descriptor->u.view->info.buffer.offset, cpu_descriptor->u.view->info.buffer.size, values[0]));
|
||||
|
||||
buffer_barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
||||
buffer_barrier.pNext = NULL;
|
||||
@ -4833,8 +4833,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
|
||||
buffer_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
buffer_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
buffer_barrier.buffer = resource_impl->u.vk_buffer;
|
||||
buffer_barrier.offset = cpu_descriptor->uav.buffer.offset;
|
||||
buffer_barrier.size = cpu_descriptor->uav.buffer.size;
|
||||
buffer_barrier.offset = cpu_descriptor->u.view->info.buffer.offset;
|
||||
buffer_barrier.size = cpu_descriptor->u.view->info.buffer.size;
|
||||
|
||||
vk_barrier_parameters_from_d3d12_resource_state(D3D12_RESOURCE_STATE_UNORDERED_ACCESS, 0,
|
||||
resource_impl, list->vk_queue_flags, vk_info, &buffer_barrier.dstAccessMask, &stage_mask, NULL);
|
||||
@ -4850,11 +4850,11 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
|
||||
color.uint32[2] = values[2];
|
||||
color.uint32[3] = values[3];
|
||||
|
||||
range.aspectMask = cpu_descriptor->uav.texture.vk_aspect_mask;
|
||||
range.baseMipLevel = cpu_descriptor->uav.texture.miplevel_idx;
|
||||
range.aspectMask = cpu_descriptor->u.view->format->vk_aspect_mask;
|
||||
range.baseMipLevel = cpu_descriptor->u.view->info.texture.miplevel_idx;
|
||||
range.levelCount = 1;
|
||||
range.baseArrayLayer = cpu_descriptor->uav.texture.layer_idx;
|
||||
range.layerCount = cpu_descriptor->uav.texture.layer_count;
|
||||
range.baseArrayLayer = cpu_descriptor->u.view->info.texture.layer_idx;
|
||||
range.layerCount = cpu_descriptor->u.view->info.texture.layer_count;
|
||||
|
||||
VK_CALL(vkCmdClearColorImage(list->vk_command_buffer,
|
||||
resource_impl->u.vk_image, VK_IMAGE_LAYOUT_GENERAL, &color, 1, &range));
|
||||
|
@ -2166,6 +2166,9 @@ static bool vkd3d_create_buffer_view(struct d3d12_device *device,
|
||||
}
|
||||
|
||||
object->u.vk_buffer_view = vk_view;
|
||||
object->format = format;
|
||||
object->info.buffer.offset = offset;
|
||||
object->info.buffer.size = size;
|
||||
*view = object;
|
||||
return true;
|
||||
}
|
||||
@ -2442,6 +2445,11 @@ static bool vkd3d_create_texture_view(struct d3d12_device *device,
|
||||
}
|
||||
|
||||
object->u.vk_image_view = vk_view;
|
||||
object->format = format;
|
||||
object->info.texture.vk_view_type = desc->view_type;
|
||||
object->info.texture.miplevel_idx = desc->miplevel_idx;
|
||||
object->info.texture.layer_idx = desc->layer_idx;
|
||||
object->info.texture.layer_count = desc->layer_count;
|
||||
*view = object;
|
||||
return true;
|
||||
}
|
||||
@ -2812,16 +2820,6 @@ static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor, struct d3d12_
|
||||
d3d12_desc_destroy(descriptor, device);
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: Clears are implemented only for R32_UINT buffer UAVs. */
|
||||
if ((desc->Format == DXGI_FORMAT_R32_TYPELESS && (desc->u.Buffer.Flags & VKD3D_VIEW_RAW_BUFFER))
|
||||
|| desc->Format == DXGI_FORMAT_R32_UINT)
|
||||
{
|
||||
const struct vkd3d_format *format = vkd3d_get_format(device, DXGI_FORMAT_R32_UINT, false);
|
||||
|
||||
descriptor->uav.buffer.offset = desc->u.Buffer.FirstElement * format->byte_count;
|
||||
descriptor->uav.buffer.size = desc->u.Buffer.NumElements * format->byte_count;
|
||||
}
|
||||
}
|
||||
|
||||
static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor,
|
||||
@ -2875,11 +2873,6 @@ static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor,
|
||||
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_UAV;
|
||||
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
||||
descriptor->u.view = view;
|
||||
|
||||
descriptor->uav.texture.vk_aspect_mask = vkd3d_desc.format->vk_aspect_mask;
|
||||
descriptor->uav.texture.miplevel_idx = vkd3d_desc.miplevel_idx;
|
||||
descriptor->uav.texture.layer_idx = vkd3d_desc.layer_idx;
|
||||
descriptor->uav.texture.layer_count = vkd3d_desc.layer_count;
|
||||
}
|
||||
|
||||
void d3d12_desc_create_uav(struct d3d12_desc *descriptor, struct d3d12_device *device,
|
||||
|
@ -468,6 +468,22 @@ struct vkd3d_view
|
||||
VkSampler vk_sampler;
|
||||
} u;
|
||||
VkBufferView vk_counter_view;
|
||||
const struct vkd3d_format *format;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
VkDeviceSize offset;
|
||||
VkDeviceSize size;
|
||||
} buffer;
|
||||
struct
|
||||
{
|
||||
VkImageViewType vk_view_type;
|
||||
unsigned int miplevel_idx;
|
||||
unsigned int layer_idx;
|
||||
unsigned int layer_count;
|
||||
} texture;
|
||||
} info;
|
||||
};
|
||||
|
||||
void vkd3d_view_decref(struct vkd3d_view *view, struct d3d12_device *device) DECLSPEC_HIDDEN;
|
||||
@ -482,22 +498,6 @@ struct d3d12_desc
|
||||
VkDescriptorBufferInfo vk_cbv_info;
|
||||
struct vkd3d_view *view;
|
||||
} u;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
VkDeviceSize offset;
|
||||
VkDeviceSize size;
|
||||
} buffer;
|
||||
struct
|
||||
{
|
||||
VkImageAspectFlags vk_aspect_mask;
|
||||
unsigned int miplevel_idx;
|
||||
unsigned int layer_idx;
|
||||
unsigned int layer_count;
|
||||
} texture;
|
||||
} uav;
|
||||
};
|
||||
|
||||
static inline struct d3d12_desc *d3d12_desc_from_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle)
|
||||
|
Loading…
x
Reference in New Issue
Block a user