void flush_render_block_buffer(psx_gpu_struct *psx_gpu)
{
- if((psx_gpu->interlace_mode & RENDER_INTERLACE_ENABLED) &&
+ if((psx_gpu->render_mode & RENDER_INTERLACE_ENABLED) &&
(psx_gpu->primitive_type == PRIMITIVE_TYPE_SPRITE))
{
u32 num_blocks_dest = 0;
u16 *vram_ptr = psx_gpu->vram_ptr;
u32 i;
- if(psx_gpu->interlace_mode & RENDER_INTERLACE_ODD)
+ if(psx_gpu->render_mode & RENDER_INTERLACE_ODD)
{
for(i = 0; i < psx_gpu->num_blocks; i++)
{
spans += psx_gpu->num_spans;
#endif
- if(psx_gpu->interlace_mode & RENDER_INTERLACE_ENABLED)
+ if(unlikely(psx_gpu->render_mode & RENDER_INTERLACE_ENABLED))
{
u32 i;
- if(psx_gpu->interlace_mode & RENDER_INTERLACE_ODD)
+ if(psx_gpu->render_mode & RENDER_INTERLACE_ODD)
{
for(i = 0; i < psx_gpu->num_spans; i++)
{
}
}
}
+ if(psx_gpu->render_mode & RENDER_DOUBLE_MODE)
+ {
+ u32 i;
+ for(i = 0; i < psx_gpu->num_spans; i++)
+ {
+ psx_gpu->span_edge_data[i].y *= 2;
+ }
+ }
u32 render_state = flags &
(RENDER_FLAGS_MODULATE_TEXELS | RENDER_FLAGS_BLEND |
u32 pitch = 512 - (width / 2);
u32 num_width;
- if(psx_gpu->interlace_mode & RENDER_INTERLACE_ENABLED)
+ if(psx_gpu->render_mode & RENDER_INTERLACE_ENABLED)
{
pitch += 512;
height /= 2;
- if(psx_gpu->interlace_mode & RENDER_INTERLACE_ODD)
+ if(psx_gpu->render_mode & RENDER_INTERLACE_ODD)
vram_ptr += 512;
}
}
}
+void render_block_fill_enh(psx_gpu_struct *psx_gpu, u32 color, u32 x, u32 y,
+ u32 width, u32 height)
+{
+ if((width == 0) || (height == 0))
+ return;
+
+ u32 r = color & 0xFF;
+ u32 g = (color >> 8) & 0xFF;
+ u32 b = (color >> 16) & 0xFF;
+ u32 color_16bpp = (r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10) |
+ psx_gpu->mask_msb;
+ u32 color_32bpp = color_16bpp | (color_16bpp << 16);
+
+ u32 *vram_ptr = (u32 *)(psx_gpu->vram_out_ptr + x + (y * 2048));
+
+ u32 pitch = 2048 / 2 - (width / 2);
+ u32 num_width;
+
+ while(height)
+ {
+ num_width = width;
+ while(num_width)
+ {
+ vram_ptr[0] = color_32bpp;
+ vram_ptr[1] = color_32bpp;
+ vram_ptr[2] = color_32bpp;
+ vram_ptr[3] = color_32bpp;
+ vram_ptr[4] = color_32bpp;
+ vram_ptr[5] = color_32bpp;
+ vram_ptr[6] = color_32bpp;
+ vram_ptr[7] = color_32bpp;
+
+ vram_ptr += 8;
+ num_width -= 16;
+ }
+
+ vram_ptr += pitch;
+ height--;
+ }
+}
+
void render_block_copy(psx_gpu_struct *psx_gpu, u16 *source, u32 x, u32 y,
u32 width, u32 height, u32 pitch)
{
psx_gpu->texture_mask_width = 0xFF;
psx_gpu->texture_mask_height = 0xFF;
- psx_gpu->interlace_mode = 0;
+ psx_gpu->render_mode = 0;
memset(psx_gpu->vram_ptr, 0, sizeof(u16) * 1024 * 512);
typedef enum
{
RENDER_INTERLACE_ENABLED = 0x1,
- RENDER_INTERLACE_ODD = 0x2
-} render_interlace_enum;
+ RENDER_INTERLACE_ODD = 0x2,
+ RENDER_DOUBLE_MODE = 0x4,
+} render_mode_enum;
typedef struct
{
u8 texture_window_y;
u8 primitive_type;
- u8 interlace_mode;
+ u8 render_mode;
// enhancement stuff
u16 *enhancement_buf_ptr;
#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_interlace_mode_offset 0x103
+#define psx_gpu_render_mode_offset 0x103
#define psx_gpu_blocks_offset 0x200
#define psx_gpu_span_uvrg_offset_offset 0x2200
#define psx_gpu_span_edge_data_offset 0x4200
WRITE_OFFSET(f, texture_window_x);
WRITE_OFFSET(f, texture_window_y);
WRITE_OFFSET(f, primitive_type);
- WRITE_OFFSET(f, interlace_mode);
+ WRITE_OFFSET(f, render_mode);
WRITE_OFFSET(f, blocks);
WRITE_OFFSET(f, span_uvrg_offset);
WRITE_OFFSET(f, span_edge_data);
psx_gpu->viewport_start_y = psx_gpu->saved_viewport_start_y; \
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; \
}
#define enhancement_enable() { \
psx_gpu->viewport_start_y = psx_gpu->saved_viewport_start_y * 2; \
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; \
}
#define shift_vertices3(v) { \
u32 height = list_s16[5] & 0x1FF;
u32 color = list[0] & 0xFFFFFF;
+ x &= ~0xF;
+ width = ((width + 0xF) & ~0xF);
+
do_fill(psx_gpu, x, y, width, height, color);
psx_gpu->vram_out_ptr = psx_gpu->enhancement_buf_ptr;
y *= 2;
width *= 2;
height *= 2;
- if (width > 1024)
- width = 1024;
- render_block_fill(psx_gpu, color, x, y, width, height);
+ render_block_fill_enh(psx_gpu, color, x, y, width, height);
break;
}
void renderer_set_interlace(int enable, int is_odd)
{
- egpu.interlace_mode &= ~(RENDER_INTERLACE_ENABLED|RENDER_INTERLACE_ODD);
+ egpu.render_mode &= ~(RENDER_INTERLACE_ENABLED|RENDER_INTERLACE_ODD);
if (enable)
- egpu.interlace_mode |= RENDER_INTERLACE_ENABLED;
+ egpu.render_mode |= RENDER_INTERLACE_ENABLED;
if (is_odd)
- egpu.interlace_mode |= RENDER_INTERLACE_ODD;
+ egpu.render_mode |= RENDER_INTERLACE_ODD;
}
#include "../../frontend/plugin_lib.h"
w *= 2;
h *= 2;
stride *= 2;
- vram_mask = 1024 * 1024 - 1;
+ vram_stride = 2048;
+ vram_mask = 2048 * 1024 - 1;
}
fb_offs = y * vram_stride + x;