chromium/third_party/angle/src/compiler/translator/ValidateClipCullDistance.cpp

//
// Copyright 2020 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.
//
// The ValidateClipCullDistance function:
// * gathers clip/cull distance usages
// * checks if the sum of array sizes for gl_ClipDistance and
//   gl_CullDistance exceeds gl_MaxCombinedClipAndCullDistances
// * checks if length() operator is used correctly
// * adds an explicit clip/cull distance declaration
//

#include "ValidateClipCullDistance.h"

#include "compiler/translator/Diagnostics.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
#include "compiler/translator/tree_util/ReplaceVariable.h"
#include "compiler/translator/util.h"

namespace sh
{

namespace
{

void error(const TIntermSymbol &symbol, const char *reason, TDiagnostics *diagnostics)
{}

class ValidateClipCullDistanceTraverser : public TIntermTraverser
{};

ValidateClipCullDistanceTraverser::ValidateClipCullDistanceTraverser()
    :{}

bool ValidateClipCullDistanceTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
{}

bool ValidateClipCullDistanceTraverser::visitBinary(Visit visit, TIntermBinary *node)
{}

void ValidateClipCullDistanceTraverser::validate(TDiagnostics *diagnostics,
                                                 const unsigned int maxCombinedClipAndCullDistances,
                                                 uint8_t *clipDistanceSizeOut,
                                                 uint8_t *cullDistanceSizeOut,
                                                 bool *clipDistanceRedeclaredOut,
                                                 bool *cullDistanceRedeclaredOut,
                                                 bool *clipDistanceUsedOut)
{}

class ValidateClipCullDistanceLengthTraverser : public TIntermTraverser
{};

ValidateClipCullDistanceLengthTraverser::ValidateClipCullDistanceLengthTraverser(
    TDiagnostics *diagnostics,
    uint8_t clipDistanceSize,
    uint8_t cullDistanceSize)
    :{}

bool ValidateClipCullDistanceLengthTraverser::visitUnary(Visit visit, TIntermUnary *node)
{}

bool ReplaceAndDeclareVariable(TCompiler *compiler,
                               TIntermBlock *root,
                               const ImmutableString &name,
                               unsigned int size)
{}

}  // anonymous namespace

bool ValidateClipCullDistance(TCompiler *compiler,
                              TIntermBlock *root,
                              TDiagnostics *diagnostics,
                              const unsigned int maxCombinedClipAndCullDistances,
                              uint8_t *clipDistanceSizeOut,
                              uint8_t *cullDistanceSizeOut,
                              bool *clipDistanceUsedOut)
{}

}  // namespace sh