Skip to content

Commit 1b6b04d

Browse files
tests: Add a reproducer for gitlab issue 15029
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
1 parent 685567e commit 1b6b04d

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

src/tests/bug/gitlab-15029.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright 2026 Intel Corporation
2+
// SPDX-License-Identifier: MIT
3+
4+
#include <math.h>
5+
#include "util/simple_pipeline.h"
6+
#include "tapi/t.h"
7+
8+
#include "src/tests/bug/gitlab-15029-spirv.h"
9+
10+
// \file
11+
// Reproduce an Intel anv bug from mesa#15029.
12+
//
13+
// The problem is a missing base offset indexing in pulling push
14+
// constant data.
15+
16+
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
17+
18+
static void
19+
test(void)
20+
{
21+
VkShaderModule cs = qoCreateShaderModuleGLSL(t_device, COMPUTE,
22+
QO_TARGET_ENV spirv1.4
23+
layout(push_constant, std430) uniform Push {
24+
uint pad[8];
25+
uint input_vals[8];
26+
} push;
27+
layout(binding = 0, std430) buffer block2 {
28+
uint output_val;
29+
} ssbo;
30+
31+
layout (local_size_x = 1) in;
32+
void main()
33+
{
34+
uint sum = 0;
35+
for (uint i = 0; i < 8; i++)
36+
sum += push.input_vals[i];
37+
ssbo.output_val = sum;
38+
}
39+
);
40+
41+
uint32_t push[16];
42+
uint32_t result = 0;
43+
44+
uint32_t sum = 0;
45+
for (uint32_t i = 0; i < ARRAY_SIZE(push); i++) {
46+
push[i] = i;
47+
sum += i >= 8 ? i : 0;
48+
}
49+
50+
simple_compute_pipeline_options_t opts = {
51+
.push_constants = push,
52+
.push_constants_size = sizeof(push),
53+
.storage = &result,
54+
.storage_size = sizeof(result),
55+
};
56+
57+
run_simple_compute_pipeline(cs, &opts);
58+
59+
t_assert(result == sum);
60+
61+
t_pass();
62+
}
63+
64+
test_define {
65+
.name = "bug.gitlab-15029",
66+
.start = test,
67+
.no_image = true,
68+
};

src/tests/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ test_sources_with_spirv = [
6363
'bug/gitlab-12927.c',
6464
'bug/gitlab-13149.c',
6565
'bug/gitlab-14054.c',
66+
'bug/gitlab-15029.c',
6667
'func/4-vertex-buffers.c',
6768
'func/depthstencil/basic.c',
6869
'func/depthstencil/arrayed-clear.c',

0 commit comments

Comments
 (0)