Home | Info | Community | Development | myReactOS | Contact Us
[static]
Allocation helper.
Definition at line 209 of file slang_vartable.c.
Referenced by _slang_alloc_temp(), and _slang_alloc_var().
{ struct table *t = vt->Top; /* if size == 1, allocate anywhere, else, pos must be multiple of 4 */ const GLuint step = (size == 1) ? 1 : 4; GLuint i, j; assert(size > 0); /* number of floats */ for (i = 0; i <= vt->MaxRegisters * 4 - size; i += step) { GLuint found = 0; for (j = 0; j < (GLuint) size; j++) { assert(i + j < 4 * MAX_PROGRAM_TEMPS); if (i + j < vt->MaxRegisters * 4 && t->Temps[i + j] == FREE) { found++; } else { break; } } if (found == size) { /* found block of size free regs */ if (size > 1) assert(i % 4 == 0); for (j = 0; j < (GLuint) size; j++) { assert(i + j < 4 * MAX_PROGRAM_TEMPS); t->Temps[i + j] = isTemp ? TEMP : VAR; } assert(i < MAX_PROGRAM_TEMPS * 4); t->ValSize[i] = size; return i; } } /* if we get here, we ran out of registers */ return -1; }