From 2cf35c04df0ec27a1efa41528eae0046a5fc491f Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 2 Sep 2020 09:48:29 -0700 Subject: [PATCH] chore: cherry-pick c4f3b713800f from swiftshader (#25266) --- patches/config.json | 2 ++ patches/swiftshader/.patches | 1 + ...pying_cubemap_textures_out_of_bounds.patch | 36 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 patches/swiftshader/.patches create mode 100644 patches/swiftshader/fix_copying_cubemap_textures_out_of_bounds.patch diff --git a/patches/config.json b/patches/config.json index 2ee6ccac12700..86be2c4f7bd5e 100644 --- a/patches/config.json +++ b/patches/config.json @@ -9,6 +9,8 @@ "src/electron/patches/node": "src/third_party/electron_node", + "src/electron/patches/swiftshader": "src/third_party/swiftshader", + "src/electron/patches/usrsctp": "src/third_party/usrsctp/usrsctplib", "src/electron/patches/pdfium": "src/third_party/pdfium", diff --git a/patches/swiftshader/.patches b/patches/swiftshader/.patches new file mode 100644 index 0000000000000..8a1b9c6fd5b33 --- /dev/null +++ b/patches/swiftshader/.patches @@ -0,0 +1 @@ +fix_copying_cubemap_textures_out_of_bounds.patch diff --git a/patches/swiftshader/fix_copying_cubemap_textures_out_of_bounds.patch b/patches/swiftshader/fix_copying_cubemap_textures_out_of_bounds.patch new file mode 100644 index 0000000000000..670bab5b0667f --- /dev/null +++ b/patches/swiftshader/fix_copying_cubemap_textures_out_of_bounds.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alexis Hetu +Date: Wed, 12 Aug 2020 17:43:18 -0400 +Subject: Fix copying cubemap textures out of bounds +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Cubemap textures are created with a border, which means that their +size is larger. Their range is also different. Instead of [0, dim-1], +they have a [-1, dim] range. This means that if we copy them starting +at [0, 0] for their full size, we'll overflow at the end, since the +buffer starts at [-1, -1]. This cl prevents going through the fast +copy path when we have a border. + +Bug: chromium:1115345 +Change-Id: I333acfd6094645231eb111634359d82ed3d5c787 +Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/47668 +Presubmit-Ready: Alexis Hétu +Reviewed-by: Corentin Wallez +Reviewed-by: Chris Forbes +Tested-by: Alexis Hétu + +diff --git a/src/OpenGL/libGLESv2/Device.cpp b/src/OpenGL/libGLESv2/Device.cpp +index 0758428fb8c2aa91a21539d533e8b32d78d15e2a..8d80db73d5e43cb7463455f85beabaaf0d773bff 100644 +--- a/src/OpenGL/libGLESv2/Device.cpp ++++ b/src/OpenGL/libGLESv2/Device.cpp +@@ -575,7 +575,7 @@ namespace es2 + bool fullCopy = (sRect.x0 == 0.0f) && (sRect.y0 == 0.0f) && (dRect.x0 == 0) && (dRect.y0 == 0) && + (sRect.x1 == (float)sWidth) && (sRect.y1 == (float)sHeight) && (dRect.x1 == dWidth) && (dRect.y1 == dHeight); + bool alpha0xFF = false; +- bool equalSlice = sourceSliceB == destSliceB; ++ bool equalSlice = (sourceSliceB == destSliceB) && (source->getBorder() == 0) && (dest->getBorder() == 0); + bool smallMargin = sourcePitchB <= source->getWidth() * Surface::bytes(source->getInternalFormat()) + 16; + + if((source->getInternalFormat() == FORMAT_A8R8G8B8 && dest->getInternalFormat() == FORMAT_X8R8G8B8) ||