Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 792 vs 801 for /trunk/Source Code/Rendering/DeferredShadingRenderer.cpp

Diff revisions: vs.
  @@ -18,14 +18,14 @@
18 18
19 19 namespace Divide {
20 20
21 - DeferredShadingRenderer::DeferredShadingRenderer()
22 - : Renderer(RendererType::RENDERER_DEFERRED_SHADING), _cachedLightCount(0)
21 + DeferredShadingRenderer::DeferredShadingRenderer(GFXDevice& context)
22 + : Renderer(context, RendererType::RENDERER_DEFERRED_SHADING), _cachedLightCount(0)
23 23 {
24 - _lightTexture = GFX_DEVICE.newPB();
24 + _lightTexture = _context.newPB();
25 25 ResourceDescriptor deferred("DeferredShadingPass2");
26 26 deferred.setThreadedLoading(false);
27 27 _deferredShader = CreateResource<ShaderProgram>(deferred);
28 - _deferredBuffer = GFX_DEVICE.allocateRT("Deferred");
28 + _deferredBuffer = _context.allocateRT("Deferred");
29 29
30 30 ResourceDescriptor deferredPreview("deferredPreview");
31 31 deferredPreview.setThreadedLoading(false);
  @@ -85,7 +85,7 @@
85 85 STUBBED("Shadow maps are currently disabled for Deferred Rendering! -Ionut")
86 86 par.setParam(_ID("rendering.enableShadows"), false);
87 87
88 - RenderTarget& screenRT = GFX_DEVICE.renderTarget(RenderTargetID(RenderTargetUsage::SCREEN));
88 + RenderTarget& screenRT = _context.renderTarget(RenderTargetID(RenderTargetUsage::SCREEN));
89 89
90 90 U16 width = screenRT.getWidth();
91 91 U16 height = screenRT.getHeight();
  @@ -119,7 +119,7 @@
119 119 {
120 120 Console::printfn(Locale::get(_ID("DEFERRED_RT_DELETE")));
121 121 _renderQuads.clear();
122 - GFX_DEVICE.deallocateRT(_deferredBuffer);
122 + _context.deallocateRT(_deferredBuffer);
123 123 _lightTexture->destroy();}
124 124
125 125 void DeferredShadingRenderer::preRender(RenderTarget& target, LightPool& lightPool) {
  @@ -171,7 +171,7 @@
171 171 // Pass 2
172 172 // Draw a 2D fullscreen quad with lighting shader applied and all generated
173 173 // textures bound to that shader
174 - GFX::Scoped2DRendering scoped2D(true);
174 + GFX::Scoped2DRendering scoped2D;
175 175
176 176 _deferredBuffer._rt->bind(0, RTAttachment::Type::Colour, 0);
177 177 _deferredBuffer._rt->bind(1, RTAttachment::Type::Colour, 1);
  @@ -180,32 +180,32 @@
180 180 _lightTexture->bind(4);
181 181
182 182 GenericDrawCommand cmd;
183 - cmd.stateHash(GFX_DEVICE.getDefaultStateBlock(true));
183 + cmd.stateHash(_context.getDefaultStateBlock(true));
184 184 cmd.shaderProgram(_previewDeferredShader);
185 185 if (_debugView) {
186 186 _previewDeferredShader->Uniform("texDiffuse0", 4);
187 - if (_renderQuads[1]->onRender(GFX_DEVICE.getRenderStage())) {
187 + if (_renderQuads[1]->onRender(_context.getRenderStage())) {
188 188 cmd.sourceBuffer(_renderQuads[1]->getGeometryVB());
189 - GFX_DEVICE.draw(cmd);
189 + _context.draw(cmd);
190 190 }
191 191 _previewDeferredShader->Uniform("texDiffuse0", 1);
192 - if (_renderQuads[2]->onRender(GFX_DEVICE.getRenderStage())) {
192 + if (_renderQuads[2]->onRender(_context.getRenderStage())) {
193 193 cmd.sourceBuffer(_renderQuads[2]->getGeometryVB());
194 - GFX_DEVICE.draw(cmd);
194 + _context.draw(cmd);
195 195 }
196 196 _previewDeferredShader->Uniform("texDiffuse0", 2);
197 - if (_renderQuads[3]->onRender(GFX_DEVICE.getRenderStage())) {
197 + if (_renderQuads[3]->onRender(_context.getRenderStage())) {
198 198 cmd.sourceBuffer(_renderQuads[3]->getGeometryVB());
199 - GFX_DEVICE.draw(cmd);
199 + _context.draw(cmd);
200 200 }
201 201 }
202 202
203 203 _deferredShader->Uniform("lightCount", (I32)_cachedLightCount);
204 204
205 205 cmd.shaderProgram(_deferredShader);
206 - if (_renderQuads[_debugView ? 4 : 0]->onRender(GFX_DEVICE.getRenderStage())) {
206 + if (_renderQuads[_debugView ? 4 : 0]->onRender(_context.getRenderStage())) {
207 207 cmd.sourceBuffer(_renderQuads[_debugView ? 4 : 0]->getGeometryVB());
208 - GFX_DEVICE.draw(cmd);
208 + _context.draw(cmd);
209 209 }
210 210
211 211 GUI& gui = GUI::instance();