1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 13:24:10 +01:00

[dxvk] Improved debug output when resource creation fails

This commit is contained in:
Philip Rebohle 2018-04-13 17:03:35 +02:00
parent ded6dec7eb
commit 15fca0b0b1
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 55 additions and 11 deletions

View File

@ -20,16 +20,20 @@ namespace dxvk {
info.pQueueFamilyIndices = nullptr;
if (m_vkd->vkCreateBuffer(m_vkd->device(),
&info, nullptr, &m_handle) != VK_SUCCESS)
throw DxvkError("DxvkPhysicalBuffer: Failed to create buffer");
&info, nullptr, &m_handle) != VK_SUCCESS) {
throw DxvkError(str::format(
"DxvkPhysicalBuffer: Failed to create buffer:"
"\n size: ", info.size,
"\n usage: ", info.usage));
}
VkMemoryRequirements memReq;
m_vkd->vkGetBufferMemoryRequirements(
m_vkd->device(), m_handle, &memReq);
m_memory = memAlloc.alloc(memReq, memFlags);
if (m_vkd->vkBindBufferMemory(m_vkd->device(),
m_handle, m_memory.memory(), m_memory.offset()) != VK_SUCCESS)
if (m_vkd->vkBindBufferMemory(m_vkd->device(), m_handle,
m_memory.memory(), m_memory.offset()) != VK_SUCCESS)
throw DxvkError("DxvkPhysicalBuffer: Failed to bind device memory");
}
@ -54,8 +58,14 @@ namespace dxvk {
viewInfo.offset = m_slice.offset();
viewInfo.range = m_slice.length();
if (m_vkd->vkCreateBufferView(m_vkd->device(), &viewInfo, nullptr, &m_view) != VK_SUCCESS)
throw DxvkError("DxvkBufferView::DxvkBufferView: Failed to create buffer view");
if (m_vkd->vkCreateBufferView(m_vkd->device(),
&viewInfo, nullptr, &m_view) != VK_SUCCESS) {
throw DxvkError(str::format(
"DxvkPhysicalBufferView: Failed to create buffer view:",
"\n Offset: ", viewInfo.offset,
"\n Range: ", viewInfo.range,
"\n Format: ", viewInfo.format));
}
}

View File

@ -102,7 +102,7 @@ namespace dxvk {
info.layers = m_framebufferSize.layers;
if (m_vkd->vkCreateFramebuffer(m_vkd->device(), &info, nullptr, &m_framebuffer) != VK_SUCCESS)
throw DxvkError("DxvkFramebuffer::DxvkFramebuffer: Failed to create framebuffer object");
throw DxvkError("DxvkFramebuffer: Failed to create framebuffer object");
}

View File

@ -27,8 +27,20 @@ namespace dxvk {
info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
if (m_vkd->vkCreateImage(m_vkd->device(),
&info, nullptr, &m_image) != VK_SUCCESS)
throw DxvkError("DxvkImage::DxvkImage: Failed to create image");
&info, nullptr, &m_image) != VK_SUCCESS) {
throw DxvkError(str::format(
"DxvkImage: Failed to create image:",
"\n Type: ", info.imageType,
"\n Format: ", info.format,
"\n Extent: ", "(", info.extent.width,
",", info.extent.width,
",", info.extent.width, ")",
"\n Mip levels: ", info.mipLevels,
"\n Array layers: ", info.arrayLayers,
"\n Samples: ", info.samples,
"\n Usage: ", info.usage,
"\n Tiling: ", info.tiling));
}
// Get memory requirements for the image. We may enforce strict
// alignment on non-linear images in order not to violate the
@ -92,8 +104,30 @@ namespace dxvk {
viewInfo.components = info.swizzle;
viewInfo.subresourceRange = subresourceRange;
if (m_vkd->vkCreateImageView(m_vkd->device(), &viewInfo, nullptr, &m_view) != VK_SUCCESS)
throw DxvkError("DxvkImageView::DxvkImageView: Failed to create image view");
if (m_vkd->vkCreateImageView(m_vkd->device(),
&viewInfo, nullptr, &m_view) != VK_SUCCESS) {
throw DxvkError(str::format(
"DxvkImageView: Failed to create image view:"
"\n View type: ", viewInfo.viewType,
"\n View format: ", viewInfo.format,
"\n Subresources: ",
"\n Aspect mask: ", std::hex, viewInfo.subresourceRange.aspectMask,
"\n Mip levels: ", viewInfo.subresourceRange.baseMipLevel, " - ",
viewInfo.subresourceRange.levelCount,
"\n Array layers: ", viewInfo.subresourceRange.baseArrayLayer, " - ",
viewInfo.subresourceRange.layerCount,
"\n Image properties:",
"\n Type: ", image->info().type,
"\n Format: ", image->info().format,
"\n Extent: ", "(", image->info().extent.width,
",", image->info().extent.height,
",", image->info().extent.depth, ")",
"\n Mip levels: ", image->info().mipLevels,
"\n Array layers: ", image->info().numLayers,
"\n Samples: ", image->info().sampleCount,
"\n Usage: ", std::hex, image->info().usage,
"\n Tiling: ", image->info().tiling));
}
}