pan/bi: Add validation for nr_srcs/nr_dests
Now that we set nr_srcs/nr_dests accurately, assert as much in the validator. This pass will be deleted later in the series, but having it here is expected to be useful for bisection, in case there are cases missed. Certainly running the CTS at this point in the series is helpful to prove completeness of the beginning of this series. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>
This commit is contained in:
committed by
Marge Bot
parent
63051b68d7
commit
662b866e1b
@@ -149,6 +149,43 @@ bi_validate_width(bi_context *ctx)
|
||||
return succ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Temporary stopgap to check that source/destination counts are correct. This
|
||||
* validation pass will go away later this series when we dynamically allocate
|
||||
* sources and destinations.
|
||||
*/
|
||||
static bool
|
||||
bi_validate_src_dest_count(bi_context *ctx)
|
||||
{
|
||||
bool succ = true;
|
||||
|
||||
bi_foreach_instr_global(ctx, I) {
|
||||
for (unsigned s = I->nr_srcs; s < ARRAY_SIZE(I->src); ++s) {
|
||||
if (!bi_is_null(I->src[s])) {
|
||||
succ = false;
|
||||
fprintf(stderr,
|
||||
"unexpected source %u, expected %u sources\n",
|
||||
s, I->nr_srcs);
|
||||
bi_print_instr(I, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned d = I->nr_dests; d < ARRAY_SIZE(I->dest); ++d) {
|
||||
if (!bi_is_null(I->dest[d])) {
|
||||
succ = false;
|
||||
fprintf(stderr,
|
||||
"unexpected dest %u, expected %u sources\n",
|
||||
d, I->nr_dests);
|
||||
bi_print_instr(I, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return succ;
|
||||
}
|
||||
|
||||
void
|
||||
bi_validate(bi_context *ctx, const char *after)
|
||||
{
|
||||
@@ -172,6 +209,11 @@ bi_validate(bi_context *ctx, const char *after)
|
||||
fail = true;
|
||||
}
|
||||
|
||||
if (!bi_validate_src_dest_count(ctx)) {
|
||||
fprintf(stderr, "Unexpected source/dest count after %s\n", after);
|
||||
fail = true;
|
||||
}
|
||||
|
||||
if (fail) {
|
||||
bi_print_shader(ctx, stderr);
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user