VideoCommon:VertexManagerBase: Only calculate remaining indices once
Before, both of those were calculated 3 times due to the ASSERTs.
This commit is contained in:
parent
408b09da31
commit
93fce0e4b6
|
@ -140,7 +140,7 @@ DataReader VertexManagerBase::PrepareForAdditionalData(OpcodeDecoder::Primitive
|
||||||
PrimitiveType new_primitive_type = g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ?
|
PrimitiveType new_primitive_type = g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ?
|
||||||
primitive_from_gx_pr[primitive] :
|
primitive_from_gx_pr[primitive] :
|
||||||
primitive_from_gx[primitive];
|
primitive_from_gx[primitive];
|
||||||
if (m_current_primitive_type != new_primitive_type)
|
if (m_current_primitive_type != new_primitive_type) [[unlikely]]
|
||||||
{
|
{
|
||||||
Flush();
|
Flush();
|
||||||
|
|
||||||
|
@ -149,9 +149,11 @@ DataReader VertexManagerBase::PrepareForAdditionalData(OpcodeDecoder::Primitive
|
||||||
SetRasterizationStateChanged();
|
SetRasterizationStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 remaining_indices = GetRemainingIndices(primitive);
|
||||||
|
u32 remaining_index_generator_indices = m_index_generator.GetRemainingIndices(primitive);
|
||||||
|
|
||||||
// Check for size in buffer, if the buffer gets full, call Flush()
|
// Check for size in buffer, if the buffer gets full, call Flush()
|
||||||
if (!m_is_flushed && (count > m_index_generator.GetRemainingIndices(primitive) ||
|
if (!m_is_flushed && (count > remaining_index_generator_indices || count > remaining_indices ||
|
||||||
count > GetRemainingIndices(primitive) ||
|
|
||||||
needed_vertex_bytes > GetRemainingSize())) [[unlikely]]
|
needed_vertex_bytes > GetRemainingSize())) [[unlikely]]
|
||||||
{
|
{
|
||||||
Flush();
|
Flush();
|
||||||
|
@ -160,7 +162,7 @@ DataReader VertexManagerBase::PrepareForAdditionalData(OpcodeDecoder::Primitive
|
||||||
m_cull_all = cullall;
|
m_cull_all = cullall;
|
||||||
|
|
||||||
// need to alloc new buffer
|
// need to alloc new buffer
|
||||||
if (m_is_flushed)
|
if (m_is_flushed) [[unlikely]]
|
||||||
{
|
{
|
||||||
if (cullall)
|
if (cullall)
|
||||||
{
|
{
|
||||||
|
@ -174,6 +176,8 @@ DataReader VertexManagerBase::PrepareForAdditionalData(OpcodeDecoder::Primitive
|
||||||
ResetBuffer(stride);
|
ResetBuffer(stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remaining_index_generator_indices = m_index_generator.GetRemainingIndices(primitive);
|
||||||
|
remaining_indices = GetRemainingIndices(primitive);
|
||||||
m_is_flushed = false;
|
m_is_flushed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,14 +185,14 @@ DataReader VertexManagerBase::PrepareForAdditionalData(OpcodeDecoder::Primitive
|
||||||
// won't have enough space in a few rare cases, such as vertex shader line/point expansion with a
|
// won't have enough space in a few rare cases, such as vertex shader line/point expansion with a
|
||||||
// ton of lines in one draw command, in which case we will either need to add support for
|
// ton of lines in one draw command, in which case we will either need to add support for
|
||||||
// splitting a single draw command into multiple draws or using bigger indices.
|
// splitting a single draw command into multiple draws or using bigger indices.
|
||||||
ASSERT_MSG(VIDEO, count <= m_index_generator.GetRemainingIndices(primitive),
|
ASSERT_MSG(VIDEO, count <= remaining_index_generator_indices,
|
||||||
"VertexManager: Too few remaining index values ({} > {}). "
|
"VertexManager: Too few remaining index values ({} > {}). "
|
||||||
"32-bit indices or primitive breaking needed.",
|
"32-bit indices or primitive breaking needed.",
|
||||||
count, m_index_generator.GetRemainingIndices(primitive));
|
count, remaining_index_generator_indices);
|
||||||
ASSERT_MSG(VIDEO, count <= GetRemainingIndices(primitive),
|
ASSERT_MSG(VIDEO, count <= remaining_indices,
|
||||||
"VertexManager: Buffer not large enough for all indices! ({} > {}) "
|
"VertexManager: Buffer not large enough for all indices! ({} > {}) "
|
||||||
"Increase MAXIBUFFERSIZE or we need primitive breaking after all.",
|
"Increase MAXIBUFFERSIZE or we need primitive breaking after all.",
|
||||||
count, GetRemainingIndices(primitive));
|
count, remaining_indices);
|
||||||
ASSERT_MSG(VIDEO, needed_vertex_bytes <= GetRemainingSize(),
|
ASSERT_MSG(VIDEO, needed_vertex_bytes <= GetRemainingSize(),
|
||||||
"VertexManager: Buffer not large enough for all vertices! ({} > {}) "
|
"VertexManager: Buffer not large enough for all vertices! ({} > {}) "
|
||||||
"Increase MAXVBUFFERSIZE or we need primitive breaking after all.",
|
"Increase MAXVBUFFERSIZE or we need primitive breaking after all.",
|
||||||
|
|
Loading…
Reference in New Issue