}
};
+inline bool imageCompare (tcu::TestLog& log, const tcu::ConstPixelBufferAccess& reference, const tcu::ConstPixelBufferAccess& result, const vk::VkPrimitiveTopology topology)
+{
+ if (topology == vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST)
+ {
+ return tcu::intThresholdPositionDeviationCompare(
+ log, "Result", "Image comparison result", reference, result,
+ tcu::UVec4(4u), // color threshold
+ tcu::IVec3(1, 1, 0), // position deviation tolerance
+ true, // don't check the pixels at the boundary
+ tcu::COMPARE_LOG_RESULT);
+ }
+ else
+ return tcu::fuzzyCompare(log, "Result", "Image comparison result", reference, result, 0.05f, tcu::COMPARE_LOG_RESULT);
+}
+
class DrawTestInstanceBase : public TestInstance
{
public:
device,
m_vertexBuffer->getBoundMemory().getMemory(),
m_vertexBuffer->getBoundMemory().getOffset(),
- dataSize);
+ VK_WHOLE_SIZE);
const CmdPoolCreateInfo cmdPoolCreateInfo(queueFamilyIndex);
m_cmdPool = vk::createCommandPool(m_vk, device, &cmdPoolCreateInfo);
<< "layout(location = 0) out vec4 out_color;\n"
<< "out gl_PerVertex {\n"
- << " vec4 gl_Position;\n"
+ << " vec4 gl_Position;\n"
+ << " float gl_PointSize;\n"
<< "};\n"
<< "void main() {\n"
- << " gl_Position = in_position;\n"
- << " out_color = in_color;\n"
+ << " gl_PointSize = 1.0;\n"
+ << " gl_Position = in_position;\n"
+ << " out_color = in_color;\n"
<< "}\n";
m_vertShaderSource = vertShader.str();
<< "layout(location = 0) out vec4 out_color;\n"
<< "void main()\n"
<< "{\n"
- << " out_color = in_color;\n"
+ << " out_color = in_color;\n"
<< "}\n";
m_fragShaderSource = fragShader.str();
qpTestResult res = QP_TEST_RESULT_PASS;
- if (!tcu::fuzzyCompare(log, "Result", "Image comparison result",
- refImage.getAccess(),
- renderedFrame, 0.05f,
- tcu::COMPARE_LOG_RESULT)) {
+ if (!imageCompare(log, refImage.getAccess(), renderedFrame, m_data.topology))
res = QP_TEST_RESULT_FAIL;
- }
+
return tcu::TestStatus(res, qpGetTestResultName(res));
}
qpTestResult res = QP_TEST_RESULT_PASS;
- if (!tcu::fuzzyCompare(log, "Result", "Image comparison result",
- refImage.getAccess(),
- renderedFrame, 0.05f,
- tcu::COMPARE_LOG_RESULT)) {
+ if (!imageCompare(log, refImage.getAccess(), renderedFrame, m_data.topology))
res = QP_TEST_RESULT_FAIL;
- }
+
return tcu::TestStatus(res, qpGetTestResultName(res));
}
qpTestResult res = QP_TEST_RESULT_PASS;
- if (!tcu::fuzzyCompare(log, "Result", "Image comparison result",
- refImage.getAccess(),
- renderedFrame, 0.05f,
- tcu::COMPARE_LOG_RESULT)) {
+ if (!imageCompare(log, refImage.getAccess(), renderedFrame, m_data.topology))
res = QP_TEST_RESULT_FAIL;
- }
+
return tcu::TestStatus(res, qpGetTestResultName(res));
}
qpTestResult res = QP_TEST_RESULT_PASS;
- if (!tcu::fuzzyCompare(log, "Result", "Image comparison result",
- refImage.getAccess(),
- renderedFrame, 0.05f,
- tcu::COMPARE_LOG_RESULT)) {
+ if (!imageCompare(log, refImage.getAccess(), renderedFrame, m_data.topology))
res = QP_TEST_RESULT_FAIL;
- }
+
return tcu::TestStatus(res, qpGetTestResultName(res));
}
vk::flushMappedMemoryRange(vk, context.getDevice(),
vertexBuffer->getBoundMemory().getMemory(),
vertexBuffer->getBoundMemory().getOffset(),
- dataSize);
+ VK_WHOLE_SIZE);
return vertexBuffer;
}
"} params;\n"
"layout(location = 0) out vec4 out_color;\n"
"out gl_PerVertex {\n"
- " vec4 gl_Position;\n"
+ " vec4 gl_Position;\n"
+ " float gl_PointSize;\n"
"};\n"
"void main() {\n"
- " gl_Position = in_position + vec4(float(gl_InstanceIndex - params.firstInstance) * 2.0 / params.instanceCount, 0.0, 0.0, 0.0);\n"
- " out_color = in_color + vec4(float(gl_InstanceIndex) / params.instanceCount, 0.0, 0.0, 1.0) + in_color_2;\n"
+ " gl_PointSize = 1.0;\n"
+ " gl_Position = in_position + vec4(float(gl_InstanceIndex - params.firstInstance) * 2.0 / params.instanceCount, 0.0, 0.0, 0.0);\n"
+ " out_color = in_color + vec4(float(gl_InstanceIndex) / params.instanceCount, 0.0, 0.0, 1.0) + in_color_2;\n"
"}\n";
m_fragmentShader = "#version 430\n"
"layout(location = 0) out vec4 out_color;\n"
"void main()\n"
"{\n"
- " out_color = in_color;\n"
+ " out_color = in_color;\n"
"}\n";
}
std::ostringstream resultDesc;
resultDesc << "Image comparison result. Instance count: " << instanceCount << " first instance index: " << firstInstance;
- if (!tcu::fuzzyCompare(log, "Result", resultDesc.str().c_str(), refImage.getAccess(), renderedFrame, 0.05f, tcu::COMPARE_LOG_RESULT))
- res = QP_TEST_RESULT_FAIL;
+
+ if (m_params.topology == vk::VK_PRIMITIVE_TOPOLOGY_POINT_LIST)
+ {
+ const bool ok = tcu::intThresholdPositionDeviationCompare(
+ log, "Result", resultDesc.str().c_str(), refImage.getAccess(), renderedFrame,
+ tcu::UVec4(4u), // color threshold
+ tcu::IVec3(1, 1, 0), // position deviation tolerance
+ true, // don't check the pixels at the boundary
+ tcu::COMPARE_LOG_RESULT);
+
+ if (!ok)
+ res = QP_TEST_RESULT_FAIL;
+ }
+ else
+ {
+ if (!tcu::fuzzyCompare(log, "Result", resultDesc.str().c_str(), refImage.getAccess(), renderedFrame, 0.05f, tcu::COMPARE_LOG_RESULT))
+ res = QP_TEST_RESULT_FAIL;
+ }
}
}
return tcu::TestStatus(res, qpGetTestResultName(res));