=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d: Implement RasterizedStream.

Alexandre Julliard julliard at winehq.org
Mon Jan 14 16:21:23 CST 2019


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Jan 14 17:05:41 2019 +0100

vkd3d: Implement RasterizedStream.

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>

---

 libs/vkd3d/device.c        |  1 +
 libs/vkd3d/state.c         | 27 ++++++++++++++++++++++++++-
 libs/vkd3d/vkd3d_private.h | 26 +++++++++++++++-----------
 3 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index 71666f9..03a7a25 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -940,6 +940,7 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
 
     vulkan_info->device_limits = device_properties2.properties.limits;
     vulkan_info->sparse_properties = device_properties2.properties.sparseProperties;
+    vulkan_info->rasterization_stream = xfb_properties.transformFeedbackRasterizationStreamSelect;
     vulkan_info->max_vertex_attrib_divisor = max(vertex_divisor_properties.maxVertexAttribDivisor, 1);
 
     device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64;
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 86ceee3..7af8b60 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -1614,6 +1614,27 @@ static void rs_desc_from_d3d12(struct VkPipelineRasterizationStateCreateInfo *vk
         FIXME("Ignoring ConservativeRaster %#x.\n", d3d12_desc->ConservativeRaster);
 }
 
+static void rs_stream_desc_from_d3d12(VkPipelineRasterizationStateStreamCreateInfoEXT *vk_desc,
+        VkPipelineRasterizationStateCreateInfo *vk_rs_desc, const D3D12_STREAM_OUTPUT_DESC *so_desc,
+        const struct vkd3d_vulkan_info *vk_info)
+{
+    if (!so_desc->RasterizedStream || so_desc->RasterizedStream == D3D12_SO_NO_RASTERIZED_STREAM)
+        return;
+
+    if (!vk_info->rasterization_stream)
+    {
+        FIXME("Rasterization stream select is not supported by Vulkan implementation.\n");
+        return;
+    }
+
+    vk_desc->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT;
+    vk_desc->pNext = NULL;
+    vk_desc->flags = 0;
+    vk_desc->rasterizationStream = so_desc->RasterizedStream;
+
+    vk_rs_desc->pNext = vk_desc;
+}
+
 static enum VkStencilOp vk_stencil_op_from_d3d12(D3D12_STENCIL_OP op)
 {
     switch (op)
@@ -1916,6 +1937,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
     unsigned int ps_output_swizzle[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
     struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
     const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+    const D3D12_STREAM_OUTPUT_DESC *so_desc = &desc->StreamOutput;
     VkVertexInputBindingDivisorDescriptionEXT *binding_divisor;
     const struct vkd3d_vulkan_info *vk_info = &device->vk_info;
     const struct vkd3d_shader_compile_arguments *compile_args;
@@ -2350,9 +2372,12 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
     }
 
     rs_desc_from_d3d12(&graphics->rs_desc, &desc->RasterizerState);
-    if (!graphics->attachment_count && !(desc->PS.pShaderBytecode && desc->PS.BytecodeLength))
+    if ((!graphics->attachment_count && !(desc->PS.pShaderBytecode && desc->PS.BytecodeLength))
+            || so_desc->RasterizedStream == D3D12_SO_NO_RASTERIZED_STREAM)
         graphics->rs_desc.rasterizerDiscardEnable = VK_TRUE;
 
+    rs_stream_desc_from_d3d12(&graphics->rs_stream_desc, &graphics->rs_desc, so_desc, vk_info);
+
     if (desc->SampleMask != ~0u)
         FIXME("Ignoring sample mask %#x.\n", desc->SampleMask);
 
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 62245b1..4564b96 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -90,6 +90,8 @@ struct vkd3d_vulkan_info
     bool EXT_transform_feedback;
     bool EXT_vertex_attribute_divisor;
 
+    bool rasterization_stream;
+
     bool vertex_attrib_zero_divisor;
     unsigned int max_vertex_attrib_divisor;
 
@@ -559,7 +561,7 @@ struct d3d12_root_signature
     VkDescriptorSetLayout vk_push_set_layout;
     VkDescriptorSetLayout vk_set_layout;
 
-    struct VkDescriptorPoolSize *pool_sizes;
+    VkDescriptorPoolSize *pool_sizes;
     size_t pool_size_count;
 
     struct d3d12_root_parameter *parameters;
@@ -593,25 +595,27 @@ struct d3d12_root_signature *unsafe_impl_from_ID3D12RootSignature(ID3D12RootSign
 
 struct d3d12_graphics_pipeline_state
 {
-    struct VkPipelineShaderStageCreateInfo stages[VKD3D_MAX_SHADER_STAGES];
+    VkPipelineShaderStageCreateInfo stages[VKD3D_MAX_SHADER_STAGES];
     size_t stage_count;
 
-    struct VkVertexInputAttributeDescription attributes[D3D12_VS_INPUT_REGISTER_COUNT];
-    enum VkVertexInputRate input_rates[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
+    VkVertexInputAttributeDescription attributes[D3D12_VS_INPUT_REGISTER_COUNT];
+    VkVertexInputRate input_rates[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
     VkVertexInputBindingDivisorDescriptionEXT instance_divisors[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
     size_t instance_divisor_count;
     size_t attribute_count;
 
-    struct VkAttachmentDescription attachments[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT + 1];
-    struct VkAttachmentReference attachment_references[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT + 1];
-    struct VkPipelineColorBlendAttachmentState blend_attachments[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
+    VkAttachmentDescription attachments[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT + 1];
+    VkAttachmentReference attachment_references[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT + 1];
+    VkPipelineColorBlendAttachmentState blend_attachments[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
     size_t attachment_count, rt_idx;
     VkRenderPass render_pass;
 
     D3D12_INDEX_BUFFER_STRIP_CUT_VALUE index_buffer_strip_cut_value;
-    struct VkPipelineRasterizationStateCreateInfo rs_desc;
-    struct VkPipelineMultisampleStateCreateInfo ms_desc;
-    struct VkPipelineDepthStencilStateCreateInfo ds_desc;
+    VkPipelineRasterizationStateCreateInfo rs_desc;
+    VkPipelineMultisampleStateCreateInfo ms_desc;
+    VkPipelineDepthStencilStateCreateInfo ds_desc;
+
+    VkPipelineRasterizationStateStreamCreateInfoEXT rs_stream_desc;
 
     const struct d3d12_root_signature *root_signature;
 
@@ -961,7 +965,7 @@ static inline unsigned int d3d12_resource_desc_get_sub_resource_count(const D3D1
     return d3d12_resource_desc_get_layer_count(desc) * desc->MipLevels;
 }
 
-enum VkCompareOp vk_compare_op_from_d3d12(D3D12_COMPARISON_FUNC op) DECLSPEC_HIDDEN;
+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;




More information about the wine-cvs mailing list