gallivm: handle A8_UNORM image stores
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 6 Mar 2023 15:44:27 +0000 (10:44 -0500)
committerMarge Bot <emma+marge@anholt.net>
Thu, 10 Aug 2023 01:56:03 +0000 (01:56 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24589>

src/gallium/auxiliary/gallivm/lp_bld_format_soa.c

index e64fc93..fde96c9 100644 (file)
@@ -1026,6 +1026,7 @@ lp_build_store_rgba_soa(struct gallivm_state *gallivm,
    memset(packed, 0, sizeof(LLVMValueRef) * 4);
    if (format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN &&
        format_desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB &&
+       !util_format_is_alpha(format) &&
        format_desc->block.width == 1 &&
        format_desc->block.height == 1 &&
        format_desc->block.bits <= type.width &&
@@ -1084,6 +1085,12 @@ lp_build_store_rgba_soa(struct gallivm_state *gallivm,
    } else if (format == PIPE_FORMAT_R11G11B10_FLOAT) {
       packed[0] = lp_build_float_to_r11g11b10(gallivm, rgba_in);
       num_stores = 1;
+   } else if (util_format_is_alpha(format)) {
+      assert(format_desc->format == PIPE_FORMAT_A8_UNORM);
+      struct lp_build_context bld;
+      lp_build_context_init(&bld, gallivm, type);
+      lp_build_insert_soa_chan(&bld, type.width, format_desc->channel[0], &packed[0], rgba_in[3]);
+      num_stores = 1;
    } else
       assert(0);