{
requireFeatures(context.getInstanceInterface(), context.getPhysicalDevice(), FEATURE_LARGE_POINTS);
- std::vector<Shader> shaders;
- shaders.push_back(Shader(VK_SHADER_STAGE_VERTEX_BIT, context.getBinaryCollection().get("vert")));
- shaders.push_back(Shader(VK_SHADER_STAGE_FRAGMENT_BIT, context.getBinaryCollection().get("frag")));
+ bool pointClippingOutside = true;
+
+ if (de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_KHR_maintenance2"))
+ {
+ VkPointClippingBehaviorKHR clippingBehavior = getClippingBehavior(context.getInstanceInterface(), context.getPhysicalDevice());
+
+ switch (clippingBehavior)
+ {
+ case VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR: pointClippingOutside = true; break;
+ case VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR: pointClippingOutside = false; break;
+ case invalidClippingBehavior: TCU_FAIL("Clipping behavior read failure"); break;
+ default:
+ {
+ TCU_FAIL("Unexpected clipping behavior reported");
+ }
+ }
+ }
- else
- {
- //TODO: Now we have 2 cases {some-points-drawn|nothing}, we should have {all-points-drawn|some-points-drawn|nothing}
- return tcu::TestStatus::pass("OK");
- }
+
+ std::vector<VulkanShader> shaders;
+ shaders.push_back(VulkanShader(VK_SHADER_STAGE_VERTEX_BIT, context.getBinaryCollection().get("vert")));
+ shaders.push_back(VulkanShader(VK_SHADER_STAGE_FRAGMENT_BIT, context.getBinaryCollection().get("frag")));
std::vector<Vec4> vertices;
{
VulkanDrawContext drawContext(context, drawState, drawCallData, vulkanProgram);
drawContext.draw();
- const int numBlackPixels = countPixels(drawContext.getColorPixels(), Vec4(0.0f, 0.0f, 0.0f, 1.0f), Vec4());
+ // Popful case: All pixels must be black -- nothing is drawn.
+ const int numBlackPixels = countPixels(drawContext.getColorPixels(), Vec4(0.0f, 0.0f, 0.0f, 1.0f), Vec4());
+ bool result = false;
- // Test passes if nothing or all points are rendered, allowing implementations to use either popful or pop-free point clipping rules.
- if (numBlackPixels == NUM_RENDER_PIXELS || allPointsRendered)
- return tcu::TestStatus::pass("OK");
+ // Pop-free case: All points must be rendered.
+ bool allPointsRendered = true;
+ for (std::vector<Vec4>::iterator i = vertices.begin(); i != vertices.end(); ++i)
+ {
+ if (countPixels(drawContext.getColorPixels(), Vec4(1.0f, i->z(), 0.0f, 1.0f), Vec4(0.01f)) == 0)
+ allPointsRendered = false;
+ }
+
- // All pixels must be black -- nothing is drawn.
- result = (numBlackPixels == NUM_RENDER_PIXELS);
+ if (pointClippingOutside)
+ {
++ result = (numBlackPixels == NUM_RENDER_PIXELS || allPointsRendered);
+ }
else
- return tcu::TestStatus::fail("Rendered image(s) are incorrect");
+ {
- // Rendering pixels without clipping: some pixels should not be black -- something is drawn.
- result = (numBlackPixels < NUM_RENDER_PIXELS);
++ // Rendering pixels without clipping: all points should be drawn.
++ result = (allPointsRendered == true);
+ }
+
+ return (result ? tcu::TestStatus::pass("OK") : tcu::TestStatus::fail("Rendered image(s) are incorrect"));
}
//! Wide line clipping