void flush_render_block_buffer(psx_gpu_struct *psx_gpu)
{
+ if((psx_gpu->interlace_mode & RENDER_INTERLACE_ENABLED) &&
+ (psx_gpu->primitive_type == PRIMITIVE_TYPE_SPRITE))
+ {
+ u32 num_blocks_dest = 0;
+ block_struct *block_src = psx_gpu->blocks;
+ block_struct *block_dest = psx_gpu->blocks;
+
+ u16 *vram_ptr = psx_gpu->vram_ptr;
+ u32 i;
+
+ if(psx_gpu->interlace_mode & RENDER_INTERLACE_ODD)
+ {
+ for(i = 0; i < psx_gpu->num_blocks; i++)
+ {
+ u32 fb_offset = (u32)((u8 *)block_src->fb_ptr - (u8 *)vram_ptr);
+ if(fb_offset & (1 << 11))
+ {
+ *block_dest = *block_src;
+ num_blocks_dest++;
+ block_dest++;
+ }
+ block_src++;
+ }
+ }
+ else
+ {
+ for(i = 0; i < psx_gpu->num_blocks; i++)
+ {
+ u32 fb_offset = (u32)((u8 *)block_src->fb_ptr - (u8 *)vram_ptr);
+ if((fb_offset & (1 << 11)) == 0)
+ {
+ *block_dest = *block_src;
+ num_blocks_dest++;
+ block_dest++;
+ }
+ block_src++;
+ }
+ }
+
+ psx_gpu->num_blocks = num_blocks_dest;
+ }
+
if(psx_gpu->num_blocks)
{
render_block_handler_struct *render_block_handler =
spans += psx_gpu->num_spans;
#endif
+ if(psx_gpu->interlace_mode & RENDER_INTERLACE_ENABLED)
+ {
+ u32 i;
+
+ if(psx_gpu->interlace_mode & RENDER_INTERLACE_ODD)
+ {
+ for(i = 0; i < psx_gpu->num_spans; i++)
+ {
+ if((psx_gpu->span_edge_data[i].y & 1) == 0)
+ psx_gpu->span_edge_data[i].num_blocks = 0;
+ }
+ }
+ else
+ {
+ for(i = 0; i < psx_gpu->num_spans; i++)
+ {
+ if(psx_gpu->span_edge_data[i].y & 1)
+ psx_gpu->span_edge_data[i].num_blocks = 0;
+ }
+ }
+ }
+
u32 render_state = flags &
(RENDER_FLAGS_MODULATE_TEXELS | RENDER_FLAGS_BLEND |
RENDER_FLAGS_TEXTURE_MAP | RENDER_FLAGS_SHADE);
psx_gpu->texture_mask_width = 0xFF;
psx_gpu->texture_mask_height = 0xFF;
+ psx_gpu->interlace_mode = 0;
+
memset(psx_gpu->vram_ptr, 0, sizeof(u16) * 1024 * 512);
initialize_reciprocal_table();
RENDER_STATE_MASK_EVALUATE = 0x20,
} render_state_enum;
+typedef enum
+{
+ RENDER_INTERLACE_ENABLED = 0x1,
+ RENDER_INTERLACE_ODD = 0x2
+} render_interlace_enum;
+
typedef struct
{
u16 left_x;
u8 texture_window_y;
u8 primitive_type;
+ u8 interlace_mode;
// Align up to 64 byte boundary to keep the upcoming buffers cache line
// aligned
- u8 reserved_a[1];
+ //u8 reserved_a[0];
// 8KB
block_struct blocks[MAX_BLOCKS_PER_ROW];