mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Pass through primitive restart state when rendering meshes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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}};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user