It happens that some games try to access a vertex buffer without
a valid format. This case was incorrectly handled by
ac_get_tbuffer_format which made ACO emit an invalid instruction.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Cc: 19.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
ac_get_tbuffer_format(enum chip_class chip_class,
unsigned dfmt, unsigned nfmt)
{
+ // Some games try to access vertex buffers without a valid format.
+ // This is a game bug, but we should still handle it gracefully.
+ if (dfmt == V_008F0C_IMG_FORMAT_INVALID)
+ return V_008F0C_IMG_FORMAT_INVALID;
+
if (chip_class >= GFX10) {
unsigned format;
switch (dfmt) {
uint32_t img_format = ac_get_tbuffer_format(ctx.chip_class, mtbuf->dfmt, mtbuf->nfmt);
uint32_t encoding = (0b111010 << 26);
+ assert(img_format <= 0x7F);
assert(!mtbuf->dlc || ctx.chip_class >= GFX10);
encoding |= (mtbuf->dlc ? 1 : 0) << 15; /* DLC bit replaces one bit of the OPCODE on GFX10 */
encoding |= (mtbuf->glc ? 1 : 0) << 14;