[PATCH vkd3d 01/10] vkd3d: Set the numer of samples for graphics pipelines.

Józef Kucia joseph.kucia at gmail.com
Thu Oct 25 04:23:59 CDT 2018


From: Józef Kucia <jkucia at codeweavers.com>

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 libs/vkd3d/resource.c      |  2 +-
 libs/vkd3d/state.c         | 14 ++++++++------
 libs/vkd3d/vkd3d_private.h |  1 +
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 68c189ad5bd4..55abd50c2c67 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -334,7 +334,7 @@ static VkImageType vk_image_type_from_d3d12_resource_dimension(D3D12_RESOURCE_DI
     }
 }
 
-static VkSampleCountFlagBits vk_samples_from_dxgi_sample_desc(const DXGI_SAMPLE_DESC *desc)
+VkSampleCountFlagBits vk_samples_from_dxgi_sample_desc(const DXGI_SAMPLE_DESC *desc)
 {
     switch (desc->Count)
     {
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index f6ccb247553c..0deea28edb6b 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -1874,6 +1874,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
     struct vkd3d_shader_signature input_signature;
     struct VkSubpassDescription sub_pass_desc;
     struct VkRenderPassCreateInfo pass_desc;
+    VkSampleCountFlagBits sample_count;
     const struct vkd3d_format *format;
     enum VkVertexInputRate input_rate;
     unsigned int i, j;
@@ -1914,6 +1915,10 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
         return E_INVALIDARG;
     }
 
+    sample_count = vk_samples_from_dxgi_sample_desc(&desc->SampleDesc);
+    if (desc->SampleDesc.Count != 1 && desc->SampleDesc.Quality)
+        WARN("Ignoring sample quality %u.\n", desc->SampleDesc.Quality);
+
     rt_count = desc->NumRenderTargets;
     if (rt_count > ARRAY_SIZE(graphics->attachments) - 1)
     {
@@ -1943,7 +1948,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
 
         graphics->attachments[0].flags = 0;
         graphics->attachments[0].format = format->vk_format;
-        graphics->attachments[0].samples = VK_SAMPLE_COUNT_1_BIT;
+        graphics->attachments[0].samples = sample_count;
         if (desc->DepthStencilState.DepthEnable)
         {
             graphics->attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
@@ -2002,7 +2007,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
 
         graphics->attachments[idx].flags = 0;
         graphics->attachments[idx].format = format->vk_format;
-        graphics->attachments[idx].samples = VK_SAMPLE_COUNT_1_BIT;
+        graphics->attachments[idx].samples = sample_count;
         graphics->attachments[idx].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
         graphics->attachments[idx].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
         graphics->attachments[idx].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
@@ -2202,7 +2207,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
     graphics->ms_desc.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
     graphics->ms_desc.pNext = NULL;
     graphics->ms_desc.flags = 0;
-    graphics->ms_desc.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
+    graphics->ms_desc.rasterizationSamples = sample_count;
     graphics->ms_desc.sampleShadingEnable = VK_FALSE;
     graphics->ms_desc.minSampleShading = 0.0f;
     graphics->ms_desc.pSampleMask = NULL;
@@ -2211,9 +2216,6 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
 
     ds_desc_from_d3d12(&graphics->ds_desc, &desc->DepthStencilState);
 
-    if (desc->SampleDesc.Count != 1)
-        FIXME("Ignoring sample desc %u, %u.\n", desc->SampleDesc.Count, desc->SampleDesc.Quality);
-
     graphics->root_signature = root_signature;
 
     list_init(&graphics->compiled_pipelines);
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index f60dc5f96676..5f5798852290 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -848,6 +848,7 @@ static inline unsigned int d3d12_resource_desc_get_layer_count(const D3D12_RESOU
 }
 
 enum VkCompareOp vk_compare_op_from_d3d12(D3D12_COMPARISON_FUNC op) DECLSPEC_HIDDEN;
+VkSampleCountFlagBits vk_samples_from_dxgi_sample_desc(const DXGI_SAMPLE_DESC *desc) DECLSPEC_HIDDEN;
 
 bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level) DECLSPEC_HIDDEN;
 bool check_feature_level_support(D3D_FEATURE_LEVEL feature_level) DECLSPEC_HIDDEN;
-- 
2.18.1




More information about the wine-devel mailing list