Vulkan: Add tags to UI textures too.
This commit is contained in:
parent
5f27a2e60a
commit
99d16b2202
8 changed files with 13 additions and 1 deletions
|
@ -165,6 +165,7 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
|
||||||
desc.format = Draw::DataFormat::R8G8B8A8_UNORM;
|
desc.format = Draw::DataFormat::R8G8B8A8_UNORM;
|
||||||
desc.depth = 1;
|
desc.depth = 1;
|
||||||
desc.mipLevels = 1;
|
desc.mipLevels = 1;
|
||||||
|
desc.tag = "SoftGPU";
|
||||||
bool hasImage = true;
|
bool hasImage = true;
|
||||||
if (!Memory::IsValidAddress(displayFramebuf_) || srcwidth == 0 || srcheight == 0) {
|
if (!Memory::IsValidAddress(displayFramebuf_) || srcwidth == 0 || srcheight == 0) {
|
||||||
hasImage = false;
|
hasImage = false;
|
||||||
|
|
|
@ -74,6 +74,7 @@ void DrawAllocatorVis(UIContext *ui, GPUInterface *gpu) {
|
||||||
desc.format = Draw::DataFormat::R8G8B8A8_UNORM;
|
desc.format = Draw::DataFormat::R8G8B8A8_UNORM;
|
||||||
desc.mipLevels = 1;
|
desc.mipLevels = 1;
|
||||||
desc.type = Draw::TextureType::LINEAR2D;
|
desc.type = Draw::TextureType::LINEAR2D;
|
||||||
|
desc.tag = "DebugVis";
|
||||||
desc.initData.push_back(initData.data());
|
desc.initData.push_back(initData.data());
|
||||||
|
|
||||||
Draw::DrawContext *draw = ui->GetDrawContext();
|
Draw::DrawContext *draw = ui->GetDrawContext();
|
||||||
|
|
|
@ -125,6 +125,7 @@ bool ManagedTexture::LoadFromFileData(const uint8_t *data, size_t dataSize, Imag
|
||||||
desc.depth = 1;
|
desc.depth = 1;
|
||||||
desc.mipLevels = generateMips ? potentialLevels : num_levels;
|
desc.mipLevels = generateMips ? potentialLevels : num_levels;
|
||||||
desc.generateMips = generateMips && potentialLevels > num_levels;
|
desc.generateMips = generateMips && potentialLevels > num_levels;
|
||||||
|
desc.tag = "LoadedFileData";
|
||||||
for (int i = 0; i < num_levels; i++) {
|
for (int i = 0; i < num_levels; i++) {
|
||||||
desc.initData.push_back(image[i]);
|
desc.initData.push_back(image[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,6 +206,7 @@ void TextDrawerAndroid::DrawString(DrawBuffer &target, const char *str, float x,
|
||||||
desc.height = entry->bmHeight;
|
desc.height = entry->bmHeight;
|
||||||
desc.depth = 1;
|
desc.depth = 1;
|
||||||
desc.mipLevels = 1;
|
desc.mipLevels = 1;
|
||||||
|
desc.tag = "TextDrawer";
|
||||||
|
|
||||||
uint16_t *bitmapData = new uint16_t[entry->bmWidth * entry->bmHeight];
|
uint16_t *bitmapData = new uint16_t[entry->bmWidth * entry->bmHeight];
|
||||||
jint* jimage = env_->GetIntArrayElements(imageData, nullptr);
|
jint* jimage = env_->GetIntArrayElements(imageData, nullptr);
|
||||||
|
|
|
@ -114,6 +114,7 @@ void TextDrawerQt::DrawString(DrawBuffer &target, const char *str, float x, floa
|
||||||
desc.height = entry->bmHeight;
|
desc.height = entry->bmHeight;
|
||||||
desc.depth = 1;
|
desc.depth = 1;
|
||||||
desc.mipLevels = 1;
|
desc.mipLevels = 1;
|
||||||
|
desc.tag = "TextDrawer";
|
||||||
|
|
||||||
uint16_t *bitmapData = new uint16_t[entry->bmWidth * entry->bmHeight];
|
uint16_t *bitmapData = new uint16_t[entry->bmWidth * entry->bmHeight];
|
||||||
for (int x = 0; x < entry->bmWidth; x++) {
|
for (int x = 0; x < entry->bmWidth; x++) {
|
||||||
|
|
|
@ -301,6 +301,7 @@ void TextDrawerWin32::DrawString(DrawBuffer &target, const char *str, float x, f
|
||||||
desc.height = entry->bmHeight;
|
desc.height = entry->bmHeight;
|
||||||
desc.depth = 1;
|
desc.depth = 1;
|
||||||
desc.mipLevels = 1;
|
desc.mipLevels = 1;
|
||||||
|
desc.tag = "TextDrawer";
|
||||||
entry->texture = draw_->CreateTexture(desc);
|
entry->texture = draw_->CreateTexture(desc);
|
||||||
if (bitmapData16)
|
if (bitmapData16)
|
||||||
delete[] bitmapData16;
|
delete[] bitmapData16;
|
||||||
|
|
|
@ -500,6 +500,8 @@ struct TextureDesc {
|
||||||
int depth;
|
int depth;
|
||||||
int mipLevels;
|
int mipLevels;
|
||||||
bool generateMips;
|
bool generateMips;
|
||||||
|
// Optional, for tracking memory usage.
|
||||||
|
std::string tag;
|
||||||
// Does not take ownership over pointed-to data.
|
// Does not take ownership over pointed-to data.
|
||||||
std::vector<uint8_t *> initData;
|
std::vector<uint8_t *> initData;
|
||||||
};
|
};
|
||||||
|
|
|
@ -311,7 +311,10 @@ public:
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageView GetImageView() { return vkTex_->GetImageView(); }
|
VkImageView GetImageView() {
|
||||||
|
vkTex_->Touch();
|
||||||
|
return vkTex_->GetImageView();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool Create(VkCommandBuffer cmd, VulkanPushBuffer *pushBuffer, const TextureDesc &desc, VulkanDeviceAllocator *alloc);
|
bool Create(VkCommandBuffer cmd, VulkanPushBuffer *pushBuffer, const TextureDesc &desc, VulkanDeviceAllocator *alloc);
|
||||||
|
@ -658,6 +661,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanPushBuffer *push, const Textur
|
||||||
height_ = desc.height;
|
height_ = desc.height;
|
||||||
depth_ = desc.depth;
|
depth_ = desc.depth;
|
||||||
vkTex_ = new VulkanTexture(vulkan_, alloc);
|
vkTex_ = new VulkanTexture(vulkan_, alloc);
|
||||||
|
vkTex_->SetTag(desc.tag);
|
||||||
VkFormat vulkanFormat = DataFormatToVulkan(format_);
|
VkFormat vulkanFormat = DataFormatToVulkan(format_);
|
||||||
int stride = desc.width * (int)DataFormatSizeInBytes(format_);
|
int stride = desc.width * (int)DataFormatSizeInBytes(format_);
|
||||||
int bpp = GetBpp(vulkanFormat);
|
int bpp = GetBpp(vulkanFormat);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue