Including testing zw components with fragcoord_msaa tests
authorPiers Daniell <pdaniell@nvidia.com>
Wed, 17 Feb 2021 20:18:22 +0000 (13:18 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 3 Mar 2021 08:20:18 +0000 (08:20 +0000)
This extends the fragcoord_msaa coverage added in
https://gerrit.khronos.org/c/vk-gl-cts/+/6761 to also include
testing of the gl_FragCoord.z and gl_FragCoord.w components.

Coverage includes both explicitly enabled per-sample shading
and implicit per-sample input shading.

Component: Vulkan

Change-Id: I834f6a273b26dd889a7bba8e8b8bd373808b8844
Affects: dEQP-VK.glsl.builtin_var.fragcoord_msaa*

external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp

index 1067de0..5574e8d 100644 (file)
@@ -1372,6 +1372,18 @@ bool BuiltinFragCoordMsaaCaseInstance::validateSampleLocations (const ConstPixel
                                const UVec2 pixelAddress        = UVec2(sampleNdx + m_sampleCount * colNdx, rowNdx);
                                const Vec4  pixelData           = sampleLocationBuffer.getPixel(pixelAddress.x(), pixelAddress.y());
 
+                               if (pixelData.z() != 0.0f)
+                               {
+                                       log << TestLog::Message << "Pixel (" << colNdx << "," << rowNdx << "): has unexpected .z component, expected: 0.0, got: " << pixelData.z() << TestLog::EndMessage;
+                                       return false;
+                               }
+
+                               if (pixelData.w() != 1.0f)
+                               {
+                                       log << TestLog::Message << "Pixel (" << colNdx << "," << rowNdx << "): has unexpected .w component, expected: 1.0, got: " << pixelData.w() << TestLog::EndMessage;
+                                       return false;
+                               }
+
                                locations.push_back(Vec2(pixelData.x(), pixelData.y()));
                        }
 
@@ -1463,7 +1475,7 @@ void BuiltinFragCoordMsaaTestCase::initPrograms (SourceCollections& programColle
                        << "{\n"
                        << "    const int sampleNdx = int(gl_SampleID);\n"
                        << "    ivec2 imageCoord = ivec2(sampleNdx + int(gl_FragCoord.x) * " << m_sampleCount << ", int(gl_FragCoord.y));\n"
-                       << "    imageStore(storageImage, imageCoord, vec4(gl_FragCoord.xy,vec2(0)));\n"
+                       << "    imageStore(storageImage, imageCoord, gl_FragCoord);\n"
                        << "    color = vec4(1.0, 0.0, 0.0, 1.0);\n"
                        << "}\n";
                programCollection.glslSources.add("FragCoordMsaaFrag") << glu::FragmentSource(fragmentSource.str());