INTERPOLATIONFLAGS_FLATSHADE = (1 << 2),
};
+enum ResolutionValues
+{
+ RESOLUTION_POT = 256,
+ RESOLUTION_NPOT = 258
+};
+
enum PrimitiveWideness
{
PRIMITIVEWIDENESS_NARROW = 0,
class BaseRenderingTestInstance : public TestInstance
{
public:
- enum {
- DEFAULT_RENDER_SIZE = 256
- };
-
- BaseRenderingTestInstance (Context& context, VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_1_BIT, deUint32 renderSize = DEFAULT_RENDER_SIZE, VkFormat imageFormat = VK_FORMAT_R8G8B8A8_UNORM);
+ BaseRenderingTestInstance (Context& context, VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_1_BIT, deUint32 renderSize = RESOLUTION_POT, VkFormat imageFormat = VK_FORMAT_R8G8B8A8_UNORM, deUint32 additionalRenderSize = 0);
~BaseRenderingTestInstance (void);
protected:
void addImageTransitionBarrier (VkCommandBuffer commandBuffer, VkImage image, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout) const;
void drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& vertexData, VkPrimitiveTopology primitiveTopology);
void drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& vertexData, const std::vector<tcu::Vec4>& coloDrata, VkPrimitiveTopology primitiveTopology);
+ void drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& positionData, const std::vector<tcu::Vec4>& colorData, VkPrimitiveTopology primitiveTopology,
+ VkImage image, VkImage resolvedImage, VkFramebuffer frameBuffer, const deUint32 renderSize, VkBuffer resultBuffer, const Allocation& resultBufferMemory);
virtual float getLineWidth (void) const;
virtual float getPointSize (void) const;
virtual bool getLineStippleDynamic (void) const { return false; };
Move<VkBuffer> m_resultBuffer;
de::MovePtr<Allocation> m_resultBufferMemory;
const VkDeviceSize m_resultBufferSize;
+
+ const deUint32 m_additionalRenderSize;
+ const VkDeviceSize m_additionalResultBufferSize;
};
-BaseRenderingTestInstance::BaseRenderingTestInstance (Context& context, VkSampleCountFlagBits sampleCount, deUint32 renderSize, VkFormat imageFormat)
+BaseRenderingTestInstance::BaseRenderingTestInstance (Context& context, VkSampleCountFlagBits sampleCount, deUint32 renderSize, VkFormat imageFormat, deUint32 additionalRenderSize)
: TestInstance (context)
, m_renderSize (renderSize)
, m_sampleCount (sampleCount)
, m_textureFormat (vk::mapVkFormat(m_imageFormat))
, m_uniformBufferSize (sizeof(float))
, m_resultBufferSize (renderSize * renderSize * m_textureFormat.getPixelSize())
+ , m_additionalRenderSize(additionalRenderSize)
+ , m_additionalResultBufferSize(additionalRenderSize * additionalRenderSize * m_textureFormat.getPixelSize())
{
const DeviceInterface& vkd = m_context.getDeviceInterface();
const VkDevice vkDevice = m_context.getDevice();
void BaseRenderingTestInstance::drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& positionData, const std::vector<tcu::Vec4>& colorData, VkPrimitiveTopology primitiveTopology)
{
+ drawPrimitives(result, positionData, colorData, primitiveTopology, *m_image, *m_resolvedImage, *m_frameBuffer, m_renderSize, *m_resultBuffer, *m_resultBufferMemory);
+}
+void BaseRenderingTestInstance::drawPrimitives (tcu::Surface& result, const std::vector<tcu::Vec4>& positionData, const std::vector<tcu::Vec4>& colorData, VkPrimitiveTopology primitiveTopology,
+ VkImage image, VkImage resolvedImage, VkFramebuffer frameBuffer, const deUint32 renderSize, VkBuffer resultBuffer, const Allocation& resultBufferMemory)
+{
const DeviceInterface& vkd = m_context.getDeviceInterface();
const VkDevice vkDevice = m_context.getDevice();
const VkQueue queue = m_context.getUniversalQueue();
vertexInputAttributeDescriptions // const VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
};
- const std::vector<VkViewport> viewports (1, makeViewport(tcu::UVec2(m_renderSize)));
- const std::vector<VkRect2D> scissors (1, makeRect2D(tcu::UVec2(m_renderSize)));
+ const std::vector<VkViewport> viewports (1, makeViewport(tcu::UVec2(renderSize)));
+ const std::vector<VkRect2D> scissors (1, makeRect2D(tcu::UVec2(renderSize)));
const VkPipelineMultisampleStateCreateInfo multisampleStateParams =
{
// Begin Command Buffer
beginCommandBuffer(vkd, *commandBuffer);
- addImageTransitionBarrier(*commandBuffer, *m_image,
+ addImageTransitionBarrier(*commandBuffer, image,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // VkPipelineStageFlags srcStageMask
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, // VkPipelineStageFlags dstStageMask
0, // VkAccessFlags srcAccessMask
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); // VkImageLayout newLayout;
if (m_multisampling) {
- addImageTransitionBarrier(*commandBuffer, *m_resolvedImage,
+ addImageTransitionBarrier(*commandBuffer, resolvedImage,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // VkPipelineStageFlags srcStageMask
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, // VkPipelineStageFlags dstStageMask
0, // VkAccessFlags srcAccessMask
}
// Begin Render Pass
- beginRenderPass(vkd, *commandBuffer, *m_renderPass, *m_frameBuffer, vk::makeRect2D(0, 0, m_renderSize, m_renderSize), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ beginRenderPass(vkd, *commandBuffer, *m_renderPass, frameBuffer, vk::makeRect2D(0, 0, renderSize, renderSize), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
const VkDeviceSize vertexBufferOffset = 0;
endRenderPass(vkd, *commandBuffer);
// Copy Image
- copyImageToBuffer(vkd, *commandBuffer, m_multisampling ? *m_resolvedImage : *m_image, *m_resultBuffer, tcu::IVec2(m_renderSize, m_renderSize));
+ copyImageToBuffer(vkd, *commandBuffer, m_multisampling ? resolvedImage : image, resultBuffer, tcu::IVec2(renderSize, renderSize));
endCommandBuffer(vkd, *commandBuffer);
// Submit
submitCommandsAndWait(vkd, vkDevice, queue, commandBuffer.get());
- invalidateAlloc(vkd, vkDevice, *m_resultBufferMemory);
- tcu::copy(result.getAccess(), tcu::ConstPixelBufferAccess(m_textureFormat, tcu::IVec3(m_renderSize, m_renderSize, 1), m_resultBufferMemory->getHostPtr()));
+ invalidateAlloc(vkd, vkDevice, resultBufferMemory);
+ tcu::copy(result.getAccess(), tcu::ConstPixelBufferAccess(m_textureFormat, tcu::IVec3(renderSize, renderSize, 1), resultBufferMemory.getHostPtr()));
}
float BaseRenderingTestInstance::getLineWidth (void) const
PrimitiveWideness wideness,
VkSampleCountFlagBits sampleCount,
LineStipple stipple,
- VkLineRasterizationModeEXT lineRasterizationMode);
+ VkLineRasterizationModeEXT lineRasterizationMode,
+ const deUint32 additionalRenderSize = 0);
virtual tcu::TestStatus iterate (void);
virtual float getLineWidth (void) const;
bool getLineStippleEnable (void) const { return m_stipple != LINESTIPPLE_DISABLED; }
private:
virtual void generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines) = DE_NULL;
+ bool resultHasAlpha (tcu::Surface& result);
+
int m_iteration;
const int m_iterationCount;
VkPrimitiveTopology m_primitiveTopology;
std::vector<float> m_lineWidths;
LineStipple m_stipple;
VkLineRasterizationModeEXT m_lineRasterizationMode;
+ Move<VkImage> m_additionalImage;
+ de::MovePtr<Allocation> m_additionalImageMemory;
+ Move<VkImageView> m_additionalImageView;
+ Move<VkImage> m_additionalResolvedImage;
+ de::MovePtr<Allocation> m_additionalResolvedImageMemory;
+ Move<VkImageView> m_additionalResolvedImageView;
+ Move<VkFramebuffer> m_additionalFrameBuffer;
+ Move<VkBuffer> m_additionalResultBuffer;
+ de::MovePtr<Allocation> m_additionalResultBufferMemory;
};
BaseLineTestInstance::BaseLineTestInstance (Context& context,
PrimitiveWideness wideness,
VkSampleCountFlagBits sampleCount,
LineStipple stipple,
- VkLineRasterizationModeEXT lineRasterizationMode)
- : BaseRenderingTestInstance (context, sampleCount)
+ VkLineRasterizationModeEXT lineRasterizationMode,
+ const deUint32 additionalRenderSize)
+ : BaseRenderingTestInstance (context, sampleCount, RESOLUTION_POT, VK_FORMAT_R8G8B8A8_UNORM, additionalRenderSize)
, m_iteration (0)
, m_iterationCount (3)
, m_primitiveTopology (primitiveTopology)
}
else
DE_ASSERT(false);
+
+ // Create image, image view and frame buffer for testing at an additional resolution if required.
+ if (m_additionalRenderSize != 0)
+ {
+ const DeviceInterface& vkd = m_context.getDeviceInterface();
+ const VkDevice vkDevice = m_context.getDevice();
+ const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
+ Allocator& allocator = m_context.getDefaultAllocator();
+ DescriptorPoolBuilder descriptorPoolBuilder;
+ DescriptorSetLayoutBuilder descriptorSetLayoutBuilder;
+ {
+ const VkImageUsageFlags imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+ const VkImageCreateInfo imageCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkImageCreateFlags flags;
+ VK_IMAGE_TYPE_2D, // VkImageType imageType;
+ m_imageFormat, // VkFormat format;
+ { m_additionalRenderSize, m_additionalRenderSize, 1u }, // VkExtent3D extent;
+ 1u, // deUint32 mipLevels;
+ 1u, // deUint32 arrayLayers;
+ m_sampleCount, // VkSampleCountFlagBits samples;
+ VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
+ imageUsage, // VkImageUsageFlags usage;
+ VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
+ 1u, // deUint32 queueFamilyIndexCount;
+ &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
+ VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout;
+ };
+
+ m_additionalImage = vk::createImage(vkd, vkDevice, &imageCreateInfo, DE_NULL);
+
+ m_additionalImageMemory = allocator.allocate(getImageMemoryRequirements(vkd, vkDevice, *m_additionalImage), MemoryRequirement::Any);
+ VK_CHECK(vkd.bindImageMemory(vkDevice, *m_additionalImage, m_additionalImageMemory->getMemory(), m_additionalImageMemory->getOffset()));
+ }
+
+ // Image View
+ {
+ const VkImageViewCreateInfo imageViewCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkImageViewCreateFlags flags;
+ *m_additionalImage, // VkImage image;
+ VK_IMAGE_VIEW_TYPE_2D, // VkImageViewType viewType;
+ m_imageFormat, // VkFormat format;
+ makeComponentMappingRGBA(), // VkComponentMapping components;
+ {
+ VK_IMAGE_ASPECT_COLOR_BIT, // VkImageAspectFlags aspectMask;
+ 0u, // deUint32 baseMipLevel;
+ 1u, // deUint32 mipLevels;
+ 0u, // deUint32 baseArrayLayer;
+ 1u, // deUint32 arraySize;
+ }, // VkImageSubresourceRange subresourceRange;
+ };
+
+ m_additionalImageView = vk::createImageView(vkd, vkDevice, &imageViewCreateInfo, DE_NULL);
+ }
+
+ if (m_multisampling)
+ {
+ {
+ const VkImageUsageFlags imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+ const VkImageCreateInfo imageCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkImageCreateFlags flags;
+ VK_IMAGE_TYPE_2D, // VkImageType imageType;
+ m_imageFormat, // VkFormat format;
+ { m_additionalRenderSize, m_additionalRenderSize, 1u }, // VkExtent3D extent;
+ 1u, // deUint32 mipLevels;
+ 1u, // deUint32 arrayLayers;
+ VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
+ VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
+ imageUsage, // VkImageUsageFlags usage;
+ VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
+ 1u, // deUint32 queueFamilyIndexCount;
+ &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
+ VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout;
+ };
+
+ m_additionalResolvedImage = vk::createImage(vkd, vkDevice, &imageCreateInfo, DE_NULL);
+ m_additionalResolvedImageMemory = allocator.allocate(getImageMemoryRequirements(vkd, vkDevice, *m_additionalResolvedImage), MemoryRequirement::Any);
+ VK_CHECK(vkd.bindImageMemory(vkDevice, *m_additionalResolvedImage, m_additionalResolvedImageMemory->getMemory(), m_additionalResolvedImageMemory->getOffset()));
+ }
+
+ // Image view
+ {
+ const VkImageViewCreateInfo imageViewCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkImageViewCreateFlags flags;
+ *m_additionalResolvedImage, // VkImage image;
+ VK_IMAGE_VIEW_TYPE_2D, // VkImageViewType viewType;
+ m_imageFormat, // VkFormat format;
+ makeComponentMappingRGBA(), // VkComponentMapping components;
+ {
+ VK_IMAGE_ASPECT_COLOR_BIT, // VkImageAspectFlags aspectMask;
+ 0u, // deUint32 baseMipLevel;
+ 1u, // deUint32 mipLevels;
+ 0u, // deUint32 baseArrayLayer;
+ 1u, // deUint32 arraySize;
+ }, // VkImageSubresourceRange subresourceRange;
+ };
+ m_additionalResolvedImageView = vk::createImageView(vkd, vkDevice, &imageViewCreateInfo, DE_NULL);
+ }
+ }
+
+ {
+ const VkImageView attachments[] =
+ {
+ *m_additionalImageView,
+ *m_additionalResolvedImageView
+ };
+
+ const VkFramebufferCreateInfo framebufferCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFramebufferCreateFlags flags;
+ *m_renderPass, // VkRenderPass renderPass;
+ m_multisampling ? 2u : 1u, // deUint32 attachmentCount;
+ attachments, // const VkImageView* pAttachments;
+ m_additionalRenderSize, // deUint32 width;
+ m_additionalRenderSize, // deUint32 height;
+ 1u, // deUint32 layers;
+ };
+ m_additionalFrameBuffer = createFramebuffer(vkd, vkDevice, &framebufferCreateInfo, DE_NULL);
+ }
+
+ // Framebuffer
+ {
+ const VkBufferCreateInfo bufferCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkBufferCreateFlags flags;
+ m_additionalResultBufferSize, // VkDeviceSize size;
+ VK_BUFFER_USAGE_TRANSFER_DST_BIT, // VkBufferUsageFlags usage;
+ VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
+ 1u, // deUint32 queueFamilyIndexCount;
+ &queueFamilyIndex // const deUint32* pQueueFamilyIndices;
+ };
+
+ m_additionalResultBuffer = createBuffer(vkd, vkDevice, &bufferCreateInfo);
+ m_additionalResultBufferMemory = allocator.allocate(getBufferMemoryRequirements(vkd, vkDevice, *m_additionalResultBuffer), MemoryRequirement::HostVisible);
+
+ VK_CHECK(vkd.bindBufferMemory(vkDevice, *m_additionalResultBuffer, m_additionalResultBufferMemory->getMemory(), m_additionalResultBufferMemory->getOffset()));
+ }
+ }
+}
+
+bool BaseLineTestInstance::resultHasAlpha(tcu::Surface& resultImage)
+{
+ bool hasAlpha = false;
+ for (int y = 0; y < resultImage.getHeight() && !hasAlpha; ++y)
+ for (int x = 0; x < resultImage.getWidth(); ++x)
+ {
+ const tcu::RGBA color = resultImage.getPixel(x, y);
+ if (color.getAlpha() > 0 && color.getAlpha() < 0xFF)
+ {
+ hasAlpha = true;
+ break;
+ }
+ }
+ return hasAlpha;
}
tcu::TestStatus BaseLineTestInstance::iterate (void)
const tcu::ScopedLogSection section (m_context.getTestContext().getLog(), iterationDescription, iterationDescription);
const float lineWidth = getLineWidth();
tcu::Surface resultImage (m_renderSize, m_renderSize);
+ tcu::Surface additionalResultImage (m_additionalRenderSize, m_additionalRenderSize);
std::vector<tcu::Vec4> drawBuffer;
std::vector<LineSceneSpec::SceneLine> lines;
drawPrimitives(resultImage, drawBuffer, m_primitiveTopology);
// compare
- {
- RasterizationArguments args;
- LineSceneSpec scene;
+ RasterizationArguments args;
+ LineSceneSpec scene;
+ tcu::IVec4 colorBits = tcu::getTextureFormatBitDepth(getTextureFormat());
- tcu::IVec4 colorBits = tcu::getTextureFormatBitDepth(getTextureFormat());
+ args.numSamples = m_multisampling ? 1 : 0;
+ args.subpixelBits = m_subpixelBits;
+ args.redBits = colorBits[0];
+ args.greenBits = colorBits[1];
+ args.blueBits = colorBits[2];
- args.numSamples = m_multisampling ? 1 : 0;
- args.subpixelBits = m_subpixelBits;
- args.redBits = colorBits[0];
- args.greenBits = colorBits[1];
- args.blueBits = colorBits[2];
+ scene.lines.swap(lines);
+ scene.lineWidth = lineWidth;
+ scene.stippleEnable = getLineStippleEnable();
+ scene.stippleFactor = getLineStippleEnable() ? lineStippleFactor : 1;
+ scene.stipplePattern = getLineStippleEnable() ? lineStipplePattern : 0xFFFF;
+ scene.isStrip = m_primitiveTopology == VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
+ scene.isSmooth = m_lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
+
+ // Choose verification mode. Smooth lines assume mostly over-rasterization (bloated lines with a falloff).
+ // Stippled lines lose some precision across segments in a strip, so need a weaker threshold than normal
+ // lines. For simple cases, check for an exact match (STRICT).
+ if (scene.isSmooth)
+ scene.verificationMode = tcu::VERIFICATIONMODE_SMOOTH;
+ else if (scene.stippleEnable)
+ scene.verificationMode = tcu::VERIFICATIONMODE_WEAKER;
+ else
+ scene.verificationMode = tcu::VERIFICATIONMODE_STRICT;
- scene.lines.swap(lines);
- scene.lineWidth = lineWidth;
- scene.stippleEnable = getLineStippleEnable();
- scene.stippleFactor = getLineStippleEnable() ? lineStippleFactor : 1;
- scene.stipplePattern = getLineStippleEnable() ? lineStipplePattern : 0xFFFF;
- scene.isStrip = m_primitiveTopology == VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
- scene.isSmooth = m_lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
-
- // Choose verification mode. Smooth lines assume mostly over-rasterization (bloated lines with a falloff).
- // Stippled lines lose some precision across segments in a strip, so need a weaker threshold than normal
- // lines. For simple cases, check for an exact match (STRICT).
+ if (m_lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT)
+ {
+ // bresenham is "no AA" in GL, so set numSamples to zero.
+ args.numSamples = 0;
+ if (!verifyLineGroupRasterization(resultImage, scene, args, m_context.getTestContext().getLog()))
+ m_allIterationsPassed = false;
+ }
+ else
+ {
if (scene.isSmooth)
- scene.verificationMode = tcu::VERIFICATIONMODE_SMOOTH;
- else if (scene.stippleEnable)
- scene.verificationMode = tcu::VERIFICATIONMODE_WEAKER;
- else
- scene.verificationMode = tcu::VERIFICATIONMODE_STRICT;
+ {
+ // Smooth lines get the fractional coverage multiplied into the alpha component,
+ // so do a sanity check to validate that there is at least one pixel in the image
+ // with a fractional opacity.
+ bool hasAlpha = resultHasAlpha(resultImage);
+ if (!hasAlpha)
+ {
+ m_context.getTestContext().getLog() << tcu::TestLog::Message << "Missing alpha transparency (failed)." << tcu::TestLog::EndMessage;
+ m_allIterationsPassed = false;
+ }
+ }
- if (m_lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT)
+ if (!verifyRelaxedLineGroupRasterization(resultImage, scene, args, m_context.getTestContext().getLog(), (0 == m_multisampling)))
{
- // bresenham is "no AA" in GL, so set numSamples to zero.
- args.numSamples = 0;
- if (!verifyLineGroupRasterization(resultImage, scene, args, m_context.getTestContext().getLog()))
+ // Retry with weaker verification. If it passes, consider it a quality warning.
+ scene.verificationMode = tcu::VERIFICATIONMODE_WEAKER;
+ if (!verifyRelaxedLineGroupRasterization(resultImage, scene, args, m_context.getTestContext().getLog()))
m_allIterationsPassed = false;
+ else
+ m_qualityWarning = true;
}
- else
+
+ if (m_additionalRenderSize != 0)
{
+ const std::vector<tcu::Vec4> colorData(drawBuffer.size(), tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
+
if (scene.isSmooth)
- {
- // Smooth lines get the fractional coverage multiplied into the alpha component,
- // so do a sanity check to validate that there is at least one pixel in the image
- // with a fractional opacity.
- bool hasAlpha = false;
- for (int y = 0; y < resultImage.getHeight() && !hasAlpha; ++y)
- for (int x = 0; x < resultImage.getWidth(); ++x)
- {
- const tcu::RGBA color = resultImage.getPixel(x, y);
- if (color.getAlpha() > 0 && color.getAlpha() < 0xFF)
- {
- hasAlpha = true;
- break;
- }
- }
- if (!hasAlpha)
- {
- m_context.getTestContext().getLog() << tcu::TestLog::Message << "Missing alpha transparency (failed)." << tcu::TestLog::EndMessage;
- m_allIterationsPassed = false;
- }
- }
+ scene.verificationMode = tcu::VERIFICATIONMODE_SMOOTH;
+ else if (scene.stippleEnable)
+ scene.verificationMode = tcu::VERIFICATIONMODE_WEAKER;
+ else
+ scene.verificationMode = tcu::VERIFICATIONMODE_STRICT;
- if (!verifyRelaxedLineGroupRasterization(resultImage, scene, args, m_context.getTestContext().getLog()))
+ drawPrimitives(additionalResultImage, drawBuffer, colorData, m_primitiveTopology, *m_additionalImage, *m_additionalResolvedImage, *m_additionalFrameBuffer, m_additionalRenderSize, *m_additionalResultBuffer, *m_additionalResultBufferMemory);
+
+ // Compare
+ if (!verifyRelaxedLineGroupRasterization(additionalResultImage, scene, args, m_context.getTestContext().getLog(), (0 == m_multisampling)))
{
// Retry with weaker verification. If it passes, consider it a quality warning.
scene.verificationMode = tcu::VERIFICATIONMODE_WEAKER;
- if (!verifyRelaxedLineGroupRasterization(resultImage, scene, args, m_context.getTestContext().getLog()))
+ if (!verifyRelaxedLineGroupRasterization(resultImage, scene, args, m_context.getTestContext().getLog(), (0 == m_multisampling)))
m_allIterationsPassed = false;
else
m_qualityWarning = true;
class PointTestInstance : public BaseRenderingTestInstance
{
public:
- PointTestInstance (Context& context, PrimitiveWideness wideness, VkSampleCountFlagBits sampleCount, /*ignored*/LineStipple stipple, /*ignored*/VkLineRasterizationModeEXT lineRasterizationMode);
+ PointTestInstance (Context& context, PrimitiveWideness wideness, VkSampleCountFlagBits sampleCount, /*ignored*/LineStipple stipple, /*ignored*/VkLineRasterizationModeEXT lineRasterizationMode, deUint32 renderSize);
virtual tcu::TestStatus iterate (void);
virtual float getPointSize (void) const;
std::vector<float> m_pointSizes;
};
-PointTestInstance::PointTestInstance (Context& context, PrimitiveWideness wideness, VkSampleCountFlagBits sampleCount, /*ignored*/LineStipple stipple, /*ignored*/VkLineRasterizationModeEXT lineRasterizationMode)
+PointTestInstance::PointTestInstance (Context& context, PrimitiveWideness wideness, VkSampleCountFlagBits sampleCount, /*ignored*/LineStipple stipple, /*ignored*/VkLineRasterizationModeEXT lineRasterizationMode, deUint32)
: BaseRenderingTestInstance (context, sampleCount)
, m_iteration (0)
, m_iterationCount (3)
class WidenessTestCase : public BaseRenderingTestCase
{
public:
- WidenessTestCase (tcu::TestContext& context, const std::string& name, const std::string& description, PrimitiveWideness wideness, bool isLineTest, VkSampleCountFlagBits sampleCount, LineStipple stipple, VkLineRasterizationModeEXT lineRasterizationMode)
+ WidenessTestCase (tcu::TestContext& context, const std::string& name, const std::string& description, PrimitiveWideness wideness, bool isLineTest, VkSampleCountFlagBits sampleCount, LineStipple stipple, VkLineRasterizationModeEXT lineRasterizationMode, deUint32 additionalRenderSize = 0)
: BaseRenderingTestCase(context, name, description, sampleCount)
- , m_wideness(wideness)
+ , m_wideness (wideness)
, m_isLineTest (isLineTest)
, m_stipple(stipple)
, m_lineRasterizationMode(lineRasterizationMode)
+ , m_additionalRenderSize (additionalRenderSize)
{}
virtual TestInstance* createInstance (Context& context) const
{
- return new ConcreteTestInstance(context, m_wideness, m_sampleCount, m_stipple, m_lineRasterizationMode);
+ return new ConcreteTestInstance(context, m_wideness, m_sampleCount, m_stipple, m_lineRasterizationMode, m_additionalRenderSize);
}
virtual void checkSupport (Context& context) const
virtual bool getLineStippleDynamic (void) const { return m_stipple == LINESTIPPLE_DYNAMIC; };
protected:
- const PrimitiveWideness m_wideness;
- const bool m_isLineTest;
+ const PrimitiveWideness m_wideness;
+ const bool m_isLineTest;
const LineStipple m_stipple;
const VkLineRasterizationModeEXT m_lineRasterizationMode;
+ const deUint32 m_additionalRenderSize;
};
class LinesTestInstance : public BaseLineTestInstance
{
public:
- LinesTestInstance (Context& context, PrimitiveWideness wideness, VkSampleCountFlagBits sampleCount, LineStipple stipple, VkLineRasterizationModeEXT lineRasterizationMode)
- : BaseLineTestInstance(context, VK_PRIMITIVE_TOPOLOGY_LINE_LIST, wideness, sampleCount, stipple, lineRasterizationMode)
+ LinesTestInstance (Context& context, PrimitiveWideness wideness, VkSampleCountFlagBits sampleCount, LineStipple stipple, VkLineRasterizationModeEXT lineRasterizationMode, deUint32 additionalRenderSize = 0)
+ : BaseLineTestInstance(context, VK_PRIMITIVE_TOPOLOGY_LINE_LIST, wideness, sampleCount, stipple, lineRasterizationMode, additionalRenderSize)
{}
virtual void generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines);
void LinesTestInstance::generateLines (int iteration, std::vector<tcu::Vec4>& outData, std::vector<LineSceneSpec::SceneLine>& outLines)
{
- outData.resize(6);
+ outData.resize(8);
switch (iteration)
{
outData[3] = tcu::Vec4(-0.3f, 0.2f, 0.0f, 1.0f);
outData[4] = tcu::Vec4(-1.5f, -0.4f, 0.0f, 1.0f);
outData[5] = tcu::Vec4( 0.1f, 0.5f, 0.0f, 1.0f);
+ outData[6] = tcu::Vec4( 0.75f, -0.4f, 0.0f, 1.0f);
+ outData[7] = tcu::Vec4( 0.3f, 0.8f, 0.0f, 1.0f);
break;
case 1:
outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f);
outData[4] = tcu::Vec4( 0.88f, 0.9f, 0.0f, 1.0f);
outData[5] = tcu::Vec4( 0.18f, -0.2f, 0.0f, 1.0f);
+ outData[6] = tcu::Vec4( 0.0f, 1.0f, 0.0f, 1.0f);
+ outData[7] = tcu::Vec4( 0.0f, -1.0f, 0.0f, 1.0f);
break;
case 2:
outData[0] = tcu::Vec4( -0.9f, -0.3f, 0.0f, 1.0f);
- outData[1] = tcu::Vec4( 0.9f, -0.9f, 0.0f, 1.0f);
+ outData[1] = tcu::Vec4( 1.1f, -0.9f, 0.0f, 1.0f);
outData[2] = tcu::Vec4( 0.7f, -0.1f, 0.0f, 1.0f);
outData[3] = tcu::Vec4( 0.11f, 0.2f, 0.0f, 1.0f);
outData[4] = tcu::Vec4( 0.88f, 0.7f, 0.0f, 1.0f);
outData[5] = tcu::Vec4( 0.8f, -0.7f, 0.0f, 1.0f);
+ outData[6] = tcu::Vec4( 1.0f, 0.0f, 0.0f, 1.0f);
+ outData[7] = tcu::Vec4( -1.0f, 0.0f, 0.0f, 1.0f);
break;
}
- outLines.resize(3);
+ outLines.resize(4);
outLines[0].positions[0] = outData[0];
outLines[0].positions[1] = outData[1];
outLines[1].positions[0] = outData[2];
outLines[1].positions[1] = outData[3];
outLines[2].positions[0] = outData[4];
outLines[2].positions[1] = outData[5];
+ outLines[3].positions[0] = outData[6];
+ outLines[3].positions[1] = outData[7];
// log
m_context.getTestContext().getLog() << tcu::TestLog::Message << "Rendering " << outLines.size() << " lines(s): (width = " << getLineWidth() << ")" << tcu::TestLog::EndMessage;
class LineStripTestInstance : public BaseLineTestInstance
{
public:
- LineStripTestInstance (Context& context, PrimitiveWideness wideness, VkSampleCountFlagBits sampleCount, LineStipple stipple, VkLineRasterizationModeEXT lineRasterizationMode)
+ LineStripTestInstance (Context& context, PrimitiveWideness wideness, VkSampleCountFlagBits sampleCount, LineStipple stipple, VkLineRasterizationModeEXT lineRasterizationMode, deUint32)
: BaseLineTestInstance(context, VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, wideness, sampleCount, stipple, lineRasterizationMode)
{}
int FillRuleTestInstance::getRenderSize (FillRuleCaseType type) const
{
if (type == FILLRULECASE_CLIPPED_FULL || type == FILLRULECASE_CLIPPED_PARTIAL)
- return DEFAULT_RENDER_SIZE / 4;
+ return RESOLUTION_POT / 4;
else
- return DEFAULT_RENDER_SIZE;
+ return RESOLUTION_POT;
}
int FillRuleTestInstance::getNumIterations (FillRuleCaseType type) const
{
public:
CullingTestInstance (Context& context, VkCullModeFlags cullMode, VkPrimitiveTopology primitiveTopology, VkFrontFace frontFace, VkPolygonMode polygonMode)
- : BaseRenderingTestInstance (context, VK_SAMPLE_COUNT_1_BIT, DEFAULT_RENDER_SIZE)
+ : BaseRenderingTestInstance (context, VK_SAMPLE_COUNT_1_BIT, RESOLUTION_POT)
, m_cullMode (cullMode)
, m_primitiveTopology (primitiveTopology)
, m_frontFace (frontFace)
{
public:
DiscardTestInstance (Context& context, VkPrimitiveTopology primitiveTopology, deBool queryFragmentShaderInvocations)
- : BaseRenderingTestInstance (context, VK_SAMPLE_COUNT_1_BIT, DEFAULT_RENDER_SIZE)
+ : BaseRenderingTestInstance (context, VK_SAMPLE_COUNT_1_BIT, RESOLUTION_POT)
, m_primitiveTopology (primitiveTopology)
, m_queryFragmentShaderInvocations (queryFragmentShaderInvocations)
{}
public:
TriangleInterpolationTestInstance (Context& context, VkPrimitiveTopology primitiveTopology, int flags, VkSampleCountFlagBits sampleCount)
- : BaseRenderingTestInstance (context, sampleCount, DEFAULT_RENDER_SIZE)
+ : BaseRenderingTestInstance (context, sampleCount, RESOLUTION_POT)
, m_primitiveTopology (primitiveTopology)
, m_projective ((flags & INTERPOLATIONFLAGS_PROJECTED) != 0)
, m_iterationCount (3)
LineStipple stipple = (LineStipple)i;
- g->addChild(new WidenessTestCase<LinesTestInstance> (testCtx, "lines", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_LIST, verify rasterization result", PRIMITIVEWIDENESS_NARROW, true, VK_SAMPLE_COUNT_1_BIT, stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT));
+ g->addChild(new WidenessTestCase<LinesTestInstance> (testCtx, "lines", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_LIST, verify rasterization result", PRIMITIVEWIDENESS_NARROW, true, VK_SAMPLE_COUNT_1_BIT, stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT, i == 0 ? RESOLUTION_NPOT : 0));
g->addChild(new WidenessTestCase<LineStripTestInstance> (testCtx, "line_strip", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, verify rasterization result", PRIMITIVEWIDENESS_NARROW, true, VK_SAMPLE_COUNT_1_BIT, stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT));
g->addChild(new WidenessTestCase<LinesTestInstance> (testCtx, "lines_wide", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_LIST with wide lines, verify rasterization result", PRIMITIVEWIDENESS_WIDE, true, VK_SAMPLE_COUNT_1_BIT, stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT));
g->addChild(new WidenessTestCase<LineStripTestInstance> (testCtx, "line_strip_wide", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_STRIP with wide lines, verify rasterization result", PRIMITIVEWIDENESS_WIDE, true, VK_SAMPLE_COUNT_1_BIT, stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT));
LineStipple stipple = (LineStipple)i;
- g->addChild(new WidenessTestCase<LinesTestInstance> (testCtx, "lines", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_LIST, verify rasterization result", PRIMITIVEWIDENESS_NARROW, true, samples[samplesNdx], stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT));
+ g->addChild(new WidenessTestCase<LinesTestInstance> (testCtx, "lines", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_LIST, verify rasterization result", PRIMITIVEWIDENESS_NARROW, true, samples[samplesNdx], stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT, i == 0 ? RESOLUTION_NPOT : 0));
g->addChild(new WidenessTestCase<LineStripTestInstance> (testCtx, "line_strip", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, verify rasterization result", PRIMITIVEWIDENESS_NARROW, true, samples[samplesNdx], stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT));
g->addChild(new WidenessTestCase<LinesTestInstance> (testCtx, "lines_wide", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_LIST with wide lines, verify rasterization result", PRIMITIVEWIDENESS_WIDE, true, samples[samplesNdx], stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT));
g->addChild(new WidenessTestCase<LineStripTestInstance> (testCtx, "line_strip_wide", "Render primitives as VK_PRIMITIVE_TOPOLOGY_LINE_STRIP with wide lines, verify rasterization result", PRIMITIVEWIDENESS_WIDE, true, samples[samplesNdx], stipple, VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT));