mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 07:49:19 +01:00
Separate vertex components by spaces
This commit is contained in:
parent
73f4e57006
commit
77b1cca987
@ -668,15 +668,20 @@ void FIFOAnalyzer::UpdateDescription()
|
|||||||
|
|
||||||
const auto& vtx_desc = frame_info.objectCPStates[object_nr].vtxDesc;
|
const auto& vtx_desc = frame_info.objectCPStates[object_nr].vtxDesc;
|
||||||
const auto& vtx_attr = frame_info.objectCPStates[object_nr].vtxAttr[vat];
|
const auto& vtx_attr = frame_info.objectCPStates[object_nr].vtxAttr[vat];
|
||||||
const u32 vertex_size = VertexLoaderBase::GetVertexSize(vtx_desc, vtx_attr);
|
const auto component_sizes = VertexLoaderBase::GetVertexComponentSizes(vtx_desc, vtx_attr);
|
||||||
|
|
||||||
u32 i = 3;
|
u32 i = 3;
|
||||||
for (u32 vertex_num = 0; vertex_num < vertex_count; vertex_num++)
|
for (u32 vertex_num = 0; vertex_num < vertex_count; vertex_num++)
|
||||||
{
|
{
|
||||||
text += QLatin1Char{'\n'};
|
text += QLatin1Char{'\n'};
|
||||||
// TODO: format each vertex nicely
|
for (u32 comp_size : component_sizes)
|
||||||
for (u32 vertex_off = 0; vertex_off < vertex_size; vertex_off++)
|
{
|
||||||
text += QStringLiteral("%1").arg(cmddata[i++], 2, 16, QLatin1Char('0'));
|
for (u32 comp_off = 0; comp_off < comp_size; comp_off++)
|
||||||
|
{
|
||||||
|
text += QStringLiteral("%1").arg(cmddata[i++], 2, 16, QLatin1Char('0'));
|
||||||
|
}
|
||||||
|
text += QLatin1Char{' '};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -97,29 +97,45 @@ private:
|
|||||||
std::vector<u8> buffer_b;
|
std::vector<u8> buffer_b;
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 VertexLoaderBase::GetVertexSize(const TVtxDesc& vtx_desc, const VAT& vtx_attr)
|
template <class Function>
|
||||||
|
static void GetComponentSizes(const TVtxDesc& vtx_desc, const VAT& vtx_attr, Function f)
|
||||||
{
|
{
|
||||||
u32 size = 0;
|
|
||||||
if (vtx_desc.low.PosMatIdx)
|
if (vtx_desc.low.PosMatIdx)
|
||||||
size++;
|
f(1);
|
||||||
for (auto texmtxidx : vtx_desc.low.TexMatIdx)
|
for (auto texmtxidx : vtx_desc.low.TexMatIdx)
|
||||||
{
|
{
|
||||||
if (texmtxidx)
|
if (texmtxidx)
|
||||||
size++;
|
f(1);
|
||||||
}
|
}
|
||||||
size += VertexLoader_Position::GetSize(vtx_desc.low.Position, vtx_attr.g0.PosFormat,
|
const u32 pos_size = VertexLoader_Position::GetSize(vtx_desc.low.Position, vtx_attr.g0.PosFormat,
|
||||||
vtx_attr.g0.PosElements);
|
vtx_attr.g0.PosElements);
|
||||||
size += VertexLoader_Normal::GetSize(vtx_desc.low.Normal, vtx_attr.g0.NormalFormat,
|
if (pos_size != 0)
|
||||||
vtx_attr.g0.NormalElements, vtx_attr.g0.NormalIndex3);
|
f(pos_size);
|
||||||
|
const u32 norm_size =
|
||||||
|
VertexLoader_Normal::GetSize(vtx_desc.low.Normal, vtx_attr.g0.NormalFormat,
|
||||||
|
vtx_attr.g0.NormalElements, vtx_attr.g0.NormalIndex3);
|
||||||
|
if (norm_size != 0)
|
||||||
|
f(norm_size);
|
||||||
for (u32 i = 0; i < vtx_desc.low.Color.Size(); i++)
|
for (u32 i = 0; i < vtx_desc.low.Color.Size(); i++)
|
||||||
{
|
{
|
||||||
size += VertexLoader_Color::GetSize(vtx_desc.low.Color[i], vtx_attr.GetColorFormat(i));
|
const u32 color_size =
|
||||||
|
VertexLoader_Color::GetSize(vtx_desc.low.Color[i], vtx_attr.GetColorFormat(i));
|
||||||
|
if (color_size != 0)
|
||||||
|
f(color_size);
|
||||||
}
|
}
|
||||||
for (u32 i = 0; i < vtx_desc.high.TexCoord.Size(); i++)
|
for (u32 i = 0; i < vtx_desc.high.TexCoord.Size(); i++)
|
||||||
{
|
{
|
||||||
size += VertexLoader_TextCoord::GetSize(vtx_desc.high.TexCoord[i], vtx_attr.GetTexFormat(i),
|
const u32 tc_size = VertexLoader_TextCoord::GetSize(
|
||||||
vtx_attr.GetTexElements(i));
|
vtx_desc.high.TexCoord[i], vtx_attr.GetTexFormat(i), vtx_attr.GetTexElements(i));
|
||||||
|
if (tc_size != 0)
|
||||||
|
f(tc_size);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 VertexLoaderBase::GetVertexSize(const TVtxDesc& vtx_desc, const VAT& vtx_attr)
|
||||||
|
{
|
||||||
|
u32 size = 0;
|
||||||
|
GetComponentSizes(vtx_desc, vtx_attr, [&size](u32 s) { size += s; });
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,6 +169,14 @@ u32 VertexLoaderBase::GetVertexComponents(const TVtxDesc& vtx_desc, const VAT& v
|
|||||||
return components;
|
return components;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<u32> VertexLoaderBase::GetVertexComponentSizes(const TVtxDesc& vtx_desc,
|
||||||
|
const VAT& vtx_attr)
|
||||||
|
{
|
||||||
|
std::vector<u32> sizes;
|
||||||
|
GetComponentSizes(vtx_desc, vtx_attr, [&sizes](u32 s) { sizes.push_back(s); });
|
||||||
|
return sizes;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<VertexLoaderBase> VertexLoaderBase::CreateVertexLoader(const TVtxDesc& vtx_desc,
|
std::unique_ptr<VertexLoaderBase> VertexLoaderBase::CreateVertexLoader(const TVtxDesc& vtx_desc,
|
||||||
const VAT& vtx_attr)
|
const VAT& vtx_attr)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoCommon/CPMemory.h"
|
#include "VideoCommon/CPMemory.h"
|
||||||
@ -62,6 +63,7 @@ class VertexLoaderBase
|
|||||||
public:
|
public:
|
||||||
static u32 GetVertexSize(const TVtxDesc& vtx_desc, const VAT& vtx_attr);
|
static u32 GetVertexSize(const TVtxDesc& vtx_desc, const VAT& vtx_attr);
|
||||||
static u32 GetVertexComponents(const TVtxDesc& vtx_desc, const VAT& vtx_attr);
|
static u32 GetVertexComponents(const TVtxDesc& vtx_desc, const VAT& vtx_attr);
|
||||||
|
static std::vector<u32> GetVertexComponentSizes(const TVtxDesc& vtx_desc, const VAT& vtx_attr);
|
||||||
static std::unique_ptr<VertexLoaderBase> CreateVertexLoader(const TVtxDesc& vtx_desc,
|
static std::unique_ptr<VertexLoaderBase> CreateVertexLoader(const TVtxDesc& vtx_desc,
|
||||||
const VAT& vtx_attr);
|
const VAT& vtx_attr);
|
||||||
virtual ~VertexLoaderBase() {}
|
virtual ~VertexLoaderBase() {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user