diff options
author | notaz | 2012-08-15 23:52:38 +0300 |
---|---|---|
committer | notaz | 2012-10-12 00:05:08 +0300 |
commit | c6063f8985c69362a89a12111f393229ab65d05f (patch) | |
tree | 7b601359aa0b83baf41b51d6ea674bc3307a52cc | |
parent | 24c742fccede19c9baecc36008f4d8ac4f9a51fa (diff) | |
download | pcsx_rearmed-c6063f8985c69362a89a12111f393229ab65d05f.tar.gz pcsx_rearmed-c6063f8985c69362a89a12111f393229ab65d05f.tar.bz2 pcsx_rearmed-c6063f8985c69362a89a12111f393229ab65d05f.zip |
psx_gpu: use different uvrgb phase for enhancement
-rw-r--r-- | plugins/gpu_neon/psx_gpu/psx_gpu.c | 9 | ||||
-rw-r--r-- | plugins/gpu_neon/psx_gpu/psx_gpu.h | 19 | ||||
-rw-r--r-- | plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S | 11 | ||||
-rw-r--r-- | plugins/gpu_neon/psx_gpu/psx_gpu_offsets.h | 59 | ||||
-rw-r--r-- | plugins/gpu_neon/psx_gpu/psx_gpu_offsets_update.c | 9 | ||||
-rw-r--r-- | plugins/gpu_neon/psx_gpu/psx_gpu_parse.c | 2 |
6 files changed, 59 insertions, 50 deletions
diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.c b/plugins/gpu_neon/psx_gpu/psx_gpu.c index 1385e2e..28ebcf5 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu.c +++ b/plugins/gpu_neon/psx_gpu/psx_gpu.c @@ -567,7 +567,7 @@ void compute_all_gradients(psx_gpu_struct *psx_gpu, vertex_struct *a, vec_4x32u uvrg_base; vec_4x32u b_base; - vec_4x32u const_0x8000; + vec_4x32u uvrgb_phase; vec_4x16s d0_a_d3_c, d0_b, d0_c; vec_4x16s d1_a, d1_b, d1_c_d2_a; @@ -596,12 +596,12 @@ void compute_all_gradients(psx_gpu_struct *psx_gpu, vertex_struct *a, setup_gradient_calculation_input(1, b); setup_gradient_calculation_input(2, c); - dup_4x32b(const_0x8000, 0x8000); + dup_4x32b(uvrgb_phase, psx_gpu->uvrgb_phase); shl_long_4x16b(uvrg_base, x0_a_y0_c, 16); shl_long_4x16b(b_base, x0_b, 16); - add_4x32b(uvrg_base, uvrg_base, const_0x8000); - add_4x32b(b_base, b_base, const_0x8000); + add_4x32b(uvrg_base, uvrg_base, uvrgb_phase); + add_4x32b(b_base, b_base, uvrgb_phase); // Can probably pair these, but it'll require careful register allocation sub_4x16b(d0_a_d3_c, x1_a_y1_c, x0_a_y0_c); @@ -4632,6 +4632,7 @@ void initialize_psx_gpu(psx_gpu_struct *psx_gpu, u16 *vram) psx_gpu->render_state = 0; psx_gpu->render_state_base = 0; psx_gpu->num_blocks = 0; + psx_gpu->uvrgb_phase = 0x8000; psx_gpu->vram_ptr = vram; psx_gpu->vram_out_ptr = vram; diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.h b/plugins/gpu_neon/psx_gpu/psx_gpu.h index 71b99cd..7252dc2 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu.h +++ b/plugins/gpu_neon/psx_gpu/psx_gpu.h @@ -123,7 +123,6 @@ typedef struct vec_4x32u g_block_span; vec_4x32u b_block_span; - // 76 bytes u32 b; u32 b_dy; @@ -139,6 +138,8 @@ typedef struct u32 triangle_color; u32 dither_table[4]; + u32 uvrgb_phase; + struct render_block_handler_struct *render_block_handler; void *texture_page_ptr; void *texture_page_base; @@ -146,19 +147,12 @@ typedef struct u16 *vram_ptr; u16 *vram_out_ptr; - // 26 bytes u16 render_state_base; u16 render_state; u16 num_spans; u16 num_blocks; - s16 offset_x; - s16 offset_y; - - u16 clut_settings; - u16 texture_settings; - s16 viewport_start_x; s16 viewport_start_y; s16 viewport_end_x; @@ -166,7 +160,6 @@ typedef struct u16 mask_msb; - // 8 bytes u8 triangle_winding; u8 display_area_draw_enable; @@ -182,6 +175,12 @@ typedef struct u8 primitive_type; u8 render_mode; + s16 offset_x; + s16 offset_y; + + u16 clut_settings; + u16 texture_settings; + // enhancement stuff u16 *enhancement_buf_ptr; s16 saved_viewport_start_x; @@ -191,7 +190,7 @@ typedef struct // Align up to 64 byte boundary to keep the upcoming buffers cache line // aligned, also make reachable with single immediate addition - u8 reserved_a[240]; + u8 reserved_a[236]; // 8KB block_struct blocks[MAX_BLOCKS_PER_ROW]; diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S b/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S index 6393e15..3239412 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S +++ b/plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S @@ -182,6 +182,7 @@ #define uvrg_dx3l d6 #define uvrg_dx3h d7 +#define uvrgb_phase q13 .align 4 @@ -313,11 +314,16 @@ function(compute_all_gradients) vmull.s16 ga_uvrg_y, d0_b, d1_b rsbmi ga_bx, ga_bx, #0 + @ r12 = psx_gpu->uvrgb_phase + ldr r12, [ psx_gpu, #psx_gpu_uvrgb_phase_offset ] + vmlsl.s16 ga_uvrg_y, d2_b, d3_b movs gs_by, ga_by, asr #31 vshr.u64 d0, d30, #22 - mov b_base, b0, lsl #16 + add b_base, r12, b0, lsl #16 + + vdup.u32 uvrgb_phase, r12 rsbmi ga_by, ga_by, #0 vclt.s32 gs_uvrg_x, ga_uvrg_x, #0 @ gs_uvrg_x = ga_uvrg_x < 0 @@ -326,7 +332,6 @@ function(compute_all_gradients) ldrb r12, [ psx_gpu, #psx_gpu_triangle_winding_offset ] vclt.s32 gs_uvrg_y, ga_uvrg_y, #0 @ gs_uvrg_y = ga_uvrg_y < 0 - add b_base, b_base, #0x8000 rsb r12, r12, #0 @ r12 = -(triangle->winding) vdup.u32 w_mask, r12 @ w_mask = { -w, -w, -w, -w } @@ -335,7 +340,7 @@ function(compute_all_gradients) vshll.u16 uvrg_base, uvrg0, #16 @ uvrg_base = uvrg0 << 16 vdup.u32 r_shift, r14 @ r_shift = { shift, shift, shift, shift } - vorr.u32 uvrg_base, #0x8000 + vadd.u32 uvrg_base, uvrgb_phase vabs.s32 ga_uvrg_x, ga_uvrg_x @ ga_uvrg_x = abs(ga_uvrg_x) vmov area_r_s, s0 @ area_r_s = triangle_reciprocal diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu_offsets.h b/plugins/gpu_neon/psx_gpu/psx_gpu_offsets.h index 7ebf7db..1307891 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu_offsets.h +++ b/plugins/gpu_neon/psx_gpu/psx_gpu_offsets.h @@ -18,35 +18,36 @@ #define psx_gpu_dirty_textures_8bpp_alternate_mask_offset 0xb0 #define psx_gpu_triangle_color_offset 0xb4 #define psx_gpu_dither_table_offset 0xb8 -#define psx_gpu_render_block_handler_offset 0xc8 -#define psx_gpu_texture_page_ptr_offset 0xcc -#define psx_gpu_texture_page_base_offset 0xd0 -#define psx_gpu_clut_ptr_offset 0xd4 -#define psx_gpu_vram_ptr_offset 0xd8 -#define psx_gpu_vram_out_ptr_offset 0xdc -#define psx_gpu_render_state_base_offset 0xe0 -#define psx_gpu_render_state_offset 0xe2 -#define psx_gpu_num_spans_offset 0xe4 -#define psx_gpu_num_blocks_offset 0xe6 -#define psx_gpu_offset_x_offset 0xe8 -#define psx_gpu_offset_y_offset 0xea -#define psx_gpu_clut_settings_offset 0xec -#define psx_gpu_texture_settings_offset 0xee -#define psx_gpu_viewport_start_x_offset 0xf0 -#define psx_gpu_viewport_start_y_offset 0xf2 -#define psx_gpu_viewport_end_x_offset 0xf4 -#define psx_gpu_viewport_end_y_offset 0xf6 -#define psx_gpu_mask_msb_offset 0xf8 -#define psx_gpu_triangle_winding_offset 0xfa -#define psx_gpu_display_area_draw_enable_offset 0xfb -#define psx_gpu_current_texture_page_offset 0xfc -#define psx_gpu_last_8bpp_texture_page_offset 0xfd -#define psx_gpu_texture_mask_width_offset 0xfe -#define psx_gpu_texture_mask_height_offset 0xff -#define psx_gpu_texture_window_x_offset 0x100 -#define psx_gpu_texture_window_y_offset 0x101 -#define psx_gpu_primitive_type_offset 0x102 -#define psx_gpu_render_mode_offset 0x103 +#define psx_gpu_uvrgb_phase_offset 0xc8 +#define psx_gpu_render_block_handler_offset 0xcc +#define psx_gpu_texture_page_ptr_offset 0xd0 +#define psx_gpu_texture_page_base_offset 0xd4 +#define psx_gpu_clut_ptr_offset 0xd8 +#define psx_gpu_vram_ptr_offset 0xdc +#define psx_gpu_vram_out_ptr_offset 0xe0 +#define psx_gpu_render_state_base_offset 0xe4 +#define psx_gpu_render_state_offset 0xe6 +#define psx_gpu_num_spans_offset 0xe8 +#define psx_gpu_num_blocks_offset 0xea +#define psx_gpu_viewport_start_x_offset 0xec +#define psx_gpu_viewport_start_y_offset 0xee +#define psx_gpu_viewport_end_x_offset 0xf0 +#define psx_gpu_viewport_end_y_offset 0xf2 +#define psx_gpu_mask_msb_offset 0xf4 +#define psx_gpu_triangle_winding_offset 0xf6 +#define psx_gpu_display_area_draw_enable_offset 0xf7 +#define psx_gpu_current_texture_page_offset 0xf8 +#define psx_gpu_last_8bpp_texture_page_offset 0xf9 +#define psx_gpu_texture_mask_width_offset 0xfa +#define psx_gpu_texture_mask_height_offset 0xfb +#define psx_gpu_texture_window_x_offset 0xfc +#define psx_gpu_texture_window_y_offset 0xfd +#define psx_gpu_primitive_type_offset 0xfe +#define psx_gpu_render_mode_offset 0xff +#define psx_gpu_offset_x_offset 0x100 +#define psx_gpu_offset_y_offset 0x102 +#define psx_gpu_clut_settings_offset 0x104 +#define psx_gpu_texture_settings_offset 0x106 #define psx_gpu_blocks_offset 0x200 #define psx_gpu_span_uvrg_offset_offset 0x2200 #define psx_gpu_span_edge_data_offset 0x4200 diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu_offsets_update.c b/plugins/gpu_neon/psx_gpu/psx_gpu_offsets_update.c index ff74f34..5adfb75 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu_offsets_update.c +++ b/plugins/gpu_neon/psx_gpu/psx_gpu_offsets_update.c @@ -43,6 +43,7 @@ int main() WRITE_OFFSET(f, dirty_textures_8bpp_alternate_mask); WRITE_OFFSET(f, triangle_color); WRITE_OFFSET(f, dither_table); + WRITE_OFFSET(f, uvrgb_phase); WRITE_OFFSET(f, render_block_handler); WRITE_OFFSET(f, texture_page_ptr); WRITE_OFFSET(f, texture_page_base); @@ -53,10 +54,6 @@ int main() WRITE_OFFSET(f, render_state); WRITE_OFFSET(f, num_spans); WRITE_OFFSET(f, num_blocks); - WRITE_OFFSET(f, offset_x); - WRITE_OFFSET(f, offset_y); - WRITE_OFFSET(f, clut_settings); - WRITE_OFFSET(f, texture_settings); WRITE_OFFSET(f, viewport_start_x); WRITE_OFFSET(f, viewport_start_y); WRITE_OFFSET(f, viewport_end_x); @@ -72,6 +69,10 @@ int main() WRITE_OFFSET(f, texture_window_y); WRITE_OFFSET(f, primitive_type); WRITE_OFFSET(f, render_mode); + WRITE_OFFSET(f, offset_x); + WRITE_OFFSET(f, offset_y); + WRITE_OFFSET(f, clut_settings); + WRITE_OFFSET(f, texture_settings); WRITE_OFFSET(f, blocks); WRITE_OFFSET(f, span_uvrg_offset); WRITE_OFFSET(f, span_edge_data); diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c b/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c index 2e1c0b8..1c449ea 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c +++ b/plugins/gpu_neon/psx_gpu/psx_gpu_parse.c @@ -757,6 +757,7 @@ breakloop: psx_gpu->viewport_end_x = psx_gpu->saved_viewport_end_x; \ psx_gpu->viewport_end_y = psx_gpu->saved_viewport_end_y; \ psx_gpu->render_mode &= ~RENDER_DOUBLE_MODE; \ + psx_gpu->uvrgb_phase = 0x8000; \ } #define enhancement_enable() { \ @@ -766,6 +767,7 @@ breakloop: psx_gpu->viewport_end_x = psx_gpu->saved_viewport_end_x * 2; \ psx_gpu->viewport_end_y = psx_gpu->saved_viewport_end_y * 2; \ psx_gpu->render_mode |= RENDER_DOUBLE_MODE; \ + psx_gpu->uvrgb_phase = 0x1000; \ } #define shift_vertices3(v) { \ |