Unprotect VRAM before switching system. Fix texture cache clean

This commit is contained in:
Flyinghead 2019-07-28 17:06:12 +02:00
parent 591ebf0ba6
commit a9dbbccf93
6 changed files with 9 additions and 22 deletions

View File

@ -98,8 +98,6 @@ bool fb_dirty;
TA_context* _pvrrc; TA_context* _pvrrc;
void SetREP(TA_context* cntx); void SetREP(TA_context* cntx);
void killtex();
bool render_output_framebuffer();
static void rend_create_renderer(); static void rend_create_renderer();
void dump_frame(const char* file, TA_context* ctx, u8* vram, u8* vram_ref = NULL) { void dump_frame(const char* file, TA_context* ctx, u8* vram, u8* vram_ref = NULL) {
@ -394,7 +392,6 @@ void rend_init_renderer()
void rend_term_renderer() void rend_term_renderer()
{ {
killtex();
gui_term(); gui_term();
renderer->Term(); renderer->Term();
delete renderer; delete renderer;

View File

@ -357,6 +357,7 @@ int reicast_init(int argc, char* argv[])
void set_platform(int platform) void set_platform(int platform)
{ {
_vmem_unprotect_vram(0, VRAM_SIZE);
switch (platform) switch (platform)
{ {
case DC_PLATFORM_DREAMCAST: case DC_PLATFORM_DREAMCAST:

View File

@ -274,17 +274,11 @@ void libCore_vramlock_Unlock_block(vram_block* block)
void libCore_vramlock_Unlock_block_wb(vram_block* block) void libCore_vramlock_Unlock_block_wb(vram_block* block)
{ {
//VRAM_SIZE/PAGE_SIZE; if (mmu_enabled())
if (block->end>VRAM_SIZE) vmem32_unprotect_vram(block->start, block->len);
WARN_LOG(PVR, "Error : block end is after vram , skipping unlock"); vramlock_list_remove(block);
else //more work needed
{ free(block);
if (mmu_enabled())
vmem32_unprotect_vram(block->start, block->len);
vramlock_list_remove(block);
//more work needed
free(block);
}
} }
// //

View File

@ -971,8 +971,6 @@ static bool RenderFrame()
eglCheck(); eglCheck();
KillTex=false;
if (is_rtt) if (is_rtt)
ReadRTTBuffer(); ReadRTTBuffer();
else if (settings.rend.ScreenScaling != 100 || gl.swap_buffer_not_preserved) else if (settings.rend.ScreenScaling != 100 || gl.swap_buffer_not_preserved)
@ -1015,8 +1013,7 @@ struct gl4rend : Renderer
glcache.DeleteTextures(1, &depthSaveTexId); glcache.DeleteTextures(1, &depthSaveTexId);
depthSaveTexId = 0; depthSaveTexId = 0;
} }
if (KillTex) killtex();
killtex();
CollectCleanup(); CollectCleanup();

View File

@ -2040,8 +2040,6 @@ bool RenderFrame()
eglCheck(); eglCheck();
KillTex=false;
if (is_rtt) if (is_rtt)
ReadRTTBuffer(); ReadRTTBuffer();
else if (settings.rend.ScreenScaling != 100 || gl.swap_buffer_not_preserved) else if (settings.rend.ScreenScaling != 100 || gl.swap_buffer_not_preserved)
@ -2062,8 +2060,7 @@ struct glesrend : Renderer
void Resize(int w, int h) { screen_width=w; screen_height=h; } void Resize(int w, int h) { screen_width=w; screen_height=h; }
void Term() void Term()
{ {
if (KillTex) killtex();
killtex();
gles_term(); gles_term();
} }

View File

@ -848,6 +848,7 @@ void killtex()
} }
TexCache.clear(); TexCache.clear();
KillTex = false;
INFO_LOG(RENDERER, "Texture cache cleared"); INFO_LOG(RENDERER, "Texture cache cleared");
} }