Fix scissor rect larger than render pass width/height in Metal backend

BUG=dawn:116
TEST=dawn_end2end_tests

Change-Id: I3e36e19d20b271ba58652bcaea973f3999e9e7ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5560
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Li Hao 2019-03-15 01:37:21 +00:00 committed by Commit Bot service account
parent 5625b63202
commit d263d752ac
1 changed files with 9 additions and 0 deletions

View File

@ -667,6 +667,15 @@ namespace dawn_native { namespace metal {
rect.width = cmd->width;
rect.height = cmd->height;
// The scissor rect x + width must be <= render pass width
if ((rect.x + rect.width) > renderPassCmd->width) {
rect.width = renderPassCmd->width - rect.x;
}
// The scissor rect y + height must be <= render pass height
if ((rect.y + rect.height > renderPassCmd->height)) {
rect.height = renderPassCmd->height - rect.y;
}
[encoder setScissorRect:rect];
} break;