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>
//
// 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_OUTPUT_UNIFORM_BLOCKS_H_
#define COMPILER_TRANSLATOR_WGSL_OUTPUT_UNIFORM_BLOCKS_H_
#include <variant>
#include "compiler/translator/Compiler.h"
#include "compiler/translator/IntermNode.h"
namespace sh
{
const char kDefaultUniformBlockVarType[] = "ANGLE_DefaultUniformBlock";
const char kDefaultUniformBlockVarName[] = "ANGLE_defaultUniformBlock";
const uint32_t kDefaultUniformBlockBindGroup = 0;
const uint32_t kDefaultUniformBlockBinding = 0;
// TODO(anglebug.com/42267100): for now does not output all uniform blocks,
// just the default block. (fails for matCx2, bool, and arrays with stride less than 16.)
bool OutputUniformBlocks(TCompiler *compiler, TIntermBlock *root);
} // namespace sh
#endif // COMPILER_TRANSLATOR_WGSL_OUTPUT_UNIFORM_BLOCKS_H_