Skip to content
This repository has been archived by the owner. It is now read-only.

8261734: Some jtreg tests are failing with invalid setRectClip #193

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -272,7 +272,26 @@ - (void)setScissorOrStencil:(id<MTLRenderCommandEncoder>)encoder
_clipRect.height = dh;
}

[encoder setScissorRect:_clipRect];
// Clamping clip rect to the destination area
MTLScissorRect rect = _clipRect;

if (rect.x > dw) {
rect.x = dw;
}

if (rect.y > dh) {
rect.y = dh;
}

if (rect.x + rect.width > dw) {
rect.width = dw - rect.x;
}

if (rect.y + rect.height > dh) {
rect.height = dh - rect.y;
}

[encoder setScissorRect:rect];
if (_clipType == NO_CLIP || _clipType == RECT_CLIP) {
// NOTE: It seems that we can use the same encoder (with disabled stencil test) when mode changes from SHAPE to RECT.
// But [encoder setDepthStencilState:nil] causes crash, so we have to recreate encoder in such case.