tbl_16(texels_high, texels, clut_high); \\r
zip_8x16b(pixels, texels_low, texels_high); \\r
\\r
- zip_4x32b(vector_cast(vec_4x32u, pixels_wide), pixels.low, pixels.low); \\r
+ zip_4x32b(vector_cast(vec_4x32u, pixels_wide), pixels.low, pixels.low); \\r
block->texels = pixels_wide; \\r
block->draw_mask_bits = left_mask_bits_a; \\r
block->fb_ptr = fb_ptr; \\r
tbl_16(texels_high, texels, clut_high); \\r
zip_8x16b(pixels, texels_low, texels_high); \\r
\\r
- zip_4x32b(vector_cast(vec_4x32u, pixels_wide), pixels.low, pixels.low); \\r
+ zip_4x32b(vector_cast(vec_4x32u, pixels_wide), pixels.low, pixels.low); \\r
block->texels = pixels_wide; \\r
block->draw_mask_bits = right_mask_bits_a; \\r
block->fb_ptr = fb_ptr + 16; \\r
{ \\r
vec_8x8u texels_low, texels_high; \\r
vec_8x16u pixels, pixels_wide; \\r
- setup_sprite_tile_add_blocks(sub_tile_height); \\r
+ setup_sprite_tile_add_blocks_4x(sub_tile_height); \\r
u32 edge##_mask_bits_a = edge##_mask_bits & 0xFF; \\r
u32 edge##_mask_bits_b = edge##_mask_bits >> 8; \\r
\\r
tbl_16(texels_high, texels, clut_high); \\r
zip_8x16b(pixels, texels_low, texels_high); \\r
\\r
- zip_4x32b(vector_cast(vec_4x32u, pixels_wide), pixels.low, pixels.low); \\r
+ zip_4x32b(vector_cast(vec_4x32u, pixels_wide), pixels.low, pixels.low); \\r
block->texels = pixels_wide; \\r
block->draw_mask_bits = edge##_mask_bits_a; \\r
block->fb_ptr = fb_ptr; \\r
\\r
block->r = texels_wide.low; \\r
block->draw_mask_bits = right_mask_bits_a; \\r
- block->fb_ptr = fb_ptr + 1024; \\r
+ block->fb_ptr = fb_ptr + 1024 + 16; \\r
block++; \\r
\\r
block->r = texels_wide.high; \\r
block->draw_mask_bits = right_mask_bits_b; \\r
- block->fb_ptr = fb_ptr + 24 + 1024; \\r
+ block->fb_ptr = fb_ptr + 24; \\r
block++; \\r
\\r
block->r = texels_wide.high; \\r
\r
#define setup_sprite_tile_half_8bpp_4x(edge) \\r
{ \\r
- setup_sprite_tile_add_blocks_4x(sub_tile_height * 2); \\r
+ setup_sprite_tile_add_blocks_4x(sub_tile_height); \\r
vec_16x8u texels_wide; \\r
u32 edge##_mask_bits_a = edge##_mask_bits & 0xFF; \\r
u32 edge##_mask_bits_b = edge##_mask_bits >> 8; \\r
u32 offset_u_right = width_rounded & 0xF; \\r
\\r
u32 left_block_mask = ~(0xFFFFFFFF << (offset_u * 2)); \\r
- u32 right_block_mask = 0xFFFFFFFE << (offset_u_right * 2); \\r
+ u32 right_block_mask = 0xFFFFFFFC << (offset_u_right * 2); \\r
\\r
u32 left_mask_bits; \\r
u32 right_mask_bits; \\r
u32 texture_offset_base = texture_offset; \\r
u32 control_mask; \\r
\\r
- u16 *fb_ptr = psx_gpu->vram_ptr + (y * 1024) + (x - offset_u); \\r
+ u16 *fb_ptr = psx_gpu->vram_out_ptr + (y * 1024) + (x - offset_u * 2); \\r
u32 num_blocks = psx_gpu->num_blocks; \\r
block_struct *block = psx_gpu->blocks + num_blocks; \\r
\\r
control_mask = tile_width == 1; \\r
control_mask |= (tile_height == 1) << 1; \\r
control_mask |= ((left_block_mask & 0xFFFF) == 0xFFFF) << 2; \\r
- control_mask |= (((right_block_mask >> 8) & 0xFFFF) == 0xFFFF) << 3; \\r
+ control_mask |= (((right_block_mask >> 16) & 0xFFFF) == 0xFFFF) << 3; \\r
\\r
sprites_##texture_mode++; \\r
\\r
u32 left_offset = u & 0x7;\r
u32 width_rounded = width + left_offset + 7;\r
\r
- u16 *fb_ptr = psx_gpu->vram_ptr + (y * 1024) + (s32)(x - left_offset);\r
+ u16 *fb_ptr = psx_gpu->vram_out_ptr + (y * 1024) + (s32)(x - left_offset * 2);\r
u32 right_width = width_rounded & 0x7;\r
u32 block_width = width_rounded / 8;\r
- u32 fb_ptr_pitch = (1024 + 8) - (block_width * 8);\r
+ u32 fb_ptr_pitch = (2048 + 16) - (block_width * 16);\r
\r
u32 left_mask_bits = ~(0xFFFF << (left_offset * 2));\r
- u32 right_mask_bits = 0xFE << (right_width * 2);\r
+ u32 right_mask_bits = 0xFFFC << (right_width * 2);\r
\r
u32 texture_offset_base = u + (v * 1024);\r
u32 texture_mask =\r
\r
load_128b(texels, texture_block_ptr);\r
\r
- zip4x32b(vector_cast(vec_4x32u, texels_wide), texels.low, texels.low);\r
+ zip_4x32b(vector_cast(vec_4x32u, texels_wide), texels.low, texels.low);\r
block->texels = texels_wide;\r
block->draw_mask_bits = mask_bits_a;\r
block->fb_ptr = fb_ptr; \r
block->fb_ptr = fb_ptr + 1024; \r
block++;\r
\r
- zip4x32b(vector_cast(vec_4x32u, texels_wide), texels.high, texels.high);\r
+ zip_4x32b(vector_cast(vec_4x32u, texels_wide), texels.high, texels.high);\r
block->texels = texels_wide;\r
block->draw_mask_bits = mask_bits_b;\r
block->fb_ptr = fb_ptr + 8;\r
if(num_blocks > MAX_BLOCKS)\r
{\r
flush_render_block_buffer(psx_gpu);\r
- num_blocks = block_width;\r
+ num_blocks = block_width * 4;\r
block = psx_gpu->blocks;\r
}\r
\r
\r
load_128b(texels, texture_block_ptr);\r
\r
- zip4x32b(vector_cast(vec_4x32u, texels_wide), texels.low, texels.low);\r
+ zip_4x32b(vector_cast(vec_4x32u, texels_wide), texels.low, texels.low);\r
block->texels = texels_wide;\r
block->draw_mask_bits = left_mask_bits_a;\r
block->fb_ptr = fb_ptr;\r
block->fb_ptr = fb_ptr + 1024;\r
block++; \r
\r
- zip4x32b(vector_cast(vec_4x32u, texels_wide), texels.high, texels.high);\r
+ zip_4x32b(vector_cast(vec_4x32u, texels_wide), texels.high, texels.high);\r
block->texels = texels_wide;\r
block->draw_mask_bits = left_mask_bits_b;\r
block->fb_ptr = fb_ptr + 8;\r
texture_block_ptr = texture_page_ptr + (texture_offset & texture_mask);\r
load_128b(texels, texture_block_ptr);\r
\r
- zip4x32b(vector_cast(vec_4x32u, texels_wide), texels.low, texels.low);\r
+ zip_4x32b(vector_cast(vec_4x32u, texels_wide), texels.low, texels.low);\r
block->texels = texels_wide;\r
block->draw_mask_bits = 0;\r
block->fb_ptr = fb_ptr;\r
block->fb_ptr = fb_ptr + 1024;\r
block++; \r
\r
- zip4x32b(vector_cast(vec_4x32u, texels_wide), texels.high, texels.high);\r
+ zip_4x32b(vector_cast(vec_4x32u, texels_wide), texels.high, texels.high);\r
block->texels = texels_wide;\r
block->draw_mask_bits = 0;\r
block->fb_ptr = fb_ptr + 8;\r
block++;\r
\r
texture_offset += 8;\r
- fb_ptr += 8;\r
+ fb_ptr += 16;\r
\r
blocks_remaining--;\r
}\r
texture_block_ptr = texture_page_ptr + (texture_offset & texture_mask);\r
load_128b(texels, texture_block_ptr);\r
\r
- zip4x32b(vector_cast(vec_4x32u, texels_wide), texels.low, texels.low);\r
+ zip_4x32b(vector_cast(vec_4x32u, texels_wide), texels.low, texels.low);\r
block->texels = texels_wide;\r
block->draw_mask_bits = right_mask_bits_a;\r
block->fb_ptr = fb_ptr;\r
block->fb_ptr = fb_ptr + 1024;\r
block++; \r
\r
- zip4x32b(vector_cast(vec_4x32u, texels_wide), texels.high, texels.high);\r
+ zip_4x32b(vector_cast(vec_4x32u, texels_wide), texels.high, texels.high);\r
block->texels = texels_wide;\r
block->draw_mask_bits = right_mask_bits_b;\r
block->fb_ptr = fb_ptr + 8;\r
\r
#endif\r
\r
+static void setup_sprite_untextured_4x(psx_gpu_struct *psx_gpu, s32 x, s32 y,\r
+ s32 u, s32 v, s32 width, s32 height, u32 color)\r
+{\r
+ setup_sprite_untextured(psx_gpu, x, y, u, v, width * 2, height * 2, color);\r
+}\r
+\r
#define setup_sprite_blocks_switch_textured_4x(texture_mode) \\r
setup_sprite_##texture_mode##_4x \\r
\r
#define setup_sprite_blocks_switch_untextured_4x(texture_mode) \\r
- setup_sprite_untextured \\r
+ setup_sprite_untextured_4x \\r
\r
#define setup_sprite_blocks_switch_4x(texturing, texture_mode) \\r
setup_sprite_blocks_switch_##texturing##_4x(texture_mode) \\r
void render_sprite_4x(psx_gpu_struct *psx_gpu, s32 x, s32 y, u32 u, u32 v,\r
s32 width, s32 height, u32 flags, u32 color)\r
{\r
- x *= 2;\r
- y *= 2;\r
-\r
s32 x_right = x + width - 1;\r
s32 y_bottom = y + height - 1;\r
\r
if((width <= 0) || (height <= 0))\r
return;\r
\r
+ x *= 2;\r
+ y *= 2;\r
+\r
#ifdef PROFILE\r
span_pixels += width * height;\r
spans += height;\r
return list - list_start;
}
+#ifdef PCSX
+
static void *select_enhancement_buf_ptr(psx_gpu_struct *psx_gpu, u32 x)
{
u32 b;
}
}
+#if 0
+
#define fill_vertex(i, x_, y_, u_, v_, rgb_) \
vertexes[i].x = x_; \
vertexes[i].y = y_; \
vertexes[i].g = (rgb_) >> 8; \
vertexes[i].b = (rgb_) >> 16
-static void do_esprite_in_triangles(psx_gpu_struct *psx_gpu, int x, int y,
+static void do_sprite_enhanced(psx_gpu_struct *psx_gpu, int x, int y,
u32 u, u32 v, u32 w, u32 h, u32 cmd_rgb)
{
vertex_struct *vertex_ptrs[3];
psx_gpu->render_state_base = render_state_base_saved;
}
+#else
+static void do_sprite_enhanced(psx_gpu_struct *psx_gpu, int x, int y,
+ u32 u, u32 v, u32 w, u32 h, u32 cmd_rgb)
+{
+ u32 flags = (cmd_rgb >> 24);
+ u32 color = cmd_rgb & 0xffffff;
+
+ psx_gpu->vram_out_ptr = psx_gpu->enhancement_current_buf_ptr;
+ render_sprite_4x(psx_gpu, x, y, u, v, w, h, flags, color);
+}
+#endif
u32 gpu_parse_enhanced(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command)
{
u32 height = list_s16[5] & 0x1FF;
render_sprite(psx_gpu, x, y, 0, 0, width, height, current_command, list[0]);
- do_esprite_in_triangles(psx_gpu, x, y, 0, 0, width, height, list[0]);
+ do_sprite_enhanced(psx_gpu, x, y, 0, 0, width, height, list[0]);
break;
}
render_sprite(psx_gpu, x, y, u, v, width, height,
current_command, list[0]);
- do_esprite_in_triangles(psx_gpu, x, y, u, v, width, height, list[0]);
+ do_sprite_enhanced(psx_gpu, x, y, u, v, width, height, list[0]);
break;
}
s32 y = sign_extend_11bit(list_s16[3] + psx_gpu->offset_y);
render_sprite(psx_gpu, x, y, 0, 0, 1, 1, current_command, list[0]);
- do_esprite_in_triangles(psx_gpu, x, y, 0, 0, 1, 1, list[0]);
+ do_sprite_enhanced(psx_gpu, x, y, 0, 0, 1, 1, list[0]);
break;
}
s32 y = sign_extend_11bit(list_s16[3] + psx_gpu->offset_y);
render_sprite(psx_gpu, x, y, 0, 0, 8, 8, current_command, list[0]);
- do_esprite_in_triangles(psx_gpu, x, y, 0, 0, 8, 8, list[0]);
+ do_sprite_enhanced(psx_gpu, x, y, 0, 0, 8, 8, list[0]);
break;
}
render_sprite(psx_gpu, x, y, u, v, 8, 8,
current_command, list[0]);
- do_esprite_in_triangles(psx_gpu, x, y, u, v, 8, 8, list[0]);
+ do_sprite_enhanced(psx_gpu, x, y, u, v, 8, 8, list[0]);
break;
}
s32 y = sign_extend_11bit(list_s16[3] + psx_gpu->offset_y);
render_sprite(psx_gpu, x, y, 0, 0, 16, 16, current_command, list[0]);
- do_esprite_in_triangles(psx_gpu, x, y, 0, 0, 16, 16, list[0]);
+ do_sprite_enhanced(psx_gpu, x, y, 0, 0, 16, 16, list[0]);
break;
}
set_clut(psx_gpu, list_s16[5]);
render_sprite(psx_gpu, x, y, u, v, 16, 16, current_command, list[0]);
- do_esprite_in_triangles(psx_gpu, x, y, u, v, 16, 16, list[0]);
+ do_sprite_enhanced(psx_gpu, x, y, u, v, 16, 16, list[0]);
break;
}
}
}
-#ifdef PCSX
+ enhancement_disable();
+
breakloop:
-#endif
-enhancement_disable();
if (last_command != NULL)
*last_command = current_command;
return list - list_start;
}
+#endif /* PCSX */
+
// vim:shiftwidth=2:expandtab