X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fgpu_neon%2Fpsx_gpu%2Fpsx_gpu_parse.c;h=5ef5f20f590530c8d3d03ca567a9740f0d38dbd5;hb=7a8d521fba9c86ae7b51369ce061bf63112b745f;hp=67da86ea289f759487393a8f62b5c1571b089042;hpb=2857d72e4ca743bba3cf55e298949e24d97dff02;p=pcsx_rearmed.git diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c b/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c index 67da86ea..5ef5f20f 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c +++ b/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c @@ -45,7 +45,6 @@ void update_texture_ptr(psx_gpu_struct *psx_gpu) switch((psx_gpu->render_state_base >> 8) & 0x3) { - default: case TEXTURE_MODE_4BPP: texture_base = psx_gpu->texture_4bpp_cache[psx_gpu->current_texture_page]; @@ -75,6 +74,7 @@ void update_texture_ptr(psx_gpu_struct *psx_gpu) texture_ptr += (psx_gpu->texture_window_y >> 4) << 12; break; + default: case TEXTURE_MODE_16BPP: texture_base = (u8 *)(psx_gpu->vram_ptr); texture_base += (psx_gpu->current_texture_page & 0xF) * 128; @@ -435,7 +435,10 @@ u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command) num_vertexes++; if(list_position >= list_end) - break; + { + current_command = (u32)-1; + goto breakloop; + } xy = *list_position; if((xy & 0xF000F000) == 0x50005000) @@ -496,7 +499,10 @@ u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command) num_vertexes++; if(list_position >= list_end) - break; + { + current_command = (u32)-1; + goto breakloop; + } color = list_position[0]; if((color & 0xF000F000) == 0x50005000) @@ -774,9 +780,7 @@ u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command) } } -#ifdef PCSX breakloop: -#endif if (last_command != NULL) *last_command = current_command; return list - list_start; @@ -864,7 +868,72 @@ extern void scale2x_tiles8(void *dst, const void *src, int w8, int h); #ifndef NEON_BUILD // TODO? -void scale2x_tiles8(void *dst, const void *src, int w8, int h) {} +void scale2x_tiles8(void *dst, const void *src, int w8, int h) +{ + uint16_t* d = (uint16_t*)dst; + const uint16_t* s = (const uint16_t*)src; + + while ( h-- ) + { + uint16_t* d_save = d; + const uint16_t* s_save = s; + int w = w8; + + while ( w-- ) + { + d[ 0 ] = *s; + d[ 1 ] = *s; + d[ 1024 ] = *s; + d[ 1025 ] = *s; + d += 2; s++; + + d[ 0 ] = *s; + d[ 1 ] = *s; + d[ 1024 ] = *s; + d[ 1025 ] = *s; + d += 2; s++; + + d[ 0 ] = *s; + d[ 1 ] = *s; + d[ 1024 ] = *s; + d[ 1025 ] = *s; + d += 2; s++; + + d[ 0 ] = *s; + d[ 1 ] = *s; + d[ 1024 ] = *s; + d[ 1025 ] = *s; + d += 2; s++; + + d[ 0 ] = *s; + d[ 1 ] = *s; + d[ 1024 ] = *s; + d[ 1025 ] = *s; + d += 2; s++; + + d[ 0 ] = *s; + d[ 1 ] = *s; + d[ 1024 ] = *s; + d[ 1025 ] = *s; + d += 2; s++; + + d[ 0 ] = *s; + d[ 1 ] = *s; + d[ 1024 ] = *s; + d[ 1025 ] = *s; + d += 2; s++; + + d[ 0 ] = *s; + d[ 1 ] = *s; + d[ 1024 ] = *s; + d[ 1025 ] = *s; + d += 2; s++; + } + + d = d_save + 2048; + s = s_save + 1024; /* or 512? */ + } +} #endif static int disable_main_render; @@ -1193,7 +1262,10 @@ u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size, num_vertexes++; if(list_position >= list_end) - break; + { + current_command = (u32)-1; + goto breakloop; + } xy = *list_position; if((xy & 0xF000F000) == 0x50005000) @@ -1259,7 +1331,10 @@ u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size, num_vertexes++; if(list_position >= list_end) - break; + { + current_command = (u32)-1; + goto breakloop; + } color = list_position[0]; if((color & 0xF000F000) == 0x50005000) @@ -1453,7 +1528,8 @@ u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size, { s16 viewport_start_x = list[0] & 0x3FF; s16 viewport_start_y = (list[0] >> 10) & 0x1FF; - u32 d; + u32 w; + s32 d; if(viewport_start_x == psx_gpu->viewport_start_x && viewport_start_y == psx_gpu->viewport_start_y) @@ -1465,11 +1541,12 @@ u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size, psx_gpu->saved_viewport_start_x = viewport_start_x; psx_gpu->saved_viewport_start_y = viewport_start_y; - d = (u32)psx_gpu->viewport_end_x - (u32)viewport_start_x + 1; - if((u32)psx_gpu->enhancement_x_threshold - d <= 16) + w = (u32)psx_gpu->viewport_end_x - (u32)viewport_start_x + 1; + d = psx_gpu->enhancement_x_threshold - w; + if(-16 <= d && d <= 16) { update_enhancement_buf_table_from_x(psx_gpu, - viewport_start_x, d); + viewport_start_x, w); } select_enhancement_buf(psx_gpu); @@ -1487,7 +1564,8 @@ u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size, { s16 viewport_end_x = list[0] & 0x3FF; s16 viewport_end_y = (list[0] >> 10) & 0x1FF; - u32 d; + u32 w; + s32 d; if(viewport_end_x == psx_gpu->viewport_end_x && viewport_end_y == psx_gpu->viewport_end_y) @@ -1500,11 +1578,12 @@ u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size, psx_gpu->saved_viewport_end_x = viewport_end_x; psx_gpu->saved_viewport_end_y = viewport_end_y; - d = (u32)viewport_end_x - (u32)psx_gpu->viewport_start_x + 1; - if((u32)psx_gpu->enhancement_x_threshold - d <= 16) + w = (u32)viewport_end_x - (u32)psx_gpu->viewport_start_x + 1; + d = psx_gpu->enhancement_x_threshold - w; + if(-16 <= d && d <= 16) { update_enhancement_buf_table_from_x(psx_gpu, - psx_gpu->viewport_start_x, d); + psx_gpu->viewport_start_x, w); } select_enhancement_buf(psx_gpu);