mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Set debug names for more framebuffers and textures
This commit is contained in:
parent
2f5de1987e
commit
fbf6008a03
@ -71,6 +71,9 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply the tag
|
||||
vulkan_->SetDebugName(image_, tag_.c_str());
|
||||
|
||||
VkMemoryRequirements mem_reqs{};
|
||||
bool dedicatedAllocation = false;
|
||||
vulkan_->GetImageMemoryRequirements(image_, &mem_reqs, &dedicatedAllocation);
|
||||
@ -161,6 +164,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Batch these.
|
||||
void VulkanTexture::UploadMip(VkCommandBuffer cmd, int mip, int mipWidth, int mipHeight, VkBuffer buffer, uint32_t offset, size_t rowLength) {
|
||||
VkBufferImageCopy copy_region{};
|
||||
copy_region.bufferOffset = offset;
|
||||
|
@ -1060,7 +1060,9 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w,
|
||||
}
|
||||
|
||||
shaderManager_->DirtyLastShader();
|
||||
vfb->fbo = draw_->CreateFramebuffer({ vfb->renderWidth, vfb->renderHeight, 1, 1, true, (Draw::FBColorDepth)vfb->colorDepth });
|
||||
char name[256];
|
||||
snprintf(name, sizeof(name), "%08x_%08x", vfb->fb_address, vfb->z_address);
|
||||
vfb->fbo = draw_->CreateFramebuffer({ vfb->renderWidth, vfb->renderHeight, 1, 1, true, (Draw::FBColorDepth)vfb->colorDepth, name });
|
||||
if (old.fbo) {
|
||||
INFO_LOG(FRAMEBUF, "Resizing FBO for %08x : %d x %d x %d", vfb->fb_address, w, h, vfb->format);
|
||||
if (vfb->fbo) {
|
||||
@ -1329,7 +1331,9 @@ VirtualFramebuffer *FramebufferManagerCommon::CreateRAMFramebuffer(uint32_t fbAd
|
||||
vfb->usageFlags = FB_USAGE_RENDERTARGET;
|
||||
SetColorUpdated(vfb, 0);
|
||||
textureCache_->NotifyFramebuffer(vfb->fb_address, vfb, NOTIFY_FB_CREATED);
|
||||
vfb->fbo = draw_->CreateFramebuffer({ vfb->renderWidth, vfb->renderHeight, 1, 1, true, (Draw::FBColorDepth)vfb->colorDepth });
|
||||
char name[64];
|
||||
snprintf(name, sizeof(name), "%08x_color_RAM", vfb->fb_address);
|
||||
vfb->fbo = draw_->CreateFramebuffer({ vfb->renderWidth, vfb->renderHeight, 1, 1, true, (Draw::FBColorDepth)vfb->colorDepth, name });
|
||||
vfbs_.push_back(vfb);
|
||||
|
||||
u32 byteSize = ColorBufferByteSize(vfb);
|
||||
@ -1417,7 +1421,9 @@ bool FramebufferManagerCommon::CreateDownloadTempBuffer(VirtualFramebuffer *nvfb
|
||||
}
|
||||
}
|
||||
|
||||
nvfb->fbo = draw_->CreateFramebuffer({ nvfb->bufferWidth, nvfb->bufferHeight, 1, 1, false, (Draw::FBColorDepth)nvfb->colorDepth });
|
||||
char name[64];
|
||||
snprintf(name, sizeof(name), "download_temp");
|
||||
nvfb->fbo = draw_->CreateFramebuffer({ nvfb->bufferWidth, nvfb->bufferHeight, 1, 1, false, (Draw::FBColorDepth)nvfb->colorDepth, name });
|
||||
if (!nvfb->fbo) {
|
||||
ERROR_LOG(FRAMEBUF, "Error creating GL FBO! %i x %i", nvfb->renderWidth, nvfb->renderHeight);
|
||||
return false;
|
||||
@ -1744,7 +1750,8 @@ Draw::Framebuffer *FramebufferManagerCommon::GetTempFBO(TempFBO reason, u16 w, u
|
||||
|
||||
textureCache_->ForgetLastTexture();
|
||||
bool z_stencil = reason == TempFBO::STENCIL;
|
||||
Draw::Framebuffer *fbo = draw_->CreateFramebuffer({ w, h, 1, 1, z_stencil, depth });
|
||||
const char *name = "temp_fbo";
|
||||
Draw::Framebuffer *fbo = draw_->CreateFramebuffer({ w, h, 1, 1, z_stencil, depth, name });
|
||||
if (!fbo)
|
||||
return fbo;
|
||||
|
||||
|
@ -317,7 +317,7 @@ bool PresentationCommon::AllocateFramebuffer(int w, int h) {
|
||||
}
|
||||
|
||||
// No depth/stencil for post processing
|
||||
Draw::Framebuffer *fbo = draw_->CreateFramebuffer({ w, h, 1, 1, false, Draw::FBO_8888 });
|
||||
Draw::Framebuffer *fbo = draw_->CreateFramebuffer({ w, h, 1, 1, false, Draw::FBO_8888, "presentation" });
|
||||
if (!fbo) {
|
||||
return false;
|
||||
}
|
||||
|
@ -859,7 +859,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||
}
|
||||
|
||||
char texName[128]{};
|
||||
snprintf(texName, sizeof(texName), "Texture%08x", entry->addr);
|
||||
snprintf(texName, sizeof(texName), "texture_%08x_%s", entry->addr, GeTextureFormatToString((GETextureFormat)entry->format));
|
||||
image->SetTag(texName);
|
||||
|
||||
bool allocSuccess = image->CreateDirect(cmdInit, allocator_, w * scaleFactor, h * scaleFactor, maxLevel + 1, actualFmt, imageLayout, usage, mapping);
|
||||
|
@ -789,7 +789,7 @@ void GameInfoCache::SetupTexture(std::shared_ptr<GameInfo> &info, Draw::DrawCont
|
||||
using namespace Draw;
|
||||
if (tex.data.size()) {
|
||||
if (!tex.texture) {
|
||||
tex.texture = CreateTextureFromFileData(thin3d, (const uint8_t *)tex.data.data(), (int)tex.data.size(), ImageFileType::DETECT);
|
||||
tex.texture = CreateTextureFromFileData(thin3d, (const uint8_t *)tex.data.data(), (int)tex.data.size(), ImageFileType::DETECT, false, info->GetTitle().c_str());
|
||||
if (tex.texture) {
|
||||
tex.timeLoaded = time_now_d();
|
||||
} else {
|
||||
|
@ -139,7 +139,7 @@ void HttpImageFileView::Draw(UIContext &dc) {
|
||||
}
|
||||
|
||||
if (!textureData_.empty()) {
|
||||
texture_ = CreateTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT);
|
||||
texture_ = CreateTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT, false, "store_icon");
|
||||
if (!texture_)
|
||||
textureFailed_ = true;
|
||||
textureData_.clear();
|
||||
|
@ -202,11 +202,11 @@ Draw::Texture *ManagedTexture::GetTexture() {
|
||||
}
|
||||
|
||||
// TODO: Remove the code duplication between this and LoadFromFileData
|
||||
std::unique_ptr<ManagedTexture> CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType type, bool generateMips) {
|
||||
std::unique_ptr<ManagedTexture> CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType type, bool generateMips, const char *name) {
|
||||
if (!draw)
|
||||
return std::unique_ptr<ManagedTexture>();
|
||||
ManagedTexture *mtex = new ManagedTexture(draw);
|
||||
if (mtex->LoadFromFileData(data, size, type, generateMips, nullptr)) {
|
||||
if (mtex->LoadFromFileData(data, size, type, generateMips, name)) {
|
||||
return std::unique_ptr<ManagedTexture>(mtex);
|
||||
} else {
|
||||
// Best to return a null pointer if we fail!
|
||||
|
@ -39,8 +39,8 @@ private:
|
||||
bool loadPending_ = false;
|
||||
};
|
||||
|
||||
std::unique_ptr<ManagedTexture> CreateTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType fileType, bool generateMips = false);
|
||||
std::unique_ptr<ManagedTexture> CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType fileType, bool generateMips = false);
|
||||
std::unique_ptr<ManagedTexture> CreateTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType fileType, bool generateMips);
|
||||
std::unique_ptr<ManagedTexture> CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType fileType, bool generateMips, const char *name);
|
||||
|
||||
class GameIconView : public UI::InertView {
|
||||
public:
|
||||
|
@ -718,6 +718,8 @@ bool VulkanRenderManager::InitDepthStencilBuffer(VkCommandBuffer cmd) {
|
||||
if (res != VK_SUCCESS)
|
||||
return false;
|
||||
|
||||
vulkan_->SetDebugName(depth_.image, "BackbufferDepth");
|
||||
|
||||
bool dedicatedAllocation = false;
|
||||
VkMemoryRequirements mem_reqs;
|
||||
vulkan_->GetImageMemoryRequirements(depth_.image, &mem_reqs, &dedicatedAllocation);
|
||||
|
@ -538,7 +538,7 @@ struct TextureDesc {
|
||||
int mipLevels;
|
||||
bool generateMips;
|
||||
// Optional, for tracking memory usage and graphcis debuggers.
|
||||
std::string tag;
|
||||
const char *tag;
|
||||
// Does not take ownership over pointed-to data.
|
||||
std::vector<const uint8_t *> initData;
|
||||
TextureCallback initDataCallback;
|
||||
|
@ -714,7 +714,9 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanPushBuffer *push, const Textur
|
||||
height_ = desc.height;
|
||||
depth_ = desc.depth;
|
||||
vkTex_ = new VulkanTexture(vulkan_);
|
||||
vkTex_->SetTag(desc.tag);
|
||||
if (desc.tag) {
|
||||
vkTex_->SetTag(desc.tag);
|
||||
}
|
||||
VkFormat vulkanFormat = DataFormatToVulkan(format_);
|
||||
int bpp = GetBpp(vulkanFormat);
|
||||
int bytesPerPixel = bpp / 8;
|
||||
|
Loading…
Reference in New Issue
Block a user