Hash :
63d8f74c
Author :
Date :
2025-08-12T19:39:03
WGSL: move DeclareDefaultUniforms() out of SPIR-V WGSL needs the same thing (default uniforms gathered into an interface block). Changes 3 things in the file move: 1. Now capable of adding a named interface block (Vulkan's is nameless) to hold the default uniforms. 2. Removes inactive uniforms 3. Deals with the case where there are no active default uniforms, by not declaring an interface block at all. Bug: angleproject:376553328 Change-Id: Ia25318b4db93068010c3c44414cd00803b783799 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6843929 Reviewed-by: Shahbaz Youssefi <syoussefi@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 38 39
//
// Copyright 2025 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.
//
// GatherDefaultUniforms.h: gathers all default uniforms and puts them in an interface block,
// rewriting accesses of the default uniforms appropriately.
#ifndef COMPILER_TRANSLATOR_TREEOPS_GATHERDEFAULTUNIFORMS_H_
#define COMPILER_TRANSLATOR_TREEOPS_GATHERDEFAULTUNIFORMS_H_
#include "common/PackedGLEnums_autogen.h"
#include "compiler/translator/ImmutableString.h"
namespace sh
{
class TCompiler;
class TIntermBlock;
class TSymbolTable;
class TVariable;
class TType;
[[nodiscard]] bool IsDefaultUniform(const TType &type);
// Gathers all default uniforms into an interface block named `uniformBlockType`, with optional
// `uniformBlockVarName`. Rewrites accesses to the default uniform variables appropriately. Inserts
// the resulting interface block into the `root` tree and stores a pointer to the interface block in
// `outUniformBlock`.
[[nodiscard]] bool GatherDefaultUniforms(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable,
gl::ShaderType shaderType,
const ImmutableString &uniformBlockType,
const ImmutableString &uniformBlockVarName,
const TVariable **outUniformBlock);
} // namespace sh
#endif // COMPILER_TRANSLATOR_TREEOPS_GATHERDEFAULTUNIFORMS_H_