gallium/u_transfer_helper: fix assert in RGTC case
authorRob Clark <robdclark@chromium.org>
Mon, 22 Jul 2019 21:23:52 +0000 (14:23 -0700)
committerRob Clark <robdclark@gmail.com>
Wed, 24 Jul 2019 21:11:06 +0000 (21:11 +0000)
Previously we'd hit the unreachable() for uploading RGTC.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/auxiliary/util/u_transfer_helper.c

index 033a49b14e28e96f2c541a7f88c01c5641942f80..f33d98b47a4a7af5fe366fd58792f8e35cf5a9f2 100644 (file)
@@ -300,32 +300,33 @@ u_transfer_helper_transfer_map(struct pipe_context *pctx,
             unreachable("Unexpected format");
          }
       }
-   } else if (needs_pack(usage) &&
-              util_format_description(prsc->format)->layout == UTIL_FORMAT_LAYOUT_RGTC) {
-      switch (prsc->format) {
-      case PIPE_FORMAT_RGTC1_UNORM:
-      case PIPE_FORMAT_RGTC1_SNORM:
-      case PIPE_FORMAT_LATC1_UNORM:
-      case PIPE_FORMAT_LATC1_SNORM:
-         util_format_rgtc1_unorm_pack_rgba_8unorm(trans->staging,
-                                                  ptrans->stride,
-                                                  trans->ptr,
-                                                  trans->trans->stride,
-                                                  width, height);
-         break;
-      case PIPE_FORMAT_RGTC2_UNORM:
-      case PIPE_FORMAT_RGTC2_SNORM:
-      case PIPE_FORMAT_LATC2_UNORM:
-      case PIPE_FORMAT_LATC2_SNORM:
-         util_format_rgtc2_unorm_pack_rgba_8unorm(trans->staging,
-                                                  ptrans->stride,
-                                                  trans->ptr,
-                                                  trans->trans->stride,
-                                                  width, height);
-         break;
-      default:
-         assert(!"Unexpected format");
-         break;
+   } else if (util_format_description(prsc->format)->layout == UTIL_FORMAT_LAYOUT_RGTC) {
+      if (needs_pack(usage)) {
+         switch (prsc->format) {
+         case PIPE_FORMAT_RGTC1_UNORM:
+         case PIPE_FORMAT_RGTC1_SNORM:
+         case PIPE_FORMAT_LATC1_UNORM:
+         case PIPE_FORMAT_LATC1_SNORM:
+            util_format_rgtc1_unorm_pack_rgba_8unorm(trans->staging,
+                                                     ptrans->stride,
+                                                     trans->ptr,
+                                                     trans->trans->stride,
+                                                     width, height);
+            break;
+         case PIPE_FORMAT_RGTC2_UNORM:
+         case PIPE_FORMAT_RGTC2_SNORM:
+         case PIPE_FORMAT_LATC2_UNORM:
+         case PIPE_FORMAT_LATC2_SNORM:
+            util_format_rgtc2_unorm_pack_rgba_8unorm(trans->staging,
+                                                     ptrans->stride,
+                                                     trans->ptr,
+                                                     trans->trans->stride,
+                                                     width, height);
+            break;
+         default:
+            assert(!"Unexpected format");
+            break;
+         }
       }
    } else {
       unreachable("bleh");