Skip to content

Commit

Permalink
Add test for scalarized flat saturation
Browse files Browse the repository at this point in the history
This was failing on the Mesa Turnip driver.

New test:
dEQP-VK.draw.renderpass.basic_draw.misc.flat_b_sat_error

Components: Vulkan
VK-GL-CTS issue: 5107

Change-Id: I473f8c6728c37230594f294634370e4a18eeb978
  • Loading branch information
rg3igalia authored and lordalcol committed May 9, 2024
1 parent d42edeb commit 391d29e
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 7 deletions.
1 change: 1 addition & 0 deletions android/cts/main/vk-main-2024-03-01/draw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10394,6 +10394,7 @@ dEQP-VK.draw.renderpass.basic_draw.draw_indirect.triangle_strip_with_adjacency.1
dEQP-VK.draw.renderpass.basic_draw.draw_indirect.triangle_strip_with_adjacency.1_multi_command_multi_draw
dEQP-VK.draw.renderpass.basic_draw.draw_indirect.triangle_strip_with_adjacency.3_multi_command_multi_draw
dEQP-VK.draw.renderpass.basic_draw.draw_indirect.triangle_strip_with_adjacency.45_multi_command_multi_draw
dEQP-VK.draw.renderpass.basic_draw.misc.flat_b_sat_error
dEQP-VK.draw.renderpass.basic_draw.misc.maintenance5
dEQP-VK.draw.renderpass.implicit_sample_shading.sample_decoration_dynamic_use
dEQP-VK.draw.renderpass.implicit_sample_shading.sample_id_static_use
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!amber
# Reproducer for https://gitlab.freedesktop.org/mesa/mesa/-/issues/10999

SHADER vertex vtex_shader GLSL
#version 430
layout(location = 0) in vec2 data_in;
layout(location = 0) out flat float data_out;
void main() {
const float count = 5.0;
gl_PointSize = 1.0;
gl_Position = vec4((((data_in.x + 0.5) / count) * 2.0) - 1.0, 0.0, 0.0, 1.0);
data_out = data_in.y;
}
END

SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) in flat float data_in;
layout(location = 0) out vec4 final_color;
void main() {
const float epsilon = 0.0009765625; // Makes sure 0.5 is rounded up to 128.
final_color = vec4(max(0.0, min(max(data_in, 0.0), 1.0) - 0.5) + epsilon, 0.0, 0.0, 1.0);
}
END

BUFFER position_buf DATA_TYPE vec2<float> DATA
0 0.0
1 0.5
2 1.0
3 1.5
4 2.0
END

BUFFER framebuffer FORMAT B8G8R8A8_UNORM

PIPELINE graphics pipeline
ATTACH vtex_shader
ATTACH frag_shader

VERTEX_DATA position_buf LOCATION 0
FRAMEBUFFER_SIZE 5 1
VIEWPORT 0 0 SIZE 5 1
BIND BUFFER framebuffer AS color LOCATION 0
END

RUN pipeline DRAW_ARRAY AS POINT_LIST START_IDX 0
EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 0 0 0 255
EXPECT framebuffer IDX 1 0 SIZE 1 1 EQ_RGBA 0 0 0 255
EXPECT framebuffer IDX 2 0 SIZE 1 1 EQ_RGBA 128 0 0 255
EXPECT framebuffer IDX 3 0 SIZE 1 1 EQ_RGBA 128 0 0 255
EXPECT framebuffer IDX 4 0 SIZE 1 1 EQ_RGBA 128 0 0 255
1 change: 1 addition & 0 deletions external/vulkancts/modules/vulkan/draw/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include_directories(
..
../amber
${DEQP_INL_DIR}
)

Expand Down
21 changes: 14 additions & 7 deletions external/vulkancts/modules/vulkan/draw/vktBasicDrawTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
#include "vkCmdUtil.hpp"
#include "vkTypeUtil.hpp"
#include "vktTestGroupUtil.hpp"
#include "vktAmberTestCase.hpp"

