From ed7212f4d2407f38d4b9fb7cd86a8a5226c8d678 Mon Sep 17 00:00:00 2001 From: Vivek Pandya Date: Mon, 22 Feb 2021 10:29:23 +0530 Subject: [PATCH] Update libresoc_CmdClearColorImage to get color in output image. --- src/libre-soc/vulkan/libresoc_meta_clear.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/libre-soc/vulkan/libresoc_meta_clear.c b/src/libre-soc/vulkan/libresoc_meta_clear.c index 5650d3e94a9..80ed9904080 100644 --- a/src/libre-soc/vulkan/libresoc_meta_clear.c +++ b/src/libre-soc/vulkan/libresoc_meta_clear.c @@ -34,11 +34,18 @@ void libresoc_CmdClearColorImage( { LIBRESOC_FROM_HANDLE(libresoc_image, image, image_h); - float r = pColor->float32[0]; - float g = pColor->float32[1]; - float b = pColor->float32[2]; - float temp = 100.00 * ((r * 0.3 ) + (g * 0.3) + (b * 0.3)); - for (int i=0; i < image->size; ++i) { - image->bytes[i] = temp; + uint32_t r = pColor->uint32[0]; + uint32_t g = pColor->uint32[1]; + uint32_t b = pColor->uint32[2]; + uint32_t a = pColor->uint32[3]; + for (int i=0; i < image->size / 4; ) { + image->bytes[i] = r; + i += 1; + image->bytes[i] = g; + i += 1; + image->bytes[i] = b; + i += 1; + image->bytes[i] = a; + i += 1; } } -- 2.30.2