mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
pan/midgard: fix check for negative texture offset
We need to sign-extend texture-offset before checking for negative values, otherwise we'll never see them. CID: 1457497 Reviewed-by: Eric R. Smith <eric.smith@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
This commit is contained in:
parent
49183bfb79
commit
f80506277d
1 changed files with 9 additions and 3 deletions
|
|
@ -1649,6 +1649,12 @@ partial_exection_mode(enum midgard_partial_execution mode)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
s4_to_int(int val) {
|
||||
int sign_bit = val & 8;
|
||||
return (val ^ sign_bit) - sign_bit;
|
||||
}
|
||||
|
||||
static void
|
||||
print_texture_word(disassemble_context *ctx, FILE *fp, const uint32_t *word,
|
||||
unsigned tabs, unsigned in_reg_base, unsigned out_reg_base)
|
||||
|
|
@ -1759,9 +1765,9 @@ print_texture_word(disassemble_context *ctx, FILE *fp, const uint32_t *word,
|
|||
} else if (texture->offset) {
|
||||
/* Only select ops allow negative immediate offsets, verify */
|
||||
|
||||
signed offset_x = (texture->offset & 0xF);
|
||||
signed offset_y = ((texture->offset >> 4) & 0xF);
|
||||
signed offset_z = ((texture->offset >> 8) & 0xF);
|
||||
int offset_x = s4_to_int(texture->offset & 0xF);
|
||||
int offset_y = s4_to_int((texture->offset >> 4) & 0xF);
|
||||
int offset_z = s4_to_int((texture->offset >> 8) & 0xF);
|
||||
|
||||
bool neg_x = offset_x < 0;
|
||||
bool neg_y = offset_y < 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue