diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index 91d196f896..af5a3f3e63 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -496,11 +496,6 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, batch.setPipeline(program); } - // NOTE: WE are assuming that the deferred lighting pass is always full screen so this texture transform is not needed (and cause problems on AMD) - // Adjust the texcoordTransform in the case we are rendeirng a sub region(mini mirror) - // auto textureFrameTransform = gpu::Framebuffer::evalSubregionTexcoordTransformCoefficients(deferredFramebuffer->getFrameSize(), args->_viewport); - // batch._glUniform4fv(ru::Uniform::TexcoordTransform, 1, reinterpret_cast< const float* >(&textureFrameTransform)); - // Setup the global lighting deferredLightingEffect->setupKeyLightBatch(args, batch); @@ -561,24 +556,18 @@ void RenderDeferredLocals::run(const render::RenderContextPointer& renderContext batch.setViewportTransform(viewport); batch.setStateScissorRect(viewport); - // NOTE: WE are assuming that the deferred lighting pass is always full screen so this texture transform is not needed (and cause problems on AMD) - // auto textureFrameTransform = gpu::Framebuffer::evalSubregionTexcoordTransformCoefficients(deferredFramebuffer->getFrameSize(), viewport); - - auto& lightIndices = lightClusters->_visibleLightIndices; if (!lightIndices.empty() && lightIndices[0] > 0) { deferredLightingEffect->setupLocalLightsBatch(batch, lightClusters); // Local light pipeline batch.setPipeline(deferredLightingEffect->_localLight); - // batch._glUniform4fv(ru::Uniform::TexcoordTransform, 1, reinterpret_cast(&textureFrameTransform)); batch.draw(gpu::TRIANGLE_STRIP, 4); // Draw outline as well ? if (lightingModel->isShowLightContourEnabled()) { batch.setPipeline(deferredLightingEffect->_localLightOutline); - // batch._glUniform4fv(ru::Uniform::TexcoordTransform, 1, reinterpret_cast(&textureFrameTransform)); batch.draw(gpu::TRIANGLE_STRIP, 4); } diff --git a/libraries/render-utils/src/deferred_light.slv b/libraries/render-utils/src/deferred_light.slv index 0bc7a0f807..4ea3133718 100644 --- a/libraries/render-utils/src/deferred_light.slv +++ b/libraries/render-utils/src/deferred_light.slv @@ -16,8 +16,10 @@ layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; +#ifdef RENDER_UTILS_USE_TEXCOORD_FRAME_TRANSFORM // NOTE: WE are assuming that the deferred lighting pass is always full screen so this texture transform is not needed (and cause problems on AMD) -//layout(location=RENDER_UTILS_UNIFORM_LIGHT_TEXCOORD_TRANSFORM) uniform vec4 texcoordFrameTransform; +layout(location=RENDER_UTILS_UNIFORM_LIGHT_TEXCOORD_TRANSFORM) uniform vec4 texcoordFrameTransform; +#endif void main(void) { const float depth = 1.0; @@ -31,8 +33,10 @@ void main(void) { _texCoord01.xy = (pos.xy + 1.0) * 0.5; - // _texCoord01.xy *= texcoordFrameTransform.zw; - // _texCoord01.xy += texcoordFrameTransform.xy; +#ifdef RENDER_UTILS_USE_TEXCOORD_FRAME_TRANSFORM + _texCoord01.xy *= texcoordFrameTransform.zw; + _texCoord01.xy += texcoordFrameTransform.xy; +#endif gl_Position = pos; }