Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 515 vs 516 for /trunk/Source Code/Platform/Video/GFXState.cpp

Diff revisions: vs.
  @@ -3,7 +3,8 @@
3 3
4 4 namespace Divide {
5 5
6 - GPUState::GPUState() {
6 + GPUState::GPUState()
7 + {
7 8 _loaderThread = nullptr;
8 9 _MSAASamples = 0;
9 10 _FXAASamples = 0;
  @@ -11,6 +12,14 @@
11 12 // Atomic boolean use to signal the loading thread to stop
12 13 _closeLoadingThread = false;
13 14 _loadQueueDataReady = false;
15 + _renderingPool.size_controller().resize(HARDWARE_THREAD_COUNT() / 2);
16 + }
17 +
18 + GPUState::~GPUState()
19 + {
20 + _renderingPool.wait();
21 + _renderingPool.clear();
22 + WAIT_FOR_CONDITION(_renderingPool.active() == 0);
14 23 }
15 24
16 25 bool GPUState::startLoaderThread(const DELEGATE_CBK<>& loadingFunction) {
  @@ -21,6 +30,26 @@
21 30 _loaderThread.reset(new std::thread(loadingFunction));
22 31 }
23 32
33 + vectorImpl<Task_ptr> tasks;
34 + tasks.reserve(_renderingPool.size());
35 + size_t threadCount = tasks.size();
36 +
37 + for (size_t i = 0; i < threadCount; ++i) {
38 + tasks.push_back(std::make_shared<Task>(_renderingPool,
39 + 1,
40 + 1,
41 + []() {
42 + Attorney::GFXDeviceGPUState::threadedLoadCallback();
43 + }));
44 + }
45 +
46 + for (Task_ptr task : tasks) {
47 + task->startTask();
48 + }
49 +
50 + _renderingPool.wait();
51 +
52 + tasks.clear();
24 53 return true;
25 54 }
26 55