Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 770 vs 771 for /trunk/Source Code/Platform/Video/GFXDevice.cpp

Diff revisions: vs.
  @@ -30,8 +30,6 @@
30 30 // Hash values
31 31 _state2DRenderingHash = 0;
32 32 _defaultStateBlockHash = 0;
33 - _currentStateBlockHash = 0;
34 - _previousStateBlockHash = 0;
35 33 _defaultStateNoDepthHash = 0;
36 34 _stateDepthOnlyRenderingHash = 0;
37 35 // Pointers
  @@ -243,59 +241,6 @@
243 241 kernel.getCameraMgr().popActiveCamera();
244 242 }
245 243
246 - /// If the stateBlock doesn't exist in the state block map, add it for future reference
247 - bool GFXDevice::registerRenderStateBlock(const RenderStateBlock& descriptor) {
248 - // Each combination of render states has a unique hash value
249 - size_t hashValue = descriptor.getHash();
250 - // Find the corresponding render state block
251 - // Create a new one if none are found. The GFXDevice class is
252 - // responsible for deleting these!
253 - std::pair<RenderStateMap::iterator, bool> result =
254 - hashAlg::emplace(_stateBlockMap, hashValue, descriptor);
255 - // Return true if registration was successful
256 - return result.second;
257 - }
258 -
259 - /// Activate the render state block described by the specified hash value (0 == default state block)
260 - size_t GFXDevice::setStateBlock(size_t stateBlockHash) {
261 - // Passing 0 is a perfectly acceptable way of enabling the default render state block
262 - if (stateBlockHash == 0) {
263 - stateBlockHash = _defaultStateBlockHash;
264 - }
265 -
266 - // If the new state hash is different from the previous one
267 - if (stateBlockHash != _currentStateBlockHash) {
268 - // Remember the previous state hash
269 - _previousStateBlockHash = _currentStateBlockHash;
270 - // Update the current state hash
271 - _currentStateBlockHash = stateBlockHash;
272 - RenderStateMap::const_iterator currentStateIt = _stateBlockMap.find(_currentStateBlockHash);
273 - RenderStateMap::const_iterator previousStateIt = _stateBlockMap.find(_previousStateBlockHash);
274 -
275 - DIVIDE_ASSERT(currentStateIt != previousStateIt &&
276 - currentStateIt != std::cend(_stateBlockMap) &&
277 - previousStateIt != std::cend(_stateBlockMap),
278 - "GFXDevice error: Invalid state blocks detected on activation!");
279 -
280 - // Activate the new render state block in an rendering API dependent way
281 - _api->activateStateBlock(currentStateIt->second, previousStateIt->second);
282 - }
283 - // Return the previous state hash
284 - return _previousStateBlockHash;
285 - }
286 -
287 - /// Return the the render state block defined by the specified hash value.
288 - const RenderStateBlock& GFXDevice::getRenderStateBlock(size_t renderStateBlockHash) const {
289 - // Find the render state block associated with the received hash value
290 - RenderStateMap::const_iterator it = _stateBlockMap.find(renderStateBlockHash);
291 - // Assert if it doesn't exist. Avoids programming errors.
292 - DIVIDE_ASSERT(it != std::cend(_stateBlockMap),
293 - "GFXDevice error: Invalid render state block hash specified "
294 - "for getRenderStateBlock!");
295 - // Return the state block's descriptor
296 - return it->second;
297 - }
298 -
299 244 void GFXDevice::increaseResolution() {
300 245 const WindowManager& winManager = Application::instance().windowManager();
301 246 const vec2<U16>& resolution = winManager.getActiveWindow().getDimensions();
  @@ -526,7 +471,7 @@
526 471 // If we need to enable 2D rendering
527 472 if (state) {
528 473 // Activate the 2D render state block
529 - previousStateBlockHash = setStateBlock(_state2DRenderingHash);
474 + previousStateBlockHash = _api->setStateBlock(_state2DRenderingHash);
530 475 // Push the 2D camera
531 476 kernel.getCameraMgr().pushActiveCamera(_2DCamera);
532 477 // Upload 2D camera matrices to the GPU
  @@ -537,7 +482,7 @@
537 482 // Reverting to 3D implies popping the 2D camera
538 483 kernel.getCameraMgr().popActiveCamera();
539 484 // And restoring the previous state block
540 - setStateBlock(previousStateBlockHash);
485 + _api->setStateBlock(previousStateBlockHash);
541 486 }
542 487 }
543 488