mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
translate: do not clamp element index in generic_run
The buffer max_index value in translate_generic struct is relevant for
indexed draw only. So do not clamp the element index in generic_run() as it
is called for non-indexed draw only.
This patch passes index_size to the common generic_run_one function
so index clamping is only performed when a non-zero index_size is specified.
This fixes a text selection bug with kitty terminal emulator running on ARM
when it falls back to the generic translate path for unsigned byte vertex
array.
cc: mesa-stable
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22568>
(cherry picked from commit 13e885842a)
This commit is contained in:
parent
20b252c4c8
commit
57d659935f
2 changed files with 12 additions and 9 deletions
|
|
@ -3144,7 +3144,7 @@
|
|||
"description": "translate: do not clamp element index in generic_run",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2007 VMware, Inc.
|
||||
* Copyright 2007-2023 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
|
@ -589,7 +589,8 @@ generic_run_one(struct translate_generic *tg,
|
|||
unsigned elt,
|
||||
unsigned start_instance,
|
||||
unsigned instance_id,
|
||||
void *vert)
|
||||
void *vert,
|
||||
unsigned index_size)
|
||||
{
|
||||
unsigned nr_attrs = tg->nr_attrib;
|
||||
unsigned attr;
|
||||
|
|
@ -613,8 +614,10 @@ generic_run_one(struct translate_generic *tg,
|
|||
}
|
||||
else {
|
||||
index = elt;
|
||||
/* clamp to avoid going out of bounds */
|
||||
index = MIN2(index, tg->attrib[attr].max_index);
|
||||
if (index_size > 0) {
|
||||
/* clamp to avoid going out of bounds */
|
||||
index = MIN2(index, tg->attrib[attr].max_index);
|
||||
}
|
||||
}
|
||||
|
||||
src = tg->attrib[attr].input_ptr +
|
||||
|
|
@ -664,7 +667,7 @@ generic_run_elts(struct translate *translate,
|
|||
unsigned i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
generic_run_one(tg, *elts++, start_instance, instance_id, vert);
|
||||
generic_run_one(tg, *elts++, start_instance, instance_id, vert, 4);
|
||||
vert += tg->translate.key.output_stride;
|
||||
}
|
||||
}
|
||||
|
|
@ -682,7 +685,7 @@ generic_run_elts16(struct translate *translate,
|
|||
unsigned i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
generic_run_one(tg, *elts++, start_instance, instance_id, vert);
|
||||
generic_run_one(tg, *elts++, start_instance, instance_id, vert, 2);
|
||||
vert += tg->translate.key.output_stride;
|
||||
}
|
||||
}
|
||||
|
|
@ -700,7 +703,7 @@ generic_run_elts8(struct translate *translate,
|
|||
unsigned i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
generic_run_one(tg, *elts++, start_instance, instance_id, vert);
|
||||
generic_run_one(tg, *elts++, start_instance, instance_id, vert, 1);
|
||||
vert += tg->translate.key.output_stride;
|
||||
}
|
||||
}
|
||||
|
|
@ -718,7 +721,7 @@ generic_run(struct translate *translate,
|
|||
unsigned i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
generic_run_one(tg, start + i, start_instance, instance_id, vert);
|
||||
generic_run_one(tg, start + i, start_instance, instance_id, vert, 0);
|
||||
vert += tg->translate.key.output_stride;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue