mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
r300/vs: Allocate temps we see a use as a source, too.
This is a quick hack for a bunch of the fail in #5766.
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14271>
(cherry picked from commit e41a53cd19)
This commit is contained in:
parent
a80330e217
commit
a42ed80f09
2 changed files with 25 additions and 17 deletions
|
|
@ -1030,7 +1030,7 @@
|
|||
"description": "r300/vs: Allocate temps we see a use as a source, too.",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "radeon_compiler.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "r300_reg.h"
|
||||
|
|
@ -559,15 +560,33 @@ struct temporary_allocation {
|
|||
struct rc_instruction * LastRead;
|
||||
};
|
||||
|
||||
static int get_reg(struct radeon_compiler *c, struct temporary_allocation *ta, bool *hwtemps,
|
||||
unsigned int orig)
|
||||
{
|
||||
if (!ta[orig].Allocated) {
|
||||
int j;
|
||||
for (j = 0; j < c->max_temp_regs; ++j)
|
||||
{
|
||||
if (!hwtemps[j])
|
||||
break;
|
||||
}
|
||||
ta[orig].Allocated = 1;
|
||||
ta[orig].HwTemp = j;
|
||||
hwtemps[ta[orig].HwTemp] = true;
|
||||
}
|
||||
|
||||
return ta[orig].HwTemp;
|
||||
}
|
||||
|
||||
static void allocate_temporary_registers(struct radeon_compiler *c, void *user)
|
||||
{
|
||||
struct r300_vertex_program_compiler *compiler = (struct r300_vertex_program_compiler*)c;
|
||||
struct rc_instruction *inst;
|
||||
struct rc_instruction *end_loop = NULL;
|
||||
unsigned int num_orig_temps = 0;
|
||||
char hwtemps[RC_REGISTER_MAX_INDEX];
|
||||
bool hwtemps[RC_REGISTER_MAX_INDEX];
|
||||
struct temporary_allocation * ta;
|
||||
unsigned int i, j;
|
||||
unsigned int i;
|
||||
|
||||
memset(hwtemps, 0, sizeof(hwtemps));
|
||||
|
||||
|
|
@ -638,28 +657,17 @@ static void allocate_temporary_registers(struct radeon_compiler *c, void *user)
|
|||
for (i = 0; i < opcode->NumSrcRegs; ++i) {
|
||||
if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY) {
|
||||
unsigned int orig = inst->U.I.SrcReg[i].Index;
|
||||
inst->U.I.SrcReg[i].Index = ta[orig].HwTemp;
|
||||
inst->U.I.SrcReg[i].Index = get_reg(c, ta, hwtemps, orig);
|
||||
|
||||
if (ta[orig].Allocated && inst == ta[orig].LastRead)
|
||||
hwtemps[ta[orig].HwTemp] = 0;
|
||||
hwtemps[ta[orig].HwTemp] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (opcode->HasDstReg) {
|
||||
if (inst->U.I.DstReg.File == RC_FILE_TEMPORARY) {
|
||||
unsigned int orig = inst->U.I.DstReg.Index;
|
||||
|
||||
if (!ta[orig].Allocated) {
|
||||
for(j = 0; j < c->max_temp_regs; ++j) {
|
||||
if (!hwtemps[j])
|
||||
break;
|
||||
}
|
||||
ta[orig].Allocated = 1;
|
||||
ta[orig].HwTemp = j;
|
||||
hwtemps[ta[orig].HwTemp] = 1;
|
||||
}
|
||||
|
||||
inst->U.I.DstReg.Index = ta[orig].HwTemp;
|
||||
inst->U.I.DstReg.Index = get_reg(c, ta, hwtemps, orig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue