Merge pull request #1990 from Tilka/getvertexsize
VertexLoaderManager: assimilate GetVertexSize()
This commit is contained in:
commit
22e27ffd23
|
@ -265,28 +265,18 @@ u8* OpcodeDecoder_Run(DataReader src, u32* cycles, bool in_display_list)
|
||||||
if (src.size() < 2)
|
if (src.size() < 2)
|
||||||
goto end;
|
goto end;
|
||||||
u16 num_vertices = src.Read<u16>();
|
u16 num_vertices = src.Read<u16>();
|
||||||
|
int bytes = VertexLoaderManager::RunVertices(
|
||||||
|
cmd_byte & GX_VAT_MASK, // Vertex loader index (0 - 7)
|
||||||
|
(cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
|
||||||
|
num_vertices,
|
||||||
|
src,
|
||||||
|
g_bSkipCurrentFrame,
|
||||||
|
is_preprocess);
|
||||||
|
|
||||||
if (is_preprocess)
|
if (bytes < 0)
|
||||||
{
|
goto end;
|
||||||
size_t size = num_vertices * VertexLoaderManager::GetVertexSize(cmd_byte & GX_VAT_MASK, is_preprocess);
|
|
||||||
if (src.size() < size)
|
|
||||||
goto end;
|
|
||||||
src.Skip(size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int bytes = VertexLoaderManager::RunVertices(
|
|
||||||
cmd_byte & GX_VAT_MASK, // Vertex loader index (0 - 7)
|
|
||||||
(cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
|
|
||||||
num_vertices,
|
|
||||||
src,
|
|
||||||
g_bSkipCurrentFrame);
|
|
||||||
|
|
||||||
if (bytes < 0)
|
src.Skip(bytes);
|
||||||
goto end;
|
|
||||||
else
|
|
||||||
src.Skip(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4 GPU ticks per vertex, 3 CPU ticks per GPU tick
|
// 4 GPU ticks per vertex, 3 CPU ticks per GPU tick
|
||||||
totalCycles += num_vertices * 4 * 3 + 6;
|
totalCycles += num_vertices * 4 * 3 + 6;
|
||||||
|
|
|
@ -138,18 +138,18 @@ static VertexLoaderBase* RefreshLoader(int vtx_attr_group, bool preprocess = fal
|
||||||
return loader;
|
return loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool skip_drawing)
|
int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool skip_drawing, bool is_preprocess)
|
||||||
{
|
{
|
||||||
if (!count)
|
if (!count)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
VertexLoaderBase* loader = RefreshLoader(vtx_attr_group);
|
VertexLoaderBase* loader = RefreshLoader(vtx_attr_group, is_preprocess);
|
||||||
|
|
||||||
int size = count * loader->m_VertexSize;
|
int size = count * loader->m_VertexSize;
|
||||||
if ((int)src.size() < size)
|
if ((int)src.size() < size)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (skip_drawing)
|
if (skip_drawing || is_preprocess)
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
// If the native vertex format changed, force a flush.
|
// If the native vertex format changed, force a flush.
|
||||||
|
@ -175,11 +175,6 @@ int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bo
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetVertexSize(int vtx_attr_group, bool preprocess)
|
|
||||||
{
|
|
||||||
return RefreshLoader(vtx_attr_group, preprocess)->m_VertexSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
NativeVertexFormat* GetCurrentVertexFormat()
|
NativeVertexFormat* GetCurrentVertexFormat()
|
||||||
{
|
{
|
||||||
return s_current_vtx_fmt;
|
return s_current_vtx_fmt;
|
||||||
|
|
|
@ -17,10 +17,8 @@ namespace VertexLoaderManager
|
||||||
|
|
||||||
void MarkAllDirty();
|
void MarkAllDirty();
|
||||||
|
|
||||||
int GetVertexSize(int vtx_attr_group, bool preprocess);
|
|
||||||
|
|
||||||
// Returns -1 if buf_size is insufficient, else the amount of bytes consumed
|
// Returns -1 if buf_size is insufficient, else the amount of bytes consumed
|
||||||
int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool skip_drawing = false);
|
int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool skip_drawing, bool is_preprocess);
|
||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
void AppendListToString(std::string *dest);
|
void AppendListToString(std::string *dest);
|
||||||
|
|
Loading…
Reference in New Issue