mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 04:54:15 +01:00
add super spammy memory debug logging
This commit is contained in:
parent
95e12decf1
commit
613de7a856
@ -598,6 +598,11 @@ namespace dxvk {
|
|||||||
const DxvkAllocationInfo& allocationInfo) {
|
const DxvkAllocationInfo& allocationInfo) {
|
||||||
std::lock_guard<dxvk::mutex> lock(m_mutex);
|
std::lock_guard<dxvk::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
Logger::err(str::format("Allocating ", requirements.size, " bytes from types ",
|
||||||
|
std::hex, requirements.memoryTypeBits, ", properties: ",
|
||||||
|
std::hex, allocationInfo.properties, ", desired types: ",
|
||||||
|
std::hex, getMemoryTypeMask(allocationInfo.properties)));
|
||||||
|
|
||||||
// Ensure the allocation size is also aligned
|
// Ensure the allocation size is also aligned
|
||||||
VkDeviceSize size = align(requirements.size, requirements.alignment);
|
VkDeviceSize size = align(requirements.size, requirements.alignment);
|
||||||
|
|
||||||
@ -688,6 +693,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (size * minResourcesPerChunk > maxChunkSize) {
|
if (size * minResourcesPerChunk > maxChunkSize) {
|
||||||
|
Logger::err(str::format("Creating dedicated allocation on type ", typeIndex));
|
||||||
DxvkDeviceMemory memory = allocateDeviceMemory(type, requirements.size, nullptr);
|
DxvkDeviceMemory memory = allocateDeviceMemory(type, requirements.size, nullptr);
|
||||||
|
|
||||||
if (!memory.memory)
|
if (!memory.memory)
|
||||||
@ -704,12 +710,15 @@ namespace dxvk {
|
|||||||
while (desiredSize < size * minResourcesPerChunk)
|
while (desiredSize < size * minResourcesPerChunk)
|
||||||
desiredSize *= 2u;
|
desiredSize *= 2u;
|
||||||
|
|
||||||
|
Logger::err(str::format("Creating new chunk on type ", typeIndex, " (", desiredSize >> 20, " MiB)"));
|
||||||
|
|
||||||
if (allocateChunkInPool(type, selectedPool, allocationInfo.properties, size, desiredSize)) {
|
if (allocateChunkInPool(type, selectedPool, allocationInfo.properties, size, desiredSize)) {
|
||||||
address = selectedPool.alloc(size, requirements.alignment);
|
address = selectedPool.alloc(size, requirements.alignment);
|
||||||
return createAllocation(type, selectedPool, address, size, allocationInfo);
|
return createAllocation(type, selectedPool, address, size, allocationInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger::err("Memory allocation failed");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,6 +729,11 @@ namespace dxvk {
|
|||||||
const void* next) {
|
const void* next) {
|
||||||
std::lock_guard<dxvk::mutex> lock(m_mutex);
|
std::lock_guard<dxvk::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
Logger::err(str::format("Allocating ", requirements.size, " bytes from types ",
|
||||||
|
std::hex, requirements.memoryTypeBits, ", properties: ",
|
||||||
|
std::hex, allocationInfo.properties, ", desired types: ",
|
||||||
|
std::hex, getMemoryTypeMask(allocationInfo.properties)));
|
||||||
|
|
||||||
DxvkDeviceMemory memory = { };
|
DxvkDeviceMemory memory = { };
|
||||||
|
|
||||||
for (auto typeIndex : bit::BitMask(requirements.memoryTypeBits & getMemoryTypeMask(allocationInfo.properties))) {
|
for (auto typeIndex : bit::BitMask(requirements.memoryTypeBits & getMemoryTypeMask(allocationInfo.properties))) {
|
||||||
@ -732,6 +746,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger::err("Memory allocation failed");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,6 +757,11 @@ namespace dxvk {
|
|||||||
DxvkLocalAllocationCache* allocationCache) {
|
DxvkLocalAllocationCache* allocationCache) {
|
||||||
Rc<DxvkResourceAllocation> allocation;
|
Rc<DxvkResourceAllocation> allocation;
|
||||||
|
|
||||||
|
Logger::err(str::format("Creating buffer: ",
|
||||||
|
"\n size: ", createInfo.size,
|
||||||
|
"\n usage: ", std::hex, createInfo.usage,
|
||||||
|
"\n flags: ", std::hex, createInfo.flags));
|
||||||
|
|
||||||
if (likely(!createInfo.flags)) {
|
if (likely(!createInfo.flags)) {
|
||||||
VkMemoryRequirements memoryRequirements = { };
|
VkMemoryRequirements memoryRequirements = { };
|
||||||
memoryRequirements.size = createInfo.size;
|
memoryRequirements.size = createInfo.size;
|
||||||
@ -904,6 +924,14 @@ namespace dxvk {
|
|||||||
const void* next) {
|
const void* next) {
|
||||||
auto vk = m_device->vkd();
|
auto vk = m_device->vkd();
|
||||||
|
|
||||||
|
Logger::err(str::format("Creating image: ",
|
||||||
|
"\n type: ", createInfo.imageType,
|
||||||
|
"\n format: ", createInfo.format,
|
||||||
|
"\n extent: ", createInfo.extent.width, "x", createInfo.extent.height, "x", createInfo.extent.depth,
|
||||||
|
"\n layers: ", createInfo.arrayLayers,
|
||||||
|
"\n mips: ", createInfo.mipLevels,
|
||||||
|
"\n samples: ", createInfo.samples));
|
||||||
|
|
||||||
VkImage image = VK_NULL_HANDLE;
|
VkImage image = VK_NULL_HANDLE;
|
||||||
VkResult vr = vk->vkCreateImage(vk->device(), &createInfo, nullptr, &image);
|
VkResult vr = vk->vkCreateImage(vk->device(), &createInfo, nullptr, &image);
|
||||||
|
|
||||||
@ -1164,12 +1192,18 @@ namespace dxvk {
|
|||||||
DxvkDeviceMemory result = { };
|
DxvkDeviceMemory result = { };
|
||||||
result.size = size;
|
result.size = size;
|
||||||
|
|
||||||
if (vk->vkAllocateMemory(vk->device(), &memoryInfo, nullptr, &result.memory)) {
|
VkResult vr = VK_SUCCESS;
|
||||||
|
|
||||||
|
Logger::err(str::format("Allocaing device memory on type ", type.index, " (", size >> 20, " MiB)"));
|
||||||
|
|
||||||
|
if ((vr = vk->vkAllocateMemory(vk->device(), &memoryInfo, nullptr, &result.memory))) {
|
||||||
freeEmptyChunksInHeap(*type.heap, VkDeviceSize(-1), high_resolution_clock::time_point());
|
freeEmptyChunksInHeap(*type.heap, VkDeviceSize(-1), high_resolution_clock::time_point());
|
||||||
|
|
||||||
if (vk->vkAllocateMemory(vk->device(), &memoryInfo, nullptr, &result.memory))
|
if ((vr = vk->vkAllocateMemory(vk->device(), &memoryInfo, nullptr, &result.memory))) {
|
||||||
|
Logger::err(str::format("vkAllocateMemory FAILED: ", vr));
|
||||||
return DxvkDeviceMemory();
|
return DxvkDeviceMemory();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Technically redundant if EXT_memory_priority is also supported, but this shouldn't hurt
|
// Technically redundant if EXT_memory_priority is also supported, but this shouldn't hurt
|
||||||
if (m_device->features().extPageableDeviceLocalMemory.pageableDeviceLocalMemory)
|
if (m_device->features().extPageableDeviceLocalMemory.pageableDeviceLocalMemory)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user