Skip to content

Commit

Permalink
JBR-8201 Vulkan: crash in VKRenderer_MaskFill
Browse files Browse the repository at this point in the history
Some perf improvement
  • Loading branch information
avu authored and mkartashev committed Jan 31, 2025
1 parent 20626e2 commit 616a312
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1261,13 +1261,18 @@ void VKRenderer_MaskFill(VKRenderingContext* context, jint x, jint y, jint w, ji
Color c = context->color;

uint32_t byteCount = maskscan * h;
if (mask == NULL) {
maskscan = 0;
byteCount = 1;
}
BufferWritingState maskState = VKRenderer_AllocateMaskFillBytes(context, byteCount);
if (mask != NULL) {
memcpy(maskState.data, mask + maskoff, byteCount);
} else {
// Special case, fully opaque mask
memset(maskState.data, 0xFF, byteCount);
*((char *)maskState.data) = 0xFF;
}

int offset = (int) maskState.offset;
VKMaskFillColorVertex p1 = {x, y, offset, maskscan, c};
VKMaskFillColorVertex p2 = {x + w, y, offset, maskscan, c};
Expand Down

0 comments on commit 616a312

Please sign in to comment.