@@ -1935,7 +1935,7 @@ setup_blocks_uv_adj_hack(psx_gpu_struct *psx_gpu, block_struct *block,
1935
1935
1936
1936
#define setup_blocks_add_blocks_direct () \
1937
1937
stats_add(texel_blocks_untextured, span_num_blocks); \
1938
- span_pixel_blocks += span_num_blocks \
1938
+ stats_add( span_pixel_blocks, span_num_blocks); \
1939
1939
1940
1940
1941
1941
#define setup_blocks_builder (shading , texturing , dithering , sw , target ) \
@@ -2918,9 +2918,9 @@ char *render_block_flag_strings[] =
2918
2918
(triangle_winding_##winding << 6)) \
2919
2919
2920
2920
static int prepare_triangle (psx_gpu_struct * psx_gpu , vertex_struct * vertexes ,
2921
- vertex_struct * vertexes_out [ 3 ] )
2921
+ prepared_triangle * triangle_out )
2922
2922
{
2923
- s32 y_top , y_bottom ;
2923
+ s32 y_top , y_bottom , offset_x , offset_y , i ;
2924
2924
s32 triangle_area ;
2925
2925
u32 triangle_winding = 0 ;
2926
2926
@@ -2955,6 +2955,7 @@ static int prepare_triangle(psx_gpu_struct *psx_gpu, vertex_struct *vertexes,
2955
2955
2956
2956
y_bottom = c -> y ;
2957
2957
y_top = a -> y ;
2958
+ offset_y = sign_extend_11bit (y_top + psx_gpu -> offset_y ) - y_top ;
2958
2959
2959
2960
if ((y_bottom - y_top ) >= 512 )
2960
2961
{
@@ -2982,29 +2983,39 @@ static int prepare_triangle(psx_gpu_struct *psx_gpu, vertex_struct *vertexes,
2982
2983
vertex_swap (a , b );
2983
2984
}
2984
2985
2985
- if (( c -> x - psx_gpu -> offset_x ) >= 1024 || ( c -> x - a -> x ) >= 1024 )
2986
+ if (c -> x - a -> x >= 1024 )
2986
2987
{
2987
2988
#ifdef PROFILE
2988
2989
trivial_rejects ++ ;
2989
2990
#endif
2990
2991
return 0 ;
2991
2992
}
2992
2993
2993
- if (invalidate_texture_cache_region_viewport (psx_gpu , a -> x , y_top , c -> x ,
2994
- y_bottom ) == 0 )
2994
+ offset_x = sign_extend_11bit (a -> x + psx_gpu -> offset_x ) - a -> x ;
2995
+ if (invalidate_texture_cache_region_viewport (psx_gpu ,
2996
+ a -> x + offset_x , y_top + offset_y ,
2997
+ c -> x + offset_x , y_bottom + offset_y ) == 0 )
2995
2998
{
2996
2999
#ifdef PROFILE
2997
3000
trivial_rejects ++ ;
2998
3001
#endif
2999
3002
return 0 ;
3000
3003
}
3001
3004
3005
+ for (i = 0 ; i < 3 ; i ++ )
3006
+ {
3007
+ vertexes [i ].x += offset_x ;
3008
+ vertexes [i ].y += offset_y ;
3009
+ }
3010
+
3002
3011
psx_gpu -> triangle_area = triangle_area ;
3003
3012
psx_gpu -> triangle_winding = triangle_winding ;
3004
3013
3005
- vertexes_out [0 ] = a ;
3006
- vertexes_out [1 ] = b ;
3007
- vertexes_out [2 ] = c ;
3014
+ triangle_out -> vertexes [0 ] = a ;
3015
+ triangle_out -> vertexes [1 ] = b ;
3016
+ triangle_out -> vertexes [2 ] = c ;
3017
+ triangle_out -> offset_x = offset_x ;
3018
+ triangle_out -> offset_y = offset_y ;
3008
3019
3009
3020
return 1 ;
3010
3021
}
@@ -3157,9 +3168,9 @@ static void render_triangle_p(psx_gpu_struct *psx_gpu,
3157
3168
void render_triangle (psx_gpu_struct * psx_gpu , vertex_struct * vertexes ,
3158
3169
u32 flags )
3159
3170
{
3160
- vertex_struct * vertex_ptrs [ 3 ] ;
3161
- if (prepare_triangle (psx_gpu , vertexes , vertex_ptrs ))
3162
- render_triangle_p (psx_gpu , vertex_ptrs , flags );
3171
+ prepared_triangle triangle ;
3172
+ if (prepare_triangle (psx_gpu , vertexes , & triangle ))
3173
+ render_triangle_p (psx_gpu , triangle . vertexes , flags );
3163
3174
}
3164
3175
3165
3176
#if !defined(NEON_BUILD ) || defined(SIMD_BUILD )
@@ -5067,6 +5078,7 @@ void initialize_psx_gpu(psx_gpu_struct *psx_gpu, u16 *vram)
5067
5078
psx_gpu -> dither_table [1 ] = dither_table_row (2 , -2 , 3 , -1 );
5068
5079
psx_gpu -> dither_table [2 ] = dither_table_row (-3 , 1 , -4 , 0 );
5069
5080
psx_gpu -> dither_table [3 ] = dither_table_row (3 , -1 , 2 , -2 );
5081
+ psx_gpu -> allow_dithering = 1 ;
5070
5082
5071
5083
psx_gpu -> primitive_type = PRIMITIVE_TYPE_UNKNOWN ;
5072
5084
0 commit comments