r300: doublecheck for free alpha source when coventing to alpha

For any instruction that can be reasonably converted to alpha we check
all of its readers to see if the conversion is possible (including check
for at least one free alpha source) at the beginning of pair scheduling.
However, if the reader instruction has multiples sources that could be
converted to alpha and multiple indeed are, than we could run of of the
alpha sources eventually. So recheck just before converting that there
are still some unused sources left.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Tested-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20009>
This commit is contained in:
Pavel Ondračka
2022-11-25 10:02:32 +01:00
parent eb9f17b309
commit 384fc52dd3
@@ -898,6 +898,16 @@ static int convert_rgb_to_alpha(
if (sched_inst->GlobalReaders.Abort)
return 0;
/* Even though we checked that we can convert to alpha previously, it is
* possible that another rgb source of the reader instructions was already
* converted to alpha and we thus have no longer free alpha sources.
*/
for(i = 0; i < sched_inst->GlobalReaders.ReaderCount; i++) {
struct rc_reader reader = sched_inst->GlobalReaders.Readers[i];
if (reader.Inst->U.P.Alpha.Src[2].Used)
return 0;
}
if (!pair_inst->RGB.WriteMask)
return 0;