Debian Codegraph @

third_party/spirv-cross/include/spirv_cross/image.hpp

raw
1 /*
2 * Copyright 2015-2017 ARM Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef SPIRV_CROSS_IMAGE_HPP
18 #define SPIRV_CROSS_IMAGE_HPP
19
20 #ifndef GLM_SWIZZLE
21 #define GLM_SWIZZLE
22 #endif
23
24 #ifndef GLM_FORCE_RADIANS
25 #define GLM_FORCE_RADIANS
26 #endif
27
28 #include <glm/glm.hpp>
29
30 namespace spirv_cross
31 {
32 template <typename T>
33 struct image2DBase
34 {
35 virtual ~image2DBase() = default;
36 inline virtual T load(glm::ivec2 coord) const
37 {
38 return T(0, 0, 0, 1);
39 }
40 inline virtual void store(glm::ivec2 coord, const T &v)
41 {
42 }
43 };
44
45 typedef image2DBase<glm::vec4> image2D;
46 typedef image2DBase<glm::ivec4> iimage2D;
47 typedef image2DBase<glm::uvec4> uimage2D;
48
49 template <typename T>
50 inline T imageLoad(const image2DBase<T> &image, glm::ivec2 coord)
51 {
52 return image.load(coord);
53 }
54
55 template <typename T>
56 void imageStore(image2DBase<T> &image, glm::ivec2 coord, const T &value)
57 {
58 image.store(coord, value);
59 }
60 }
61
62 #endif