r300: add some synchronization for KIL

Set texture semaphore wait at the first control flow instruction
after the KIL.

Fixes: dEQP-GLES2.functional.shaders.discard.dynamic_loop_always

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18576>
This commit is contained in:
Pavel Ondračka 2022-09-13 13:21:54 +02:00 committed by Marge Bot
parent 6a19950b61
commit 0deca8bef8
3 changed files with 13 additions and 2 deletions

View file

@ -41,8 +41,6 @@ dEQP-GLES2.functional.rasterization.primitives.lines_wide,Fail
dEQP-GLES2.functional.rasterization.primitives.line_strip_wide,Fail,Fail
dEQP-GLES2.functional.rasterization.primitives.line_loop_wide,Fail
dEQP-GLES2.functional.shaders.discard.dynamic_loop_always,Fail
dEQP-GLES2.functional.shaders.indexing.tmp_array.float_dynamic_write_dynamic_loop_read_fragment,Fail
dEQP-GLES2.functional.shaders.random.texture.fragment.141,Fail

View file

@ -460,6 +460,7 @@ static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst
s->Code->int_constant_count = 1;
}
s->Code->inst[newip].inst0 = R500_INST_TYPE_FC | R500_INST_ALU_WAIT;
s->Code->inst[newip].inst0 |= (inst->U.I.TexSemWait << R500_INST_TEX_SEM_WAIT_SHIFT);
switch(inst->U.I.Opcode){
struct branch_info * branch;

View file

@ -153,6 +153,7 @@ struct schedule_state {
void (*CalcScore)(struct schedule_instruction *);
long max_tex_group;
unsigned PrevBlockHasTex:1;
unsigned PrevBlockHasKil:1;
unsigned TEXCount;
unsigned Opt:1;
};
@ -1102,6 +1103,7 @@ static void emit_instruction(
for (tex_ptr = s->ReadyTEX; tex_ptr; tex_ptr = tex_ptr->NextReady) {
if (tex_ptr->Instruction->U.I.Opcode == RC_OPCODE_KIL) {
emit_all_tex(s, before);
s->PrevBlockHasKil = 1;
return;
}
tex_count++;
@ -1335,6 +1337,16 @@ void rc_pair_schedule(struct radeon_compiler *cc, void *user)
struct rc_instruction * first;
if (is_controlflow(inst)) {
/* The TexSemWait flag is already properly set for ALU
* instructions using the results of normal TEX lookup,
* however it was found empirically that TEXKIL also needs
* synchronization with the control flow. This might not be optimal,
* however the docs don't offer any guidance in this matter.
*/
if (s.PrevBlockHasKil) {
inst->U.I.TexSemWait = 1;
s.PrevBlockHasKil = 0;
}
inst = inst->Next;
continue;
}