xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/metal/renderermtl_utils.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2023 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 // renderermtl_utils:
7 //   Helper methods pertaining to the Metal backend.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_METAL_RENDERERMTL_UTILS_H_
11 #define LIBANGLE_RENDERER_METAL_RENDERERMTL_UTILS_H_
12 
13 #include <cstdint>
14 
15 #include <limits>
16 #include <map>
17 
18 #include "GLSLANG/ShaderLang.h"
19 #include "common/angleutils.h"
20 #include "common/utilities.h"
21 #include "libANGLE/angletypes.h"
22 
23 namespace rx
24 {
25 namespace mtl
26 {
27 
28 template <int cols, int rows>
29 struct SetFloatUniformMatrixMetal
30 {
31     static void Run(unsigned int arrayElementOffset,
32                     unsigned int elementCount,
33                     GLsizei countIn,
34                     GLboolean transpose,
35                     const GLfloat *value,
36                     uint8_t *targetData);
37 };
38 
39 // Helper method to de-tranpose a matrix uniform for an API query, Metal Version
40 void GetMatrixUniformMetal(GLenum type, GLfloat *dataOut, const GLfloat *source, bool transpose);
41 
42 template <typename NonFloatT>
43 void GetMatrixUniformMetal(GLenum type,
44                            NonFloatT *dataOut,
45                            const NonFloatT *source,
46                            bool transpose);
47 }  // namespace mtl
48 }  // namespace rx
49 #endif
50