Skip to content

Commit

Permalink
Don't try to allocate a temp array if the preshader has no temps.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 1, 2011
1 parent b2524a0 commit 23af57e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mojoshader_effects.c
Expand Up @@ -20,8 +20,12 @@ void MOJOSHADER_runPreshader(const MOJOSHADER_preshader *preshader,
// opcodes in the preshader instruction set (at the moment, at least).
const int scalarstart = (int) MOJOSHADER_PRESHADEROP_SCALAR_OPS;

double *temps = (double *) alloca(sizeof (double) * preshader->temp_count);
memset(temps, '\0', sizeof (double) * preshader->temp_count);
double *temps = NULL;
if (preshader->temp_count > 0)
{
temps = (double *) alloca(sizeof (double) * preshader->temp_count);
memset(temps, '\0', sizeof (double) * preshader->temp_count);
} // if

double dst[4];
double src[3][4];
Expand Down

0 comments on commit 23af57e

Please sign in to comment.