Pass through primitive restart state when rendering meshes

This commit is contained in:
baldurk
2019-08-12 15:38:19 +01:00
parent c0f7dc34e7
commit 61de35bfc6
4 changed files with 25 additions and 4 deletions
+3
View File
@@ -2091,6 +2091,9 @@ void BufferViewer::OnEventChanged(uint32_t eventId)
float vpWidth = qAbs(vp.width);
float vpHeight = qAbs(vp.height);
m_Config.position.allowRestart = m_Ctx.CurPipelineState().IsStripRestartEnabled();
m_Config.position.restartIndex = m_Ctx.CurPipelineState().GetStripRestartIndex();
m_Config.fov = ui->fovGuess->value();
m_Config.aspect = (vpWidth > 0.0f && vpHeight > 0.0f) ? (vpWidth / vpHeight) : 1.0f;
m_Config.highlightVert = 0;
+7
View File
@@ -47,6 +47,8 @@ struct MeshFormat
unproject = false;
instanced = false;
nearPlane = farPlane = 0.0f;
allowRestart = true;
restartIndex = 0xffffffff;
}
MeshFormat(const MeshFormat &o) = default;
@@ -80,6 +82,8 @@ struct MeshFormat
uint32_t numIndices;
DOCUMENT("The number of instances to render with the same value. See :data:`instanced`.");
uint32_t instStepRate;
DOCUMENT("The primitive restart index to use, if possible. See :data:`allowRestart`.");
uint32_t restartIndex;
DOCUMENT("The near plane for the projection matrix.");
float nearPlane;
@@ -93,6 +97,9 @@ struct MeshFormat
DOCUMENT("``True`` if the alpha component of this element should be used.");
bool showAlpha;
DOCUMENT("``True`` if the primitive restart index feature should be used.");
bool allowRestart;
};
DECLARE_REFLECTION_STRUCT(MeshFormat);
+14
View File
@@ -68,6 +68,20 @@ void GLReplay::RenderMesh(uint32_t eventId, const std::vector<MeshFormat> &secon
if(HasExt[EXT_framebuffer_sRGB])
drv.glEnable(eGL_FRAMEBUFFER_SRGB);
if(cfg.position.allowRestart)
{
if(IsGLES)
{
drv.glEnable(eGL_PRIMITIVE_RESTART_FIXED_INDEX);
}
else
{
drv.glEnable(eGL_PRIMITIVE_RESTART);
drv.glPrimitiveRestartIndex(cfg.position.restartIndex &
(0xFFFFFFFFU >> ((4 - cfg.position.indexByteStride) * 8)));
}
}
drv.glDisable(eGL_CULL_FACE);
if(cfg.position.unproject)
+1 -4
View File
@@ -138,10 +138,7 @@ MeshDisplayPipelines VulkanDebugManager::CacheMeshDisplayPipelines(VkPipelineLay
false,
};
if(IsStrip(primary.topology))
{
ia.primitiveRestartEnable = true;
}
ia.primitiveRestartEnable = primary.allowRestart;
VkRect2D scissor = {{0, 0}, {16384, 16384}};