2015-05-24 04:32:32 +00:00
|
|
|
// Copyright 2014 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-05-24 04:32:32 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
#include <limits>
|
|
|
|
#include <memory>
|
|
|
|
#include <tuple>
|
|
|
|
#include <type_traits>
|
2014-12-12 23:23:54 +00:00
|
|
|
#include <unordered_set>
|
2014-08-02 06:42:36 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
#include <gtest/gtest.h> // NOLINT
|
|
|
|
|
2018-05-10 14:35:00 +00:00
|
|
|
#include "Common/BitUtils.h"
|
2014-08-02 06:42:36 +00:00
|
|
|
#include "Common/Common.h"
|
2021-01-28 11:49:28 +00:00
|
|
|
#include "Common/MathUtil.h"
|
2015-03-12 10:27:22 +00:00
|
|
|
#include "VideoCommon/CPMemory.h"
|
2014-08-02 06:42:36 +00:00
|
|
|
#include "VideoCommon/DataReader.h"
|
2015-03-12 10:27:22 +00:00
|
|
|
#include "VideoCommon/OpcodeDecoding.h"
|
2014-12-13 00:51:14 +00:00
|
|
|
#include "VideoCommon/VertexLoaderBase.h"
|
2015-05-29 12:42:45 +00:00
|
|
|
#include "VideoCommon/VertexLoaderManager.h"
|
2014-08-02 06:42:36 +00:00
|
|
|
|
|
|
|
TEST(VertexLoaderUID, UniqueEnough)
|
|
|
|
{
|
2014-12-12 23:23:54 +00:00
|
|
|
std::unordered_set<VertexLoaderUID> uids;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-08-02 06:42:36 +00:00
|
|
|
TVtxDesc vtx_desc;
|
|
|
|
VAT vat;
|
|
|
|
uids.insert(VertexLoaderUID(vtx_desc, vat));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2021-06-09 04:35:43 +00:00
|
|
|
vtx_desc.low.Hex = 0x76543210;
|
|
|
|
vtx_desc.high.Hex = 0xFEDCBA98;
|
2014-08-02 06:42:36 +00:00
|
|
|
EXPECT_EQ(uids.end(), uids.find(VertexLoaderUID(vtx_desc, vat)));
|
|
|
|
uids.insert(VertexLoaderUID(vtx_desc, vat));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-08-02 06:42:36 +00:00
|
|
|
vat.g0.Hex = 0xFFFFFFFF;
|
|
|
|
vat.g1.Hex = 0xFFFFFFFF;
|
|
|
|
vat.g2.Hex = 0xFFFFFFFF;
|
|
|
|
EXPECT_EQ(uids.end(), uids.find(VertexLoaderUID(vtx_desc, vat)));
|
|
|
|
uids.insert(VertexLoaderUID(vtx_desc, vat));
|
|
|
|
}
|
|
|
|
|
2014-08-02 21:02:38 +00:00
|
|
|
static u8 input_memory[16 * 1024 * 1024];
|
|
|
|
static u8 output_memory[16 * 1024 * 1024];
|
|
|
|
|
2014-08-02 06:42:36 +00:00
|
|
|
class VertexLoaderTest : public testing::Test
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
void SetUp() override
|
|
|
|
{
|
2015-03-12 10:27:22 +00:00
|
|
|
memset(input_memory, 0, sizeof(input_memory));
|
|
|
|
memset(output_memory, 0xFF, sizeof(input_memory));
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2021-03-19 02:24:35 +00:00
|
|
|
m_vtx_desc.low.Hex = 0;
|
|
|
|
m_vtx_desc.high.Hex = 0;
|
|
|
|
|
|
|
|
m_vtx_attr.g0.Hex = 0;
|
|
|
|
m_vtx_attr.g1.Hex = 0;
|
|
|
|
m_vtx_attr.g2.Hex = 0;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
m_loader = nullptr;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-08-02 21:02:38 +00:00
|
|
|
ResetPointers();
|
2014-08-02 06:42:36 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-03-17 06:05:19 +00:00
|
|
|
void CreateAndCheckSizes(size_t input_size, size_t output_size)
|
2015-03-12 10:27:22 +00:00
|
|
|
{
|
2015-12-23 00:59:32 +00:00
|
|
|
m_loader = VertexLoaderBase::CreateVertexLoader(m_vtx_desc, m_vtx_attr);
|
2021-03-11 20:55:25 +00:00
|
|
|
ASSERT_EQ(input_size, m_loader->m_vertex_size);
|
2015-03-12 10:27:22 +00:00
|
|
|
ASSERT_EQ((int)output_size, m_loader->m_native_vtx_decl.stride);
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-08-02 06:42:36 +00:00
|
|
|
template <typename T>
|
|
|
|
void Input(T val)
|
|
|
|
{
|
2015-03-12 10:27:22 +00:00
|
|
|
// Write swapped.
|
|
|
|
m_src.Write<T, true>(val);
|
2014-08-02 06:42:36 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2018-05-10 14:35:00 +00:00
|
|
|
void ExpectOut(float expected)
|
2014-08-02 06:42:36 +00:00
|
|
|
{
|
2015-03-12 10:27:22 +00:00
|
|
|
// Read unswapped.
|
2018-05-10 14:35:00 +00:00
|
|
|
const float actual = m_dst.Read<float, false>();
|
|
|
|
|
|
|
|
if (!actual || actual != actual)
|
|
|
|
EXPECT_EQ(Common::BitCast<u32>(expected), Common::BitCast<u32>(actual));
|
2015-03-12 10:27:22 +00:00
|
|
|
else
|
2018-05-10 14:35:00 +00:00
|
|
|
EXPECT_EQ(expected, actual);
|
2014-08-02 06:42:36 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
void RunVertices(int count, int expected_count = -1)
|
2014-08-02 21:02:38 +00:00
|
|
|
{
|
2015-03-12 10:27:22 +00:00
|
|
|
if (expected_count == -1)
|
|
|
|
expected_count = count;
|
|
|
|
ResetPointers();
|
2015-04-06 09:44:13 +00:00
|
|
|
int actual_count = m_loader->RunVertices(m_src, m_dst, count);
|
2015-03-12 10:27:22 +00:00
|
|
|
EXPECT_EQ(actual_count, expected_count);
|
2014-08-02 21:02:38 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-08-02 21:02:38 +00:00
|
|
|
void ResetPointers()
|
|
|
|
{
|
2015-03-12 10:27:22 +00:00
|
|
|
m_src = DataReader(input_memory, input_memory + sizeof(input_memory));
|
|
|
|
m_dst = DataReader(output_memory, output_memory + sizeof(output_memory));
|
2014-08-02 21:02:38 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
DataReader m_src;
|
|
|
|
DataReader m_dst;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-08-02 21:02:38 +00:00
|
|
|
TVtxDesc m_vtx_desc;
|
|
|
|
VAT m_vtx_attr;
|
2015-03-12 10:27:22 +00:00
|
|
|
std::unique_ptr<VertexLoaderBase> m_loader;
|
2014-08-02 06:42:36 +00:00
|
|
|
};
|
|
|
|
|
2021-02-08 23:22:10 +00:00
|
|
|
class VertexLoaderParamTest
|
|
|
|
: public VertexLoaderTest,
|
|
|
|
public ::testing::WithParamInterface<
|
|
|
|
std::tuple<VertexComponentFormat, ComponentFormat, CoordComponentCount, int>>
|
2015-03-12 10:27:22 +00:00
|
|
|
{
|
|
|
|
};
|
2021-02-08 23:22:10 +00:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
AllCombinations, VertexLoaderParamTest,
|
|
|
|
::testing::Combine(
|
|
|
|
::testing::Values(VertexComponentFormat::Direct, VertexComponentFormat::Index8,
|
|
|
|
VertexComponentFormat::Index16),
|
|
|
|
::testing::Values(ComponentFormat::UByte, ComponentFormat::Byte, ComponentFormat::UShort,
|
|
|
|
ComponentFormat::Short, ComponentFormat::Float),
|
|
|
|
::testing::Values(CoordComponentCount::XY, CoordComponentCount::XYZ),
|
|
|
|
::testing::Values(0, 1, 31) // frac
|
|
|
|
));
|
2015-03-12 10:27:22 +00:00
|
|
|
|
|
|
|
TEST_P(VertexLoaderParamTest, PositionAll)
|
2014-08-02 06:42:36 +00:00
|
|
|
{
|
2021-02-08 23:22:10 +00:00
|
|
|
VertexComponentFormat addr;
|
|
|
|
ComponentFormat format;
|
|
|
|
CoordComponentCount elements;
|
|
|
|
int frac;
|
2015-03-12 10:27:22 +00:00
|
|
|
std::tie(addr, format, elements, frac) = GetParam();
|
2021-02-08 23:22:10 +00:00
|
|
|
this->m_vtx_desc.low.Position = addr;
|
2015-03-12 10:27:22 +00:00
|
|
|
this->m_vtx_attr.g0.PosFormat = format;
|
|
|
|
this->m_vtx_attr.g0.PosElements = elements;
|
|
|
|
this->m_vtx_attr.g0.PosFrac = frac;
|
|
|
|
this->m_vtx_attr.g0.ByteDequant = true;
|
2021-02-08 23:22:10 +00:00
|
|
|
const u32 elem_size = GetElementSize(format);
|
|
|
|
const u32 elem_count = elements == CoordComponentCount::XY ? 2 : 3;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
std::vector<float> values = {
|
|
|
|
std::numeric_limits<float>::lowest(),
|
|
|
|
std::numeric_limits<float>::denorm_min(),
|
|
|
|
std::numeric_limits<float>::min(),
|
|
|
|
std::numeric_limits<float>::max(),
|
|
|
|
std::numeric_limits<float>::quiet_NaN(),
|
|
|
|
std::numeric_limits<float>::infinity(),
|
|
|
|
-0x8000,
|
|
|
|
-0x80,
|
|
|
|
-1,
|
2021-01-28 11:49:28 +00:00
|
|
|
-0.0,
|
2015-03-12 10:27:22 +00:00
|
|
|
0,
|
|
|
|
1,
|
|
|
|
123,
|
|
|
|
0x7F,
|
|
|
|
0xFF,
|
|
|
|
0x7FFF,
|
|
|
|
0xFFFF,
|
|
|
|
12345678,
|
|
|
|
};
|
|
|
|
ASSERT_EQ(0u, values.size() % 2);
|
|
|
|
ASSERT_EQ(0u, values.size() % 3);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2021-02-08 23:22:10 +00:00
|
|
|
int count = (int)values.size() / elem_count;
|
|
|
|
size_t input_size = elem_count * elem_size;
|
|
|
|
if (IsIndexed(addr))
|
2015-03-12 10:27:22 +00:00
|
|
|
{
|
2021-02-08 23:22:10 +00:00
|
|
|
input_size = addr == VertexComponentFormat::Index8 ? 1 : 2;
|
2015-03-12 10:27:22 +00:00
|
|
|
for (int i = 0; i < count; i++)
|
2021-02-08 23:22:10 +00:00
|
|
|
if (addr == VertexComponentFormat::Index8)
|
2015-03-12 10:27:22 +00:00
|
|
|
Input<u8>(i);
|
|
|
|
else
|
|
|
|
Input<u16>(i);
|
2021-06-20 20:47:57 +00:00
|
|
|
VertexLoaderManager::cached_arraybases[CPArray::Position] = m_src.GetPointer();
|
|
|
|
g_main_cp_state.array_strides[CPArray::Position] = elem_count * elem_size;
|
2015-03-12 10:27:22 +00:00
|
|
|
}
|
2021-02-08 23:22:10 +00:00
|
|
|
CreateAndCheckSizes(input_size, elem_count * sizeof(float));
|
2015-03-12 10:27:22 +00:00
|
|
|
for (float value : values)
|
|
|
|
{
|
|
|
|
switch (format)
|
|
|
|
{
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::UByte:
|
2021-01-28 11:49:28 +00:00
|
|
|
Input(MathUtil::SaturatingCast<u8>(value));
|
2015-03-12 10:27:22 +00:00
|
|
|
break;
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::Byte:
|
2021-01-28 11:49:28 +00:00
|
|
|
Input(MathUtil::SaturatingCast<s8>(value));
|
2015-03-12 10:27:22 +00:00
|
|
|
break;
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::UShort:
|
2021-01-28 11:49:28 +00:00
|
|
|
Input(MathUtil::SaturatingCast<u16>(value));
|
2015-03-12 10:27:22 +00:00
|
|
|
break;
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::Short:
|
2021-01-28 11:49:28 +00:00
|
|
|
Input(MathUtil::SaturatingCast<s16>(value));
|
2015-03-12 10:27:22 +00:00
|
|
|
break;
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::Float:
|
2015-03-12 10:27:22 +00:00
|
|
|
Input(value);
|
|
|
|
break;
|
2016-06-24 08:43:46 +00:00
|
|
|
}
|
2015-03-12 10:27:22 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
RunVertices(count);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2021-02-08 23:22:10 +00:00
|
|
|
float scale = 1.f / (1u << (format == ComponentFormat::Float ? 0 : frac));
|
2015-03-12 10:27:22 +00:00
|
|
|
for (auto iter = values.begin(); iter != values.end();)
|
|
|
|
{
|
|
|
|
float f, g;
|
|
|
|
switch (format)
|
|
|
|
{
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::UByte:
|
2021-01-28 11:49:28 +00:00
|
|
|
f = MathUtil::SaturatingCast<u8>(*iter++);
|
|
|
|
g = MathUtil::SaturatingCast<u8>(*iter++);
|
2015-03-12 10:27:22 +00:00
|
|
|
break;
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::Byte:
|
2021-01-28 11:49:28 +00:00
|
|
|
f = MathUtil::SaturatingCast<s8>(*iter++);
|
|
|
|
g = MathUtil::SaturatingCast<s8>(*iter++);
|
2015-03-12 10:27:22 +00:00
|
|
|
break;
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::UShort:
|
2021-01-28 11:49:28 +00:00
|
|
|
f = MathUtil::SaturatingCast<u16>(*iter++);
|
|
|
|
g = MathUtil::SaturatingCast<u16>(*iter++);
|
2015-03-12 10:27:22 +00:00
|
|
|
break;
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::Short:
|
2021-01-28 11:49:28 +00:00
|
|
|
f = MathUtil::SaturatingCast<s16>(*iter++);
|
|
|
|
g = MathUtil::SaturatingCast<s16>(*iter++);
|
2015-03-12 10:27:22 +00:00
|
|
|
break;
|
2021-02-08 23:22:10 +00:00
|
|
|
case ComponentFormat::Float:
|
2015-03-12 10:27:22 +00:00
|
|
|
f = *iter++;
|
|
|
|
g = *iter++;
|
|
|
|
break;
|
2017-03-25 22:21:35 +00:00
|
|
|
default:
|
|
|
|
FAIL() << "Unknown format";
|
2015-03-12 10:27:22 +00:00
|
|
|
}
|
|
|
|
ExpectOut(f * scale);
|
|
|
|
ExpectOut(g * scale);
|
|
|
|
}
|
2014-08-02 21:02:38 +00:00
|
|
|
}
|
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
TEST_F(VertexLoaderTest, PositionIndex16FloatXY)
|
2014-08-02 21:02:38 +00:00
|
|
|
{
|
2021-02-08 23:22:10 +00:00
|
|
|
m_vtx_desc.low.Position = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_attr.g0.PosFormat = ComponentFormat::Float;
|
2015-03-17 06:05:19 +00:00
|
|
|
CreateAndCheckSizes(sizeof(u16), 2 * sizeof(float));
|
2015-03-12 10:27:22 +00:00
|
|
|
Input<u16>(1);
|
|
|
|
Input<u16>(0);
|
2021-06-20 20:47:57 +00:00
|
|
|
VertexLoaderManager::cached_arraybases[CPArray::Position] = m_src.GetPointer();
|
|
|
|
g_main_cp_state.array_strides[CPArray::Position] = sizeof(float); // ;)
|
2015-03-12 10:27:22 +00:00
|
|
|
Input(1.f);
|
|
|
|
Input(2.f);
|
|
|
|
Input(3.f);
|
|
|
|
RunVertices(2);
|
2015-03-17 06:05:19 +00:00
|
|
|
ExpectOut(2);
|
|
|
|
ExpectOut(3);
|
|
|
|
ExpectOut(1);
|
|
|
|
ExpectOut(2);
|
2014-08-02 21:02:38 +00:00
|
|
|
}
|
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
class VertexLoaderSpeedTest : public VertexLoaderTest,
|
2021-02-08 23:22:10 +00:00
|
|
|
public ::testing::WithParamInterface<std::tuple<ComponentFormat, int>>
|
2015-03-12 10:27:22 +00:00
|
|
|
{
|
|
|
|
};
|
2021-02-08 23:22:10 +00:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
FormatsAndElements, VertexLoaderSpeedTest,
|
|
|
|
::testing::Combine(::testing::Values(ComponentFormat::UByte, ComponentFormat::Byte,
|
|
|
|
ComponentFormat::UShort, ComponentFormat::Short,
|
|
|
|
ComponentFormat::Float),
|
|
|
|
::testing::Values(0, 1)));
|
2015-03-12 10:27:22 +00:00
|
|
|
|
|
|
|
TEST_P(VertexLoaderSpeedTest, PositionDirectAll)
|
2014-08-02 21:02:38 +00:00
|
|
|
{
|
2021-02-08 23:22:10 +00:00
|
|
|
ComponentFormat format;
|
|
|
|
int elements_i;
|
|
|
|
std::tie(format, elements_i) = GetParam();
|
|
|
|
CoordComponentCount elements = static_cast<CoordComponentCount>(elements_i);
|
|
|
|
fmt::print("format: {}, elements: {}\n", format, elements);
|
|
|
|
const u32 elem_count = elements == CoordComponentCount::XY ? 2 : 3;
|
|
|
|
m_vtx_desc.low.Position = VertexComponentFormat::Direct;
|
2015-03-12 10:27:22 +00:00
|
|
|
m_vtx_attr.g0.PosFormat = format;
|
|
|
|
m_vtx_attr.g0.PosElements = elements;
|
2021-02-08 23:22:10 +00:00
|
|
|
const size_t elem_size = GetElementSize(format);
|
|
|
|
CreateAndCheckSizes(elem_count * elem_size, elem_count * sizeof(float));
|
2014-08-02 21:02:38 +00:00
|
|
|
for (int i = 0; i < 1000; ++i)
|
2015-03-12 10:27:22 +00:00
|
|
|
RunVertices(100000);
|
2014-08-02 21:02:38 +00:00
|
|
|
}
|
2014-08-02 06:42:36 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
TEST_P(VertexLoaderSpeedTest, TexCoordSingleElement)
|
2014-08-02 21:02:38 +00:00
|
|
|
{
|
2021-02-08 23:22:10 +00:00
|
|
|
ComponentFormat format;
|
|
|
|
int elements_i;
|
|
|
|
std::tie(format, elements_i) = GetParam();
|
|
|
|
TexComponentCount elements = static_cast<TexComponentCount>(elements_i);
|
|
|
|
fmt::print("format: {}, elements: {}\n", format, elements);
|
|
|
|
const u32 elem_count = elements == TexComponentCount::S ? 1 : 2;
|
|
|
|
m_vtx_desc.low.Position = VertexComponentFormat::Direct;
|
|
|
|
m_vtx_attr.g0.PosFormat = ComponentFormat::Byte;
|
|
|
|
m_vtx_desc.high.Tex0Coord = VertexComponentFormat::Direct;
|
2015-03-12 10:27:22 +00:00
|
|
|
m_vtx_attr.g0.Tex0CoordFormat = format;
|
|
|
|
m_vtx_attr.g0.Tex0CoordElements = elements;
|
2021-02-08 23:22:10 +00:00
|
|
|
const size_t elem_size = GetElementSize(format);
|
|
|
|
CreateAndCheckSizes(2 * sizeof(s8) + elem_count * elem_size,
|
|
|
|
2 * sizeof(float) + elem_count * sizeof(float));
|
2014-08-02 21:02:38 +00:00
|
|
|
for (int i = 0; i < 1000; ++i)
|
2015-03-12 10:27:22 +00:00
|
|
|
RunVertices(100000);
|
2014-08-02 21:02:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(VertexLoaderTest, LargeFloatVertexSpeed)
|
|
|
|
{
|
2015-03-12 10:27:22 +00:00
|
|
|
// Enables most attributes in floating point indexed mode to test speed.
|
2021-02-08 23:22:10 +00:00
|
|
|
m_vtx_desc.low.PosMatIdx = 1;
|
|
|
|
m_vtx_desc.low.Tex0MatIdx = 1;
|
|
|
|
m_vtx_desc.low.Tex1MatIdx = 1;
|
|
|
|
m_vtx_desc.low.Tex2MatIdx = 1;
|
|
|
|
m_vtx_desc.low.Tex3MatIdx = 1;
|
|
|
|
m_vtx_desc.low.Tex4MatIdx = 1;
|
|
|
|
m_vtx_desc.low.Tex5MatIdx = 1;
|
|
|
|
m_vtx_desc.low.Tex6MatIdx = 1;
|
|
|
|
m_vtx_desc.low.Tex7MatIdx = 1;
|
|
|
|
m_vtx_desc.low.Position = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.low.Normal = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.low.Color0 = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.low.Color1 = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.high.Tex0Coord = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.high.Tex1Coord = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.high.Tex2Coord = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.high.Tex3Coord = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.high.Tex4Coord = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.high.Tex5Coord = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.high.Tex6Coord = VertexComponentFormat::Index16;
|
|
|
|
m_vtx_desc.high.Tex7Coord = VertexComponentFormat::Index16;
|
|
|
|
|
|
|
|
m_vtx_attr.g0.PosElements = CoordComponentCount::XYZ;
|
|
|
|
m_vtx_attr.g0.PosFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g0.NormalElements = NormalComponentCount::NBT;
|
|
|
|
m_vtx_attr.g0.NormalFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g0.Color0Elements = ColorComponentCount::RGBA;
|
|
|
|
m_vtx_attr.g0.Color0Comp = ColorFormat::RGBA8888;
|
|
|
|
m_vtx_attr.g0.Color1Elements = ColorComponentCount::RGBA;
|
|
|
|
m_vtx_attr.g0.Color1Comp = ColorFormat::RGBA8888;
|
|
|
|
m_vtx_attr.g0.Tex0CoordElements = TexComponentCount::ST;
|
|
|
|
m_vtx_attr.g0.Tex0CoordFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g1.Tex1CoordElements = TexComponentCount::ST;
|
|
|
|
m_vtx_attr.g1.Tex1CoordFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g1.Tex2CoordElements = TexComponentCount::ST;
|
|
|
|
m_vtx_attr.g1.Tex2CoordFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g1.Tex3CoordElements = TexComponentCount::ST;
|
|
|
|
m_vtx_attr.g1.Tex3CoordFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g1.Tex4CoordElements = TexComponentCount::ST;
|
|
|
|
m_vtx_attr.g1.Tex4CoordFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g2.Tex5CoordElements = TexComponentCount::ST;
|
|
|
|
m_vtx_attr.g2.Tex5CoordFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g2.Tex6CoordElements = TexComponentCount::ST;
|
|
|
|
m_vtx_attr.g2.Tex6CoordFormat = ComponentFormat::Float;
|
|
|
|
m_vtx_attr.g2.Tex7CoordElements = TexComponentCount::ST;
|
|
|
|
m_vtx_attr.g2.Tex7CoordFormat = ComponentFormat::Float;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2015-03-12 10:27:22 +00:00
|
|
|
CreateAndCheckSizes(33, 156);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2021-03-26 22:46:37 +00:00
|
|
|
for (int i = 0; i < NUM_VERTEX_COMPONENT_ARRAYS; i++)
|
2015-03-12 10:27:22 +00:00
|
|
|
{
|
2021-06-20 20:47:57 +00:00
|
|
|
VertexLoaderManager::cached_arraybases[static_cast<CPArray>(i)] = m_src.GetPointer();
|
|
|
|
g_main_cp_state.array_strides[static_cast<CPArray>(i)] = 129;
|
2015-03-12 10:27:22 +00:00
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-08-02 21:02:38 +00:00
|
|
|
// This test is only done 100x in a row since it's ~20x slower using the
|
|
|
|
// current vertex loader implementation.
|
|
|
|
for (int i = 0; i < 100; ++i)
|
2015-03-12 10:27:22 +00:00
|
|
|
RunVertices(100000);
|
2014-08-02 06:42:36 +00:00
|
|
|
}
|