Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 790 vs 801 for /trunk/Source Code/Rendering/RenderPass/RenderPass.cpp

Diff revisions: vs.
  @@ -61,16 +61,16 @@
61 61
62 62 };
63 63
64 - RenderPass::BufferData::BufferData()
64 + RenderPass::BufferData::BufferData(GFXDevice& context)
65 65 : _lastCommandCount(0),
66 66 _lasNodeCount(0)
67 67 {
68 68 // This do not need to be persistently mapped as, hopefully, they will only be update once per frame
69 69 // Each pass should have its own set of buffers (shadows, reflection, etc)
70 - _renderData = GFX_DEVICE.newSB(1, true, false, BufferUpdateFrequency::OCASSIONAL);
70 + _renderData = context.newSB(1, true, false, BufferUpdateFrequency::OCASSIONAL);
71 71 _renderData->create(to_uint(Config::MAX_VISIBLE_NODES), sizeof(GFXDevice::NodeData));
72 72
73 - _cmdBuffer = GFX_DEVICE.newSB(1, true, false, BufferUpdateFrequency::OCASSIONAL);
73 + _cmdBuffer = context.newSB(1, true, false, BufferUpdateFrequency::OCASSIONAL);
74 74 _cmdBuffer->create(Config::MAX_VISIBLE_NODES, sizeof(IndirectDrawCommand));
75 75 _cmdBuffer->addAtomicCounter(3);
76 76 }
  @@ -81,7 +81,7 @@
81 81 _renderData->destroy();
82 82 }
83 83
84 - RenderPass::BufferDataPool::BufferDataPool(U32 maxBuffers)
84 + RenderPass::BufferDataPool::BufferDataPool(GFXDevice& context, U32 maxBuffers)
85 85 {
86 86 // Every visible node will first update this buffer with required data (WorldMatrix, NormalMatrix, Material properties, Bone count, etc)
87 87 // Due to it's potentially huge size, it translates to (as seen by OpenGL) a Shader Storage Buffer that's persistently and coherently mapped
  @@ -89,7 +89,7 @@
89 89 // Create a shader buffer to hold all of our indirect draw commands
90 90 // Useful if we need access to the buffer in GLSL/Compute programs
91 91 for (U32 j = 0; j < maxBuffers; ++j) {
92 - BufferData* data = MemoryManager_NEW BufferData();
92 + BufferData* data = MemoryManager_NEW BufferData(context);
93 93 _buffers.push_back(data);
94 94 }
95 95 }
  @@ -107,15 +107,16 @@
107 107 return *_buffers[bufferIndex];
108 108 }
109 109
110 - RenderPass::RenderPass(stringImpl name, U8 sortKey, RenderStage passStageFlag)
111 - : _sortKey(sortKey),
110 + RenderPass::RenderPass(GFXDevice& context, stringImpl name, U8 sortKey, RenderStage passStageFlag)
111 + : _context(context),
112 + _sortKey(sortKey),
112 113 _name(name),
113 114 _stageFlag(passStageFlag)
114 115 {
115 116 _lastTotalBinSize = 0;
116 117
117 118 U32 count = getBufferCountForStage(_stageFlag);
118 - _passBuffers = MemoryManager_NEW BufferDataPool(count);
119 + _passBuffers = MemoryManager_NEW BufferDataPool(_context, count);
119 120
120 121 _drawCommandsCache.reserve(Config::MAX_VISIBLE_NODES);
121 122 }
  @@ -135,12 +136,12 @@
135 136
136 137 void RenderPass::render(SceneRenderState& renderState) {
137 138 if (_stageFlag != RenderStage::SHADOW) {
138 - LightPool::bindShadowMaps();
139 + LightPool::bindShadowMaps(_context);
139 140 }
140 141
141 142 switch(_stageFlag) {
142 143 case RenderStage::DISPLAY: {
143 - const RenderTarget& screenRT = GFX_DEVICE.renderTarget(RenderTargetID(RenderTargetUsage::SCREEN));
144 + const RenderTarget& screenRT = _context.renderTarget(RenderTargetID(RenderTargetUsage::SCREEN));
144 145 RenderPassManager& passMgr = RenderPassManager::instance();
145 146 RenderPassManager::PassParams params;
146 147 params.occlusionCull = Config::USE_HIZ_CULLING;