Hash :
a6ee4641
Author :
Date :
2024-09-25T11:41:47
WGSL: Output default uniform block and accesses to it Default uniforms are put into a WGSL struct, and all accesses of those uniforms now output struct accesses. Similarly to I/O vars and builtins, these are outputted in a pre-pass, but in the future it might make sense to do what Vulkan does and do an AST transformation to put the default uniforms into a UBO which should be outputted similarly. This does not handle bool, matCx2, or array of element size < 16. Bug: angleproject:42267100 Change-Id: If29e2895a8aba3212b581813316af87273c1515c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5878759 Reviewed-by: Liza Burakova <liza@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Matthew Denton <mpdenton@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
//
// 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.
//
#ifndef COMPILER_TRANSLATOR_WGSL_UTILS_H_
#define COMPILER_TRANSLATOR_WGSL_UTILS_H_
#include "compiler/translator/Common.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/IntermNode.h"
#include "compiler/translator/Types.h"
namespace sh
{
// Can be used with TSymbol or TField or TFunc.
template <typename StringStreamType, typename Object>
void WriteNameOf(StringStreamType &output, const Object &namedObject)
{
WriteNameOf(output, namedObject.symbolType(), namedObject.name());
}
template <typename StringStreamType>
void WriteNameOf(StringStreamType &output, SymbolType symbolType, const ImmutableString &name);
template <typename StringStreamType>
void WriteWgslBareTypeName(StringStreamType &output, const TType &type);
template <typename StringStreamType>
void WriteWgslType(StringStreamType &output, const TType &type);
using GlobalVars = TMap<ImmutableString, TIntermDeclaration *>;
GlobalVars FindGlobalVars(TIntermBlock *root);
} // namespace sh
#endif // COMPILER_TRANSLATOR_WGSL_UTILS_H_