Change code to actually work when NUM_OUTPUT_SURFACES is changed.