=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d: Drop support for dummy sampler.

Alexandre Julliard julliard at winehq.org
Thu Apr 4 15:28:37 CDT 2019


Module: vkd3d
Branch: master
Commit: 41274e6285f8d126eb3f40c5fd4a93a2353e8ca4
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=41274e6285f8d126eb3f40c5fd4a93a2353e8ca4

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Apr  4 13:01:29 2019 +0200

vkd3d: Drop support for dummy sampler.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/vkd3d_shader.h     |  6 ------
 libs/vkd3d-shader/spirv.c  |  1 -
 libs/vkd3d/device.c        | 21 ---------------------
 libs/vkd3d/state.c         | 32 --------------------------------
 libs/vkd3d/vkd3d_private.h |  4 ----
 5 files changed, 64 deletions(-)

diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h
index ed4c0a0..15a0b22 100644
--- a/include/vkd3d_shader.h
+++ b/include/vkd3d_shader.h
@@ -144,12 +144,6 @@ struct vkd3d_shader_interface_info
     const struct vkd3d_shader_combined_resource_sampler *combined_samplers;
     unsigned int combined_sampler_count;
 
-    /* A sampler used by OpImageFetches generated for SM4 ld instructions.
-     *
-     * In Vulkan OpImageFetch must be used with a sampled image.
-     */
-    struct vkd3d_shader_descriptor_binding dummy_sampler;
-
     const struct vkd3d_shader_uav_counter_binding *uav_counters;
     unsigned int uav_counter_count;
 };
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index e036c71..b013416 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -2004,7 +2004,6 @@ struct vkd3d_dxbc_compiler
     uint32_t private_output_variable[MAX_REG_OUTPUT + 1]; /* 1 entry for oDepth */
     uint32_t private_output_variable_write_mask[MAX_REG_OUTPUT + 1]; /* 1 entry for oDepth */
     uint32_t epilogue_function_id;
-    uint32_t dummy_sampler_id;
 
     uint32_t binding_idx;
 
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index 8563b43..78f339f 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -1634,18 +1634,6 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device,
     return hr;
 }
 
-static HRESULT d3d12_device_create_dummy_sampler(struct d3d12_device *device)
-{
-    D3D12_STATIC_SAMPLER_DESC sampler_desc;
-
-    memset(&sampler_desc, 0, sizeof(sampler_desc));
-    sampler_desc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT;
-    sampler_desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
-    sampler_desc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
-    sampler_desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
-    return vkd3d_create_static_sampler(device, &sampler_desc, &device->vk_dummy_sampler);
-}
-
 static HRESULT d3d12_device_init_pipeline_cache(struct d3d12_device *device)
 {
     const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
@@ -1855,7 +1843,6 @@ static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device *iface)
         vkd3d_destroy_null_resources(&device->null_resources, device);
         vkd3d_gpu_va_allocator_cleanup(&device->gpu_va_allocator);
         vkd3d_fence_worker_stop(&device->fence_worker, device);
-        VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL));
         d3d12_device_destroy_pipeline_cache(device);
         d3d12_device_destroy_vkd3d_queues(device);
         VK_CALL(vkDestroyDevice(device->vk_device, NULL));
@@ -3003,17 +2990,10 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
     device->removed_reason = S_OK;
 
     device->vk_device = VK_NULL_HANDLE;
-    device->vk_dummy_sampler = VK_NULL_HANDLE;
 
     if (FAILED(hr = vkd3d_create_vk_device(device, create_info)))
         goto out_free_instance;
 
-    if (FAILED(hr = d3d12_device_create_dummy_sampler(device)))
-    {
-        ERR("Failed to create dummy sampler, hr %#x.\n", hr);
-        goto out_free_vk_resources;
-    }
-
     if (FAILED(hr = d3d12_device_init_pipeline_cache(device)))
         goto out_free_vk_resources;
 
@@ -3041,7 +3021,6 @@ out_free_pipeline_cache:
     d3d12_device_destroy_pipeline_cache(device);
 out_free_vk_resources:
     vk_procs = &device->vk_procs;
-    VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL));
     VK_CALL(vkDestroyDevice(device->vk_device, NULL));
 out_free_instance:
     vkd3d_instance_decref(device->vkd3d_instance);
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index aa9f62b..c7ae63b 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -775,24 +775,6 @@ static HRESULT d3d12_root_signature_init_root_descriptors(struct d3d12_root_sign
     return S_OK;
 }
 
