mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
libs/vkd3d: Allocate Vulkan descriptors for samplers.
This commit is contained in:
parent
593a13402d
commit
d1de972430
@ -222,9 +222,9 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
|||||||
{
|
{
|
||||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
||||||
struct VkPipelineLayoutCreateInfo pipeline_layout_info;
|
struct VkPipelineLayoutCreateInfo pipeline_layout_info;
|
||||||
|
size_t cbv_count = 0, srv_count = 0, sampler_count = 0;
|
||||||
struct VkDescriptorSetLayoutBinding *binding_desc;
|
struct VkDescriptorSetLayoutBinding *binding_desc;
|
||||||
struct VkDescriptorSetLayoutCreateInfo set_desc;
|
struct VkDescriptorSetLayoutCreateInfo set_desc;
|
||||||
size_t cbv_count = 0, srv_count = 0;
|
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
VkResult vr;
|
VkResult vr;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@ -284,6 +284,9 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
|||||||
|
|
||||||
switch (binding_desc[i].descriptorType)
|
switch (binding_desc[i].descriptorType)
|
||||||
{
|
{
|
||||||
|
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||||
|
sampler_count += binding_desc[i].descriptorCount;
|
||||||
|
break;
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
cbv_count += binding_desc[i].descriptorCount;
|
cbv_count += binding_desc[i].descriptorCount;
|
||||||
break;
|
break;
|
||||||
@ -305,6 +308,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
|||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sampler_count += desc->NumStaticSamplers;
|
||||||
for (j = 0; j < desc->NumStaticSamplers; ++i, ++j)
|
for (j = 0; j < desc->NumStaticSamplers; ++i, ++j)
|
||||||
{
|
{
|
||||||
const D3D12_STATIC_SAMPLER_DESC *s = &desc->pStaticSamplers[j];
|
const D3D12_STATIC_SAMPLER_DESC *s = &desc->pStaticSamplers[j];
|
||||||
@ -341,13 +345,15 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
|||||||
return hresult_from_vk_result(vr);
|
return hresult_from_vk_result(vr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cbv_count || srv_count)
|
if (cbv_count || srv_count || sampler_count)
|
||||||
{
|
{
|
||||||
root_signature->pool_size_count = 0;
|
root_signature->pool_size_count = 0;
|
||||||
if (cbv_count)
|
if (cbv_count)
|
||||||
++root_signature->pool_size_count;
|
++root_signature->pool_size_count;
|
||||||
if (srv_count)
|
if (srv_count)
|
||||||
++root_signature->pool_size_count;
|
++root_signature->pool_size_count;
|
||||||
|
if (sampler_count)
|
||||||
|
++root_signature->pool_size_count;
|
||||||
if (!(root_signature->pool_sizes = vkd3d_calloc(root_signature->pool_size_count,
|
if (!(root_signature->pool_sizes = vkd3d_calloc(root_signature->pool_size_count,
|
||||||
sizeof(*root_signature->pool_sizes))))
|
sizeof(*root_signature->pool_sizes))))
|
||||||
{
|
{
|
||||||
@ -369,6 +375,11 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
|
|||||||
root_signature->pool_sizes[i].type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
|
root_signature->pool_sizes[i].type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
|
||||||
root_signature->pool_sizes[i++].descriptorCount = srv_count;
|
root_signature->pool_sizes[i++].descriptorCount = srv_count;
|
||||||
}
|
}
|
||||||
|
if (sampler_count)
|
||||||
|
{
|
||||||
|
root_signature->pool_sizes[i].type = VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||||
|
root_signature->pool_sizes[i++].descriptorCount = sampler_count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user