tgsi: try and handle overflowing shaders.

macos/master
Dave Airlie 10 years ago committed by Dave Airlie
parent d404b2279b
commit 8954f84727
  1. 10
      src/gallium/auxiliary/tgsi/tgsi_dump.c
  2. 2
      src/gallium/auxiliary/tgsi/tgsi_dump.h

@ -683,6 +683,7 @@ struct str_dump_ctx
char *str;
char *ptr;
int left;
bool nospace;
};
static void
@ -705,10 +706,11 @@ str_dump_ctx_printf(struct dump_ctx *ctx, const char *format, ...)
sctx->ptr += written;
sctx->left -= written;
}
}
} else
sctx->nospace = true;
}
void
int
tgsi_dump_str(
const struct tgsi_token *tokens,
uint flags,
@ -734,6 +736,7 @@ tgsi_dump_str(
ctx.str[0] = 0;
ctx.ptr = str;
ctx.left = (int)size;
ctx.nospace = false;
if (flags & TGSI_DUMP_FLOAT_AS_HEX)
ctx.base.dump_float_as_hex = TRUE;
@ -741,6 +744,8 @@ tgsi_dump_str(
ctx.base.dump_float_as_hex = FALSE;
tgsi_iterate_shader( tokens, &ctx.base.iter );
return (ctx.nospace == true) ? -1 : 0;
}
void
@ -762,6 +767,7 @@ tgsi_dump_instruction_str(
ctx.str[0] = 0;
ctx.ptr = str;
ctx.left = (int)size;
ctx.nospace = false;
iter_instruction( &ctx.base.iter, (struct tgsi_full_instruction *)inst );
}

@ -38,7 +38,7 @@ extern "C" {
#define TGSI_DUMP_FLOAT_AS_HEX (1 << 0)
void
int
tgsi_dump_str(
const struct tgsi_token *tokens,
uint flags,

Loading…
Cancel
Save