From c09596ed4b8d17f057f77a42475d59c1ac126797 Mon Sep 17 00:00:00 2001 From: Pyry Haulos Date: Wed, 1 Feb 2017 15:24:52 -0800 Subject: [PATCH] Fix issues in Vulkan PointCoord test * Fixed PointCoord calculation to follow spec. * Made random point size generation code more robust. Existing code resulted in rnd.getInt() being called with invalid range. Changed: dEQP-VK.glsl.builtin_var.simple.pointcoord Components: Vulkan VK-GL-CTS issue: 68 Change-Id: I34f0c2c2ec5c8d759f22e81a1683c21572887c58 --- .../vktShaderRenderBuiltinVarTests.cpp | 30 +++++++++++++++------- .../mustpass/1.0.2/src/excluded-tests.txt | 3 --- external/vulkancts/mustpass/1.0.2/vk-default.txt | 1 + 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp b/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp index 4f89e18..3a6d8cc 100644 --- a/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp +++ b/external/vulkancts/modules/vulkan/shaderrender/vktShaderRenderBuiltinVarTests.cpp @@ -439,15 +439,21 @@ TestStatus BuiltinGlPointCoordCaseInstance::iterate (void) Surface resImage (width, height); Surface refImage (width, height); bool compareOk = false; - VkPhysicalDeviceLimits limits = m_context.getDeviceProperties().limits; // Compute coordinates. { + const VkPhysicalDeviceLimits& limits = m_context.getDeviceProperties().limits; + const float minPointSize = limits.pointSizeRange[0]; + const float maxPointSize = limits.pointSizeRange[1]; + const int pointSizeDeltaMultiples = de::max(1, deCeilFloatToInt32((maxPointSize - minPointSize) / limits.pointSizeGranularity)); + + TCU_CHECK(minPointSize <= maxPointSize); + for (vector::iterator coord = coords.begin(); coord != coords.end(); ++coord) { coord->x() = rnd.getFloat(-0.9f, 0.9f); coord->y() = rnd.getFloat(-0.9f, 0.9f); - coord->z() = limits.pointSizeRange[0] + float(rnd.getInt(0, int((limits.pointSizeRange[1] - limits.pointSizeRange[0]) / limits.pointSizeGranularity))) * limits.pointSizeGranularity; + coord->z() = de::min(maxPointSize, minPointSize + float(rnd.getInt(0, pointSizeDeltaMultiples)) * limits.pointSizeGranularity); } } @@ -458,12 +464,16 @@ TestStatus BuiltinGlPointCoordCaseInstance::iterate (void) // Draw reference clear(refImage.getAccess(), m_clearColor); + for (vector::const_iterator pointIter = coords.begin(); pointIter != coords.end(); ++pointIter) { - const int x0 = deRoundFloatToInt32(float(width) *(pointIter->x()*0.5f + 0.5f) - pointIter->z()*0.5f); - const int y0 = deRoundFloatToInt32(float(height)*(pointIter->y()*0.5f + 0.5f) - pointIter->z()*0.5f); - const int x1 = deRoundFloatToInt32(float(width) *(pointIter->x()*0.5f + 0.5f) + pointIter->z()*0.5f); - const int y1 = deRoundFloatToInt32(float(height)*(pointIter->y()*0.5f + 0.5f) + pointIter->z()*0.5f); + const float centerX = float(width) *(pointIter->x()*0.5f + 0.5f); + const float centerY = float(height)*(pointIter->y()*0.5f + 0.5f); + const float size = pointIter->z(); + const int x0 = deRoundFloatToInt32(centerX - size*0.5f); + const int y0 = deRoundFloatToInt32(centerY - size*0.5f); + const int x1 = deRoundFloatToInt32(centerX + size*0.5f); + const int y1 = deRoundFloatToInt32(centerY + size*0.5f); const int w = x1-x0; const int h = y1-y0; @@ -471,11 +481,13 @@ TestStatus BuiltinGlPointCoordCaseInstance::iterate (void) { for (int xo = 0; xo < w; xo++) { - const float xf = (float(xo)+0.5f) / float(w); - const float yf = (float(yo)+0.5f) / float(h); - const Vec4 color (xf, yf, 0.0f, 1.0f); const int dx = x0+xo; const int dy = y0+yo; + const float fragX = float(dx) + 0.5f; + const float fragY = float(dy) + 0.5f; + const float s = 0.5f + (fragX - centerX) / size; + const float t = 0.5f + (fragY - centerY) / size; + const Vec4 color (s, t, 0.0f, 1.0f); if (de::inBounds(dx, 0, refImage.getWidth()) && de::inBounds(dy, 0, refImage.getHeight())) refImage.setPixel(dx, dy, RGBA(color)); diff --git a/external/vulkancts/mustpass/1.0.2/src/excluded-tests.txt b/external/vulkancts/mustpass/1.0.2/src/excluded-tests.txt index 84c1c9b..ea8d52f 100644 --- a/external/vulkancts/mustpass/1.0.2/src/excluded-tests.txt +++ b/external/vulkancts/mustpass/1.0.2/src/excluded-tests.txt @@ -293,6 +293,3 @@ dEQP-VK.texture.explicit_lod.* # Exclude tests which are not on the Android CTS mustpass list dEQP-VK.texture.mipmap.2d.projected.* - -# Vulkan CTS issue 582 -dEQP-VK.glsl.builtin_var.simple.pointcoord diff --git a/external/vulkancts/mustpass/1.0.2/vk-default.txt b/external/vulkancts/mustpass/1.0.2/vk-default.txt index 6eb7cb5..68eaf54 100644 --- a/external/vulkancts/mustpass/1.0.2/vk-default.txt +++ b/external/vulkancts/mustpass/1.0.2/vk-default.txt @@ -106037,6 +106037,7 @@ dEQP-VK.glsl.texture_gather.offsets.min_required_offset.2d_array.depth32f.base_l dEQP-VK.glsl.builtin_var.simple.frontfacing dEQP-VK.glsl.builtin_var.simple.fragcoord_xyz dEQP-VK.glsl.builtin_var.simple.fragcoord_w +dEQP-VK.glsl.builtin_var.simple.pointcoord dEQP-VK.glsl.builtin_var.input_variations.input_none dEQP-VK.glsl.builtin_var.input_variations.input_builtin dEQP-VK.glsl.builtin_var.input_variations.input_varying -- 2.7.4