mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
zink: do not copy colors through floats
Copying per compoents might flush NaN values, leading to changes in the values, so it'd be safer to copy as unsigned integers here. But in one of the cases here we can do even better, and just copy the whole damn union instead. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14932>
This commit is contained in:
parent
745fc95659
commit
883017b67e
1 changed files with 9 additions and 10 deletions
|
|
@ -75,10 +75,10 @@ clear_in_rp(struct pipe_context *pctx,
|
|||
|
||||
if (buffers & PIPE_CLEAR_COLOR) {
|
||||
VkClearColorValue color;
|
||||
color.float32[0] = pcolor->f[0];
|
||||
color.float32[1] = pcolor->f[1];
|
||||
color.float32[2] = pcolor->f[2];
|
||||
color.float32[3] = pcolor->f[3];
|
||||
color.uint32[0] = pcolor->ui[0];
|
||||
color.uint32[1] = pcolor->ui[1];
|
||||
color.uint32[2] = pcolor->ui[2];
|
||||
color.uint32[3] = pcolor->ui[3];
|
||||
|
||||
for (unsigned i = 0; i < fb->nr_cbufs; i++) {
|
||||
if (!(buffers & (PIPE_CLEAR_COLOR0 << i)) || !fb->cbufs[i])
|
||||
|
|
@ -134,10 +134,10 @@ clear_color_no_rp(struct zink_context *ctx, struct zink_resource *res, const uni
|
|||
range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
|
||||
VkClearColorValue color;
|
||||
color.float32[0] = pcolor->f[0];
|
||||
color.float32[1] = pcolor->f[1];
|
||||
color.float32[2] = pcolor->f[2];
|
||||
color.float32[3] = pcolor->f[3];
|
||||
color.uint32[0] = pcolor->ui[0];
|
||||
color.uint32[1] = pcolor->ui[1];
|
||||
color.uint32[2] = pcolor->ui[2];
|
||||
color.uint32[3] = pcolor->ui[3];
|
||||
|
||||
if (zink_resource_image_needs_barrier(res, VK_IMAGE_LAYOUT_GENERAL, 0, 0) &&
|
||||
zink_resource_image_needs_barrier(res, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 0, 0))
|
||||
|
|
@ -533,8 +533,7 @@ zink_fb_clear_util_unpack_clear_color(struct zink_framebuffer_clear_data *clear,
|
|||
}
|
||||
color->f[3] = clear->color.color.f[3];
|
||||
} else {
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
color->f[i] = clear->color.color.f[i];
|
||||
*color = clear->color.color;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue