- renamed some variables because they were getting into the way of analyzing usage of the global variable of the same name.

This commit is contained in:
Christoph Oelckers 2018-12-28 18:11:33 +01:00
parent 0e904286e8
commit d066a1f10f

View file

@ -48,20 +48,20 @@ void PPBloom::UpdateTextures()
for (int i = 0; i < NumBloomLevels; i++) for (int i = 0; i < NumBloomLevels; i++)
{ {
auto &level = levels[i]; auto &blevel = levels[i];
level.VTexture.Format("Bloom.VTexture.%d", i); blevel.VTexture.Format("Bloom.VTexture.%d", i);
level.HTexture.Format("Bloom.HTexture.%d", i); blevel.HTexture.Format("Bloom.HTexture.%d", i);
level.Viewport.left = 0; blevel.Viewport.left = 0;
level.Viewport.top = 0; blevel.Viewport.top = 0;
level.Viewport.width = (bloomWidth + 1) / 2; blevel.Viewport.width = (bloomWidth + 1) / 2;
level.Viewport.height = (bloomHeight + 1) / 2; blevel.Viewport.height = (bloomHeight + 1) / 2;
PPTextureDesc texture = { level.Viewport.width, level.Viewport.height, PixelFormat::Rgba16f }; PPTextureDesc texture = { blevel.Viewport.width, blevel.Viewport.height, PixelFormat::Rgba16f };
hw_postprocess.Textures[level.VTexture] = texture; hw_postprocess.Textures[blevel.VTexture] = texture;
hw_postprocess.Textures[level.HTexture] = texture; hw_postprocess.Textures[blevel.HTexture] = texture;
bloomWidth = level.Viewport.width; bloomWidth = blevel.Viewport.width;
bloomHeight = level.Viewport.height; bloomHeight = blevel.Viewport.height;
} }
} }
@ -102,17 +102,17 @@ void PPBloom::UpdateSteps()
// Blur and downscale: // Blur and downscale:
for (int i = 0; i < NumBloomLevels - 1; i++) for (int i = 0; i < NumBloomLevels - 1; i++)
{ {
auto &level = levels[i]; auto &blevel = levels[i];
auto &next = levels[i + 1]; auto &next = levels[i + 1];
steps.Push(BlurStep(blurUniforms, level.VTexture, level.HTexture, level.Viewport, false)); steps.Push(BlurStep(blurUniforms, blevel.VTexture, blevel.HTexture, blevel.Viewport, false));
steps.Push(BlurStep(blurUniforms, level.HTexture, level.VTexture, level.Viewport, true)); steps.Push(BlurStep(blurUniforms, blevel.HTexture, blevel.VTexture, blevel.Viewport, true));
// Linear downscale: // Linear downscale:
step.ShaderName = "BloomCombine"; step.ShaderName = "BloomCombine";
step.Uniforms.Clear(); step.Uniforms.Clear();
step.Viewport = next.Viewport; step.Viewport = next.Viewport;
step.SetInputTexture(0, level.VTexture, PPFilterMode::Linear); step.SetInputTexture(0, blevel.VTexture, PPFilterMode::Linear);
step.SetOutputTexture(next.VTexture); step.SetOutputTexture(next.VTexture);
step.SetNoBlend(); step.SetNoBlend();
steps.Push(step); steps.Push(step);
@ -121,17 +121,17 @@ void PPBloom::UpdateSteps()
// Blur and upscale: // Blur and upscale:
for (int i = NumBloomLevels - 1; i > 0; i--) for (int i = NumBloomLevels - 1; i > 0; i--)
{ {
auto &level = levels[i]; auto &blevel = levels[i];
auto &next = levels[i - 1]; auto &next = levels[i - 1];
steps.Push(BlurStep(blurUniforms, level.VTexture, level.HTexture, level.Viewport, false)); steps.Push(BlurStep(blurUniforms, blevel.VTexture, blevel.HTexture, blevel.Viewport, false));
steps.Push(BlurStep(blurUniforms, level.HTexture, level.VTexture, level.Viewport, true)); steps.Push(BlurStep(blurUniforms, blevel.HTexture, blevel.VTexture, blevel.Viewport, true));
// Linear upscale: // Linear upscale:
step.ShaderName = "BloomCombine"; step.ShaderName = "BloomCombine";
step.Uniforms.Clear(); step.Uniforms.Clear();
step.Viewport = next.Viewport; step.Viewport = next.Viewport;
step.SetInputTexture(0, level.VTexture, PPFilterMode::Linear); step.SetInputTexture(0, blevel.VTexture, PPFilterMode::Linear);
step.SetOutputTexture(next.VTexture); step.SetOutputTexture(next.VTexture);
step.SetNoBlend(); step.SetNoBlend();
steps.Push(step); steps.Push(step);
@ -191,17 +191,17 @@ void PPBloom::UpdateBlurSteps()
// Blur and downscale: // Blur and downscale:
for (int i = 0; i < numLevels - 1; i++) for (int i = 0; i < numLevels - 1; i++)
{ {
auto &level = levels[i]; auto &blevel = levels[i];
auto &next = levels[i + 1]; auto &next = levels[i + 1];
steps.Push(BlurStep(blurUniforms, level.VTexture, level.HTexture, level.Viewport, false)); steps.Push(BlurStep(blurUniforms, blevel.VTexture, blevel.HTexture, blevel.Viewport, false));
steps.Push(BlurStep(blurUniforms, level.HTexture, level.VTexture, level.Viewport, true)); steps.Push(BlurStep(blurUniforms, blevel.HTexture, blevel.VTexture, blevel.Viewport, true));
// Linear downscale: // Linear downscale:
step.ShaderName = "BloomCombine"; step.ShaderName = "BloomCombine";
step.Uniforms.Clear(); step.Uniforms.Clear();
step.Viewport = next.Viewport; step.Viewport = next.Viewport;
step.SetInputTexture(0, level.VTexture, PPFilterMode::Linear); step.SetInputTexture(0, blevel.VTexture, PPFilterMode::Linear);
step.SetOutputTexture(next.VTexture); step.SetOutputTexture(next.VTexture);
step.SetNoBlend(); step.SetNoBlend();
steps.Push(step); steps.Push(step);
@ -210,17 +210,17 @@ void PPBloom::UpdateBlurSteps()
// Blur and upscale: // Blur and upscale:
for (int i = numLevels - 1; i > 0; i--) for (int i = numLevels - 1; i > 0; i--)
{ {
auto &level = levels[i]; auto &blevel = levels[i];
auto &next = levels[i - 1]; auto &next = levels[i - 1];
steps.Push(BlurStep(blurUniforms, level.VTexture, level.HTexture, level.Viewport, false)); steps.Push(BlurStep(blurUniforms, blevel.VTexture, blevel.HTexture, blevel.Viewport, false));
steps.Push(BlurStep(blurUniforms, level.HTexture, level.VTexture, level.Viewport, true)); steps.Push(BlurStep(blurUniforms, blevel.HTexture, blevel.VTexture, blevel.Viewport, true));
// Linear upscale: // Linear upscale:
step.ShaderName = "BloomCombine"; step.ShaderName = "BloomCombine";
step.Uniforms.Clear(); step.Uniforms.Clear();
step.Viewport = next.Viewport; step.Viewport = next.Viewport;
step.SetInputTexture(0, level.VTexture, PPFilterMode::Linear); step.SetInputTexture(0, blevel.VTexture, PPFilterMode::Linear);
step.SetOutputTexture(next.VTexture); step.SetOutputTexture(next.VTexture);
step.SetNoBlend(); step.SetNoBlend();
steps.Push(step); steps.Push(step);
@ -440,16 +440,16 @@ void PPCameraExposure::UpdateTextures()
width = MAX(width / 2, 1); width = MAX(width / 2, 1);
height = MAX(height / 2, 1); height = MAX(height / 2, 1);
PPExposureLevel level; PPExposureLevel blevel;
level.Viewport.left = 0; blevel.Viewport.left = 0;
level.Viewport.top = 0; blevel.Viewport.top = 0;
level.Viewport.width = width; blevel.Viewport.width = width;
level.Viewport.height = height; blevel.Viewport.height = height;
level.Texture.Format("Exposure.Level.%d", i); blevel.Texture.Format("Exposure.Level.%d", i);
ExposureLevels.Push(level); ExposureLevels.Push(blevel);
PPTextureDesc texture = { level.Viewport.width, level.Viewport.height, PixelFormat::R32f }; PPTextureDesc texture = { blevel.Viewport.width, blevel.Viewport.height, PixelFormat::R32f };
hw_postprocess.Textures[level.Texture] = texture; hw_postprocess.Textures[blevel.Texture] = texture;
i++; i++;
@ -483,7 +483,7 @@ void PPCameraExposure::UpdateSteps()
auto &level0 = ExposureLevels[0]; auto &level0 = ExposureLevels[0];
// Extract light level from scene texture: // Extract light blevel from scene texture:
step.ShaderName = "ExposureExtract"; step.ShaderName = "ExposureExtract";
step.Uniforms.Set(extractUniforms); step.Uniforms.Set(extractUniforms);
step.Viewport = level0.Viewport; step.Viewport = level0.Viewport;
@ -495,13 +495,13 @@ void PPCameraExposure::UpdateSteps()
// Find the average value: // Find the average value:
for (unsigned int i = 0; i + 1 < ExposureLevels.Size(); i++) for (unsigned int i = 0; i + 1 < ExposureLevels.Size(); i++)
{ {
auto &level = ExposureLevels[i]; auto &blevel = ExposureLevels[i];
auto &next = ExposureLevels[i + 1]; auto &next = ExposureLevels[i + 1];
step.ShaderName = "ExposureAverage"; step.ShaderName = "ExposureAverage";
step.Uniforms.Clear(); step.Uniforms.Clear();
step.Viewport = next.Viewport; step.Viewport = next.Viewport;
step.SetInputTexture(0, level.Texture, PPFilterMode::Linear); step.SetInputTexture(0, blevel.Texture, PPFilterMode::Linear);
step.SetOutputTexture(next.Texture); step.SetOutputTexture(next.Texture);
step.SetNoBlend(); step.SetNoBlend();
steps.Push(step); steps.Push(step);