custom tex: recreate gl/vk texture when loading custom tex. vk crash
This commit is contained in:
parent
1cf4c36ede
commit
e2b3ef147d
|
@ -765,7 +765,7 @@ void BaseTextureCacheData::Update()
|
|||
|
||||
void BaseTextureCacheData::CheckCustomTexture()
|
||||
{
|
||||
if (custom_load_in_progress == 0 && custom_image_data != NULL)
|
||||
if (IsCustomTextureAvailable())
|
||||
{
|
||||
tex_type = TextureType::_8888;
|
||||
UploadToGPU(custom_width, custom_height, custom_image_data, false);
|
||||
|
@ -968,7 +968,7 @@ u8* loadPNGData(const string& fname, int &width, int &height)
|
|||
|
||||
if (!file)
|
||||
{
|
||||
EMUERROR("Error opening %s\n", filename);
|
||||
EMUERROR("Error opening %s", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ void dump_screenshot(u8 *buffer, u32 width, u32 height, bool alpha, u32 rowPitch
|
|||
FILE *fp = fopen("screenshot.png", "wb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
ERROR_LOG(RENDERER, "Failed to open screenshot.png for writing\n");
|
||||
ERROR_LOG(RENDERER, "Failed to open screenshot.png for writing");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -707,6 +707,11 @@ struct BaseTextureCacheData
|
|||
}
|
||||
}
|
||||
|
||||
bool IsCustomTextureAvailable()
|
||||
{
|
||||
return custom_load_in_progress == 0 && custom_image_data != NULL;
|
||||
}
|
||||
|
||||
void Create();
|
||||
void ComputeHash();
|
||||
void Update();
|
||||
|
|
|
@ -416,7 +416,12 @@ u64 gl_GetTexture(TSP tsp, TCW tcw)
|
|||
tf->Update();
|
||||
else
|
||||
{
|
||||
tf->CheckCustomTexture();
|
||||
if (tf->IsCustomTextureAvailable())
|
||||
{
|
||||
glcache.DeleteTextures(1, &tf->texID);
|
||||
tf->texID = glcache.GenTexture();
|
||||
tf->CheckCustomTexture();
|
||||
}
|
||||
TexCacheHits++;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,13 +256,16 @@ public:
|
|||
if (tf->NeedsUpdate())
|
||||
{
|
||||
textureCache.DestroyLater(tf);
|
||||
|
||||
tf->SetCommandBuffer(texCommandPool.Allocate());
|
||||
tf->Update();
|
||||
tf->SetCommandBuffer(nullptr);
|
||||
}
|
||||
else
|
||||
else if (tf->IsCustomTextureAvailable())
|
||||
{
|
||||
textureCache.DestroyLater(tf);
|
||||
tf->SetCommandBuffer(texCommandPool.Allocate());
|
||||
tf->CheckCustomTexture();
|
||||
}
|
||||
tf->SetCommandBuffer(nullptr);
|
||||
|
||||
return tf->GetIntId();
|
||||
}
|
||||
|
|
|
@ -244,13 +244,16 @@ public:
|
|||
if (tf->NeedsUpdate())
|
||||
{
|
||||
textureCache.DestroyLater(tf);
|
||||
|
||||
tf->SetCommandBuffer(texCommandPool.Allocate());
|
||||
tf->Update();
|
||||
tf->SetCommandBuffer(nullptr);
|
||||
}
|
||||
else
|
||||
else if (tf->IsCustomTextureAvailable())
|
||||
{
|
||||
textureCache.DestroyLater(tf);
|
||||
tf->SetCommandBuffer(texCommandPool.Allocate());
|
||||
tf->CheckCustomTexture();
|
||||
}
|
||||
tf->SetCommandBuffer(nullptr);
|
||||
|
||||
return tf->GetIntId();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue