GPU: GLSL-C++ compilation stubs #4

Closed
Clément Foucault wants to merge 38 commits from glsl-cpp-stubs-2 into glsl-include

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit cb7624eeef - Show all commits

View File

@ -169,3 +169,62 @@ using vec4 = float4;
#define inout #define inout
#define in #define in
#define out #define out
template<typename T> using Vec4 = VecBase<T, 4>;
template<int D> using VecInt = VecBase<int, D>;
template<int D> using VecFlt = VecBase<double, D>;
template<typename T, int Dimensions, bool Cube = false, bool Array = false> struct SamplerBase {
static constexpr int coord_dim = Dimensions + int(Cube) + int(Array);
static constexpr int deriv_dim = Dimensions + int(Cube);
static constexpr int extent_dim = Dimensions + int(Array);
using int_coord_type = VecBase<int, coord_dim>;
using flt_coord_type = VecBase<double, coord_dim>;
using derivative_type = VecBase<double, deriv_dim>;
using data_vec_type = VecBase<T, 4>;
using size_vec_type = VecBase<int, extent_dim>;
};
#define TEX_TEMPLATE \
template<typename T, \
typename IntCoord = typename T::int_coord_type, \
typename FltCoord = typename T::flt_coord_type, \
typename DerivVec = typename T::derivative_type, \
typename DataVec = typename T::data_vec_type, \
typename SizeVec = typename T::size_vec_type>
TEX_TEMPLATE SizeVec textureSize(T, int) {}
TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) {}
TEX_TEMPLATE DataVec texelFetchOffset(T, IntCoord, int, IntCoord) {}
TEX_TEMPLATE DataVec texture(T, FltCoord) {}
TEX_TEMPLATE DataVec textureGather(T, FltCoord) {}
TEX_TEMPLATE DataVec textureGrad(T, FltCoord, DerivVec, DerivVec) {}
TEX_TEMPLATE DataVec textureLod(T, FltCoord, double) {}
#undef TEX_TEMPLATE
using sampler1D = SamplerBase<double, 1>;
using sampler2D = SamplerBase<double, 2>;
using sampler3D = SamplerBase<double, 3>;
using isampler1D = SamplerBase<int, 1>;
using isampler2D = SamplerBase<int, 2>;
using isampler3D = SamplerBase<int, 3>;
using usampler1D = SamplerBase<uint, 1>;
using usampler2D = SamplerBase<uint, 2>;
using usampler3D = SamplerBase<uint, 3>;
using sampler1DArray = SamplerBase<double, 1, false, true>;
using sampler2DArray = SamplerBase<double, 2, false, true>;
using isampler1DArray = SamplerBase<int, 1, false, true>;
using isampler2DArray = SamplerBase<int, 2, false, true>;
using usampler1DArray = SamplerBase<uint, 1, false, true>;
using usampler2DArray = SamplerBase<uint, 2, false, true>;
using samplerCube = SamplerBase<double, 2, true>;
using isamplerCube = SamplerBase<int, 2, true>;
using usamplerCube = SamplerBase<uint, 2, true>;
using samplerCubeArray = SamplerBase<double, 2, true, true>;
using isamplerCubeArray = SamplerBase<int, 2, true, true>;
using usamplerCubeArray = SamplerBase<uint, 2, true, true>;