Update libresoc_CmdClearColorImage to get color in output image.
authorVivek Pandya <vivekvpandya@gmail.com>
Mon, 22 Feb 2021 04:59:23 +0000 (10:29 +0530)
committerVivek Pandya <vivekvpandya@gmail.com>
Mon, 22 Feb 2021 04:59:23 +0000 (10:29 +0530)
src/libre-soc/vulkan/libresoc_meta_clear.c

index 5650d3e94a96f201551fea7a0be72c909f37ea7f..80ed9904080fb948bce271d77fa53d58ea7ddb3c 100644 (file)
@@ -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;
     }
 }