2 * Copyright 2018 Józef Kucia for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_WINED3D_VK_H
20 #define __WINE_WINED3D_VK_H
23 #include "wine/list.h"
24 #include "wine/wined3d.h"
25 #define VK_NO_PROTOTYPES
26 #include "wine/vulkan.h"
27 #include "wined3d_private.h"
29 struct wined3d_buffer_vk
;
30 struct wined3d_context_vk
;
31 struct wined3d_device_vk
;
33 #define VK_INSTANCE_FUNCS() \
34 VK_INSTANCE_PFN(vkCreateDevice) \
35 VK_INSTANCE_PFN(vkDestroyInstance) \
36 VK_INSTANCE_PFN(vkEnumerateDeviceExtensionProperties) \
37 VK_INSTANCE_PFN(vkEnumerateDeviceLayerProperties) \
38 VK_INSTANCE_PFN(vkEnumeratePhysicalDevices) \
39 VK_INSTANCE_PFN(vkGetDeviceProcAddr) \
40 VK_INSTANCE_PFN(vkGetPhysicalDeviceFeatures) \
41 VK_INSTANCE_PFN(vkGetPhysicalDeviceFormatProperties) \
42 VK_INSTANCE_PFN(vkGetPhysicalDeviceImageFormatProperties) \
43 VK_INSTANCE_PFN(vkGetPhysicalDeviceMemoryProperties) \
44 VK_INSTANCE_PFN(vkGetPhysicalDeviceProperties) \
45 VK_INSTANCE_PFN(vkGetPhysicalDeviceQueueFamilyProperties) \
46 VK_INSTANCE_PFN(vkGetPhysicalDeviceSparseImageFormatProperties) \
48 VK_INSTANCE_EXT_PFN(vkGetPhysicalDeviceFeatures2) \
49 VK_INSTANCE_EXT_PFN(vkGetPhysicalDeviceProperties2) \
50 /* VK_KHR_surface */ \
51 VK_INSTANCE_PFN(vkDestroySurfaceKHR) \
52 VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) \
53 VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceFormatsKHR) \
54 VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfacePresentModesKHR) \
55 VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceSupportKHR) \
56 /* VK_KHR_win32_surface */ \
57 VK_INSTANCE_PFN(vkCreateWin32SurfaceKHR) \
58 /* VK_EXT_host_query_reset */ \
59 VK_INSTANCE_EXT_PFN(vkResetQueryPoolEXT)
61 #define VK_DEVICE_FUNCS() \
62 VK_DEVICE_PFN(vkAllocateCommandBuffers) \
63 VK_DEVICE_PFN(vkAllocateDescriptorSets) \
64 VK_DEVICE_PFN(vkAllocateMemory) \
65 VK_DEVICE_PFN(vkBeginCommandBuffer) \
66 VK_DEVICE_PFN(vkBindBufferMemory) \
67 VK_DEVICE_PFN(vkBindImageMemory) \
68 VK_DEVICE_PFN(vkCmdBeginQuery) \
69 VK_DEVICE_PFN(vkCmdBeginRenderPass) \
70 VK_DEVICE_PFN(vkCmdBindDescriptorSets) \
71 VK_DEVICE_PFN(vkCmdBindIndexBuffer) \
72 VK_DEVICE_PFN(vkCmdBindPipeline) \
73 VK_DEVICE_PFN(vkCmdBindVertexBuffers) \
74 VK_DEVICE_PFN(vkCmdBlitImage) \
75 VK_DEVICE_PFN(vkCmdClearAttachments) \
76 VK_DEVICE_PFN(vkCmdClearColorImage) \
77 VK_DEVICE_PFN(vkCmdClearDepthStencilImage) \
78 VK_DEVICE_PFN(vkCmdCopyBuffer) \
79 VK_DEVICE_PFN(vkCmdCopyBufferToImage) \
80 VK_DEVICE_PFN(vkCmdCopyImage) \
81 VK_DEVICE_PFN(vkCmdCopyImageToBuffer) \
82 VK_DEVICE_PFN(vkCmdCopyQueryPoolResults) \
83 VK_DEVICE_PFN(vkCmdDispatch) \
84 VK_DEVICE_PFN(vkCmdDispatchIndirect) \
85 VK_DEVICE_PFN(vkCmdDraw) \
86 VK_DEVICE_PFN(vkCmdDrawIndexed) \
87 VK_DEVICE_PFN(vkCmdDrawIndexedIndirect) \
88 VK_DEVICE_PFN(vkCmdDrawIndirect) \
89 VK_DEVICE_PFN(vkCmdEndQuery) \
90 VK_DEVICE_PFN(vkCmdEndRenderPass) \
91 VK_DEVICE_PFN(vkCmdExecuteCommands) \
92 VK_DEVICE_PFN(vkCmdFillBuffer) \
93 VK_DEVICE_PFN(vkCmdNextSubpass) \
94 VK_DEVICE_PFN(vkCmdPipelineBarrier) \
95 VK_DEVICE_PFN(vkCmdPushConstants) \
96 VK_DEVICE_PFN(vkCmdResetEvent) \
97 VK_DEVICE_PFN(vkCmdResetQueryPool) \
98 VK_DEVICE_PFN(vkCmdResolveImage) \
99 VK_DEVICE_PFN(vkCmdSetBlendConstants) \
100 VK_DEVICE_PFN(vkCmdSetDepthBias) \
101 VK_DEVICE_PFN(vkCmdSetDepthBounds) \
102 VK_DEVICE_PFN(vkCmdSetEvent) \
103 VK_DEVICE_PFN(vkCmdSetLineWidth) \
104 VK_DEVICE_PFN(vkCmdSetScissor) \
105 VK_DEVICE_PFN(vkCmdSetStencilCompareMask) \
106 VK_DEVICE_PFN(vkCmdSetStencilReference) \
107 VK_DEVICE_PFN(vkCmdSetStencilWriteMask) \
108 VK_DEVICE_PFN(vkCmdSetViewport) \
109 VK_DEVICE_PFN(vkCmdUpdateBuffer) \
110 VK_DEVICE_PFN(vkCmdWaitEvents) \
111 VK_DEVICE_PFN(vkCmdWriteTimestamp) \
112 VK_DEVICE_PFN(vkCreateBuffer) \
113 VK_DEVICE_PFN(vkCreateBufferView) \
114 VK_DEVICE_PFN(vkCreateCommandPool) \
115 VK_DEVICE_PFN(vkCreateComputePipelines) \
116 VK_DEVICE_PFN(vkCreateDescriptorPool) \
117 VK_DEVICE_PFN(vkCreateDescriptorSetLayout) \
118 VK_DEVICE_PFN(vkCreateEvent) \
119 VK_DEVICE_PFN(vkCreateFence) \
120 VK_DEVICE_PFN(vkCreateFramebuffer) \
121 VK_DEVICE_PFN(vkCreateGraphicsPipelines) \
122 VK_DEVICE_PFN(vkCreateImage) \
123 VK_DEVICE_PFN(vkCreateImageView) \
124 VK_DEVICE_PFN(vkCreatePipelineCache) \
125 VK_DEVICE_PFN(vkCreatePipelineLayout) \
126 VK_DEVICE_PFN(vkCreateQueryPool) \
127 VK_DEVICE_PFN(vkCreateRenderPass) \
128 VK_DEVICE_PFN(vkCreateSampler) \
129 VK_DEVICE_PFN(vkCreateSemaphore) \
130 VK_DEVICE_PFN(vkCreateShaderModule) \
131 VK_DEVICE_PFN(vkDestroyBuffer) \
132 VK_DEVICE_PFN(vkDestroyBufferView) \
133 VK_DEVICE_PFN(vkDestroyCommandPool) \
134 VK_DEVICE_PFN(vkDestroyDescriptorPool) \
135 VK_DEVICE_PFN(vkDestroyDescriptorSetLayout) \
136 VK_DEVICE_PFN(vkDestroyDevice) \
137 VK_DEVICE_PFN(vkDestroyEvent) \
138 VK_DEVICE_PFN(vkDestroyFence) \
139 VK_DEVICE_PFN(vkDestroyFramebuffer) \
140 VK_DEVICE_PFN(vkDestroyImage) \
141 VK_DEVICE_PFN(vkDestroyImageView) \
142 VK_DEVICE_PFN(vkDestroyPipeline) \
143 VK_DEVICE_PFN(vkDestroyPipelineCache) \
144 VK_DEVICE_PFN(vkDestroyPipelineLayout) \
145 VK_DEVICE_PFN(vkDestroyQueryPool) \
146 VK_DEVICE_PFN(vkDestroyRenderPass) \
147 VK_DEVICE_PFN(vkDestroySampler) \
148 VK_DEVICE_PFN(vkDestroySemaphore) \
149 VK_DEVICE_PFN(vkDestroyShaderModule) \
150 VK_DEVICE_PFN(vkDeviceWaitIdle) \
151 VK_DEVICE_PFN(vkEndCommandBuffer) \
152 VK_DEVICE_PFN(vkFlushMappedMemoryRanges) \
153 VK_DEVICE_PFN(vkFreeCommandBuffers) \
154 VK_DEVICE_PFN(vkFreeDescriptorSets) \
155 VK_DEVICE_PFN(vkFreeMemory) \
156 VK_DEVICE_PFN(vkGetBufferMemoryRequirements) \
157 VK_DEVICE_PFN(vkGetDeviceMemoryCommitment) \
158 VK_DEVICE_PFN(vkGetDeviceQueue) \
159 VK_DEVICE_PFN(vkGetEventStatus) \
160 VK_DEVICE_PFN(vkGetFenceStatus) \
161 VK_DEVICE_PFN(vkGetImageMemoryRequirements) \
162 VK_DEVICE_PFN(vkGetImageSparseMemoryRequirements) \
163 VK_DEVICE_PFN(vkGetImageSubresourceLayout) \
164 VK_DEVICE_PFN(vkGetPipelineCacheData) \
165 VK_DEVICE_PFN(vkGetQueryPoolResults) \
166 VK_DEVICE_PFN(vkGetRenderAreaGranularity) \
167 VK_DEVICE_PFN(vkInvalidateMappedMemoryRanges) \
168 VK_DEVICE_PFN(vkMapMemory) \
169 VK_DEVICE_PFN(vkMergePipelineCaches) \
170 VK_DEVICE_PFN(vkQueueBindSparse) \
171 VK_DEVICE_PFN(vkQueueSubmit) \
172 VK_DEVICE_PFN(vkQueueWaitIdle) \
173 VK_DEVICE_PFN(vkResetCommandBuffer) \
174 VK_DEVICE_PFN(vkResetCommandPool) \
175 VK_DEVICE_PFN(vkResetDescriptorPool) \
176 VK_DEVICE_PFN(vkResetEvent) \
177 VK_DEVICE_PFN(vkResetFences) \
178 VK_DEVICE_PFN(vkSetEvent) \
179 VK_DEVICE_PFN(vkUnmapMemory) \
180 VK_DEVICE_PFN(vkUpdateDescriptorSets) \
181 VK_DEVICE_PFN(vkWaitForFences) \
182 /* VK_EXT_transform_feedback */ \
183 VK_DEVICE_EXT_PFN(vkCmdBeginQueryIndexedEXT) \
184 VK_DEVICE_EXT_PFN(vkCmdBeginTransformFeedbackEXT) \
185 VK_DEVICE_EXT_PFN(vkCmdBindTransformFeedbackBuffersEXT) \
186 VK_DEVICE_EXT_PFN(vkCmdEndQueryIndexedEXT) \
187 VK_DEVICE_EXT_PFN(vkCmdEndTransformFeedbackEXT) \
188 /* VK_KHR_swapchain */ \
189 VK_DEVICE_PFN(vkAcquireNextImageKHR) \
190 VK_DEVICE_PFN(vkCreateSwapchainKHR) \
191 VK_DEVICE_PFN(vkDestroySwapchainKHR) \
192 VK_DEVICE_PFN(vkGetSwapchainImagesKHR) \
193 VK_DEVICE_PFN(vkQueuePresentKHR)
195 #define DECLARE_VK_PFN(name) PFN_##name name;
199 #define VK_INSTANCE_PFN DECLARE_VK_PFN
200 #define VK_INSTANCE_EXT_PFN DECLARE_VK_PFN
201 #define VK_DEVICE_PFN DECLARE_VK_PFN
202 #define VK_DEVICE_EXT_PFN DECLARE_VK_PFN
205 #undef VK_INSTANCE_PFN
206 #undef VK_INSTANCE_EXT_PFN
208 #undef VK_DEVICE_EXT_PFN
210 PFN_vkCreateInstance vkCreateInstance
;
211 PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr
;
214 enum wined3d_vk_extension
218 WINED3D_VK_EXT_TRANSFORM_FEEDBACK
,
219 WINED3D_VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE
,
220 WINED3D_VK_KHR_SHADER_DRAW_PARAMETERS
,
221 WINED3D_VK_EXT_HOST_QUERY_RESET
,
223 WINED3D_VK_EXT_COUNT
,
226 struct wined3d_vk_info
228 struct vulkan_ops vk_ops
;
231 unsigned int api_version
;
233 BOOL supported
[WINED3D_VK_EXT_COUNT
];
236 unsigned int multiple_viewports
: 1;
239 #define VK_CALL(f) (vk_info->vk_ops.f)
241 static const VkAccessFlags WINED3D_READ_ONLY_ACCESS_FLAGS
= VK_ACCESS_INDIRECT_COMMAND_READ_BIT
242 | VK_ACCESS_INDEX_READ_BIT
| VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT
| VK_ACCESS_UNIFORM_READ_BIT
243 | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT
| VK_ACCESS_SHADER_READ_BIT
| VK_ACCESS_COLOR_ATTACHMENT_READ_BIT
244 | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT
| VK_ACCESS_TRANSFER_READ_BIT
| VK_ACCESS_HOST_READ_BIT
245 | VK_ACCESS_MEMORY_READ_BIT
;
247 VkAccessFlags
vk_access_mask_from_bind_flags(uint32_t bind_flags
) DECLSPEC_HIDDEN
;
248 VkCompareOp
vk_compare_op_from_wined3d(enum wined3d_cmp_func op
) DECLSPEC_HIDDEN
;
249 VkImageViewType
vk_image_view_type_from_wined3d(enum wined3d_resource_type type
, uint32_t flags
) DECLSPEC_HIDDEN
;
250 VkPipelineStageFlags
vk_pipeline_stage_mask_from_bind_flags(uint32_t bind_flags
) DECLSPEC_HIDDEN
;
251 VkShaderStageFlagBits
vk_shader_stage_from_wined3d(enum wined3d_shader_type shader_type
) DECLSPEC_HIDDEN
;
252 VkAccessFlags
vk_access_mask_from_buffer_usage(VkBufferUsageFlags usage
) DECLSPEC_HIDDEN
;
253 VkPipelineStageFlags
vk_pipeline_stage_mask_from_buffer_usage(VkBufferUsageFlags usage
) DECLSPEC_HIDDEN
;
254 VkBufferUsageFlags
vk_buffer_usage_from_bind_flags(uint32_t bind_flags
) DECLSPEC_HIDDEN
;
255 VkMemoryPropertyFlags
vk_memory_type_from_access_flags(uint32_t access
, uint32_t usage
) DECLSPEC_HIDDEN
;
256 void wined3d_format_colour_to_vk(const struct wined3d_format
*format
, const struct wined3d_color
*c
,
257 VkClearColorValue
*retval
) DECLSPEC_HIDDEN
;
258 void wined3d_vk_swizzle_from_color_fixup(VkComponentMapping
*mapping
, struct color_fixup_desc fixup
) DECLSPEC_HIDDEN
;
259 const char *wined3d_debug_vkresult(VkResult vr
) DECLSPEC_HIDDEN
;
261 static inline VkImageAspectFlags
vk_aspect_mask_from_format(const struct wined3d_format
*format
)
263 VkImageAspectFlags mask
= 0;
265 if (format
->depth_size
)
266 mask
|= VK_IMAGE_ASPECT_DEPTH_BIT
;
267 if (format
->stencil_size
)
268 mask
|= VK_IMAGE_ASPECT_STENCIL_BIT
;
269 if (!mask
|| format
->red_size
|| format
->green_size
|| format
->blue_size
|| format
->alpha_size
)
270 mask
|= VK_IMAGE_ASPECT_COLOR_BIT
;
280 struct wined3d_allocator_block
*memory
;
281 struct wined3d_bo_slab_vk
*slab
;
283 VkDeviceMemory vk_memory
;
286 VkBufferUsageFlags usage
;
287 VkMemoryPropertyFlags memory_type
;
289 uint64_t command_buffer_id
;
293 static inline struct wined3d_bo_vk
*wined3d_bo_vk(struct wined3d_bo
*bo
)
295 return CONTAINING_RECORD(bo
, struct wined3d_bo_vk
, b
);
298 struct wined3d_bo_slab_vk_key
300 VkMemoryPropertyFlags memory_type
;
301 VkBufferUsageFlags usage
;
305 struct wined3d_bo_slab_vk
307 struct wine_rb_entry entry
;
308 struct wined3d_bo_slab_vk
*next
;
309 VkMemoryPropertyFlags requested_memory_type
;
310 struct wined3d_bo_vk bo
;
311 unsigned int map_count
;
316 void *wined3d_bo_slab_vk_map(struct wined3d_bo_slab_vk
*slab_vk
,
317 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
318 void wined3d_bo_slab_vk_unmap(struct wined3d_bo_slab_vk
*slab_vk
,
319 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
321 struct wined3d_image_vk
324 struct wined3d_allocator_block
*memory
;
325 VkDeviceMemory vk_memory
;
326 uint64_t command_buffer_id
;
329 struct wined3d_query_pool_vk
332 struct list completed_entry
;
334 struct list
*free_list
;
335 VkQueryPool vk_query_pool
;
338 uint32_t allocated
[WINED3D_BITMAP_SIZE(WINED3D_QUERY_POOL_SIZE
)];
339 uint32_t completed
[WINED3D_BITMAP_SIZE(WINED3D_QUERY_POOL_SIZE
)];
342 bool wined3d_query_pool_vk_allocate_query(struct wined3d_query_pool_vk
*pool_vk
, size_t *idx
) DECLSPEC_HIDDEN
;
343 void wined3d_query_pool_vk_mark_free(struct wined3d_context_vk
*context_vk
, struct wined3d_query_pool_vk
*pool_vk
,
344 uint32_t start
, uint32_t count
) DECLSPEC_HIDDEN
;
345 void wined3d_query_pool_vk_cleanup(struct wined3d_query_pool_vk
*pool_vk
,
346 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
347 bool wined3d_query_pool_vk_init(struct wined3d_query_pool_vk
*pool_vk
, struct wined3d_context_vk
*context_vk
,
348 enum wined3d_query_type type
, struct list
*free_pools
) DECLSPEC_HIDDEN
;
350 struct wined3d_query_pool_idx_vk
352 struct wined3d_query_pool_vk
*pool_vk
;
356 #define WINED3D_QUERY_VK_FLAG_ACTIVE 0x00000001
357 #define WINED3D_QUERY_VK_FLAG_STARTED 0x00000002
358 #define WINED3D_QUERY_VK_FLAG_RENDER_PASS 0x00000004
360 struct wined3d_query_vk
362 struct wined3d_query q
;
365 struct wined3d_query_pool_idx_vk pool_idx
;
367 uint64_t command_buffer_id
;
368 uint32_t control_flags
;
370 SIZE_T pending_count
, pending_size
;
371 struct wined3d_query_pool_idx_vk
*pending
;
374 static inline struct wined3d_query_vk
*wined3d_query_vk(struct wined3d_query
*query
)
376 return CONTAINING_RECORD(query
, struct wined3d_query_vk
, q
);
379 bool wined3d_query_vk_accumulate_data(struct wined3d_query_vk
*query_vk
, struct wined3d_device_vk
*device_vk
,
380 const struct wined3d_query_pool_idx_vk
*pool_idx
) DECLSPEC_HIDDEN
;
381 HRESULT
wined3d_query_vk_create(struct wined3d_device
*device
, enum wined3d_query_type type
, void *parent
,
382 const struct wined3d_parent_ops
*parent_ops
, struct wined3d_query
**query
) DECLSPEC_HIDDEN
;
383 void wined3d_query_vk_resume(struct wined3d_query_vk
*query_vk
, struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
384 void wined3d_query_vk_suspend(struct wined3d_query_vk
*query_vk
, struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
386 struct wined3d_command_buffer_vk
389 VkCommandBuffer vk_command_buffer
;
393 enum wined3d_retired_object_type_vk
395 WINED3D_RETIRED_FREE_VK
,
396 WINED3D_RETIRED_FRAMEBUFFER_VK
,
397 WINED3D_RETIRED_DESCRIPTOR_POOL_VK
,
398 WINED3D_RETIRED_MEMORY_VK
,
399 WINED3D_RETIRED_ALLOCATOR_BLOCK_VK
,
400 WINED3D_RETIRED_BO_SLAB_SLICE_VK
,
401 WINED3D_RETIRED_BUFFER_VK
,
402 WINED3D_RETIRED_IMAGE_VK
,
403 WINED3D_RETIRED_BUFFER_VIEW_VK
,
404 WINED3D_RETIRED_IMAGE_VIEW_VK
,
405 WINED3D_RETIRED_SAMPLER_VK
,
406 WINED3D_RETIRED_QUERY_POOL_VK
,
407 WINED3D_RETIRED_EVENT_VK
,
408 WINED3D_RETIRED_PIPELINE_VK
,
411 struct wined3d_retired_object_vk
413 enum wined3d_retired_object_type_vk type
;
416 struct wined3d_retired_object_vk
*next
;
417 VkFramebuffer vk_framebuffer
;
418 VkDescriptorPool vk_descriptor_pool
;
419 VkDeviceMemory vk_memory
;
420 struct wined3d_allocator_block
*block
;
423 struct wined3d_bo_slab_vk
*slab
;
428 VkBufferView vk_buffer_view
;
429 VkImageView vk_image_view
;
430 VkSampler vk_sampler
;
432 VkPipeline vk_pipeline
;
435 struct wined3d_query_pool_vk
*pool_vk
;
440 uint64_t command_buffer_id
;
443 struct wined3d_retired_objects_vk
445 struct wined3d_retired_object_vk
*objects
;
446 struct wined3d_retired_object_vk
*free
;
451 #define WINED3D_FB_ATTACHMENT_FLAG_DISCARDED 1
452 #define WINED3D_FB_ATTACHMENT_FLAG_CLEAR_C 2
453 #define WINED3D_FB_ATTACHMENT_FLAG_CLEAR_S 4
454 #define WINED3D_FB_ATTACHMENT_FLAG_CLEAR_Z 8
456 struct wined3d_render_pass_attachment_vk
459 VkSampleCountFlagBits vk_samples
;
460 VkImageLayout vk_layout
;
464 struct wined3d_render_pass_key_vk
466 struct wined3d_render_pass_attachment_vk rt
[WINED3D_MAX_RENDER_TARGETS
];
467 struct wined3d_render_pass_attachment_vk ds
;
471 struct wined3d_render_pass_vk
473 struct wine_rb_entry entry
;
474 struct wined3d_render_pass_key_vk key
;
475 VkRenderPass vk_render_pass
;
478 struct wined3d_pipeline_layout_key_vk
480 VkDescriptorSetLayoutBinding
*bindings
;
481 SIZE_T binding_count
;
484 struct wined3d_pipeline_layout_vk
486 struct wine_rb_entry entry
;
487 struct wined3d_pipeline_layout_key_vk key
;
488 VkPipelineLayout vk_pipeline_layout
;
489 VkDescriptorSetLayout vk_set_layout
;
492 struct wined3d_graphics_pipeline_key_vk
494 VkPipelineShaderStageCreateInfo stages
[WINED3D_SHADER_TYPE_GRAPHICS_COUNT
];
495 VkVertexInputBindingDivisorDescriptionEXT divisors
[MAX_ATTRIBS
];
496 VkVertexInputAttributeDescription attributes
[MAX_ATTRIBS
];
497 VkVertexInputBindingDescription bindings
[MAX_ATTRIBS
];
498 VkViewport viewports
[WINED3D_MAX_VIEWPORTS
];
499 VkRect2D scissors
[WINED3D_MAX_VIEWPORTS
];
500 VkSampleMask sample_mask
;
501 VkPipelineColorBlendAttachmentState blend_attachments
[WINED3D_MAX_RENDER_TARGETS
];
503 VkPipelineVertexInputDivisorStateCreateInfoEXT divisor_desc
;
504 VkPipelineVertexInputStateCreateInfo input_desc
;
505 VkPipelineInputAssemblyStateCreateInfo ia_desc
;
506 VkPipelineTessellationStateCreateInfo ts_desc
;
507 VkPipelineViewportStateCreateInfo vp_desc
;
508 VkPipelineRasterizationStateCreateInfo rs_desc
;
509 VkPipelineMultisampleStateCreateInfo ms_desc
;
510 VkPipelineDepthStencilStateCreateInfo ds_desc
;
511 VkPipelineColorBlendStateCreateInfo blend_desc
;
512 VkPipelineDynamicStateCreateInfo dynamic_desc
;
514 VkGraphicsPipelineCreateInfo pipeline_desc
;
517 struct wined3d_graphics_pipeline_vk
519 struct wine_rb_entry entry
;
520 struct wined3d_graphics_pipeline_key_vk key
;
521 VkPipeline vk_pipeline
;
524 enum wined3d_shader_descriptor_type
526 WINED3D_SHADER_DESCRIPTOR_TYPE_CBV
,
527 WINED3D_SHADER_DESCRIPTOR_TYPE_SRV
,
528 WINED3D_SHADER_DESCRIPTOR_TYPE_UAV
,
529 WINED3D_SHADER_DESCRIPTOR_TYPE_UAV_COUNTER
,
530 WINED3D_SHADER_DESCRIPTOR_TYPE_SAMPLER
,
533 struct wined3d_shader_resource_binding
535 enum wined3d_shader_type shader_type
;
536 enum wined3d_shader_descriptor_type shader_descriptor_type
;
538 enum wined3d_shader_resource_type resource_type
;
539 enum wined3d_data_type resource_data_type
;
543 struct wined3d_shader_resource_bindings
545 struct wined3d_shader_resource_binding
*bindings
;
549 struct wined3d_shader_descriptor_writes_vk
551 VkWriteDescriptorSet
*writes
;
555 struct wined3d_context_vk
557 struct wined3d_context c
;
559 const struct wined3d_vk_info
*vk_info
;
561 uint32_t update_compute_pipeline
: 1;
562 uint32_t update_stream_output
: 1;
563 uint32_t padding
: 30;
567 VkShaderModule vk_modules
[WINED3D_SHADER_TYPE_GRAPHICS_COUNT
];
568 struct wined3d_graphics_pipeline_key_vk pipeline_key_vk
;
569 VkPipeline vk_pipeline
;
570 VkPipelineLayout vk_pipeline_layout
;
571 VkDescriptorSetLayout vk_set_layout
;
572 struct wined3d_shader_resource_bindings bindings
;
577 VkPipeline vk_pipeline
;
578 VkPipelineLayout vk_pipeline_layout
;
579 VkDescriptorSetLayout vk_set_layout
;
580 struct wined3d_shader_resource_bindings bindings
;
583 VkCommandPool vk_command_pool
;
584 struct wined3d_command_buffer_vk current_command_buffer
;
585 uint64_t completed_command_buffer_id
;
586 VkDeviceSize retired_bo_size
;
590 struct wined3d_command_buffer_vk
*buffers
;
593 } submitted
, completed
;
595 struct wined3d_shader_descriptor_writes_vk descriptor_writes
;
597 VkFramebuffer vk_framebuffer
;
598 VkRenderPass vk_render_pass
;
600 SIZE_T vk_descriptor_pools_size
;
601 SIZE_T vk_descriptor_pool_count
;
602 VkDescriptorPool
*vk_descriptor_pools
;
604 VkSampleCountFlagBits sample_count
;
605 unsigned int rt_count
;
607 VkBuffer vk_so_counters
[WINED3D_MAX_STREAM_OUTPUT_BUFFERS
];
608 VkDeviceSize vk_so_offsets
[WINED3D_MAX_STREAM_OUTPUT_BUFFERS
];
609 struct wined3d_bo_vk vk_so_counter_bo
;
611 struct list render_pass_queries
;
612 struct list active_queries
;
613 struct list completed_query_pools
;
614 struct list free_occlusion_query_pools
;
615 struct list free_timestamp_query_pools
;
616 struct list free_pipeline_statistics_query_pools
;
617 struct list free_stream_output_statistics_query_pools
;
619 struct wined3d_retired_objects_vk retired
;
620 struct wine_rb_tree render_passes
;
621 struct wine_rb_tree pipeline_layouts
;
622 struct wine_rb_tree graphics_pipelines
;
623 struct wine_rb_tree bo_slab_available
;
626 static inline struct wined3d_context_vk
*wined3d_context_vk(struct wined3d_context
*context
)
628 return CONTAINING_RECORD(context
, struct wined3d_context_vk
, c
);
631 bool wined3d_context_vk_allocate_query(struct wined3d_context_vk
*context_vk
,
632 enum wined3d_query_type type
, struct wined3d_query_pool_idx_vk
*pool_idx
) DECLSPEC_HIDDEN
;
633 VkDeviceMemory
wined3d_context_vk_allocate_vram_chunk_memory(struct wined3d_context_vk
*context_vk
,
634 unsigned int pool
, size_t size
) DECLSPEC_HIDDEN
;
635 VkCommandBuffer
wined3d_context_vk_apply_compute_state(struct wined3d_context_vk
*context_vk
,
636 const struct wined3d_state
*state
, struct wined3d_buffer_vk
*indirect_vk
) DECLSPEC_HIDDEN
;
637 VkCommandBuffer
wined3d_context_vk_apply_draw_state(struct wined3d_context_vk
*context_vk
,
638 const struct wined3d_state
*state
, struct wined3d_buffer_vk
*indirect_vk
, bool indexed
) DECLSPEC_HIDDEN
;
639 void wined3d_context_vk_cleanup(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
640 BOOL
wined3d_context_vk_create_bo(struct wined3d_context_vk
*context_vk
, VkDeviceSize size
,
641 VkBufferUsageFlags usage
, VkMemoryPropertyFlags memory_type
, struct wined3d_bo_vk
*bo
) DECLSPEC_HIDDEN
;
642 BOOL
wined3d_context_vk_create_image(struct wined3d_context_vk
*context_vk
, VkImageType vk_image_type
,
643 VkImageUsageFlags usage
, VkFormat vk_format
, unsigned int width
, unsigned int height
, unsigned int depth
,
644 unsigned int sample_count
, unsigned int mip_levels
, unsigned int layer_count
, unsigned int flags
,
645 struct wined3d_image_vk
*image
) DECLSPEC_HIDDEN
;
646 void wined3d_context_vk_destroy_allocator_block(struct wined3d_context_vk
*context_vk
,
647 struct wined3d_allocator_block
*block
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
648 void wined3d_context_vk_destroy_bo(struct wined3d_context_vk
*context_vk
,
649 const struct wined3d_bo_vk
*bo
) DECLSPEC_HIDDEN
;
650 void wined3d_context_vk_destroy_image(struct wined3d_context_vk
*context_vk
,
651 struct wined3d_image_vk
*image_vk
) DECLSPEC_HIDDEN
;
652 void wined3d_context_vk_destroy_vk_buffer_view(struct wined3d_context_vk
*context_vk
,
653 VkBufferView vk_view
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
654 void wined3d_context_vk_destroy_vk_framebuffer(struct wined3d_context_vk
*context_vk
,
655 VkFramebuffer vk_framebuffer
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
656 void wined3d_context_vk_destroy_vk_image(struct wined3d_context_vk
*context_vk
,
657 VkImage vk_image
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
658 void wined3d_context_vk_destroy_vk_image_view(struct wined3d_context_vk
*context_vk
,
659 VkImageView vk_view
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
660 void wined3d_context_vk_destroy_vk_memory(struct wined3d_context_vk
*context_vk
,
661 VkDeviceMemory vk_memory
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
662 void wined3d_context_vk_destroy_vk_sampler(struct wined3d_context_vk
*context_vk
,
663 VkSampler vk_sampler
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
664 void wined3d_context_vk_destroy_vk_event(struct wined3d_context_vk
*context_vk
,
665 VkEvent vk_event
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
666 void wined3d_context_vk_destroy_vk_pipeline(struct wined3d_context_vk
*context_vk
,
667 VkPipeline vk_pipeline
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
668 void wined3d_context_vk_end_current_render_pass(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
669 VkCommandBuffer
wined3d_context_vk_get_command_buffer(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
670 struct wined3d_pipeline_layout_vk
*wined3d_context_vk_get_pipeline_layout(struct wined3d_context_vk
*context_vk
,
671 VkDescriptorSetLayoutBinding
*bindings
, SIZE_T binding_count
) DECLSPEC_HIDDEN
;
672 VkRenderPass
wined3d_context_vk_get_render_pass(struct wined3d_context_vk
*context_vk
,
673 const struct wined3d_fb_state
*fb
, unsigned int rt_count
,
674 bool depth_stencil
, uint32_t clear_flags
) DECLSPEC_HIDDEN
;
675 void wined3d_context_vk_image_barrier(struct wined3d_context_vk
*context_vk
,
676 VkCommandBuffer vk_command_buffer
, VkPipelineStageFlags src_stage_mask
, VkPipelineStageFlags dst_stage_mask
,
677 VkAccessFlags src_access_mask
, VkAccessFlags dst_access_mask
, VkImageLayout old_layout
,
678 VkImageLayout new_layout
, VkImage image
, const VkImageSubresourceRange
*range
) DECLSPEC_HIDDEN
;
679 HRESULT
wined3d_context_vk_init(struct wined3d_context_vk
*context_vk
,
680 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
681 void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk
*context_vk
,
682 unsigned int wait_semaphore_count
, const VkSemaphore
*wait_semaphores
, const VkPipelineStageFlags
*wait_stages
,
683 unsigned int signal_semaphore_count
, const VkSemaphore
*signal_semaphores
) DECLSPEC_HIDDEN
;
684 void wined3d_context_vk_wait_command_buffer(struct wined3d_context_vk
*context_vk
, uint64_t id
) DECLSPEC_HIDDEN
;
685 VkDescriptorSet
wined3d_context_vk_create_vk_descriptor_set(struct wined3d_context_vk
*context_vk
,
686 VkDescriptorSetLayout vk_set_layout
) DECLSPEC_HIDDEN
;
688 struct wined3d_adapter_vk
690 struct wined3d_adapter a
;
692 struct wined3d_vk_info vk_info
;
693 unsigned int device_extension_count
;
694 const char **device_extensions
;
695 VkPhysicalDevice physical_device
;
697 VkPhysicalDeviceLimits device_limits
;
698 VkPhysicalDeviceMemoryProperties memory_properties
;
701 static inline struct wined3d_adapter_vk
*wined3d_adapter_vk(struct wined3d_adapter
*adapter
)
703 return CONTAINING_RECORD(adapter
, struct wined3d_adapter_vk
, a
);
706 void adapter_vk_copy_bo_address(struct wined3d_context
*context
, const struct wined3d_bo_address
*dst
,
707 const struct wined3d_bo_address
*src
,
708 unsigned int range_count
, const struct wined3d_range
*ranges
, uint32_t map_flags
) DECLSPEC_HIDDEN
;
709 unsigned int wined3d_adapter_vk_get_memory_type_index(const struct wined3d_adapter_vk
*adapter_vk
,
710 uint32_t memory_type_mask
, VkMemoryPropertyFlags flags
) DECLSPEC_HIDDEN
;
711 BOOL
wined3d_adapter_vk_init_format_info(struct wined3d_adapter_vk
*adapter_vk
,
712 const struct wined3d_vk_info
*vk_info
) DECLSPEC_HIDDEN
;
714 struct wined3d_null_resources_vk
716 struct wined3d_bo_vk bo
;
717 VkDescriptorBufferInfo buffer_info
;
719 struct wined3d_image_vk image_1d
;
720 struct wined3d_image_vk image_2d
;
721 struct wined3d_image_vk image_2dms
;
722 struct wined3d_image_vk image_3d
;
725 struct wined3d_null_views_vk
727 VkBufferView vk_view_buffer_uint
;
728 VkBufferView vk_view_buffer_float
;
730 VkDescriptorImageInfo vk_info_1d
;
731 VkDescriptorImageInfo vk_info_2d
;
732 VkDescriptorImageInfo vk_info_2dms
;
733 VkDescriptorImageInfo vk_info_3d
;
734 VkDescriptorImageInfo vk_info_cube
;
735 VkDescriptorImageInfo vk_info_1d_array
;
736 VkDescriptorImageInfo vk_info_2d_array
;
737 VkDescriptorImageInfo vk_info_2dms_array
;
738 VkDescriptorImageInfo vk_info_cube_array
;
741 struct wined3d_allocator_chunk_vk
743 struct wined3d_allocator_chunk c
;
744 VkDeviceMemory vk_memory
;
747 static inline struct wined3d_allocator_chunk_vk
*wined3d_allocator_chunk_vk(struct wined3d_allocator_chunk
*chunk
)
749 return CONTAINING_RECORD(chunk
, struct wined3d_allocator_chunk_vk
, c
);
752 void *wined3d_allocator_chunk_vk_map(struct wined3d_allocator_chunk_vk
*chunk_vk
,
753 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
754 void wined3d_allocator_chunk_vk_unmap(struct wined3d_allocator_chunk_vk
*chunk_vk
,
755 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
757 struct wined3d_uav_clear_pipelines_vk
761 VkPipeline image_1d_array
;
763 VkPipeline image_2d_array
;
767 struct wined3d_uav_clear_state_vk
769 struct wined3d_uav_clear_pipelines_vk float_pipelines
;
770 struct wined3d_uav_clear_pipelines_vk uint_pipelines
;
772 struct wined3d_shader_thread_group_size buffer_group_size
;
773 struct wined3d_shader_thread_group_size image_1d_group_size
;
774 struct wined3d_shader_thread_group_size image_1d_array_group_size
;
775 struct wined3d_shader_thread_group_size image_2d_group_size
;
776 struct wined3d_shader_thread_group_size image_2d_array_group_size
;
777 struct wined3d_shader_thread_group_size image_3d_group_size
;
779 struct wined3d_pipeline_layout_vk
*image_layout
;
780 struct wined3d_pipeline_layout_vk
*buffer_layout
;
783 struct wined3d_device_vk
785 struct wined3d_device d
;
787 struct wined3d_context_vk context_vk
;
791 uint32_t vk_queue_family_index
;
792 uint32_t timestamp_bits
;
794 struct wined3d_vk_info vk_info
;
796 struct wined3d_null_resources_vk null_resources_vk
;
797 struct wined3d_null_views_vk null_views_vk
;
799 CRITICAL_SECTION allocator_cs
;
800 struct wined3d_allocator allocator
;
802 struct wined3d_uav_clear_state_vk uav_clear_state
;
805 static inline struct wined3d_device_vk
*wined3d_device_vk(struct wined3d_device
*device
)
807 return CONTAINING_RECORD(device
, struct wined3d_device_vk
, d
);
810 static inline struct wined3d_device_vk
*wined3d_device_vk_from_allocator(struct wined3d_allocator
*allocator
)
812 return CONTAINING_RECORD(allocator
, struct wined3d_device_vk
, allocator
);
815 static inline void wined3d_device_vk_allocator_lock(struct wined3d_device_vk
*device_vk
)
817 EnterCriticalSection(&device_vk
->allocator_cs
);
820 static inline void wined3d_device_vk_allocator_unlock(struct wined3d_device_vk
*device_vk
)
822 LeaveCriticalSection(&device_vk
->allocator_cs
);
825 bool wined3d_device_vk_create_null_resources(struct wined3d_device_vk
*device_vk
,
826 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
827 bool wined3d_device_vk_create_null_views(struct wined3d_device_vk
*device_vk
,
828 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
829 void wined3d_device_vk_destroy_null_resources(struct wined3d_device_vk
*device_vk
,
830 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
831 void wined3d_device_vk_destroy_null_views(struct wined3d_device_vk
*device_vk
,
832 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
834 void wined3d_device_vk_uav_clear_state_init(struct wined3d_device_vk
*device_vk
) DECLSPEC_HIDDEN
;
835 void wined3d_device_vk_uav_clear_state_cleanup(struct wined3d_device_vk
*device_vk
) DECLSPEC_HIDDEN
;
837 struct wined3d_texture_vk
839 struct wined3d_texture t
;
841 struct wined3d_image_vk image
;
842 enum VkImageLayout layout
;
845 VkDescriptorImageInfo default_image_info
;
848 static inline struct wined3d_texture_vk
*wined3d_texture_vk(struct wined3d_texture
*texture
)
850 return CONTAINING_RECORD(texture
, struct wined3d_texture_vk
, t
);
853 void wined3d_texture_vk_barrier(struct wined3d_texture_vk
*texture_vk
,
854 struct wined3d_context_vk
*context_vk
, uint32_t bind_mask
) DECLSPEC_HIDDEN
;
855 const VkDescriptorImageInfo
*wined3d_texture_vk_get_default_image_info(struct wined3d_texture_vk
*texture_vk
,
856 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
857 HRESULT
wined3d_texture_vk_init(struct wined3d_texture_vk
*texture_vk
, struct wined3d_device
*device
,
858 const struct wined3d_resource_desc
*desc
, unsigned int layer_count
, unsigned int level_count
,
859 uint32_t flags
, void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
860 void wined3d_texture_vk_make_generic(struct wined3d_texture_vk
*texture_vk
,
861 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
862 BOOL
wined3d_texture_vk_prepare_texture(struct wined3d_texture_vk
*texture_vk
,
863 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
865 struct wined3d_sampler_vk
867 struct wined3d_sampler s
;
869 VkDescriptorImageInfo vk_image_info
;
870 uint64_t command_buffer_id
;
873 static inline struct wined3d_sampler_vk
*wined3d_sampler_vk(struct wined3d_sampler
*sampler
)
875 return CONTAINING_RECORD(sampler
, struct wined3d_sampler_vk
, s
);
878 void wined3d_sampler_vk_init(struct wined3d_sampler_vk
*sampler_vk
,
879 struct wined3d_device
*device
, const struct wined3d_sampler_desc
*desc
,
880 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
882 struct wined3d_buffer_vk
884 struct wined3d_buffer b
;
886 VkDescriptorBufferInfo buffer_info
;
890 static inline struct wined3d_buffer_vk
*wined3d_buffer_vk(struct wined3d_buffer
*buffer
)
892 return CONTAINING_RECORD(buffer
, struct wined3d_buffer_vk
, b
);
895 void wined3d_buffer_vk_barrier(struct wined3d_buffer_vk
*buffer_vk
,
896 struct wined3d_context_vk
*context_vk
, uint32_t bind_mask
) DECLSPEC_HIDDEN
;
897 const VkDescriptorBufferInfo
*wined3d_buffer_vk_get_buffer_info(struct wined3d_buffer_vk
*buffer_vk
) DECLSPEC_HIDDEN
;
898 HRESULT
wined3d_buffer_vk_init(struct wined3d_buffer_vk
*buffer_vk
, struct wined3d_device
*device
,
899 const struct wined3d_buffer_desc
*desc
, const struct wined3d_sub_resource_data
*data
,
900 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
902 static inline void wined3d_resource_vk_barrier(struct wined3d_resource
*resource
,
903 struct wined3d_context_vk
*context_vk
, uint32_t bind_mask
)
905 if (resource
->type
== WINED3D_RTYPE_BUFFER
)
906 wined3d_buffer_vk_barrier(wined3d_buffer_vk(buffer_from_resource(resource
)), context_vk
, bind_mask
);
908 wined3d_texture_vk_barrier(wined3d_texture_vk(texture_from_resource(resource
)), context_vk
, bind_mask
);
911 struct wined3d_rendertarget_view_vk
913 struct wined3d_rendertarget_view v
;
915 VkImageView vk_image_view
;
916 uint64_t command_buffer_id
;
919 static inline struct wined3d_rendertarget_view_vk
*wined3d_rendertarget_view_vk(
920 struct wined3d_rendertarget_view
*view
)
922 return CONTAINING_RECORD(view
, struct wined3d_rendertarget_view_vk
, v
);
925 static inline void wined3d_rendertarget_view_vk_barrier(struct wined3d_rendertarget_view_vk
*rtv_vk
,
926 struct wined3d_context_vk
*context_vk
, uint32_t bind_mask
)
928 wined3d_resource_vk_barrier(rtv_vk
->v
.resource
, context_vk
, bind_mask
);
931 static inline VkImageView
wined3d_rendertarget_view_vk_get_image_view(struct wined3d_rendertarget_view_vk
*rtv_vk
,
932 struct wined3d_context_vk
*context_vk
)
934 struct wined3d_texture_vk
*texture_vk
;
936 if (rtv_vk
->vk_image_view
)
937 return rtv_vk
->vk_image_view
;
939 texture_vk
= wined3d_texture_vk(wined3d_texture_from_resource(rtv_vk
->v
.resource
));
940 return wined3d_texture_vk_get_default_image_info(texture_vk
, context_vk
)->imageView
;
943 HRESULT
wined3d_rendertarget_view_vk_init(struct wined3d_rendertarget_view_vk
*view_vk
,
944 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
945 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
947 struct wined3d_view_vk
949 struct wined3d_bo_user bo_user
;
952 VkBufferView vk_buffer_view
;
953 VkDescriptorImageInfo vk_image_info
;
955 uint64_t command_buffer_id
;
958 struct wined3d_shader_resource_view_vk
960 struct wined3d_shader_resource_view v
;
961 struct wined3d_view_vk view_vk
;
964 static inline struct wined3d_shader_resource_view_vk
*wined3d_shader_resource_view_vk(
965 struct wined3d_shader_resource_view
*view
)
967 return CONTAINING_RECORD(view
, struct wined3d_shader_resource_view_vk
, v
);
970 static inline void wined3d_shader_resource_view_vk_barrier(struct wined3d_shader_resource_view_vk
*srv_vk
,
971 struct wined3d_context_vk
*context_vk
, uint32_t bind_mask
)
973 wined3d_resource_vk_barrier(srv_vk
->v
.resource
, context_vk
, bind_mask
);
976 void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resource_view_vk
*srv_vk
,
977 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
978 HRESULT
wined3d_shader_resource_view_vk_init(struct wined3d_shader_resource_view_vk
*view_vk
,
979 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
980 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
981 void wined3d_shader_resource_view_vk_update_buffer(struct wined3d_shader_resource_view_vk
*view_vk
,
982 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
983 void wined3d_shader_resource_view_vk_update_layout(struct wined3d_shader_resource_view_vk
*srv_vk
,
984 VkImageLayout layout
) DECLSPEC_HIDDEN
;
986 struct wined3d_unordered_access_view_vk
988 struct wined3d_unordered_access_view v
;
989 struct wined3d_view_vk view_vk
;
991 VkBufferView vk_counter_view
;
992 struct wined3d_bo_vk counter_bo
;
995 static inline struct wined3d_unordered_access_view_vk
*wined3d_unordered_access_view_vk(
996 struct wined3d_unordered_access_view
*view
)
998 return CONTAINING_RECORD(view
, struct wined3d_unordered_access_view_vk
, v
);
1001 static inline void wined3d_unordered_access_view_vk_barrier(struct wined3d_unordered_access_view_vk
*uav_vk
,
1002 struct wined3d_context_vk
*context_vk
, uint32_t bind_mask
)
1004 wined3d_resource_vk_barrier(uav_vk
->v
.resource
, context_vk
, bind_mask
);
1007 void wined3d_unordered_access_view_vk_clear(struct wined3d_unordered_access_view_vk
*view_vk
,
1008 const struct wined3d_uvec4
*clear_value
, struct wined3d_context_vk
*context_vk
, bool fp
) DECLSPEC_HIDDEN
;
1009 HRESULT
wined3d_unordered_access_view_vk_init(struct wined3d_unordered_access_view_vk
*view_vk
,
1010 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
1011 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
1012 void wined3d_unordered_access_view_vk_update(struct wined3d_unordered_access_view_vk
*view_vk
,
1013 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
1015 struct wined3d_swapchain_vk
1017 struct wined3d_swapchain s
;
1019 VkSwapchainKHR vk_swapchain
;
1020 VkSurfaceKHR vk_surface
;
1024 VkSemaphore available
;
1025 VkSemaphore presentable
;
1026 uint64_t command_buffer_id
;
1028 unsigned int current
, image_count
;
1029 unsigned int width
, height
;
1032 static inline struct wined3d_swapchain_vk
*wined3d_swapchain_vk(struct wined3d_swapchain
*swapchain
)
1034 return CONTAINING_RECORD(swapchain
, struct wined3d_swapchain_vk
, s
);
1037 void wined3d_swapchain_vk_cleanup(struct wined3d_swapchain_vk
*swapchain_vk
) DECLSPEC_HIDDEN
;
1038 HRESULT
wined3d_swapchain_vk_init(struct wined3d_swapchain_vk
*swapchain_vk
,
1039 struct wined3d_device
*device
, const struct wined3d_swapchain_desc
*desc
,
1040 struct wined3d_swapchain_state_parent
*state_parent
, void *parent
,
1041 const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
1043 struct wined3d_format_vk
1045 struct wined3d_format f
;
1050 static inline const struct wined3d_format_vk
*wined3d_format_vk(const struct wined3d_format
*format
)
1052 return CONTAINING_RECORD(format
, struct wined3d_format_vk
, f
);
1055 static inline void wined3d_context_vk_reference_bo(const struct wined3d_context_vk
*context_vk
,
1056 struct wined3d_bo_vk
*bo
)
1058 bo
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
1061 static inline void wined3d_context_vk_reference_image(const struct wined3d_context_vk
*context_vk
,
1062 struct wined3d_image_vk
*image
)
1064 image
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
1067 static inline void wined3d_context_vk_reference_texture(const struct wined3d_context_vk
*context_vk
,
1068 struct wined3d_texture_vk
*texture_vk
)
1070 wined3d_context_vk_reference_image(context_vk
, &texture_vk
->image
);
1073 static inline void wined3d_context_vk_reference_resource(const struct wined3d_context_vk
*context_vk
,
1074 struct wined3d_resource
*resource
)
1076 if (resource
->type
== WINED3D_RTYPE_BUFFER
)
1077 wined3d_context_vk_reference_bo(context_vk
, wined3d_bo_vk(buffer_from_resource(resource
)->buffer_object
));
1079 wined3d_context_vk_reference_texture(context_vk
, wined3d_texture_vk(texture_from_resource(resource
)));
1082 static inline void wined3d_context_vk_reference_query(const struct wined3d_context_vk
*context_vk
,
1083 struct wined3d_query_vk
*query_vk
)
1085 query_vk
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
1088 static inline void wined3d_context_vk_reference_sampler(const struct wined3d_context_vk
*context_vk
,
1089 struct wined3d_sampler_vk
*sampler_vk
)
1091 sampler_vk
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
1094 static inline void wined3d_context_vk_reference_rendertarget_view(const struct wined3d_context_vk
*context_vk
,
1095 struct wined3d_rendertarget_view_vk
*rtv_vk
)
1097 wined3d_context_vk_reference_resource(context_vk
, rtv_vk
->v
.resource
);
1098 rtv_vk
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
1101 static inline void wined3d_context_vk_reference_shader_resource_view(const struct wined3d_context_vk
*context_vk
,
1102 struct wined3d_shader_resource_view_vk
*srv_vk
)
1104 wined3d_context_vk_reference_resource(context_vk
, srv_vk
->v
.resource
);
1105 srv_vk
->view_vk
.command_buffer_id
= context_vk
->current_command_buffer
.id
;
1108 static inline void wined3d_context_vk_reference_unordered_access_view(const struct wined3d_context_vk
*context_vk
,
1109 struct wined3d_unordered_access_view_vk
*uav_vk
)
1111 wined3d_context_vk_reference_resource(context_vk
, uav_vk
->v
.resource
);
1112 uav_vk
->view_vk
.command_buffer_id
= context_vk
->current_command_buffer
.id
;
1115 #endif /* __WINE_WINED3D_VK */