--- src/intel/blorp/blorp_blit.c | 64 +++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 22 deletions(-)
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index e825862..9258470 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -879,10 +879,14 @@ bit_cast_color(struct nir_builder *b, nir_ssa_def *color, const struct isl_format_layout *dst_fmtl = isl_format_get_layout(key->dst_format); - /* They must be uint formats with the same bit size */ + /* They must be uint formats with the same bit size. We also support + * ISL_FORMAT_R11G11B10_FLOAT. + */ assert(src_fmtl->bpb == dst_fmtl->bpb); - assert(src_fmtl->channels.r.type == ISL_UINT); - assert(dst_fmtl->channels.r.type == ISL_UINT); + assert(key->src_format == ISL_FORMAT_R11G11B10_FLOAT || + src_fmtl->channels.r.type == ISL_UINT); + assert(key->dst_format == ISL_FORMAT_R11G11B10_FLOAT || + dst_fmtl->channels.r.type == ISL_UINT); /* They must be in regular color formats (no luminance or alpha) */ assert(src_fmtl->channels.r.bits > 0); @@ -893,25 +897,35 @@ bit_cast_color(struct nir_builder *b, nir_ssa_def *color, assert(dst_fmtl->channels.r.start_bit == 0); if (src_fmtl->bpb <= 32) { - const unsigned src_channels = - isl_format_get_num_channels(key->src_format); - const unsigned src_bits[4] = { - src_fmtl->channels.r.bits, - src_fmtl->channels.g.bits, - src_fmtl->channels.b.bits, - src_fmtl->channels.a.bits, - }; - const unsigned dst_channels = - isl_format_get_num_channels(key->dst_format); - const unsigned dst_bits[4] = { - dst_fmtl->channels.r.bits, - dst_fmtl->channels.g.bits, - dst_fmtl->channels.b.bits, - dst_fmtl->channels.a.bits, - }; - nir_ssa_def *packed = - nir_format_pack_uint_unmasked(b, color, src_bits, src_channels); - color = nir_format_unpack_uint(b, packed, dst_bits, dst_channels); + nir_ssa_def *packed; + if (key->src_format == ISL_FORMAT_R11G11B10_FLOAT) { + packed = nir_format_pack_r11g11b10f(b, color); + } else { + const unsigned src_channels = + isl_format_get_num_channels(key->src_format); + const unsigned src_bits[4] = { + src_fmtl->channels.r.bits, + src_fmtl->channels.g.bits, + src_fmtl->channels.b.bits, + src_fmtl->channels.a.bits, + }; + packed = nir_format_pack_uint_unmasked(b, color, src_bits, + src_channels); + } + + if (key->dst_format == ISL_FORMAT_R11G11B10_FLOAT) { + color = nir_format_unpack_11f11f10f(b, packed); + } else { + const unsigned dst_channels = + isl_format_get_num_channels(key->dst_format); + const unsigned dst_bits[4] = { + dst_fmtl->channels.r.bits, + dst_fmtl->channels.g.bits, + dst_fmtl->channels.b.bits, + dst_fmtl->channels.a.bits, + }; + color = nir_format_unpack_uint(b, packed, dst_bits, dst_channels); + } } else { const unsigned src_bpc = src_fmtl->channels.r.bits; const unsigned dst_bpc = dst_fmtl->channels.r.bits; @@ -2422,6 +2436,12 @@ get_ccs_compatible_uint_format(const struct isl_format_layout *fmtl) case ISL_FORMAT_R10G10B10A2_UINT: return ISL_FORMAT_R10G10B10A2_UINT; + case ISL_FORMAT_R11G11B10_FLOAT: + /* This obviously isn't a UINT format but we know how to bitcast it none + * the less. Let's just hope we don't have rounding error. :-) + */ + return ISL_FORMAT_R11G11B10_FLOAT; + default: unreachable("Not a compressible format"); } -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev