mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
libs/vkd3d: Implement d3d12_device_CreateConstantBufferView().
This commit is contained in:
parent
6de74f6cc3
commit
0859b94833
@ -48,6 +48,7 @@ const UINT D3D12_SHADER_COMPONENT_MAPPING_SHIFT = 3;
|
||||
const UINT D3D12_SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES
|
||||
= 1 << (D3D12_SHADER_COMPONENT_MAPPING_SHIFT * 4);
|
||||
const UINT D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT = 8;
|
||||
const UINT D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT = 256;
|
||||
const UINT D3D12_TEXTURE_DATA_PITCH_ALIGNMENT = 256;
|
||||
const UINT D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT = 512;
|
||||
const UINT D3D12_VS_INPUT_REGISTER_COUNT = 32;
|
||||
|
@ -882,7 +882,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature(ID3D12Device *
|
||||
static void STDMETHODCALLTYPE d3d12_device_CreateConstantBufferView(ID3D12Device *iface,
|
||||
const D3D12_CONSTANT_BUFFER_VIEW_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor)
|
||||
{
|
||||
FIXME("iface %p, desc %p, descriptor %#lx stub!\n", iface, desc, descriptor.ptr);
|
||||
TRACE("iface %p, desc %p, descriptor %#lx.\n", iface, desc, descriptor.ptr);
|
||||
|
||||
d3d12_cbv_srv_uav_desc_create_cbv((struct d3d12_cbv_srv_uav_desc *)descriptor.ptr,
|
||||
impl_from_ID3D12Device(iface), desc);
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d12_device_CreateShaderResourceView(ID3D12Device *iface,
|
||||
|
@ -763,6 +763,7 @@ static void d3d12_cbv_srv_uav_desc_destroy(struct d3d12_cbv_srv_uav_desc *descri
|
||||
{
|
||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
||||
|
||||
/* Nothing to do for VKD3D_DESCRIPTOR_MAGIC_CBV. */
|
||||
if (descriptor->magic == VKD3D_DESCRIPTOR_MAGIC_SRV)
|
||||
{
|
||||
VK_CALL(vkDestroyImageView(device->vk_device, descriptor->u.vk_image_view, NULL));
|
||||
@ -828,6 +829,36 @@ static VkResult vkd3d_create_texture_view(struct d3d12_device *device,
|
||||
return vr;
|
||||
}
|
||||
|
||||
void d3d12_cbv_srv_uav_desc_create_cbv(struct d3d12_cbv_srv_uav_desc *descriptor,
|
||||
struct d3d12_device *device, const D3D12_CONSTANT_BUFFER_VIEW_DESC *desc)
|
||||
{
|
||||
struct VkDescriptorBufferInfo *buffer_info;
|
||||
struct d3d12_resource *resource;
|
||||
|
||||
d3d12_cbv_srv_uav_desc_destroy(descriptor, device);
|
||||
|
||||
if (!desc)
|
||||
{
|
||||
WARN("Constant buffer desc is NULL.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (desc->SizeInBytes & (D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT - 1))
|
||||
{
|
||||
WARN("Size is not %u bytes aligned.\n", D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
|
||||
return;
|
||||
}
|
||||
|
||||
resource = vkd3d_gpu_va_allocator_dereference(&device->gpu_va_allocator, desc->BufferLocation);
|
||||
buffer_info = &descriptor->u.vk_cbv_info;
|
||||
buffer_info->buffer = resource->u.vk_buffer;
|
||||
buffer_info->offset = desc->BufferLocation - resource->gpu_address;
|
||||
buffer_info->range = min(desc->SizeInBytes, resource->desc.Width - buffer_info->offset);
|
||||
|
||||
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_CBV;
|
||||
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||
}
|
||||
|
||||
void d3d12_cbv_srv_uav_desc_create_srv(struct d3d12_cbv_srv_uav_desc *descriptor,
|
||||
struct d3d12_device *device, struct d3d12_resource *resource,
|
||||
const D3D12_SHADER_RESOURCE_VIEW_DESC *desc)
|
||||
|
@ -185,11 +185,14 @@ struct d3d12_cbv_srv_uav_desc
|
||||
VkDescriptorType vk_descriptor_type;
|
||||
union
|
||||
{
|
||||
VkDescriptorBufferInfo vk_cbv_info;
|
||||
VkBufferView vk_buffer_view;
|
||||
VkImageView vk_image_view;
|
||||
} u;
|
||||
};
|
||||
|
||||
void d3d12_cbv_srv_uav_desc_create_cbv(struct d3d12_cbv_srv_uav_desc *descriptor,
|
||||
struct d3d12_device *device, const D3D12_CONSTANT_BUFFER_VIEW_DESC *desc) DECLSPEC_HIDDEN;
|
||||
void d3d12_cbv_srv_uav_desc_create_srv(struct d3d12_cbv_srv_uav_desc *descriptor,
|
||||
struct d3d12_device *device, struct d3d12_resource *resource,
|
||||
const D3D12_SHADER_RESOURCE_VIEW_DESC *desc) DECLSPEC_HIDDEN;
|
||||
|
Loading…
x
Reference in New Issue
Block a user