- const UVec2 viewportSize = getViewportSize();
- const int width = viewportSize.x();
- const int height = viewportSize.y();
- const RGBA threshold (2, 2, 2, 2);
- Surface resImage (width, height);
- Surface refImage (width, height);
- bool compareOk = false;
- const deUint16 indices[12] =
- {
- 0, 4, 1,
- 0, 5, 4,
- 1, 2, 3,
- 1, 3, 4
- };
-
- setup();
- render(6, 4, indices);
- copy(resImage.getAccess(), getResultImage().getAccess());
-
- for (int y = 0; y < refImage.getHeight(); y++)
+ TestLog& log = m_context.getTestContext().getLog();
+ std::vector<Vec4> vertices;
+ std::vector<Shader> shaders;
+ FrontFacingVertexShader vertexShader;
+ FrontFacingFragmentShader fragmentShader;
+ std::string testDesc;
+
+ vertices.push_back(Vec4( -0.75f, -0.75f, 0.0f, 1.0f));
+ vertices.push_back(Vec4( 0.0f, -0.75f, 0.0f, 1.0f));
+ vertices.push_back(Vec4( -0.37f, 0.75f, 0.0f, 1.0f));
+ vertices.push_back(Vec4( 0.37f, 0.75f, 0.0f, 1.0f));
+ vertices.push_back(Vec4( 0.75f, -0.75f, 0.0f, 1.0f));
+ vertices.push_back(Vec4( 0.0f, -0.75f, 0.0f, 1.0f));
+
+ shaders.push_back(Shader(VK_SHADER_STAGE_VERTEX_BIT, m_context.getBinaryCollection().get("vert")));
+ shaders.push_back(Shader(VK_SHADER_STAGE_FRAGMENT_BIT, m_context.getBinaryCollection().get("frag")));
+
+ testDesc = "gl_FrontFacing " + getPrimitiveTopologyShortName(m_topology) + " ";
+
+ DrawState drawState (m_topology, FRONTFACE_RENDERWIDTH, FRONTFACE_RENDERHEIGHT);
+ DrawCallData drawCallData (vertices);
+ VulkanProgram vulkanProgram (shaders);
+
+ VulkanDrawContext dc(m_context, drawState, drawCallData, vulkanProgram);
+ dc.draw();
+
+ ReferenceDrawContext refDrawContext(drawState, drawCallData, vertexShader, fragmentShader);
+ refDrawContext.draw();
+
+ log << TestLog::Image( "reference",
+ "reference",
+ tcu::ConstPixelBufferAccess(tcu::TextureFormat(
+ refDrawContext.getColorPixels().getFormat()),
+ refDrawContext.getColorPixels().getWidth(),
+ refDrawContext.getColorPixels().getHeight(),
+ 1,
+ refDrawContext.getColorPixels().getDataPtr()));
+
+ log << TestLog::Image( "result",
+ "result",
+ tcu::ConstPixelBufferAccess(tcu::TextureFormat(
+ dc.getColorPixels().getFormat()),
+ dc.getColorPixels().getWidth(),
+ dc.getColorPixels().getHeight(),
+ 1,
+ dc.getColorPixels().getDataPtr()));
+
+ if (tcu::intThresholdPositionDeviationCompare(m_context.getTestContext().getLog(),
+ "ComparisonResult",
+ "Image comparison result",
+ refDrawContext.getColorPixels(),
+ dc.getColorPixels(),
+ UVec4(0u),
+ IVec3(1,1,0),
+ false,
+ tcu::COMPARE_LOG_RESULT))