-static HRESULT d3d12_root_signature_init_dummy_sampler(struct d3d12_root_signature *root_signature,
-        struct d3d12_device *device, struct vkd3d_descriptor_set_context *context)
-{
-    VkDescriptorSetLayoutBinding *binding = context->current_binding;
-
-    root_signature->dummy_sampler.set = context->set_index;
-    root_signature->dummy_sampler.binding = context->descriptor_binding++;
-
-    binding->binding = root_signature->dummy_sampler.binding;
-    binding->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
-    binding->descriptorCount = 1;
-    binding->stageFlags = VK_SHADER_STAGE_ALL;
-    binding->pImmutableSamplers = &device->vk_dummy_sampler;
-
-    ++context->current_binding;
-    return S_OK;
-}
-
 static HRESULT d3d12_root_signature_init_static_samplers(struct d3d12_root_signature *root_signature,
         struct d3d12_device *device, const D3D12_ROOT_SIGNATURE_DESC *desc,
         struct vkd3d_descriptor_set_context *context)
@@ -883,7 +865,6 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
     VkDescriptorSetLayoutBinding *binding_desc;
     struct d3d12_root_signature_info info;
     VkDescriptorSetLayout set_layouts[2];
-    bool needs_dummy_sampler;
     HRESULT hr;
 
     memset(&context, 0, sizeof(context));
@@ -924,14 +905,6 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
     root_signature->static_sampler_count = desc->NumStaticSamplers;
     root_signature->root_descriptor_count = info.root_descriptor_count;
 
-    /* An additional sampler is created for SpvOpImageFetch. */
-    needs_dummy_sampler = info.srv_count || info.buffer_srv_count;
-    if (needs_dummy_sampler)
-    {
-        ++info.sampler_count;
-        ++info.descriptor_count;
-    }
-
     hr = E_OUTOFMEMORY;
     root_signature->parameter_count = desc->NumParameters;
     if (!(root_signature->parameters = vkd3d_calloc(root_signature->parameter_count,
@@ -978,9 +951,6 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
         goto fail;
     if (FAILED(hr = d3d12_root_signature_init_static_samplers(root_signature, device, desc, &context)))
         goto fail;
-    if (needs_dummy_sampler && FAILED(hr = d3d12_root_signature_init_dummy_sampler(root_signature,
-            device, &context)))
-        goto fail;
 
     root_signature->main_set = context.set_index;
     if (context.descriptor_binding)
@@ -1421,7 +1391,6 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
     shader_interface.push_constant_buffer_count = root_signature->root_constant_count;
     shader_interface.combined_samplers = NULL;
     shader_interface.combined_sampler_count = 0;
-    shader_interface.dummy_sampler = root_signature->dummy_sampler;
     shader_interface.uav_counters = state->uav_counters;
     shader_interface.uav_counter_count = vkd3d_popcount(state->uav_counter_mask);
 
@@ -2148,7 +2117,6 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
     shader_interface.push_constant_buffer_count = root_signature->root_constant_count;
     shader_interface.combined_samplers = NULL;
     shader_interface.combined_sampler_count = 0;
-    shader_interface.dummy_sampler = root_signature->dummy_sampler;
     shader_interface.uav_counters = NULL;
     shader_interface.uav_counter_count = 0;
 
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index c071b41..24d26d9 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -584,7 +584,6 @@ struct d3d12_root_signature
 
     unsigned int descriptor_count;
     struct vkd3d_shader_resource_binding *descriptor_mapping;
-    struct vkd3d_shader_descriptor_binding dummy_sampler;
 
     unsigned int root_constant_count;
     struct vkd3d_shader_push_constant_buffer *root_constants;
@@ -912,9 +911,6 @@ struct d3d12_device
     pthread_mutex_t pipeline_cache_mutex;
     VkPipelineCache vk_pipeline_cache;
 
-    /* A sampler used for SpvOpImageFetch. */
-    VkSampler vk_dummy_sampler;
-
     VkPhysicalDeviceMemoryProperties memory_properties;
 
     D3D12_FEATURE_DATA_D3D12_OPTIONS feature_options;




More information about the wine-cvs mailing list