tcu::TestStatus iterate (void);
private:
+ tcu::TextureLevel generateReferenceColorImage (const tcu::TextureFormat format, const tcu::IVec2& renderSize);
+
Move<VkRenderPass> makeRenderPass (const DeviceInterface& vk,
const VkDevice device,
const VkFormat colorFormat,
return createRenderPass(vk, device, &renderPassInfo, DE_NULL);
}
+tcu::TextureLevel EarlyFragmentSampleCountTestInstance::generateReferenceColorImage(const tcu::TextureFormat format, const tcu::IVec2 &renderSize)
+{
+ tcu::TextureLevel image (format, renderSize.x(), renderSize.y());
+ const tcu::Vec4 clearColor = tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f);
+
+ tcu::clear(image.getAccess(), clearColor);
+
+ return image;
+}
+
tcu::TestStatus EarlyFragmentSampleCountTestInstance::iterate (void)
{
const DeviceInterface& vk = m_context.getDeviceInterface();
submitCommandsAndWait(vk, device, queue, *cmdBuffer);
}
+ // When early fragment test is enabled, all samples are killed in fragment shader. The result color should be black.
+ {
+ invalidateAlloc(vk, device, *colorBufferAllocEarly);
+
+ const tcu::ConstPixelBufferAccess imagePixelAccess(mapVkFormat(colorFormat), renderSize.x(), renderSize.y(), 1, colorBufferAllocEarly->getHostPtr());
+ const tcu::TextureLevel referenceImage = generateReferenceColorImage(mapVkFormat(colorFormat), renderSize);
+
+ if (!tcu::floatThresholdCompare(m_context.getTestContext().getLog(), "Compare color output", "Early fragment image result comparison", referenceImage.getAccess(), imagePixelAccess, tcu::Vec4(0.02f), tcu::COMPARE_LOG_RESULT))
+ return tcu::TestStatus::fail("Rendered color image is not correct");
+ }
+
// The image has 32x32 pixels and each pixel has m_sampleCount samples. Half of these samples are discarded before sample counting.
// This means the reference value for passed samples is ((32 x 32) / 2 / 2) * sampleCount.
{