| 59 | }; |
| 60 | |
| 61 | static Request* GetNextRequest(Queue* queue) |
| 62 | { |
| 63 | // Since we can be loading many things at once, track the total Capacity() for buffers |
| 64 | // that are waiting to be picked up by the preloader. In the case of the queue being filled |
| 65 | // with only large requests (say only 4Mb textures), this throttles a bit so memory consumption |
| 66 | // does not run away. |
| 67 | if (queue->m_BytesWaiting >= MAX_PENDING_DATA) |
| 68 | { |
| 69 | return 0x0; |
| 70 | } |
| 71 | |
| 72 | if (queue->m_Loaded == queue->m_Front) |
| 73 | { |
| 74 | return 0x0; |
| 75 | } |
| 76 | |
| 77 | return &queue->m_Request[queue->m_Loaded % QUEUE_SLOTS]; |
| 78 | } |
| 79 | |
| 80 | static void LoadThread(void* arg) |
| 81 | { |