1 // 2 // Copyright 2024 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // wgpu_wgsl_util.h: Utilities to manipulate previously translated WGSL. 7 // 8 9 #ifndef LIBANGLE_RENDERER_WGPU_WGPU_WGSL_UTIL_H_ 10 #define LIBANGLE_RENDERER_WGPU_WGPU_WGSL_UTIL_H_ 11 12 #include "common/PackedGLEnums_autogen.h" 13 #include "libANGLE/Program.h" 14 15 namespace rx 16 { 17 namespace webgpu 18 { 19 20 // Replaces location markers in the WGSL source with actual locations, for 21 // `shaderVars` which is a vector of either gl::ProgramInputs or gl::ProgramOutputs, and for 22 // `mergedVaryings` which get assigned sequentially increasing locations. There should be at most 23 // vertex and fragment shader stages or this function will not assign locations correctly. 24 template <typename T> 25 std::string WgslAssignLocations(const std::string &shaderSource, 26 const std::vector<T> shaderVars, 27 const gl::ProgramMergedVaryings &mergedVaryings, 28 gl::ShaderType shaderType); 29 30 } // namespace webgpu 31 } // namespace rx 32 33 #endif /* LIBANGLE_RENDERER_WGPU_WGPU_WGSL_UTIL_H_ */ 34