Compare commits

...

2 Commits

View File

@ -71,6 +71,20 @@ struct alignas(4) rk_output_row {
}
};
template<typename _output, unsigned _cols, bool _signed, bool _normalized>
struct alignas(4) rk_output_row<_output, _output, _cols, _signed, _normalized> {
rk_output<_output, _output, _signed, _normalized> output_col[_cols];
[[RK_FAST]]
inline void convert(
rk_input_row<_output, _cols> const & __restrict src) {
static_assert(sizeof(output_col) == sizeof(src.input_col));
rk_output<_output, _output, _signed, _normalized> const * const input_col =
reinterpret_cast<rk_output<_output, _output, _signed, _normalized> const *>(src.input_col);
*output_col = *input_col;
}
};
template<typename _input, unsigned _cols, bool _signed, bool _normalized>
struct alignas(4) rk_output_row<rk_packed<_signed, _cols>, _input, _cols, _signed, _normalized> {
rk_output<rk_packed<_signed, _cols>, _input, _signed, _normalized> output_cols;
@ -100,6 +114,20 @@ struct alignas(4) rk_output_format {
}
};
template<typename _output, unsigned _cols, unsigned _rows, bool _signed, bool _normalized>
struct alignas(4) rk_output_format<_output, _output, _cols, _rows, _signed, _normalized> {
rk_output_row<_output, _output, _cols, _signed, _normalized> output_row[_rows];
[[RK_FAST]]
inline void convert(
rk_input_format<_output, _cols, _rows> const & __restrict src) {
static_assert(sizeof(output_row) == sizeof(src.input_row));
rk_output_row<_output, _output, _cols, _signed, _normalized> const * const input_row =
reinterpret_cast<rk_output_row<_output, _output, _cols, _signed, _normalized> const *>(src.input_row);
*output_row = *input_row;
}
};
template<typename _input, bool _signed, bool _normalized>
struct alignas(alignof(rk_packed<_signed, 3>)) rk_output<rk_packed<_signed, 3>, _input, _signed, _normalized> {
rk_packed<_signed, 3> output;
@ -216,15 +244,15 @@ struct rk_format {
} // namepace rk_vertex
typedef rk_vertex::rk_format<rk_float, rk_float, 3, 1, true, false> rk_vec3_float;
typedef rk_vertex::rk_format<rk_short, rk_float, 3, 1, true, false> rk_vec3_short;
typedef rk_vertex::rk_format<rk_short, rk_float, 3, 1, true, true> rk_vec3_short_norm;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 1, true, false> rk_vec3_int10;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 1, true, true> rk_vec3_int10_norm;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 1, true, false> rk_vec3_uint10;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 1, true, true> rk_vec3_uint10_norm;
typedef rk_vertex::rk_format<rk_float, rk_float, 3, 3, true, false> rk_mat3_float;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 3, true, false> rk_mat3_int10;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 3, true, true> rk_mat3_int10_norm;
typedef rk_vertex::rk_format<rk_float, rk_float, 3, 1, true, false> rk_vec3_float;
typedef rk_vertex::rk_format<rk_short, rk_float, 3, 1, true, false> rk_vec3_short;
typedef rk_vertex::rk_format<rk_short, rk_float, 3, 1, true, true> rk_vec3_short_norm;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 1, true, false> rk_vec3_int10;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 1, true, true> rk_vec3_int10_norm;
typedef rk_vertex::rk_format<rk_packed<false, 3>, rk_float, 3, 1, false, false> rk_vec3_uint10;
typedef rk_vertex::rk_format<rk_packed<false, 3>, rk_float, 3, 1, false, true> rk_vec3_uint10_norm;
typedef rk_vertex::rk_format<rk_float, rk_float, 3, 3, true, false> rk_mat3_float;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 3, true, false> rk_mat3_int10;
typedef rk_vertex::rk_format<rk_packed<true, 3>, rk_float, 3, 3, true, true> rk_mat3_int10_norm;
#endif // RK_ENGINE_VERTEX_FORMAT_H