History

Replacing setUniformTexture by setResourceTexture in order to differenciate the 2 types of binding points for the BUffers.

Sam Gateau committed 11 years ago

Commit 7fc9fd91 parent cac239a15 files · +38 −38Browse files

Showing the changes to libraries/render-utils/src/DeferredLightingEffect.cpp (1 of 15 files). Show all

Unified · Split

libraries/render-utils/src/DeferredLightingEffect.cpp+14−14
@@ -147,7 +147,7 @@ void DeferredLightingEffect::bindSimpleProgram(gpu::Batch& batch, bool textured, · 146 unmodified lines
147 147
148 if (!config.isTextured()) {148 if (!config.isTextured()) {
149 // If it is not textured, bind white texture and keep using textured pipeline149 // If it is not textured, bind white texture and keep using textured pipeline
150 batch.setUniformTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture());150 batch.setResourceTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture());
151 }151 }
152}152}
153 153
@@ -244,13 +244,13 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 90 unmodified lines
244 244
245 batch.clearColorFramebuffer(freeFBO->getBufferMask(), glm::vec4(0.0f, 0.0f, 0.0f, 0.0f));245 batch.clearColorFramebuffer(freeFBO->getBufferMask(), glm::vec4(0.0f, 0.0f, 0.0f, 0.0f));
246 246
247 batch.setUniformTexture(0, textureCache->getPrimaryColorTexture());247 batch.setResourceTexture(0, textureCache->getPrimaryColorTexture());
248 248
249 batch.setUniformTexture(1, textureCache->getPrimaryNormalTexture());249 batch.setResourceTexture(1, textureCache->getPrimaryNormalTexture());
250 250
251 batch.setUniformTexture(2, textureCache->getPrimarySpecularTexture());251 batch.setResourceTexture(2, textureCache->getPrimarySpecularTexture());
252 252
253 batch.setUniformTexture(3, textureCache->getPrimaryDepthTexture());253 batch.setResourceTexture(3, textureCache->getPrimaryDepthTexture());
254 254
255 // get the viewport side (left, right, both)255 // get the viewport side (left, right, both)
256 int viewport[4];256 int viewport[4];
@@ -275,7 +275,7 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 18 unmodified lines
275 const LightLocations* locations = &_directionalLightLocations;275 const LightLocations* locations = &_directionalLightLocations;
276 bool shadowsEnabled = _viewState->getShadowsEnabled();276 bool shadowsEnabled = _viewState->getShadowsEnabled();
277 if (shadowsEnabled) {277 if (shadowsEnabled) {
278 batch.setUniformTexture(4, textureCache->getShadowFramebuffer()->getDepthStencilBuffer());278 batch.setResourceTexture(4, textureCache->getShadowFramebuffer()->getDepthStencilBuffer());
279 279
280 program = _directionalLightShadowMap;280 program = _directionalLightShadowMap;
281 locations = &_directionalLightShadowMapLocations;281 locations = &_directionalLightShadowMapLocations;
@@ -329,7 +329,7 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 47 unmodified lines
329 }329 }
330 330
331 if (useSkyboxCubemap) {331 if (useSkyboxCubemap) {
332 batch.setUniformTexture(5, _skybox->getCubemap());332 batch.setResourceTexture(5, _skybox->getCubemap());
333 }333 }
334 334
335 if (locations->lightBufferUnit >= 0) {335 if (locations->lightBufferUnit >= 0) {
@@ -377,11 +377,11 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 41 unmodified lines
377 }377 }
378 378
379 if (useSkyboxCubemap) {379 if (useSkyboxCubemap) {
380 batch.setUniformTexture(5, nullptr);380 batch.setResourceTexture(5, nullptr);
381 }381 }
382 382
383 if (shadowsEnabled) {383 if (shadowsEnabled) {
384 batch.setUniformTexture(4, nullptr);384 batch.setResourceTexture(4, nullptr);
385 }385 }
386 386
387 glm::vec4 sCoefficients(sWidth / 2.0f, 0.0f, 0.0f, sMin + sWidth / 2.0f);387 glm::vec4 sCoefficients(sWidth / 2.0f, 0.0f, 0.0f, sMin + sWidth / 2.0f);
@@ -530,10 +530,10 @@ void DeferredLightingEffect::render(RenderArgs* args) { · 142 unmodified lines
530 }530 }
531 531
532 // Probably not necessary in the long run because the gpu layer would unbound this texture if used as render target532 // Probably not necessary in the long run because the gpu layer would unbound this texture if used as render target
533 batch.setUniformTexture(0, nullptr);533 batch.setResourceTexture(0, nullptr);
534 batch.setUniformTexture(1, nullptr);534 batch.setResourceTexture(1, nullptr);
535 batch.setUniformTexture(2, nullptr);535 batch.setResourceTexture(2, nullptr);
536 batch.setUniformTexture(3, nullptr);536 batch.setResourceTexture(3, nullptr);
537 537
538 args->_context->syncCache();538 args->_context->syncCache();
539 args->_context->render(batch);539 args->_context->render(batch);
@@ -551,7 +551,7 @@ void DeferredLightingEffect::copyBack(RenderArgs* args) { · 11 unmodified lines
551 batch.setFramebuffer(textureCache->getPrimaryFramebuffer());551 batch.setFramebuffer(textureCache->getPrimaryFramebuffer());
552 batch.setPipeline(_blitLightBuffer);552 batch.setPipeline(_blitLightBuffer);
553 553
554 batch.setUniformTexture(0, freeFBO->getRenderBuffer(0));554 batch.setResourceTexture(0, freeFBO->getRenderBuffer(0));
555 555
556 batch.setProjectionTransform(glm::mat4());556 batch.setProjectionTransform(glm::mat4());
557 batch.setViewTransform(Transform());557 batch.setViewTransform(Transform());