Skip to content

Commit d666830

Browse files
committed
Improve sceGuClear
- Fix wrong color of first vertex when slow mode - Speed up clear-fast when 32 bits mode
1 parent 0a8f216 commit d666830

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/gu/sceGuClear.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void sceGuClear(int flags)
4646
vertices = (struct Vertex *)sceGuGetMemory(2 * sizeof(struct Vertex));
4747
count = 2;
4848

49-
vertices[0].color = 0;
49+
vertices[0].color = filter;
5050
vertices[0].x = 0;
5151
vertices[0].y = 0;
5252
vertices[0].z = context->clear_depth;
@@ -59,8 +59,10 @@ void sceGuClear(int flags)
5959
else
6060
{
6161
struct Vertex *curr;
62-
unsigned int i;
63-
count = ((gu_draw_buffer.width + 63) / 64) * 2;
62+
unsigned int i, blockWidth;
63+
// Use blockWidth of 32 for 8888, 64 for other formats
64+
blockWidth = gu_draw_buffer.pixel_size == GU_PSM_8888 ? 32 : 64;
65+
count = ((gu_draw_buffer.width + blockWidth - 1) / blockWidth) * 2;
6466
vertices = (struct Vertex *)sceGuGetMemory(count * sizeof(struct Vertex));
6567
curr = vertices;
6668

@@ -72,7 +74,7 @@ void sceGuClear(int flags)
7274
k = (i & 1);
7375

7476
curr->color = filter;
75-
curr->x = (j + k) * 64;
77+
curr->x = (j + k) * blockWidth;
7678
curr->y = k * gu_draw_buffer.height;
7779
curr->z = context->clear_depth;
7880
}

0 commit comments

Comments
 (0)