Hash :
cac1e824
Author :
Date :
2025-04-29T18:27:36
WGSL: Output driver uniform and UBO structs This is the WGSL half of the change to implement driver uniforms. Driver uniforms are implemented as a UBO and reuse the default set of driver uniforms. User-provided UBOs don't yet have variables outputted for them. This requires moving MSL's ReduceInterfaceBlocks to the tree_ops dir in order to change interface block definitions into struct definitions. Bug: angleproject:389145696 Change-Id: I27f3837b3d115f2ffac66cc545f3b60ca9f01cb6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6477564 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
//
// 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_MSL_REDUCEINTERFACEBLOCKS_H_
#define COMPILER_TRANSLATOR_TREEOPS_MSL_REDUCEINTERFACEBLOCKS_H_
#include <functional>
#include "common/angleutils.h"
#include "compiler/translator/Compiler.h"
namespace sh
{
class TSymbolTable;
using InterfaceBlockInstanceVarNameGen = std::function<ImmutableString()>;
// This rewrites interface block declarations only.
//
// Access of interface blocks is not rewritten (e.g. TOperator::EOpIndexDirectInterfaceBlock). //
// XXX: ^ Still true?
//
// Example:
// uniform Foo { int x; };
// Becomes:
// uniform int x;
//
// Example:
// uniform Foo { int x; } foo;
// Becomes:
// struct Foo { int x; }; uniform Foo x;
//
[[nodiscard]] bool ReduceInterfaceBlocks(TCompiler &compiler,
TIntermBlock &root,
InterfaceBlockInstanceVarNameGen nameGen);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_MSL_REDUCEINTERFACEBLOCKS_H_