2016-03-02 17:09:16 +00:00
|
|
|
/*
|
2017-01-28 08:00:40 +00:00
|
|
|
* Copyright 2015-2017 ARM Limited
|
2016-03-02 17:09:16 +00:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2016-04-04 07:36:04 +00:00
|
|
|
#ifndef SPIRV_CROSS_IMAGE_HPP
|
|
|
|
#define SPIRV_CROSS_IMAGE_HPP
|
2016-03-02 17:09:16 +00:00
|
|
|
|
|
|
|
#ifndef GLM_SWIZZLE
|
|
|
|
#define GLM_SWIZZLE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GLM_FORCE_RADIANS
|
|
|
|
#define GLM_FORCE_RADIANS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
2016-04-04 07:36:04 +00:00
|
|
|
namespace spirv_cross
|
2016-03-02 17:09:16 +00:00
|
|
|
{
|
2016-05-05 07:33:18 +00:00
|
|
|
template <typename T>
|
|
|
|
struct image2DBase
|
|
|
|
{
|
|
|
|
virtual ~image2DBase() = default;
|
2017-06-13 11:41:11 +00:00
|
|
|
inline virtual T load(glm::ivec2 coord) const
|
2016-05-05 07:33:18 +00:00
|
|
|
{
|
|
|
|
return T(0, 0, 0, 1);
|
|
|
|
}
|
|
|
|
inline virtual void store(glm::ivec2 coord, const T &v)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2016-03-02 17:09:16 +00:00
|
|
|
|
2016-05-05 07:33:18 +00:00
|
|
|
typedef image2DBase<glm::vec4> image2D;
|
|
|
|
typedef image2DBase<glm::ivec4> iimage2D;
|
|
|
|
typedef image2DBase<glm::uvec4> uimage2D;
|
2016-05-28 11:09:26 +00:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
inline T imageLoad(const image2DBase<T> &image, glm::ivec2 coord)
|
|
|
|
{
|
|
|
|
return image.load(coord);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void imageStore(image2DBase<T> &image, glm::ivec2 coord, const T &value)
|
|
|
|
{
|
|
|
|
image.store(coord, value);
|
|
|
|
}
|
2016-03-02 17:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|