Module: Mesa
Branch: master
Commit: eab078f1321cbd6b292c88fe1770dc1b24261514
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eab078f1321cbd6b292c88fe1770dc1b24261514

Author: Karol Herbst <karolher...@gmail.com>
Date:   Wed Aug 16 20:32:42 2017 +0200

main/format: skip format conversion if src and dst format are equal

Fixes 'KHR-GL45.copy_image.functional' on Nouveau and i965.

v2: (by Kenneth Graunke)
    Rewrite patch according to Jason Ekstrand's review feedback.
    This makes it handle differing strides, which i965 needed.

Signed-off-by: Karol Herbst <karolher...@gmail.com>
Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net>

---

 src/mesa/main/format_utils.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
index d16d69c379..31580750bd 100644
--- a/src/mesa/main/format_utils.c
+++ b/src/mesa/main/format_utils.c
@@ -312,6 +312,20 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, 
size_t dst_stride,
     * enable it for specific combinations that are known to work.
     */
    if (!rebase_swizzle) {
+      /* Do a direct memcpy where possible */
+      if ((dst_format_is_mesa_array_format &&
+           src_format_is_mesa_array_format &&
+           src_array_format == dst_array_format) ||
+          src_format == dst_format) {
+         int format_size = _mesa_get_format_bytes(src_format);
+         for (row = 0; row < height; row++) {
+            memcpy(dst, src, width * format_size);
+            src += src_stride;
+            dst += dst_stride;
+         }
+         return;
+      }
+
       /* Handle the cases where we can directly unpack */
       if (!src_format_is_mesa_array_format) {
          if (dst_array_format == RGBA32_FLOAT) {

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to