ggpo: don't protect rtt texture vram if ggpo is enabled
tentative fix for flashing water reflection texture in vf4 during netplay
This commit is contained in:
parent
971d47eb42
commit
ddcd3861d3
|
@ -214,23 +214,23 @@ void vramlock_list_add(vram_block* block)
|
||||||
|
|
||||||
std::mutex vramlist_lock;
|
std::mutex vramlist_lock;
|
||||||
|
|
||||||
void libCore_vramlock_Lock(u32 start_offset64, u32 end_offset64, BaseTextureCacheData *texture)
|
static void vramlock_Lock(u32 start, u32 end, BaseTextureCacheData *texture)
|
||||||
{
|
{
|
||||||
if (end_offset64 > VRAM_SIZE - 1)
|
if (end >= VRAM_SIZE)
|
||||||
{
|
{
|
||||||
WARN_LOG(PVR, "vramlock_Lock_64: end_offset64>(VRAM_SIZE-1) \n Tried to lock area out of vram , possibly bug on the pvr plugin");
|
WARN_LOG(PVR, "vramlock_Lock: end >= VRAM_SIZE. Tried to lock area out of vram");
|
||||||
end_offset64 = VRAM_SIZE - 1;
|
end = VRAM_SIZE - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start_offset64 > end_offset64)
|
if (start > end)
|
||||||
{
|
{
|
||||||
WARN_LOG(PVR, "vramlock_Lock_64: start_offset64>end_offset64 \n Tried to lock negative block , possibly bug on the pvr plugin");
|
WARN_LOG(PVR, "vramlock_Lock: start > end. Tried to lock negative block");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vram_block *block = new vram_block();
|
vram_block *block = new vram_block();
|
||||||
block->end = end_offset64;
|
block->end = end;
|
||||||
block->start = start_offset64;
|
block->start = start;
|
||||||
block->texture = texture;
|
block->texture = texture;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -445,19 +445,28 @@ bool BaseTextureCacheData::NeedsUpdate() {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseTextureCacheData::protectVRam()
|
||||||
|
{
|
||||||
|
vramlock_Lock(sa_tex, sa + size - 1, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseTextureCacheData::unprotectVRam()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(vramlist_lock);
|
||||||
|
if (lock_block)
|
||||||
|
libCore_vramlock_Unlock_block_wb(lock_block);
|
||||||
|
lock_block = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool BaseTextureCacheData::Delete()
|
bool BaseTextureCacheData::Delete()
|
||||||
{
|
{
|
||||||
if (custom_load_in_progress > 0)
|
if (custom_load_in_progress > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
{
|
unprotectVRam();
|
||||||
std::lock_guard<std::mutex> lock(vramlist_lock);
|
|
||||||
if (lock_block)
|
|
||||||
libCore_vramlock_Unlock_block_wb(lock_block);
|
|
||||||
lock_block = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(custom_image_data);
|
free(custom_image_data);
|
||||||
|
custom_image_data = nullptr;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -777,7 +786,7 @@ void BaseTextureCacheData::Update()
|
||||||
height = original_h;
|
height = original_h;
|
||||||
|
|
||||||
//lock the texture to detect changes in it
|
//lock the texture to detect changes in it
|
||||||
libCore_vramlock_Lock(sa_tex, sa + size - 1, this);
|
protectVRam();
|
||||||
|
|
||||||
UploadToGPU(upscaled_w, upscaled_h, (u8*)temp_tex_buffer, IsMipmapped(), mipmapped);
|
UploadToGPU(upscaled_w, upscaled_h, (u8*)temp_tex_buffer, IsMipmapped(), mipmapped);
|
||||||
if (config::DumpTextures)
|
if (config::DumpTextures)
|
||||||
|
|
|
@ -564,7 +564,6 @@ struct vram_block
|
||||||
|
|
||||||
bool VramLockedWriteOffset(size_t offset);
|
bool VramLockedWriteOffset(size_t offset);
|
||||||
bool VramLockedWrite(u8* address);
|
bool VramLockedWrite(u8* address);
|
||||||
void libCore_vramlock_Lock(u32 start_offset, u32 end_offset, BaseTextureCacheData *texture);
|
|
||||||
|
|
||||||
void UpscalexBRZ(int factor, u32* source, u32* dest, int width, int height, bool has_alpha);
|
void UpscalexBRZ(int factor, u32* source, u32* dest, int width, int height, bool has_alpha);
|
||||||
|
|
||||||
|
@ -648,6 +647,9 @@ public:
|
||||||
bool NeedsUpdate();
|
bool NeedsUpdate();
|
||||||
virtual bool Delete();
|
virtual bool Delete();
|
||||||
virtual ~BaseTextureCacheData() = default;
|
virtual ~BaseTextureCacheData() = default;
|
||||||
|
void protectVRam();
|
||||||
|
void unprotectVRam();
|
||||||
|
|
||||||
static bool IsGpuHandledPaletted(TSP tsp, TCW tcw)
|
static bool IsGpuHandledPaletted(TSP tsp, TCW tcw)
|
||||||
{
|
{
|
||||||
// Some palette textures are handled on the GPU
|
// Some palette textures are handled on the GPU
|
||||||
|
|
|
@ -1338,7 +1338,10 @@ void DX11Renderer::readRttRenderTarget(u32 texAddress)
|
||||||
device->CreateShaderResourceView(texture->texture, &viewDesc, &texture->textureView.get());
|
device->CreateShaderResourceView(texture->texture, &viewDesc, &texture->textureView.get());
|
||||||
|
|
||||||
texture->dirty = 0;
|
texture->dirty = 0;
|
||||||
libCore_vramlock_Lock(texture->sa_tex, texture->sa + texture->size - 1, texture);
|
if (!config::GGPOEnable)
|
||||||
|
texture->protectVRam();
|
||||||
|
else
|
||||||
|
texture->unprotectVRam();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -968,7 +968,10 @@ void D3DRenderer::readRttRenderTarget(u32 texAddress)
|
||||||
|
|
||||||
texture->texture = rttTexture;
|
texture->texture = rttTexture;
|
||||||
texture->dirty = 0;
|
texture->dirty = 0;
|
||||||
libCore_vramlock_Lock(texture->sa_tex, texture->sa + texture->size - 1, texture);
|
if (!config::GGPOEnable)
|
||||||
|
texture->protectVRam();
|
||||||
|
else
|
||||||
|
texture->unprotectVRam();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,10 @@ void ReadRTTBuffer()
|
||||||
texture_data->texID = gl.rtt.tex;
|
texture_data->texID = gl.rtt.tex;
|
||||||
gl.rtt.tex = 0;
|
gl.rtt.tex = 0;
|
||||||
texture_data->dirty = 0;
|
texture_data->dirty = 0;
|
||||||
libCore_vramlock_Lock(texture_data->sa_tex, texture_data->sa + texture_data->size - 1, texture_data);
|
if (!config::GGPOEnable)
|
||||||
|
texture_data->protectVRam();
|
||||||
|
else
|
||||||
|
texture_data->unprotectVRam();
|
||||||
}
|
}
|
||||||
gl.rtt.texAddress = ~0;
|
gl.rtt.texAddress = ~0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -558,7 +558,10 @@ void TextureDrawer::EndRenderPass()
|
||||||
//memset(&vram[fb_rtt.TexAddr << 3], '\0', size);
|
//memset(&vram[fb_rtt.TexAddr << 3], '\0', size);
|
||||||
|
|
||||||
texture->dirty = 0;
|
texture->dirty = 0;
|
||||||
libCore_vramlock_Lock(texture->sa_tex, texture->sa + texture->size - 1, texture);
|
if (!config::GGPOEnable)
|
||||||
|
texture->protectVRam();
|
||||||
|
else
|
||||||
|
texture->unprotectVRam();
|
||||||
}
|
}
|
||||||
Drawer::EndRenderPass();
|
Drawer::EndRenderPass();
|
||||||
}
|
}
|
||||||
|
|
|
@ -678,7 +678,10 @@ void OITTextureDrawer::EndFrame()
|
||||||
//memset(&vram[fb_rtt.TexAddr << 3], '\0', size);
|
//memset(&vram[fb_rtt.TexAddr << 3], '\0', size);
|
||||||
|
|
||||||
texture->dirty = 0;
|
texture->dirty = 0;
|
||||||
libCore_vramlock_Lock(texture->sa_tex, texture->sa + texture->size - 1, texture);
|
if (!config::GGPOEnable)
|
||||||
|
texture->protectVRam();
|
||||||
|
else
|
||||||
|
texture->unprotectVRam();
|
||||||
}
|
}
|
||||||
OITDrawer::EndFrame();
|
OITDrawer::EndFrame();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue