From b4f476867238a5ce288b9295e9ec38250493f2c1 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 22 Jul 2019 14:23:52 -0700 Subject: [PATCH] gallium/u_transfer_helper: fix assert in RGTC case Previously we'd hit the unreachable() for uploading RGTC. Signed-off-by: Rob Clark Reviewed-by: Kenneth Graunke --- src/gallium/auxiliary/util/u_transfer_helper.c | 53 +++++++++++++------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c b/src/gallium/auxiliary/util/u_transfer_helper.c index 033a49b..f33d98b 100644 --- a/src/gallium/auxiliary/util/u_transfer_helper.c +++ b/src/gallium/auxiliary/util/u_transfer_helper.c @@ -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"); -- 2.7.4