~mmach/netext73/mesa_2004

« back to all changes in this revision

Viewing changes to src/amd/vulkan/radv_device.c

  • Committer: mmach
  • Date: 2021-07-04 19:28:58 UTC
  • Revision ID: netbit73@gmail.com-20210704192858-3dzjz3h2a015l3mq
2021-07-04 21:20:24

Show diffs side-by-side

added added

removed removed

Lines of Context:
5427
5427
}
5428
5428
 
5429
5429
VkResult
5430
 
radv_BindBufferMemory2(VkDevice device, uint32_t bindInfoCount,
 
5430
radv_BindBufferMemory2(VkDevice _device, uint32_t bindInfoCount,
5431
5431
                       const VkBindBufferMemoryInfo *pBindInfos)
5432
5432
{
 
5433
   RADV_FROM_HANDLE(radv_device, device, _device);
 
5434
 
5433
5435
   for (uint32_t i = 0; i < bindInfoCount; ++i) {
5434
5436
      RADV_FROM_HANDLE(radv_device_memory, mem, pBindInfos[i].memory);
5435
5437
      RADV_FROM_HANDLE(radv_buffer, buffer, pBindInfos[i].buffer);
5436
5438
 
5437
5439
      if (mem) {
 
5440
         if (mem->alloc_size) {
 
5441
            VkMemoryRequirements req;
 
5442
 
 
5443
            radv_GetBufferMemoryRequirements(_device, pBindInfos[i].buffer, &req);
 
5444
 
 
5445
            if (pBindInfos[i].memoryOffset + req.size > mem->alloc_size) {
 
5446
               return vk_errorf(device->instance, VK_ERROR_UNKNOWN,
 
5447
                                "Device memory object too small for the buffer.\n");
 
5448
            }
 
5449
         }
 
5450
 
5438
5451
         buffer->bo = mem->bo;
5439
5452
         buffer->offset = pBindInfos[i].memoryOffset;
5440
5453
      } else {
5457
5470
}
5458
5471
 
5459
5472
VkResult
5460
 
radv_BindImageMemory2(VkDevice device, uint32_t bindInfoCount,
 
5473
radv_BindImageMemory2(VkDevice _device, uint32_t bindInfoCount,
5461
5474
                      const VkBindImageMemoryInfo *pBindInfos)
5462
5475
{
 
5476
   RADV_FROM_HANDLE(radv_device, device, _device);
 
5477
 
5463
5478
   for (uint32_t i = 0; i < bindInfoCount; ++i) {
5464
5479
      RADV_FROM_HANDLE(radv_device_memory, mem, pBindInfos[i].memory);
5465
5480
      RADV_FROM_HANDLE(radv_image, image, pBindInfos[i].image);
5466
5481
 
5467
5482
      if (mem) {
 
5483
         if (mem->alloc_size) {
 
5484
            VkMemoryRequirements req;
 
5485
 
 
5486
            radv_GetImageMemoryRequirements(_device, pBindInfos[i].image, &req);
 
5487
 
 
5488
            if (pBindInfos[i].memoryOffset + req.size > mem->alloc_size) {
 
5489
               return vk_errorf(device->instance, VK_ERROR_UNKNOWN,
 
5490
                                "Device memory object too small for the image.\n");
 
5491
            }
 
5492
         }
 
5493
 
5468
5494
         image->bo = mem->bo;
5469
5495
         image->offset = pBindInfos[i].memoryOffset;
5470
5496
      } else {