Hash :
3036e090
Author :
Date :
2021-07-29T15:55:39
Vulkan: Direct SPIR-V Gen: Support the precise keyword The precise keyword is different in GLSL in that it defines what arithmetic operations _that have led to the value being assigned to a variable_ should be done precisely (i.e. not "contracted"). A tree traverser is implemented that detects precise access chains and applies precise-ness to the right hand side of assignment expressions to said access chains. This is only done if the shader uses the precise keyword in the first place. The algorithm for this is inspired by the implementation in glslang. This change additionally: - Fixes parser to allow precise on function parameters - Fixes GLSL code generation to output precise on struct members and function parameters. Bug: angleproject:4889 Change-Id: Ie3808c3c8c08da308e88af20f5f90379d9d14d47 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3056369 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
//
// Copyright 2021 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.
//
// FindPreciseNodes.h: Propagates |precise| to AST nodes and creates a set of them. In SPIR-V, the
// corresponding decoration (NoContraction) is applied on the intermediate result of operations that
// affect the |precise| variables, not the variables themselves.
#ifndef COMPILER_TRANSLATOR_TREEUTIL_FINDPRECISENODES_H_
#define COMPILER_TRANSLATOR_TREEUTIL_FINDPRECISENODES_H_
#include "common/angleutils.h"
namespace sh
{
class TCompiler;
class TIntermBlock;
class TIntermTyped;
using PreciseNodeSet = angle::HashSet<const TIntermTyped *>;
void FindPreciseNodes(TCompiler *compiler, TIntermBlock *root, PreciseNodeSet *preciseNodesOut);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEUTIL_FINDPRECISENODES_H_