intel/blorp: Use ISL instead of bitcast_color_value_to_uint
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
parent
09ced65420
commit
a6b66a7b26
|
@ -2393,75 +2393,6 @@ get_ccs_compatible_uint_format(const struct isl_format_layout *fmtl)
|
|||
}
|
||||
}
|
||||
|
||||
/* Takes an isl_color_value and returns a color value that is the original
|
||||
* color value only bit-casted to a UINT format. This value, together with
|
||||
* the format from get_ccs_compatible_uint_format, will yield the same bit
|
||||
* value as the original color and format.
|
||||
*/
|
||||
static union isl_color_value
|
||||
bitcast_color_value_to_uint(union isl_color_value color,
|
||||
const struct isl_format_layout *fmtl)
|
||||
{
|
||||
/* All CCS formats have the same number of bits in each channel */
|
||||
const struct isl_channel_layout *chan = &fmtl->channels.r;
|
||||
|
||||
union isl_color_value bits;
|
||||
switch (chan->type) {
|
||||
case ISL_UINT:
|
||||
case ISL_SINT:
|
||||
/* Hardware will ignore the high bits so there's no need to cast */
|
||||
bits = color;
|
||||
break;
|
||||
|
||||
case ISL_UNORM:
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
bits.u32[i] = _mesa_float_to_unorm(color.f32[i], chan->bits);
|
||||
break;
|
||||
|
||||
case ISL_SNORM:
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
bits.i32[i] = _mesa_float_to_snorm(color.f32[i], chan->bits);
|
||||
break;
|
||||
|
||||
case ISL_SFLOAT:
|
||||
switch (chan->bits) {
|
||||
case 16:
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
bits.u32[i] = _mesa_float_to_half(color.f32[i]);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
bits = color;
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("Invalid float format size");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("Invalid channel type");
|
||||
}
|
||||
|
||||
switch (fmtl->format) {
|
||||
case ISL_FORMAT_B8G8R8A8_UNORM:
|
||||
case ISL_FORMAT_B8G8R8A8_UNORM_SRGB:
|
||||
case ISL_FORMAT_B8G8R8X8_UNORM:
|
||||
case ISL_FORMAT_B8G8R8X8_UNORM_SRGB: {
|
||||
/* If it's a BGRA format, we need to swap blue and red */
|
||||
uint32_t tmp = bits.u32[0];
|
||||
bits.u32[0] = bits.u32[2];
|
||||
bits.u32[2] = tmp;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break; /* Nothing to do */
|
||||
}
|
||||
|
||||
return bits;
|
||||
}
|
||||
|
||||
void
|
||||
blorp_surf_convert_to_uncompressed(const struct isl_device *isl_dev,
|
||||
struct brw_blorp_surface_info *info,
|
||||
|
@ -2595,8 +2526,11 @@ blorp_copy(struct blorp_batch *batch,
|
|||
assert(isl_formats_are_ccs_e_compatible(batch->blorp->isl_dev->info,
|
||||
linear_src_format,
|
||||
params.src.view.format));
|
||||
params.src.clear_color =
|
||||
bitcast_color_value_to_uint(params.src.clear_color, src_fmtl);
|
||||
uint32_t packed[4];
|
||||
isl_color_value_pack(¶ms.src.clear_color,
|
||||
params.src.surf.format, packed);
|
||||
isl_color_value_unpack(¶ms.src.clear_color,
|
||||
params.src.view.format, packed);
|
||||
}
|
||||
|
||||
if (params.dst.aux_usage == ISL_AUX_USAGE_CCS_E) {
|
||||
|
@ -2606,8 +2540,11 @@ blorp_copy(struct blorp_batch *batch,
|
|||
assert(isl_formats_are_ccs_e_compatible(batch->blorp->isl_dev->info,
|
||||
linear_dst_format,
|
||||
params.dst.view.format));
|
||||
params.dst.clear_color =
|
||||
bitcast_color_value_to_uint(params.dst.clear_color, dst_fmtl);
|
||||
uint32_t packed[4];
|
||||
isl_color_value_pack(¶ms.dst.clear_color,
|
||||
params.dst.surf.format, packed);
|
||||
isl_color_value_unpack(¶ms.dst.clear_color,
|
||||
params.dst.view.format, packed);
|
||||
}
|
||||
|
||||
wm_prog_key.src_bpc =
|
||||
|
|
Loading…
Reference in New Issue