DO NOT MERGE: Fix dEQP-VK.api.copy_and_blit.image_to_image_depth value range.
authorBas Nieuwenhuizen <basni@google.com>
Thu, 15 Feb 2018 10:33:22 +0000 (11:33 +0100)
committerBas Nieuwenhuizen <basni@google.com>
Thu, 15 Feb 2018 12:30:35 +0000 (13:30 +0100)
Per spec:

"Because depth or stencil aspect buffer to image copies may require format conversions on some
implementations, they are not supported on queues that do not support graphics. When copying to
a depth aspect, the data in buffer memory must be in the the range [0,1] or undefined results occur."

Initializing it to integer values falls afoul of this rule
quickly. As the image is 256 by 256, x/255.0 should always fall in the range [0,1].

Not entirely sure this would initialize combined depth stencil correctly,
but this version of CTS does not have a test using those formats with
this code.

This has been fixed upstream for a while with

"9909b9f3 Fix combined depth/stencil clear colors."

but this is not a straight backport as these tests saw some significant rework between
this CTS version and the fix.

Bug: b/73449389

Change-Id: Iaf0ce14ed4338d437f1b20033be5d0f8c0cbd699

external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp

index 43bd8a9..e248f5b 100644 (file)
@@ -189,16 +189,28 @@ void CopiesAndBlittingTestInstance::generateBuffer(tcu::PixelBufferAccess buffer
                                switch (mode)
                                {
                                        case FILL_MODE_SEQUENTIAL:
-                                               buffer.setPixel(tcu::UVec4(x, y, z, 255), x, y, z);
+                                               if (tcu::hasDepthComponent(buffer.getFormat().order))
+                                                       buffer.setPixDepth((float)x/255.0f, x, y, z);
+                                               else
+                                                       buffer.setPixel(tcu::UVec4(x, y, z, 255), x, y, z);
                                                break;
                                        case FILL_MODE_WHITE:
-                                               buffer.setPixel(tcu::UVec4(255, 255, 255, 255), x, y, z);
+                                               if (tcu::hasDepthComponent(buffer.getFormat().order))
+                                                       buffer.setPixDepth(1.0f, x, y, z);
+                                               else
+                                                       buffer.setPixel(tcu::UVec4(255, 255, 255, 255), x, y, z);
                                                break;
                                        case FILL_MODE_RED:
-                                               buffer.setPixel(tcu::UVec4(255, 0, 0, 255), x, y, z);
+                                               if (tcu::hasDepthComponent(buffer.getFormat().order))
+                                                       buffer.setPixDepth(1.0f, x, y, z);
+                                               else
+                                                       buffer.setPixel(tcu::UVec4(255, 0, 0, 255), x, y, z);
                                                break;
                                        case FILL_MODE_RANDOM:
-                                               buffer.setPixel(tcu::UVec4(rnd.getUint8(), rnd.getUint8(), rnd.getUint8(), 255), x, y, z);
+                                               if (tcu::hasDepthComponent(buffer.getFormat().order))
+                                                       buffer.setPixDepth(rnd.getUint8()/255.0f, x, y, z);
+                                               else
+                                                       buffer.setPixel(tcu::UVec4(rnd.getUint8(), rnd.getUint8(), rnd.getUint8(), 255), x, y, z);
                                        default:
                                                break;
                                }