mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
SWVertexLoader: fix truncated components
This commit is contained in:
@ -100,16 +100,17 @@ static T ReadNormalized(I value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, bool swap = false>
|
template <typename T, bool swap = false>
|
||||||
static void ReadVertexAttribute(T* dst, DataReader src, const AttributeFormat& format, int base_component, int max_components, bool reverse)
|
static void ReadVertexAttribute(T* dst, DataReader src, const AttributeFormat& format, int base_component, int components, bool reverse)
|
||||||
{
|
{
|
||||||
if (format.enable)
|
if (format.enable)
|
||||||
{
|
{
|
||||||
src.Skip(format.offset);
|
src.Skip(format.offset);
|
||||||
src.Skip(base_component * (1<<(format.type>>1)));
|
src.Skip(base_component * (1<<(format.type>>1)));
|
||||||
|
|
||||||
for (int i = 0; i < std::min(format.components - base_component, max_components); i++)
|
int i;
|
||||||
|
for (i = 0; i < std::min(format.components - base_component, components); i++)
|
||||||
{
|
{
|
||||||
int i_dst = reverse ? max_components - i - 1 : i;
|
int i_dst = reverse ? components - i - 1 : i;
|
||||||
switch (format.type)
|
switch (format.type)
|
||||||
{
|
{
|
||||||
case VAR_UNSIGNED_BYTE:
|
case VAR_UNSIGNED_BYTE:
|
||||||
@ -131,6 +132,11 @@ static void ReadVertexAttribute(T* dst, DataReader src, const AttributeFormat& f
|
|||||||
|
|
||||||
_assert_msg_(VIDEO, !format.integer || format.type != VAR_FLOAT, "only non-float values are allowed to be streamed as integer");
|
_assert_msg_(VIDEO, !format.integer || format.type != VAR_FLOAT, "only non-float values are allowed to be streamed as integer");
|
||||||
}
|
}
|
||||||
|
for (; i < components; i++)
|
||||||
|
{
|
||||||
|
int i_dst = reverse ? components - i - 1 : i;
|
||||||
|
dst[i_dst] = i == 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user