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()
|
void BaseTextureCacheData::CheckCustomTexture()
|
||||||
{
|
{
|
||||||
if (custom_load_in_progress == 0 && custom_image_data != NULL)
|
if (IsCustomTextureAvailable())
|
||||||
{
|
{
|
||||||
tex_type = TextureType::_8888;
|
tex_type = TextureType::_8888;
|
||||||
UploadToGPU(custom_width, custom_height, custom_image_data, false);
|
UploadToGPU(custom_width, custom_height, custom_image_data, false);
|
||||||
|
@ -968,7 +968,7 @@ u8* loadPNGData(const string& fname, int &width, int &height)
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
EMUERROR("Error opening %s\n", filename);
|
EMUERROR("Error opening %s", filename);
|
||||||
return NULL;
|
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");
|
FILE *fp = fopen("screenshot.png", "wb");
|
||||||
if (fp == NULL)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -707,6 +707,11 @@ struct BaseTextureCacheData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsCustomTextureAvailable()
|
||||||
|
{
|
||||||
|
return custom_load_in_progress == 0 && custom_image_data != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void Create();
|
void Create();
|
||||||
void ComputeHash();
|
void ComputeHash();
|
||||||
void Update();
|
void Update();
|
||||||
|
|
|
@ -416,7 +416,12 @@ u64 gl_GetTexture(TSP tsp, TCW tcw)
|
||||||
tf->Update();
|
tf->Update();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (tf->IsCustomTextureAvailable())
|
||||||
|
{
|
||||||
|
glcache.DeleteTextures(1, &tf->texID);
|
||||||
|
tf->texID = glcache.GenTexture();
|
||||||
tf->CheckCustomTexture();
|
tf->CheckCustomTexture();
|
||||||
|
}
|
||||||
TexCacheHits++;
|
TexCacheHits++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,13 +256,16 @@ public:
|
||||||
if (tf->NeedsUpdate())
|
if (tf->NeedsUpdate())
|
||||||
{
|
{
|
||||||
textureCache.DestroyLater(tf);
|
textureCache.DestroyLater(tf);
|
||||||
|
|
||||||
tf->SetCommandBuffer(texCommandPool.Allocate());
|
tf->SetCommandBuffer(texCommandPool.Allocate());
|
||||||
tf->Update();
|
tf->Update();
|
||||||
tf->SetCommandBuffer(nullptr);
|
|
||||||
}
|
}
|
||||||
else
|
else if (tf->IsCustomTextureAvailable())
|
||||||
|
{
|
||||||
|
textureCache.DestroyLater(tf);
|
||||||
|
tf->SetCommandBuffer(texCommandPool.Allocate());
|
||||||
tf->CheckCustomTexture();
|
tf->CheckCustomTexture();
|
||||||
|
}
|
||||||
|
tf->SetCommandBuffer(nullptr);
|
||||||
|
|
||||||
return tf->GetIntId();
|
return tf->GetIntId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,13 +244,16 @@ public:
|
||||||
if (tf->NeedsUpdate())
|
if (tf->NeedsUpdate())
|
||||||
{
|
{
|
||||||
textureCache.DestroyLater(tf);
|
textureCache.DestroyLater(tf);
|
||||||
|
|
||||||
tf->SetCommandBuffer(texCommandPool.Allocate());
|
tf->SetCommandBuffer(texCommandPool.Allocate());
|
||||||
tf->Update();
|
tf->Update();
|
||||||
tf->SetCommandBuffer(nullptr);
|
|
||||||
}
|
}
|
||||||
else
|
else if (tf->IsCustomTextureAvailable())
|
||||||
|
{
|
||||||
|
textureCache.DestroyLater(tf);
|
||||||
|
tf->SetCommandBuffer(texCommandPool.Allocate());
|
||||||
tf->CheckCustomTexture();
|
tf->CheckCustomTexture();
|
||||||
|
}
|
||||||
|
tf->SetCommandBuffer(nullptr);
|
||||||
|
|
||||||
return tf->GetIntId();
|
return tf->GetIntId();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue