Fix API usage errors in geometry tests
authorIlkka Saarelainen <ilkka.saarelainen@siru.fi>
Wed, 21 Aug 2019 11:41:07 +0000 (14:41 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 5 Sep 2019 15:16:05 +0000 (11:16 -0400)
Fixes validation errors in various geometry tests.

geometry.basic.output_* tests were potentially exceeding the
maxGeometryTotalOutputComponents limit because the gl_PerVertex was
implicitly declared and therefore contained gl_Position and gl_PointSize.
Now the gl_PerVertex is declared explicitly to contain only gl_Position.

Fixes flush/invalidate mapped memory range -validation errors by using the
flushAlloc/invalidateAlloc -framework functions.

Affects:
dEQP-VK.geometry.basic.output_*
dEQP-VK.geometry.instanced.*

Components: Vulkan

VK-GL-CTS issue: 1911

Change-Id: I8e4cfd5879ba8c61be3019578b8afbc76592d82e

external/vulkancts/modules/vulkan/geometry/vktGeometryBasicGeometryShaderTests.cpp
external/vulkancts/modules/vulkan/geometry/vktGeometryInstancedRenderingTests.cpp

index 0393fb9..764aaf7 100644 (file)
@@ -609,6 +609,10 @@ void GeometryOutputCountTest::initPrograms (SourceCollections& sourceCollections
                        << "layout(triangle_strip, max_vertices = " << max_vertices << ") out;\n"
                        << "layout(location = 0) in highp vec4 v_geom_FragColor[];\n"
                        << "layout(location = 0) out highp vec4 v_frag_FragColor;\n"
+                       << "out gl_PerVertex\n"
+                       << "{\n"
+                       << "    vec4 gl_Position;\n"
+                       << "};\n"
                        << "void main (void)\n"
                        << "{\n"
                        << "    const highp float rowHeight = 2.0 / float(" << m_pattern.size() << ");\n"
@@ -732,6 +736,10 @@ void VaryingOutputCountCase::initPrograms (SourceCollections& sourceCollections)
                                src     << "layout(triangle_strip, max_vertices = 128) out;\n"
                                        << "layout(location = 0) in highp vec4 v_geom_emitCount[];\n"
                                        << "layout(location = 0) out highp vec4 v_frag_FragColor;\n"
+                                       << "out gl_PerVertex\n"
+                                       << "{\n"
+                                       << "    vec4 gl_Position;\n"
+                                       << "};\n"
                                        << "void main (void)\n"
                                        << "{\n"
                                        << "    highp vec4 attrEmitCounts = v_geom_emitCount[0];\n"
@@ -757,6 +765,10 @@ void VaryingOutputCountCase::initPrograms (SourceCollections& sourceCollections)
                                        << "    ivec4 u_emitCount;\n"
                                        << "} emit;\n"
                                        << "layout(location = 0) out highp vec4 v_frag_FragColor;\n"
+                                       << "out gl_PerVertex\n"
+                                       << "{\n"
+                                       << "    vec4 gl_Position;\n"
+                                       << "};\n"
                                        << "void main (void)\n"
                                        << "{\n"
                                        << "    mediump int primitiveNdx = " << ((instanced) ? ("gl_InvocationID") : ("int(v_geom_vertexNdx[0].x)")) << ";\n"
@@ -787,6 +799,10 @@ void VaryingOutputCountCase::initPrograms (SourceCollections& sourceCollections)
                                        << "layout(location = 0) in highp vec4 v_geom_vertexNdx[];\n"
                                        << "layout(binding = 0) uniform highp sampler2D u_sampler;\n"
                                        << "layout(location = 0) out highp vec4 v_frag_FragColor;\n"
+                                       << "out gl_PerVertex\n"
+                                       << "{\n"
+                                       << "    vec4 gl_Position;\n"
+                                       << "};\n"
                                        << "void main (void)\n"
                                        << "{\n"
                                        << "    highp float primitiveNdx = " << ((instanced) ? ("float(gl_InvocationID)") : ("v_geom_vertexNdx[0].x")) << ";\n"
index 3af55d5..451adde 100644 (file)
@@ -180,7 +180,7 @@ void draw (Context&                                 context,
        // Initialize vertex data
        {
                deMemcpy(vertexBufferAlloc->getHostPtr(), &perInstanceAttribute[0], (size_t)vertexBufferSize);
-               flushMappedMemoryRange(vk, device, vertexBufferAlloc->getMemory(), vertexBufferAlloc->getOffset(), vertexBufferSize);
+               flushAlloc(vk, device, *vertexBufferAlloc);
        }
 
        beginCommandBuffer(vk, *cmdBuffer);
@@ -380,7 +380,7 @@ tcu::TestStatus test (Context& context, const TestParams params)
 
        // Compare result
        {
-               invalidateMappedMemoryRange(vk, device, colorBufferAlloc->getMemory(), colorBufferAlloc->getOffset(), colorBufferSize);
+               invalidateAlloc(vk, device, *colorBufferAlloc);
                const tcu::ConstPixelBufferAccess result(mapVkFormat(colorFormat), renderSize.x(), renderSize.y(), 1u, colorBufferAlloc->getHostPtr());
 
                tcu::TextureLevel reference(mapVkFormat(colorFormat), renderSize.x(), renderSize.y());