#include "deDefs.h"
#include "deRandom.hpp"
#include "deString.h"

#include "tcuTestCase.hpp"
#include "tcuRGBA.hpp"
#include "tcuTextureUtil.hpp"
#include "tcuImageCompare.hpp"
#include "tcuVectorUtil.hpp"
Expand Down Expand Up @@ -1748,10 +1748,12 @@ void populateSubGroup (tcu::TestCaseGroup* testGroup, const TestCaseParams caseP

void createDrawTests(tcu::TestCaseGroup* testGroup, const SharedGroupParams groupParams)
{
auto& testCtx = testGroup->getTestContext();

for (deUint32 drawTypeIndex = 0; drawTypeIndex < DRAW_COMMAND_TYPE_DRAW_LAST; ++drawTypeIndex)
{
const DrawCommandType command (static_cast<DrawCommandType>(drawTypeIndex));
de::MovePtr<tcu::TestCaseGroup> topologyGroup (new tcu::TestCaseGroup(testGroup->getTestContext(), getDrawCommandTypeName(command)));
de::MovePtr<tcu::TestCaseGroup> topologyGroup (new tcu::TestCaseGroup(testCtx, getDrawCommandTypeName(command)));

for (deUint32 topologyIdx = 0; topologyIdx != vk::VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; ++topologyIdx)
{
Expand All @@ -1773,13 +1775,18 @@ void createDrawTests(tcu::TestCaseGroup* testGroup, const SharedGroupParams grou
}

#ifndef CTS_USES_VULKANSC
de::MovePtr<tcu::TestCaseGroup> miscGroup(new tcu::TestCaseGroup(testGroup->getTestContext(), "misc"));
de::MovePtr<tcu::TestCaseGroup> miscGroup(new tcu::TestCaseGroup(testCtx, "misc"));
if (groupParams->useDynamicRendering == false)
{
DrawIndexedIndirectParams params(vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, groupParams, vk::VK_INDEX_TYPE_UINT32, false);
params.addCommand(4, 1, 0, 0, 0);
params.useMaintenance5 = true;
miscGroup->addChild(new IndexedIndirectCase(testGroup->getTestContext(), "maintenance5", params));
{
DrawIndexedIndirectParams params(vk::VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, groupParams, vk::VK_INDEX_TYPE_UINT32, false);
params.addCommand(4, 1, 0, 0, 0);
params.useMaintenance5 = true;
miscGroup->addChild(new IndexedIndirectCase(testCtx, "maintenance5", params));
}
{
miscGroup->addChild(cts_amber::createAmberTestCase(testCtx, "flat_b_sat_error", "", "draw/misc", "flat_b_sat_error.amber"));
}
}
testGroup->addChild(miscGroup.release());
#endif // CTS_USES_VULKANSC
Expand Down
1 change: 1 addition & 0 deletions external/vulkancts/mustpass/main/vk-default/draw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18273,6 +18273,7 @@ dEQP-VK.draw.renderpass.basic_draw.draw_indirect.triangle_strip_with_adjacency.3
dEQP-VK.draw.renderpass.basic_draw.draw_indirect.triangle_strip_with_adjacency.45_multi_command
dEQP-VK.draw.renderpass.basic_draw.draw_indirect.triangle_strip_with_adjacency.45_multi_command_multi_draw
dEQP-VK.draw.renderpass.basic_draw.draw_indirect.triangle_strip_with_adjacency.45_single_command
dEQP-VK.draw.renderpass.basic_draw.misc.flat_b_sat_error
dEQP-VK.draw.renderpass.basic_draw.misc.maintenance5
dEQP-VK.draw.renderpass.concurrent.compute_and_triangle_list
dEQP-VK.draw.renderpass.depth_bias.depth_bias_patch_list_tri_fill
Expand Down

0 comments on commit 391d29e

Please sign in to comment.