Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unnecessary fullscreen pass when haze is off/disabled #1176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libraries/graphics/src/graphics/Haze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// Created by Nissim Hadar on 9/13/2017.
// Copyright 2014 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
Expand Down Expand Up @@ -182,3 +183,7 @@ void Haze::setHazeBackgroundBlend(const float hazeBackgroundBlend) {
_hazeParametersBuffer.edit<Parameters>().hazeBackgroundBlend = newBlend;
}
}

bool Haze::isActive() const {
return (_hazeParametersBuffer.get<Parameters>().hazeMode & HAZE_MODE_IS_ACTIVE) == HAZE_MODE_IS_ACTIVE;
}
3 changes: 3 additions & 0 deletions libraries/graphics/src/graphics/Haze.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// Created by Nissim Hadar on 9/13/2017.
// Copyright 2014 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
Expand Down Expand Up @@ -95,6 +96,8 @@ namespace graphics {
using UniformBufferView = gpu::BufferView;
UniformBufferView getHazeParametersBuffer() const { return _hazeParametersBuffer; }

bool isActive() const;

protected:
class Parameters {
public:
Expand Down
5 changes: 5 additions & 0 deletions libraries/render-utils/src/DrawHaze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// Created by Nissim Hadar on 9/1/2017.
// Copyright 2015 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
Expand Down Expand Up @@ -55,6 +56,10 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu

auto depthBuffer = framebuffer->getLinearDepthTexture();

if (!lightingModel->isHazeEnabled() || !haze->isActive()) {
return;
}

RenderArgs* args = renderContext->args;

if (!_hazePipeline) {
Expand Down
5 changes: 1 addition & 4 deletions libraries/render-utils/src/Haze.slf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
// Created by Nissim Hadar on 9/5/2107.
// Copyright 2016 High Fidelity, Inc.
// Copyright 2024 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
Expand Down Expand Up @@ -45,10 +46,6 @@ layout(location=0) in vec2 varTexCoord0;
layout(location=0) out vec4 outFragColor;

void main(void) {
if ((isHazeEnabled() == 0.0) || (hazeParams.hazeMode & HAZE_MODE_IS_ACTIVE) != HAZE_MODE_IS_ACTIVE) {
discard;
}

vec4 fragPositionES = unpackPositionFromZeye(varTexCoord0);
mat4 viewInverse = getViewInverse();

Expand Down
Loading