VertexLoader: Skip vertices with position index = -1
This commit is contained in:
parent
325e8e370e
commit
1efd00227d
|
@ -92,6 +92,17 @@ static void LOADERDECL TexMtx_Write_Float4(VertexLoader* loader)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void LOADERDECL SkipVertex(VertexLoader* loader)
|
||||||
|
{
|
||||||
|
if (loader->m_vertexSkip)
|
||||||
|
{
|
||||||
|
// reset the output buffer
|
||||||
|
g_vertex_manager_write_ptr -= loader->m_native_vtx_decl.stride;
|
||||||
|
|
||||||
|
loader->m_skippedVertices++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr)
|
VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr)
|
||||||
: VertexLoaderBase(vtx_desc, vtx_attr)
|
: VertexLoaderBase(vtx_desc, vtx_attr)
|
||||||
{
|
{
|
||||||
|
@ -393,6 +404,12 @@ void VertexLoader::CompileVertexTranslator()
|
||||||
nat_offset += 4;
|
nat_offset += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// indexed position formats may skip a the vertex
|
||||||
|
if (m_VtxDesc.Position & 2)
|
||||||
|
{
|
||||||
|
WriteCall(SkipVertex);
|
||||||
|
}
|
||||||
|
|
||||||
m_native_components = components;
|
m_native_components = components;
|
||||||
m_native_vtx_decl.stride = nat_offset;
|
m_native_vtx_decl.stride = nat_offset;
|
||||||
|
|
||||||
|
@ -440,6 +457,7 @@ int VertexLoader::RunVertices(int primitive, int count, DataReader src, DataRead
|
||||||
src.WritePointer(&g_video_buffer_read_ptr);
|
src.WritePointer(&g_video_buffer_read_ptr);
|
||||||
|
|
||||||
m_numLoadedVertices += count;
|
m_numLoadedVertices += count;
|
||||||
|
m_skippedVertices = 0;
|
||||||
|
|
||||||
// Prepare bounding box
|
// Prepare bounding box
|
||||||
if (!g_ActiveConfig.backend_info.bSupportsBBox)
|
if (!g_ActiveConfig.backend_info.bSupportsBBox)
|
||||||
|
@ -462,5 +480,5 @@ int VertexLoader::RunVertices(int primitive, int count, DataReader src, DataRead
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return count;
|
return count - m_skippedVertices;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,8 @@ public:
|
||||||
u8 m_curtexmtx[8];
|
u8 m_curtexmtx[8];
|
||||||
int m_texmtxwrite;
|
int m_texmtxwrite;
|
||||||
int m_texmtxread;
|
int m_texmtxread;
|
||||||
|
bool m_vertexSkip;
|
||||||
|
int m_skippedVertices;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef USE_VERTEX_LOADER_JIT
|
#ifndef USE_VERTEX_LOADER_JIT
|
||||||
|
|
|
@ -93,6 +93,7 @@ void LOADERDECL Pos_ReadIndex(VertexLoader* loader)
|
||||||
static_assert(N <= 3, "N > 3 is not sane!");
|
static_assert(N <= 3, "N > 3 is not sane!");
|
||||||
|
|
||||||
auto const index = DataRead<I>();
|
auto const index = DataRead<I>();
|
||||||
|
loader->m_vertexSkip = index == std::numeric_limits<I>::max();
|
||||||
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_POSITION] + (index * g_main_cp_state.array_strides[ARRAY_POSITION]));
|
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_POSITION] + (index * g_main_cp_state.array_strides[ARRAY_POSITION]));
|
||||||
auto const scale = loader->m_posScale[0];
|
auto const scale = loader->m_posScale[0];
|
||||||
DataReader dst(g_vertex_manager_write_ptr, nullptr);
|
DataReader dst(g_vertex_manager_write_ptr, nullptr);
|
||||||
|
@ -119,6 +120,7 @@ void LOADERDECL Pos_ReadIndex_SSSE3(VertexLoader* loader)
|
||||||
{
|
{
|
||||||
static_assert(std::is_unsigned<I>::value, "Only unsigned I is sane!");
|
static_assert(std::is_unsigned<I>::value, "Only unsigned I is sane!");
|
||||||
auto const index = DataRead<I>();
|
auto const index = DataRead<I>();
|
||||||
|
loader->m_vertexSkip = index == std::numeric_limits<I>::max();
|
||||||
const T* pData = (const T*)(cached_arraybases[ARRAY_POSITION] + (index * g_main_cp_state.array_strides[ARRAY_POSITION]));
|
const T* pData = (const T*)(cached_arraybases[ARRAY_POSITION] + (index * g_main_cp_state.array_strides[ARRAY_POSITION]));
|
||||||
Vertex_Read_SSSE3<T, three, true>(pData, *(__m128*)loader->m_posScale);
|
Vertex_Read_SSSE3<T, three, true>(pData, *(__m128*)loader->m_posScale);
|
||||||
LOG_VTX();
|
LOG_VTX();
|
||||||
|
|
Loading…
Reference in New Issue