Files
igl/external/embree/tutorials/common/math/veci.isph
T

137 lines
5.0 KiB
Plaintext
Executable File

// ======================================================================== //
// Copyright 2009-2014 Intel Corporation //
// //
// 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. //
// ======================================================================== //
#pragma once
// //////////////////////////////////////////////////////////////////////////////
// / Vector of 2 signed ints
// //////////////////////////////////////////////////////////////////////////////
/*! \brief ISPC class for vector of two signed ints */
struct Vec2i
{
int32 x;
int32 y;
};
inline uniform Vec2i make_Vec2i(const uniform int x, const uniform int y) {
uniform Vec2i v; v.x = x; v.y = y; return v;
}
inline varying Vec2i make_Vec2i(const varying int x, const varying int y, const varying int z, const varying int w) {
varying Vec2i v; v.x = x; v.y = y; return v;
}
// //////////////////////////////////////////////////////////////////////////////
// / Vector of 3 signed ints
// //////////////////////////////////////////////////////////////////////////////
/*! \brief ISPC class for vector of three signed ints */
struct Vec3i
{
int32 x;
int32 y;
int32 z;
};
inline uniform Vec3i make_Vec3i(const uniform int x, const uniform int y, const uniform int z) {
uniform Vec3i v; v.x = x; v.y = y; v.z = z; return v;
}
inline varying Vec3i make_Vec3i(const varying int x, const varying int y, const varying int z) {
varying Vec3i v; v.x = x; v.y = y; v.z = z; return v;
}
// //////////////////////////////////////////////////////////////////////////////
// / Vector of 4 signed ints
// //////////////////////////////////////////////////////////////////////////////
/*! \brief ISPC class for vector of four signed ints */
struct Vec4i
{
int32 x;
int32 y;
int32 z;
int32 w;
};
inline uniform Vec4i make_Vec4i(const uniform int x, const uniform int y, const uniform int z, const uniform int w) {
uniform Vec4i v; v.x = x; v.y = y; v.z = z; v.w = w; return v;
}
inline varying Vec4i make_Vec4i(const varying int x, const varying int y, const varying int z, const varying int w) {
varying Vec4i v; v.x = x; v.y = y; v.z = z; v.w = w; return v;
}
// //////////////////////////////////////////////////////////////////////////////
// / Vector of 2 unsigned ints
// //////////////////////////////////////////////////////////////////////////////
/*! \brief ISPC class for vector of two unsigned ints */
struct Vec2ui
{
unsigned int x;
unsigned int y;
};
inline uniform Vec2ui make_Vec2ui(const uniform unsigned int x, const uniform unsigned int y) {
uniform Vec2ui v; v.x = x; v.y = y; return v;
}
inline varying Vec2ui make_Vec2ui(const varying unsigned int x, const varying unsigned int y) {
varying Vec2ui v; v.x = x; v.y = y; return v;
}
// //////////////////////////////////////////////////////////////////////////////
// / Vector of 3 unsigned ints
// //////////////////////////////////////////////////////////////////////////////
/*! \brief ISPC class for vector of three unsigned ints */
struct Vec3ui
{
unsigned int x;
unsigned int y;
unsigned int z;
};
inline uniform Vec3ui make_Vec3ui(const uniform unsigned int x, const uniform unsigned int y, const uniform unsigned int z) {
uniform Vec3ui v; v.x = x; v.y = y; v.z = z; return v;
}
inline varying Vec3ui make_Vec3ui(const varying unsigned int x, const varying unsigned int y, const varying unsigned int z) {
varying Vec3ui v; v.x = x; v.y = y; v.z = z; return v;
}
// //////////////////////////////////////////////////////////////////////////////
// / Vector of 3 unsigned chars
// //////////////////////////////////////////////////////////////////////////////
/*! \brief ISPC class for vector of three unsigned chars (unsigned int8's) */
struct Vec3uc
{
unsigned int8 x;
unsigned int8 y;
unsigned int8 z;
};
inline uniform Vec3uc make_Vec3uc(const uniform unsigned int8 x, const uniform unsigned int8 y, const uniform unsigned int8 z) {
uniform Vec3uc v; v.x = x; v.y = y; v.z = z; return v;
}
inline varying Vec3uc make_Vec3uc(const varying unsigned int8 x, const varying unsigned int8 y, const varying unsigned int8 z) {
Vec3uc v; v.x = x; v.y = y; v.z = z; return v;
}