Hash :
e72cc71b
Author :
Date :
2024-12-13T11:59:29
Vulkan: Remove framebuffer fetch from shader if unused Some application shaders may use `inout` variables to simplify shader generation (presumably), but in the end don't actually ever read from those variables. This change tries to detect some very simple but common cases where it's clear that the shader completely overwrites the variable without reading from it and turns `inout` into `out`. When coherent framebuffer fetch emulation kicks in, these shaders would no longer cause unnecessary barriers. Bug: angleproject:377923479 Change-Id: I0970b72f551b24409337a375cf97aa63bb511fb5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6094425 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Roman Lavrov <romanl@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com>
//
// Copyright 2024 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// RemoveUnusedFramebufferFetch.h:
// If the shader declares |inout| variables but only ever assigns to all their channels, the
// variable is turned into a regular |out| variable.
#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEUNUSEDFRAMEBUFFERFETCH_H_
#define COMPILER_TRANSLATOR_TREEOPS_REMOVEUNUSEDFRAMEBUFFERFETCH_H_
#include "common/angleutils.h"
namespace sh
{
class TCompiler;
class TIntermBlock;
class TSymbolTable;
[[nodiscard]] bool RemoveUnusedFramebufferFetch(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEUNUSEDFRAMEBUFFERFETCH_H_