v3dv: Take format plane when packing hw clear color
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35820>
This commit is contained in:
committed by
Marge Bot
parent
b597e838c2
commit
9e9763cf86
@@ -1238,13 +1238,11 @@ cmd_buffer_state_set_attachment_clear_color(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
v3d_X((&cmd_buffer->device->devinfo), get_internal_type_bpp_for_output_format)
|
||||
(format->planes[0].rt_type, &internal_type, &internal_bpp);
|
||||
|
||||
uint32_t internal_size = 4 << internal_bpp;
|
||||
|
||||
struct v3dv_cmd_buffer_attachment_state *attachment_state =
|
||||
&cmd_buffer->state.attachments[attachment_idx];
|
||||
|
||||
v3d_X((&cmd_buffer->device->devinfo), get_hw_clear_color)
|
||||
(color, internal_type, internal_size, &attachment_state->clear_value.color[0]);
|
||||
(color, &format->planes[0], &attachment_state->clear_value.color[0]);
|
||||
|
||||
attachment_state->vk_clear_value.color = *color;
|
||||
}
|
||||
|
||||
@@ -33,12 +33,10 @@ get_hw_clear_color(struct v3dv_device *device,
|
||||
const VkClearColorValue *color,
|
||||
VkFormat fb_format,
|
||||
VkFormat image_format,
|
||||
uint32_t internal_type,
|
||||
uint32_t internal_bpp,
|
||||
const struct v3dv_format_plane *format,
|
||||
uint32_t internal_size,
|
||||
uint32_t *hw_color)
|
||||
{
|
||||
const uint32_t internal_size = 4 << internal_bpp;
|
||||
|
||||
/* If the image format doesn't match the framebuffer format, then we are
|
||||
* trying to clear an unsupported tlb format using a compatible
|
||||
* format for the framebuffer. In this case, we want to make sure that
|
||||
@@ -46,7 +44,7 @@ get_hw_clear_color(struct v3dv_device *device,
|
||||
* not the compatible format.
|
||||
*/
|
||||
if (fb_format == image_format) {
|
||||
v3d_X((&device->devinfo), get_hw_clear_color)(color, internal_type, internal_size,
|
||||
v3d_X((&device->devinfo), get_hw_clear_color)(color, format,
|
||||
hw_color);
|
||||
} else {
|
||||
union util_color uc;
|
||||
@@ -82,10 +80,15 @@ clear_image_tlb(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
(fb_format, range->aspectMask,
|
||||
&internal_type, &internal_bpp);
|
||||
|
||||
const uint32_t internal_size = 4 << internal_bpp;
|
||||
|
||||
const struct v3dv_format *format =
|
||||
v3d_X((&cmd_buffer->device->devinfo), get_format)(fb_format);
|
||||
|
||||
union v3dv_clear_value hw_clear_value = { 0 };
|
||||
if (range->aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
get_hw_clear_color(cmd_buffer->device, &clear_value->color, fb_format,
|
||||
image->vk.format, internal_type, internal_bpp,
|
||||
image->vk.format, &format->planes[0], internal_size,
|
||||
&hw_clear_value.color[0]);
|
||||
} else {
|
||||
assert((range->aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) ||
|
||||
|
||||
@@ -353,11 +353,15 @@ v3dX(zs_buffer_from_aspect_bits)(VkImageAspectFlags aspects)
|
||||
|
||||
void
|
||||
v3dX(get_hw_clear_color)(const VkClearColorValue *color,
|
||||
uint32_t internal_type,
|
||||
uint32_t internal_size,
|
||||
const struct v3dv_format_plane *format,
|
||||
uint32_t *hw_color)
|
||||
{
|
||||
union util_color uc;
|
||||
uint32_t internal_type, internal_bpp;
|
||||
v3dX(get_internal_type_bpp_for_output_format)
|
||||
(format->rt_type, &internal_type, &internal_bpp);
|
||||
const uint32_t internal_size = 4 << internal_bpp;
|
||||
|
||||
switch (internal_type) {
|
||||
case V3D_INTERNAL_TYPE_8:
|
||||
util_pack_color(color->float32, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
|
||||
|
||||
@@ -138,8 +138,7 @@ v3dX(cmd_buffer_prepare_suspend_job_for_submit)(struct v3dv_job *job);
|
||||
|
||||
void
|
||||
v3dX(get_hw_clear_color)(const VkClearColorValue *color,
|
||||
uint32_t internal_type,
|
||||
uint32_t internal_size,
|
||||
const struct v3dv_format_plane *format,
|
||||
uint32_t *hw_color);
|
||||
|
||||
/* Used at v3dv_device */
|
||||
|
||||
Reference in New Issue
Block a user