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