Support padding in instance attributes
This commit is contained in:
parent
644c9ca5b6
commit
564a0001a2
1 changed files with 15 additions and 1 deletions
|
|
@ -85,6 +85,13 @@ namespace psemek::gfx
|
||||||
using type = T;
|
using type = T;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <std::size_t N>
|
||||||
|
struct instanced<padding<N>>
|
||||||
|
{
|
||||||
|
using type = padding<N>;
|
||||||
|
static constexpr std::size_t size = N;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename ... Attribs>
|
template <typename ... Attribs>
|
||||||
attribs_description make_attribs_description();
|
attribs_description make_attribs_description();
|
||||||
|
|
||||||
|
|
@ -275,6 +282,10 @@ namespace psemek::gfx
|
||||||
struct is_padding<padding<N>> : std::true_type
|
struct is_padding<padding<N>> : std::true_type
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
template <std::size_t N>
|
||||||
|
struct is_padding<instanced<padding<N>>> : std::true_type
|
||||||
|
{};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_instanced : std::false_type
|
struct is_instanced : std::false_type
|
||||||
{};
|
{};
|
||||||
|
|
@ -359,7 +370,10 @@ namespace psemek::gfx
|
||||||
}
|
}
|
||||||
else if constexpr (is_padding<Attr1>::value)
|
else if constexpr (is_padding<Attr1>::value)
|
||||||
{
|
{
|
||||||
make_attribs_description_impl<Instance, Attribs...>::make_impl(result, index, Instance ? offset : offset + Attr1::size);
|
if constexpr (is_instanced<Attr1>::value == Instance)
|
||||||
|
make_attribs_description_impl<Instance, Attribs...>::make_impl(result, index, offset + Attr1::size);
|
||||||
|
else
|
||||||
|
make_attribs_description_impl<Instance, Attribs...>::make_impl(result, index, offset);
|
||||||
}
|
}
|
||||||
else if constexpr (is_instanced<Attr1>::value == Instance)
|
else if constexpr (is_instanced<Attr1>::value == Instance)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue