Hash :
fe8c0390
Author :
Date :
2024-09-25T19:00:34
WGSL: Run SeparateCompoundStructDeclarations to name structs Borrow SeparateCompoundStructDeclarations from the Metal backend to separate struct definitions and name nameless structs. Refactor id generation into a callback. Bug: angleproject:42267100 Change-Id: I8ed6f13113a5d5e450d30ce187ce1df52e572000 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5889089 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
//
// 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.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATECOMPOUNDSTRUCTDECLARATIONS_H_
#define COMPILER_TRANSLATOR_TREEOPS_SEPARATECOMPOUNDSTRUCTDECLARATIONS_H_
#include "common/angleutils.h"
#include "compiler/translator/Compiler.h"
#include <functional>
namespace sh
{
class TSymbolTable;
using StructNameGenerator = std::function<ImmutableString()>;
// Example:
// struct Foo { int x; } foo;
// Becomes:
// struct Foo {int x; }; Foo foo;
[[nodiscard]] bool SeparateCompoundStructDeclarations(TCompiler &compiler,
StructNameGenerator nameGenerator,
TIntermBlock &root);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATECOMPOUNDSTRUCTDECLARATIONS_H_