1 /*
2 * Copyright © 2015 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include "anv_private.h"
25
26 #include "vk_format.h"
27 #include "vk_util.h"
28
29 static void
anv_render_pass_add_subpass_dep(struct anv_device * device,struct anv_render_pass * pass,const VkSubpassDependency2KHR * dep)30 anv_render_pass_add_subpass_dep(struct anv_device *device,
31 struct anv_render_pass *pass,
32 const VkSubpassDependency2KHR *dep)
33 {
34 /* From the Vulkan 1.2.195 spec:
35 *
36 * "If an instance of VkMemoryBarrier2 is included in the pNext chain,
37 * srcStageMask, dstStageMask, srcAccessMask, and dstAccessMask
38 * parameters are ignored. The synchronization and access scopes instead
39 * are defined by the parameters of VkMemoryBarrier2."
40 */
41 const VkMemoryBarrier2KHR *barrier =
42 vk_find_struct_const(dep->pNext, MEMORY_BARRIER_2_KHR);
43 VkAccessFlags2KHR src_access_mask =
44 barrier ? barrier->srcAccessMask : dep->srcAccessMask;
45 VkAccessFlags2KHR dst_access_mask =
46 barrier ? barrier->dstAccessMask : dep->dstAccessMask;
47
48 if (dep->dstSubpass == VK_SUBPASS_EXTERNAL) {
49 pass->subpass_flushes[pass->subpass_count] |=
50 anv_pipe_invalidate_bits_for_access_flags(device, dst_access_mask);
51 } else {
52 assert(dep->dstSubpass < pass->subpass_count);
53 pass->subpass_flushes[dep->dstSubpass] |=
54 anv_pipe_invalidate_bits_for_access_flags(device, dst_access_mask);
55 }
56
57 if (dep->srcSubpass == VK_SUBPASS_EXTERNAL) {
58 pass->subpass_flushes[0] |=
59 anv_pipe_flush_bits_for_access_flags(device, src_access_mask);
60 } else {
61 assert(dep->srcSubpass < pass->subpass_count);
62 pass->subpass_flushes[dep->srcSubpass + 1] |=
63 anv_pipe_flush_bits_for_access_flags(device, src_access_mask);
64 }
65 }
66
67 /* Do a second "compile" step on a render pass */
68 static void
anv_render_pass_compile(struct anv_render_pass * pass)69 anv_render_pass_compile(struct anv_render_pass *pass)
70 {
71 /* The CreateRenderPass code zeros the entire render pass and also uses a
72 * designated initializer for filling these out. There's no need for us to
73 * do it again.
74 *
75 * for (uint32_t i = 0; i < pass->attachment_count; i++) {
76 * pass->attachments[i].usage = 0;
77 * pass->attachments[i].first_subpass_layout = VK_IMAGE_LAYOUT_UNDEFINED;
78 * }
79 */
80
81 VkImageUsageFlags all_usage = 0;
82 for (uint32_t i = 0; i < pass->subpass_count; i++) {
83 struct anv_subpass *subpass = &pass->subpasses[i];
84
85 /* We don't allow depth_stencil_attachment to be non-NULL and be
86 * VK_ATTACHMENT_UNUSED. This way something can just check for NULL
87 * and be guaranteed that they have a valid attachment.
88 */
89 if (subpass->depth_stencil_attachment &&
90 subpass->depth_stencil_attachment->attachment == VK_ATTACHMENT_UNUSED)
91 subpass->depth_stencil_attachment = NULL;
92
93 if (subpass->ds_resolve_attachment &&
94 subpass->ds_resolve_attachment->attachment == VK_ATTACHMENT_UNUSED)
95 subpass->ds_resolve_attachment = NULL;
96
97 for (uint32_t j = 0; j < subpass->attachment_count; j++) {
98 struct anv_subpass_attachment *subpass_att = &subpass->attachments[j];
99 if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
100 continue;
101
102 struct anv_render_pass_attachment *pass_att =
103 &pass->attachments[subpass_att->attachment];
104
105 pass_att->usage |= subpass_att->usage;
106 pass_att->last_subpass_idx = i;
107
108 all_usage |= subpass_att->usage;
109
110 if (pass_att->first_subpass_layout == VK_IMAGE_LAYOUT_UNDEFINED) {
111 pass_att->first_subpass_layout = subpass_att->layout;
112 assert(pass_att->first_subpass_layout != VK_IMAGE_LAYOUT_UNDEFINED);
113 }
114
115 if (subpass_att->usage == VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT &&
116 subpass->depth_stencil_attachment &&
117 subpass_att->attachment == subpass->depth_stencil_attachment->attachment)
118 subpass->has_ds_self_dep = true;
119 }
120
121 /* We have to handle resolve attachments specially */
122 subpass->has_color_resolve = false;
123 if (subpass->resolve_attachments) {
124 for (uint32_t j = 0; j < subpass->color_count; j++) {
125 struct anv_subpass_attachment *color_att =
126 &subpass->color_attachments[j];
127 struct anv_subpass_attachment *resolve_att =
128 &subpass->resolve_attachments[j];
129 if (resolve_att->attachment == VK_ATTACHMENT_UNUSED)
130 continue;
131
132 subpass->has_color_resolve = true;
133
134 assert(color_att->attachment < pass->attachment_count);
135 struct anv_render_pass_attachment *color_pass_att =
136 &pass->attachments[color_att->attachment];
137
138 assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT);
139 assert(color_att->usage == VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
140 color_pass_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
141 }
142 }
143
144 if (subpass->ds_resolve_attachment) {
145 struct anv_subpass_attachment *ds_att =
146 subpass->depth_stencil_attachment;
147 UNUSED struct anv_subpass_attachment *resolve_att =
148 subpass->ds_resolve_attachment;
149
150 assert(ds_att->attachment < pass->attachment_count);
151 struct anv_render_pass_attachment *ds_pass_att =
152 &pass->attachments[ds_att->attachment];
153
154 assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT);
155 assert(ds_att->usage == VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);
156 ds_pass_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
157 }
158
159 for (uint32_t j = 0; j < subpass->attachment_count; j++)
160 assert(__builtin_popcount(subpass->attachments[j].usage) == 1);
161 }
162
163 /* From the Vulkan 1.0.39 spec:
164 *
165 * If there is no subpass dependency from VK_SUBPASS_EXTERNAL to the
166 * first subpass that uses an attachment, then an implicit subpass
167 * dependency exists from VK_SUBPASS_EXTERNAL to the first subpass it is
168 * used in. The subpass dependency operates as if defined with the
169 * following parameters:
170 *
171 * VkSubpassDependency implicitDependency = {
172 * .srcSubpass = VK_SUBPASS_EXTERNAL;
173 * .dstSubpass = firstSubpass; // First subpass attachment is used in
174 * .srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
175 * .dstStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
176 * .srcAccessMask = 0;
177 * .dstAccessMask = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT |
178 * VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
179 * VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
180 * VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
181 * VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
182 * .dependencyFlags = 0;
183 * };
184 *
185 * Similarly, if there is no subpass dependency from the last subpass
186 * that uses an attachment to VK_SUBPASS_EXTERNAL, then an implicit
187 * subpass dependency exists from the last subpass it is used in to
188 * VK_SUBPASS_EXTERNAL. The subpass dependency operates as if defined
189 * with the following parameters:
190 *
191 * VkSubpassDependency implicitDependency = {
192 * .srcSubpass = lastSubpass; // Last subpass attachment is used in
193 * .dstSubpass = VK_SUBPASS_EXTERNAL;
194 * .srcStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
195 * .dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
196 * .srcAccessMask = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT |
197 * VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
198 * VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
199 * VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
200 * VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
201 * .dstAccessMask = 0;
202 * .dependencyFlags = 0;
203 * };
204 *
205 * We could implement this by walking over all of the attachments and
206 * subpasses and checking to see if any of them don't have an external
207 * dependency. Or, we could just be lazy and add a couple extra flushes.
208 * We choose to be lazy.
209 *
210 * From the documentation for vkCmdNextSubpass:
211 *
212 * "Moving to the next subpass automatically performs any multisample
213 * resolve operations in the subpass being ended. End-of-subpass
214 * multisample resolves are treated as color attachment writes for the
215 * purposes of synchronization. This applies to resolve operations for
216 * both color and depth/stencil attachments. That is, they are
217 * considered to execute in the
218 * VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT pipeline stage and
219 * their writes are synchronized with
220 * VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT."
221 *
222 * Therefore, the above flags concerning color attachments also apply to
223 * color and depth/stencil resolve attachments.
224 */
225 if (all_usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) {
226 pass->subpass_flushes[0] |=
227 ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT;
228 }
229 if (all_usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
230 VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
231 pass->subpass_flushes[pass->subpass_count] |=
232 ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT;
233 }
234 if (all_usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
235 pass->subpass_flushes[pass->subpass_count] |=
236 ANV_PIPE_DEPTH_CACHE_FLUSH_BIT;
237 }
238 }
239
240 static unsigned
num_subpass_attachments2(const VkSubpassDescription2KHR * desc)241 num_subpass_attachments2(const VkSubpassDescription2KHR *desc)
242 {
243 const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
244 vk_find_struct_const(desc->pNext,
245 SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR);
246
247 return desc->inputAttachmentCount +
248 desc->colorAttachmentCount +
249 (desc->pResolveAttachments ? desc->colorAttachmentCount : 0) +
250 (desc->pDepthStencilAttachment != NULL) +
251 (ds_resolve && ds_resolve->pDepthStencilResolveAttachment);
252 }
253
254 static bool
vk_image_layout_depth_only(VkImageLayout layout)255 vk_image_layout_depth_only(VkImageLayout layout)
256 {
257 switch (layout) {
258 case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL:
259 case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL:
260 return true;
261
262 default:
263 return false;
264 }
265 }
266
267 /* From the Vulkan Specification 1.2.166 - VkAttachmentReference2:
268 *
269 * "If layout only specifies the layout of the depth aspect of the
270 * attachment, the layout of the stencil aspect is specified by the
271 * stencilLayout member of a VkAttachmentReferenceStencilLayout structure
272 * included in the pNext chain. Otherwise, layout describes the layout for
273 * all relevant image aspects."
274 */
275 static VkImageLayout
stencil_ref_layout(const VkAttachmentReference2KHR * att_ref)276 stencil_ref_layout(const VkAttachmentReference2KHR *att_ref)
277 {
278 if (!vk_image_layout_depth_only(att_ref->layout))
279 return att_ref->layout;
280
281 const VkAttachmentReferenceStencilLayoutKHR *stencil_ref =
282 vk_find_struct_const(att_ref->pNext,
283 ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
284 if (!stencil_ref)
285 return VK_IMAGE_LAYOUT_UNDEFINED;
286 return stencil_ref->stencilLayout;
287 }
288
289 /* From the Vulkan Specification 1.2.166 - VkAttachmentDescription2:
290 *
291 * "If format is a depth/stencil format, and initialLayout only specifies
292 * the initial layout of the depth aspect of the attachment, the initial
293 * layout of the stencil aspect is specified by the stencilInitialLayout
294 * member of a VkAttachmentDescriptionStencilLayout structure included in
295 * the pNext chain. Otherwise, initialLayout describes the initial layout
296 * for all relevant image aspects."
297 */
298 static VkImageLayout
stencil_desc_layout(const VkAttachmentDescription2KHR * att_desc,bool final)299 stencil_desc_layout(const VkAttachmentDescription2KHR *att_desc, bool final)
300 {
301 if (!vk_format_has_stencil(att_desc->format))
302 return VK_IMAGE_LAYOUT_UNDEFINED;
303
304 const VkImageLayout main_layout =
305 final ? att_desc->finalLayout : att_desc->initialLayout;
306 if (!vk_image_layout_depth_only(main_layout))
307 return main_layout;
308
309 const VkAttachmentDescriptionStencilLayoutKHR *stencil_desc =
310 vk_find_struct_const(att_desc->pNext,
311 ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR);
312 assert(stencil_desc);
313 return final ?
314 stencil_desc->stencilFinalLayout :
315 stencil_desc->stencilInitialLayout;
316 }
317
anv_CreateRenderPass2(VkDevice _device,const VkRenderPassCreateInfo2KHR * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkRenderPass * pRenderPass)318 VkResult anv_CreateRenderPass2(
319 VkDevice _device,
320 const VkRenderPassCreateInfo2KHR* pCreateInfo,
321 const VkAllocationCallbacks* pAllocator,
322 VkRenderPass* pRenderPass)
323 {
324 ANV_FROM_HANDLE(anv_device, device, _device);
325
326 assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2_KHR);
327
328 VK_MULTIALLOC(ma);
329 VK_MULTIALLOC_DECL(&ma, struct anv_render_pass, pass, 1);
330 VK_MULTIALLOC_DECL(&ma, struct anv_subpass, subpasses,
331 pCreateInfo->subpassCount);
332 VK_MULTIALLOC_DECL(&ma, struct anv_render_pass_attachment, attachments,
333 pCreateInfo->attachmentCount);
334 VK_MULTIALLOC_DECL(&ma, enum anv_pipe_bits, subpass_flushes,
335 pCreateInfo->subpassCount + 1);
336
337 uint32_t subpass_attachment_count = 0;
338 for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {
339 subpass_attachment_count +=
340 num_subpass_attachments2(&pCreateInfo->pSubpasses[i]);
341 }
342 VK_MULTIALLOC_DECL(&ma, struct anv_subpass_attachment, subpass_attachments,
343 subpass_attachment_count);
344
345 if (!vk_object_multizalloc(&device->vk, &ma, pAllocator,
346 VK_OBJECT_TYPE_RENDER_PASS))
347 return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
348
349 /* Clear the subpasses along with the parent pass. This required because
350 * each array member of anv_subpass must be a valid pointer if not NULL.
351 */
352 pass->attachment_count = pCreateInfo->attachmentCount;
353 pass->subpass_count = pCreateInfo->subpassCount;
354 pass->attachments = attachments;
355 pass->subpass_flushes = subpass_flushes;
356
357 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
358 pass->attachments[i] = (struct anv_render_pass_attachment) {
359 .format = pCreateInfo->pAttachments[i].format,
360 .samples = pCreateInfo->pAttachments[i].samples,
361 .load_op = pCreateInfo->pAttachments[i].loadOp,
362 .store_op = pCreateInfo->pAttachments[i].storeOp,
363 .stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp,
364 .initial_layout = pCreateInfo->pAttachments[i].initialLayout,
365 .final_layout = pCreateInfo->pAttachments[i].finalLayout,
366
367 .stencil_initial_layout = stencil_desc_layout(&pCreateInfo->pAttachments[i],
368 false),
369 .stencil_final_layout = stencil_desc_layout(&pCreateInfo->pAttachments[i],
370 true),
371 };
372 }
373
374 for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {
375 const VkSubpassDescription2KHR *desc = &pCreateInfo->pSubpasses[i];
376 struct anv_subpass *subpass = &pass->subpasses[i];
377
378 subpass->input_count = desc->inputAttachmentCount;
379 subpass->color_count = desc->colorAttachmentCount;
380 subpass->attachment_count = num_subpass_attachments2(desc);
381 subpass->attachments = subpass_attachments;
382 subpass->view_mask = desc->viewMask;
383
384 if (desc->inputAttachmentCount > 0) {
385 subpass->input_attachments = subpass_attachments;
386 subpass_attachments += desc->inputAttachmentCount;
387
388 for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
389 subpass->input_attachments[j] = (struct anv_subpass_attachment) {
390 .usage = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT,
391 .attachment = desc->pInputAttachments[j].attachment,
392 .layout = desc->pInputAttachments[j].layout,
393 .stencil_layout = stencil_ref_layout(&desc->pInputAttachments[j]),
394 };
395 }
396 }
397
398 if (desc->colorAttachmentCount > 0) {
399 subpass->color_attachments = subpass_attachments;
400 subpass_attachments += desc->colorAttachmentCount;
401
402 for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
403 subpass->color_attachments[j] = (struct anv_subpass_attachment) {
404 .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
405 .attachment = desc->pColorAttachments[j].attachment,
406 .layout = desc->pColorAttachments[j].layout,
407 };
408 }
409 }
410
411 if (desc->pResolveAttachments) {
412 subpass->resolve_attachments = subpass_attachments;
413 subpass_attachments += desc->colorAttachmentCount;
414
415 for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
416 subpass->resolve_attachments[j] = (struct anv_subpass_attachment) {
417 .usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT,
418 .attachment = desc->pResolveAttachments[j].attachment,
419 .layout = desc->pResolveAttachments[j].layout,
420 };
421 }
422 }
423
424 if (desc->pDepthStencilAttachment) {
425 subpass->depth_stencil_attachment = subpass_attachments++;
426
427 *subpass->depth_stencil_attachment = (struct anv_subpass_attachment) {
428 .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
429 .attachment = desc->pDepthStencilAttachment->attachment,
430 .layout = desc->pDepthStencilAttachment->layout,
431 .stencil_layout = stencil_ref_layout(desc->pDepthStencilAttachment),
432 };
433 }
434
435 const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
436 vk_find_struct_const(desc->pNext,
437 SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR);
438
439 if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment) {
440 subpass->ds_resolve_attachment = subpass_attachments++;
441
442 *subpass->ds_resolve_attachment = (struct anv_subpass_attachment) {
443 .usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT,
444 .attachment = ds_resolve->pDepthStencilResolveAttachment->attachment,
445 .layout = ds_resolve->pDepthStencilResolveAttachment->layout,
446 .stencil_layout = stencil_ref_layout(ds_resolve->pDepthStencilResolveAttachment),
447 };
448 subpass->depth_resolve_mode = ds_resolve->depthResolveMode;
449 subpass->stencil_resolve_mode = ds_resolve->stencilResolveMode;
450 }
451 }
452
453 for (uint32_t i = 0; i < pCreateInfo->dependencyCount; i++) {
454 anv_render_pass_add_subpass_dep(device, pass,
455 &pCreateInfo->pDependencies[i]);
456 }
457
458 vk_foreach_struct(ext, pCreateInfo->pNext) {
459 switch (ext->sType) {
460 default:
461 anv_debug_ignored_stype(ext->sType);
462 }
463 }
464
465 anv_render_pass_compile(pass);
466
467 *pRenderPass = anv_render_pass_to_handle(pass);
468
469 return VK_SUCCESS;
470 }
471
anv_DestroyRenderPass(VkDevice _device,VkRenderPass _pass,const VkAllocationCallbacks * pAllocator)472 void anv_DestroyRenderPass(
473 VkDevice _device,
474 VkRenderPass _pass,
475 const VkAllocationCallbacks* pAllocator)
476 {
477 ANV_FROM_HANDLE(anv_device, device, _device);
478 ANV_FROM_HANDLE(anv_render_pass, pass, _pass);
479
480 if (!pass)
481 return;
482
483 vk_object_free(&device->vk, pAllocator, pass);
484 }
485
anv_GetRenderAreaGranularity(VkDevice device,VkRenderPass renderPass,VkExtent2D * pGranularity)486 void anv_GetRenderAreaGranularity(
487 VkDevice device,
488 VkRenderPass renderPass,
489 VkExtent2D* pGranularity)
490 {
491 ANV_FROM_HANDLE(anv_render_pass, pass, renderPass);
492
493 /* This granularity satisfies HiZ fast clear alignment requirements
494 * for all sample counts.
495 */
496 for (unsigned i = 0; i < pass->subpass_count; ++i) {
497 if (pass->subpasses[i].depth_stencil_attachment) {
498 *pGranularity = (VkExtent2D) { .width = 8, .height = 4 };
499 return;
500 }
501 }
502
503 *pGranularity = (VkExtent2D) { 1, 1 };
504 }
505