aboutsummaryrefslogtreecommitdiff
path: root/src/vulkan/pipeline.cc
blob: df301e4ce068cfaf882813b79f6ac6dee72816a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
// Copyright 2018 The Amber Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "src/vulkan/pipeline.h"

#include <algorithm>
#include <limits>
#include <utility>

#include "src/command.h"
#include "src/engine.h"
#include "src/make_unique.h"
#include "src/vulkan/buffer_descriptor.h"
#include "src/vulkan/compute_pipeline.h"
#include "src/vulkan/device.h"
#include "src/vulkan/graphics_pipeline.h"
#include "src/vulkan/image_descriptor.h"
#include "src/vulkan/sampler_descriptor.h"

namespace amber {
namespace vulkan {
namespace {

const char* kDefaultEntryPointName = "main";

}  // namespace

Pipeline::Pipeline(
    PipelineType type,
    Device* device,
    uint32_t fence_timeout_ms,
    const std::vector<VkPipelineShaderStageCreateInfo>& shader_stage_info)
    : device_(device),
      pipeline_type_(type),
      shader_stage_info_(shader_stage_info),
      fence_timeout_ms_(fence_timeout_ms) {}

Pipeline::~Pipeline() {
  // Command must be reset before we destroy descriptors or we get a validation
  // error.
  command_ = nullptr;

  for (auto& info : descriptor_set_info_) {
    if (info.layout != VK_NULL_HANDLE) {
      device_->GetPtrs()->vkDestroyDescriptorSetLayout(device_->GetVkDevice(),
                                                       info.layout, nullptr);
    }

    if (info.empty)
      continue;

    if (info.pool != VK_NULL_HANDLE) {
      device_->GetPtrs()->vkDestroyDescriptorPool(device_->GetVkDevice(),
                                                  info.pool, nullptr);
    }
  }
}

GraphicsPipeline* Pipeline::AsGraphics() {
  return static_cast<GraphicsPipeline*>(this);
}

ComputePipeline* Pipeline::AsCompute() {
  return static_cast<ComputePipeline*>(this);
}

Result Pipeline::Initialize(CommandPool* pool) {
  push_constant_ = MakeUnique<PushConstant>(device_);

  command_ = MakeUnique<CommandBuffer>(device_, pool);
  return command_->Initialize();
}

Result Pipeline::CreateDescriptorSetLayouts() {
  for (auto& info : descriptor_set_info_) {
    VkDescriptorSetLayoutCreateInfo desc_info =
        VkDescriptorSetLayoutCreateInfo();
    desc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;

    // If there are no descriptors for this descriptor set we only
    // need to create its layout and there will be no bindings.
    std::vector<VkDescriptorSetLayoutBinding> bindings;
    for (auto& desc : info.descriptors) {
      bindings.emplace_back();
      bindings.back().binding = desc->GetBinding();
      bindings.back().descriptorType = desc->GetVkDescriptorType();
      bindings.back().descriptorCount = desc->GetDescriptorCount();
      bindings.back().stageFlags = VK_SHADER_STAGE_ALL;
    }
    desc_info.bindingCount = static_cast<uint32_t>(bindings.size());
    desc_info.pBindings = bindings.data();

    if (device_->GetPtrs()->vkCreateDescriptorSetLayout(
            device_->GetVkDevice(), &desc_info, nullptr, &info.layout) !=
        VK_SUCCESS) {
      return Result("Vulkan::Calling vkCreateDescriptorSetLayout Fail");
    }
  }

  return {};
}

Result Pipeline::CreateDescriptorPools() {
  for (auto& info : descriptor_set_info_) {
    if (info.empty)
      continue;

    std::vector<VkDescriptorPoolSize> pool_sizes;
    for (auto& desc : info.descriptors) {
      VkDescriptorType type = desc->GetVkDescriptorType();
      auto it = find_if(pool_sizes.begin(), pool_sizes.end(),
                        [&type](const VkDescriptorPoolSize& size) {
                          return size.type == type;
                        });
      if (it != pool_sizes.end()) {
        it->descriptorCount += desc->GetDescriptorCount();
        continue;
      }

      pool_sizes.emplace_back();
      pool_sizes.back().type = type;
      pool_sizes.back().descriptorCount = desc->GetDescriptorCount();
    }

    VkDescriptorPoolCreateInfo pool_info = VkDescriptorPoolCreateInfo();
    pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
    pool_info.maxSets = 1;
    pool_info.poolSizeCount = static_cast<uint32_t>(pool_sizes.size());
    pool_info.pPoolSizes = pool_sizes.data();

    if (device_->GetPtrs()->vkCreateDescriptorPool(device_->GetVkDevice(),
                                                   &pool_info, nullptr,
                                                   &info.pool) != VK_SUCCESS) {
      return Result("Vulkan::Calling vkCreateDescriptorPool Fail");
    }
  }

  return {};
}

Result Pipeline::CreateDescriptorSets() {
  for (size_t i = 0; i < descriptor_set_info_.size(); ++i) {
    if (descriptor_set_info_[i].empty)
      continue;

    VkDescriptorSetAllocateInfo desc_set_info = VkDescriptorSetAllocateInfo();
    desc_set_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
    desc_set_info.descriptorPool = descriptor_set_info_[i].pool;
    desc_set_info.descriptorSetCount = 1;
    desc_set_info.pSetLayouts = &descriptor_set_info_[i].layout;

    VkDescriptorSet desc_set = VK_NULL_HANDLE;
    if (device_->GetPtrs()->vkAllocateDescriptorSets(
            device_->GetVkDevice(), &desc_set_info, &desc_set) != VK_SUCCESS) {
      return Result("Vulkan::Calling vkAllocateDescriptorSets Fail");
    }
    descriptor_set_info_[i].vk_desc_set = desc_set;
  }

  return {};
}

Result Pipeline::CreateVkPipelineLayout(VkPipelineLayout* pipeline_layout) {
  Result r = CreateVkDescriptorRelatedObjectsIfNeeded();
  if (!r.IsSuccess())
    return r;

  std::vector<VkDescriptorSetLayout> descriptor_set_layouts;
  for (const auto& desc_set : descriptor_set_info_)
    descriptor_set_layouts.push_back(desc_set.layout);

  VkPipelineLayoutCreateInfo pipeline_layout_info =
      VkPipelineLayoutCreateInfo();
  pipeline_layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
  pipeline_layout_info.setLayoutCount =
      static_cast<uint32_t>(descriptor_set_layouts.size());
  pipeline_layout_info.pSetLayouts = descriptor_set_layouts.data();

  VkPushConstantRange push_const_range =
      push_constant_->GetVkPushConstantRange();
  if (push_const_range.size > 0) {
    pipeline_layout_info.pushConstantRangeCount = 1U;
    pipeline_layout_info.pPushConstantRanges = &push_const_range;
  }

  if (device_->GetPtrs()->vkCreatePipelineLayout(
          device_->GetVkDevice(), &pipeline_layout_info, nullptr,
          pipeline_layout) != VK_SUCCESS) {
    return Result("Vulkan::Calling vkCreatePipelineLayout Fail");
  }

  return {};
}

Result Pipeline::CreateVkDescriptorRelatedObjectsIfNeeded() {
  if (descriptor_related_objects_already_created_)
    return {};

  Result r = CreateDescriptorSetLayouts();
  if (!r.IsSuccess())
    return r;

  r = CreateDescriptorPools();
  if (!r.IsSuccess())
    return r;

  r = CreateDescriptorSets();
  if (!r.IsSuccess())
    return r;

  descriptor_related_objects_already_created_ = true;
  return {};
}

void Pipeline::UpdateDescriptorSetsIfNeeded() {
  for (auto& info : descriptor_set_info_) {
    for (auto& desc : info.descriptors)
      desc->UpdateDescriptorSetIfNeeded(info.vk_desc_set);
  }
}

Result Pipeline::RecordPushConstant(const VkPipelineLayout& pipeline_layout) {
  return push_constant_->RecordPushConstantVkCommand(command_.get(),
                                                     pipeline_layout);
}

Result Pipeline::AddPushConstantBuffer(const Buffer* buf, uint32_t offset) {
  if (!buf)
    return Result("Missing push constant buffer data");
  return push_constant_->AddBuffer(buf, offset);
}

Result Pipeline::GetDescriptorSlot(uint32_t desc_set,
                                   uint32_t binding,
                                   Descriptor** desc) {
  *desc = nullptr;

  if (desc_set >= descriptor_set_info_.size()) {
    for (size_t i = descriptor_set_info_.size();
         i <= static_cast<size_t>(desc_set); ++i) {
      descriptor_set_info_.emplace_back();
    }
  }

  if (descriptor_set_info_[desc_set].empty &&
      descriptor_related_objects_already_created_) {
    return Result(
        "Vulkan: Pipeline descriptor related objects were already created but "
        "try to put data on empty descriptor set '" +
        std::to_string(desc_set) +
        "'. Note that all used descriptor sets must be allocated before the "
        "first compute or draw.");
  }
  descriptor_set_info_[desc_set].empty = false;

  auto& descriptors = descriptor_set_info_[desc_set].descriptors;
  for (auto& descriptor : descriptors) {
    if (descriptor->GetBinding() == binding)
      *desc = descriptor.get();
  }

  return {};
}

Result Pipeline::AddDescriptorBuffer(Buffer* amber_buffer) {
  // Don't add the buffer if it's already added.
  const auto& buffer = std::find_if(
      descriptor_buffers_.begin(), descriptor_buffers_.end(),
      [&](const Buffer* buf) { return buf == amber_buffer; });
  if (buffer != descriptor_buffers_.end()) {
    return {};
  }
  descriptor_buffers_.push_back(amber_buffer);
  return {};
}

Result Pipeline::AddBufferDescriptor(const BufferCommand* cmd) {
  if (cmd == nullptr)
    return Result("Pipeline::AddBufferDescriptor BufferCommand is nullptr");
  if (!cmd->IsSSBO() && !cmd->IsUniform() && !cmd->IsStorageImage() &&
      !cmd->IsSampledImage() && !cmd->IsCombinedImageSampler() &&
      !cmd->IsUniformTexelBuffer() && !cmd->IsStorageTexelBuffer() &&
      !cmd->IsUniformDynamic() && !cmd->IsSSBODynamic()) {
    return Result("Pipeline::AddBufferDescriptor not supported buffer type");
  }

  Descriptor* desc;
  Result r =
      GetDescriptorSlot(cmd->GetDescriptorSet(), cmd->GetBinding(), &desc);
  if (!r.IsSuccess())
    return r;

  auto& descriptors = descriptor_set_info_[cmd->GetDescriptorSet()].descriptors;

  bool is_image = false;
  DescriptorType desc_type = DescriptorType::kUniformBuffer;

  if (cmd->IsStorageImage()) {
    desc_type = DescriptorType::kStorageImage;
    is_image = true;
  } else if (cmd->IsSampledImage()) {
    desc_type = DescriptorType::kSampledImage;
    is_image = true;
  } else if (cmd->IsCombinedImageSampler()) {
    desc_type = DescriptorType::kCombinedImageSampler;
    is_image = true;
  } else if (cmd->IsUniformTexelBuffer()) {
    desc_type = DescriptorType::kUniformTexelBuffer;
  } else if (cmd->IsStorageTexelBuffer()) {
    desc_type = DescriptorType::kStorageTexelBuffer;
  } else if (cmd->IsSSBO()) {
    desc_type = DescriptorType::kStorageBuffer;
  } else if (cmd->IsUniformDynamic()) {
    desc_type = DescriptorType::kUniformBufferDynamic;
  } else if (cmd->IsSSBODynamic()) {
    desc_type = DescriptorType::kStorageBufferDynamic;
  }

  if (desc == nullptr) {
    if (is_image) {
      auto image_desc = MakeUnique<ImageDescriptor>(
          cmd->GetBuffer(), desc_type, device_, cmd->GetBaseMipLevel(),
          cmd->GetDescriptorSet(), cmd->GetBinding(), this);
      if (cmd->IsCombinedImageSampler())
        image_desc->SetAmberSampler(cmd->GetSampler());

      descriptors.push_back(std::move(image_desc));
    } else {
      auto buffer_desc = MakeUnique<BufferDescriptor>(
          cmd->GetBuffer(), desc_type, device_, cmd->GetDescriptorSet(),
          cmd->GetBinding(), this);
      descriptors.push_back(std::move(buffer_desc));
    }
    AddDescriptorBuffer(cmd->GetBuffer());
    desc = descriptors.back().get();
  } else {
    if (desc->GetDescriptorType() != desc_type) {
      return Result(
          "Descriptors bound to the same binding needs to have matching "
          "descriptor types");
    }
    desc->AsBufferBackedDescriptor()->AddAmberBuffer(cmd->GetBuffer());
    AddDescriptorBuffer(cmd->GetBuffer());
  }

  if (cmd->IsUniformDynamic() || cmd->IsSSBODynamic())
    desc->AsBufferDescriptor()->AddDynamicOffset(cmd->GetDynamicOffset());

  if (cmd->IsUniform() || cmd->IsUniformDynamic() || cmd->IsSSBO() ||
      cmd->IsSSBODynamic()) {
    desc->AsBufferDescriptor()->AddDescriptorOffset(cmd->GetDescriptorOffset());
    desc->AsBufferDescriptor()->AddDescriptorRange(cmd->GetDescriptorRange());
  }

  if (cmd->IsSSBO() && !desc->IsStorageBuffer()) {
    return Result(
        "Vulkan::AddBufferDescriptor BufferCommand for SSBO uses wrong "
        "descriptor "
        "set and binding");
  }

  if (cmd->IsUniform() && !desc->IsUniformBuffer()) {
    return Result(
        "Vulkan::AddBufferDescriptor BufferCommand for UBO uses wrong "
        "descriptor set "
        "and binding");
  }

  return {};
}

Result Pipeline::AddSamplerDescriptor(const SamplerCommand* cmd) {
  if (cmd == nullptr)
    return Result("Pipeline::AddSamplerDescriptor SamplerCommand is nullptr");

  Descriptor* desc;
  Result r =
      GetDescriptorSlot(cmd->GetDescriptorSet(), cmd->GetBinding(), &desc);
  if (!r.IsSuccess())
    return r;

  auto& descriptors = descriptor_set_info_[cmd->GetDescriptorSet()].descriptors;

  if (desc == nullptr) {
    auto sampler_desc = MakeUnique<SamplerDescriptor>(
        cmd->GetSampler(), DescriptorType::kSampler, device_,
        cmd->GetDescriptorSet(), cmd->GetBinding());
    descriptors.push_back(std::move(sampler_desc));
  } else {
    if (desc->GetDescriptorType() != DescriptorType::kSampler) {
      return Result(
          "Descriptors bound to the same binding needs to have matching "
          "descriptor types");
    }
    desc->AsSamplerDescriptor()->AddAmberSampler(cmd->GetSampler());
  }

  return {};
}

Result Pipeline::SendDescriptorDataToDeviceIfNeeded() {
  {
    CommandBufferGuard guard(GetCommandBuffer());
    if (!guard.IsRecording())
      return guard.GetResult();

    for (auto& info : descriptor_set_info_) {
      for (auto& desc : info.descriptors) {
        Result r = desc->CreateResourceIfNeeded();
        if (!r.IsSuccess())
          return r;
      }
    }

    // Initialize transfer buffers / images.
    for (auto buffer : descriptor_buffers_) {
      if (descriptor_transfer_resources_.count(buffer) == 0) {
        return Result(
            "Vulkan: Pipeline::SendDescriptorDataToDeviceIfNeeded() "
            "descriptor's transfer resource is not found");
      }
      descriptor_transfer_resources_[buffer]->Initialize();
    }

    // Note that if a buffer for a descriptor is host accessible and
    // does not need to record a command to copy data to device, it
    // directly writes data to the buffer. The direct write must be
    // done after resizing backed buffer i.e., copying data to the new
    // buffer from the old one. Thus, we must submit commands here to
    // guarantee this.
    Result r = guard.Submit(GetFenceTimeout());
    if (!r.IsSuccess())
      return r;
  }

  CommandBufferGuard guard(GetCommandBuffer());
  if (!guard.IsRecording())
    return guard.GetResult();

  // Copy descriptor data to transfer resources.
  for (auto& buffer : descriptor_buffers_) {
    if (auto transfer_buffer =
            descriptor_transfer_resources_[buffer]->AsTransferBuffer()) {
      BufferBackedDescriptor::RecordCopyBufferDataToTransferResourceIfNeeded(
          GetCommandBuffer(), buffer, transfer_buffer);
    } else if (auto transfer_image =
                   descriptor_transfer_resources_[buffer]->AsTransferImage()) {
      transfer_image->ImageBarrier(GetCommandBuffer(),
                                   VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
                                   VK_PIPELINE_STAGE_TRANSFER_BIT);

      BufferBackedDescriptor::RecordCopyBufferDataToTransferResourceIfNeeded(
          GetCommandBuffer(), buffer, transfer_image);

      transfer_image->ImageBarrier(GetCommandBuffer(), VK_IMAGE_LAYOUT_GENERAL,
                                   VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
    } else {
      return Result(
          "Vulkan: Pipeline::SendDescriptorDataToDeviceIfNeeded() "
          "this should be unreachable");
    }
  }
  return guard.Submit(GetFenceTimeout());
}

void Pipeline::BindVkDescriptorSets(const VkPipelineLayout& pipeline_layout) {
  for (size_t i = 0; i < descriptor_set_info_.size(); ++i) {
    if (descriptor_set_info_[i].empty)
      continue;

    // Sort descriptors by binding number to get correct order of dynamic
    // offsets.
    typedef std::pair<uint32_t, std::vector<uint32_t>> binding_offsets_pair;
    std::vector<binding_offsets_pair> binding_offsets;
    for (const auto& desc : descriptor_set_info_[i].descriptors) {
      binding_offsets.push_back(
          {desc->GetBinding(), desc->GetDynamicOffsets()});
    }

    std::sort(std::begin(binding_offsets), std::end(binding_offsets),
              [](const binding_offsets_pair& a, const binding_offsets_pair& b) {
                return a.first < b.first;
              });

    // Add the sorted dynamic offsets.
    std::vector<uint32_t> dynamic_offsets;
    for (const auto& binding_offset : binding_offsets) {
      for (auto offset : binding_offset.second) {
        dynamic_offsets.push_back(offset);
      }
    }

    device_->GetPtrs()->vkCmdBindDescriptorSets(
        command_->GetVkCommandBuffer(),
        IsGraphics() ? VK_PIPELINE_BIND_POINT_GRAPHICS
                     : VK_PIPELINE_BIND_POINT_COMPUTE,
        pipeline_layout, static_cast<uint32_t>(i), 1,
        &descriptor_set_info_[i].vk_desc_set,
        static_cast<uint32_t>(dynamic_offsets.size()), dynamic_offsets.data());
  }
}

Result Pipeline::ReadbackDescriptorsToHostDataQueue() {
  // Record required commands to copy the data to a host visible buffer.
  {
    CommandBufferGuard guard(GetCommandBuffer());
    if (!guard.IsRecording())
      return guard.GetResult();

    for (auto& buffer : descriptor_buffers_) {
      if (descriptor_transfer_resources_.count(buffer) == 0) {
        return Result(
            "Vulkan: Pipeline::ReadbackDescriptorsToHostDataQueue() "
            "descriptor's transfer resource is not found");
      }
      if (auto transfer_buffer =
              descriptor_transfer_resources_[buffer]->AsTransferBuffer()) {
        Result r = BufferBackedDescriptor::RecordCopyTransferResourceToHost(
            GetCommandBuffer(), transfer_buffer);
        if (!r.IsSuccess())
          return r;
      } else if (auto transfer_image = descriptor_transfer_resources_[buffer]
                                           ->AsTransferImage()) {
        transfer_image->ImageBarrier(GetCommandBuffer(),
                                     VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
                                     VK_PIPELINE_STAGE_TRANSFER_BIT);
        Result r = BufferBackedDescriptor::RecordCopyTransferResourceToHost(
            GetCommandBuffer(), transfer_image);
        if (!r.IsSuccess())
          return r;
      } else {
        return Result(
            "Vulkan: Pipeline::ReadbackDescriptorsToHostDataQueue() "
            "this should be unreachable");
      }
    }

    Result r = guard.Submit(GetFenceTimeout());
    if (!r.IsSuccess())
      return r;
  }

  // Move data from transfer buffers to output buffers.
  for (auto& buffer : descriptor_buffers_) {
    auto& transfer_resource = descriptor_transfer_resources_[buffer];
    Result r = BufferBackedDescriptor::MoveTransferResourceToBufferOutput(
        transfer_resource.get(), buffer);
    if (!r.IsSuccess())
      return r;
  }
  descriptor_transfer_resources_.clear();
  return {};
}

const char* Pipeline::GetEntryPointName(VkShaderStageFlagBits stage) const {
  auto it = entry_points_.find(stage);
  if (it != entry_points_.end())
    return it->second.c_str();

  return kDefaultEntryPointName;
}

}  // namespace vulkan
}  // namespace amber