mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 23:16:31 +00:00
Allow displaying any semantics as 'position' on mesh output view
* This means you can visualise the UVs directly, not just as a colour on the regular mesh.
This commit is contained in:
@@ -57,6 +57,7 @@ struct MeshDisplay
|
||||
uint32_t highlightVert;
|
||||
MeshFormat position;
|
||||
MeshFormat second;
|
||||
bool32 unproject;
|
||||
|
||||
FloatVector prevMeshColour;
|
||||
FloatVector currentMeshColour;
|
||||
|
||||
@@ -4630,8 +4630,6 @@ void D3D11DebugManager::RenderMesh(uint32_t frameID, const vector<uint32_t> &eve
|
||||
RDCERR("Failed to create m_MeshDisplayLayout %08x", hr);
|
||||
m_MeshDisplayLayout = NULL;
|
||||
}
|
||||
|
||||
layoutdesc[0].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
|
||||
hr = m_pDevice->CreateInputLayout(layoutdesc, 2, m_DebugRender.MeshHomogVSBytecode, m_DebugRender.MeshHomogVSBytelen, &m_PostMeshDisplayLayout);
|
||||
|
||||
@@ -4645,8 +4643,7 @@ void D3D11DebugManager::RenderMesh(uint32_t frameID, const vector<uint32_t> &eve
|
||||
m_PrevMeshFmt = resFmt;
|
||||
m_PrevMeshFmt2 = resFmt2;
|
||||
|
||||
if((cfg.type != eMeshDataStage_VSIn && pipeState.m_HS.Shader == ResourceId()) ||
|
||||
(cfg.type == eMeshDataStage_GSOut && pipeState.m_HS.Shader != ResourceId()))
|
||||
if(cfg.unproject || events.size() > 1)
|
||||
{
|
||||
float nearp = 0.1f;
|
||||
float farp = 1000.0f;
|
||||
@@ -4832,16 +4829,28 @@ void D3D11DebugManager::RenderMesh(uint32_t frameID, const vector<uint32_t> &eve
|
||||
UINT str[] = { cfg.position.stride, cfg.second.stride };
|
||||
UINT offs[] = { cfg.position.offset, cfg.second.offset };
|
||||
|
||||
auto it = WrappedID3D11Buffer::m_BufferList.find(cfg.position.buf);
|
||||
if(cfg.type == eMeshDataStage_VSIn)
|
||||
{
|
||||
auto it = WrappedID3D11Buffer::m_BufferList.find(cfg.position.buf);
|
||||
|
||||
if(it != WrappedID3D11Buffer::m_BufferList.end())
|
||||
vbs[0] = UNWRAP(WrappedID3D11Buffer, it->second.m_Buffer);
|
||||
if(it != WrappedID3D11Buffer::m_BufferList.end())
|
||||
vbs[0] = UNWRAP(WrappedID3D11Buffer, it->second.m_Buffer);
|
||||
|
||||
it = WrappedID3D11Buffer::m_BufferList.find(cfg.second.buf);
|
||||
it = WrappedID3D11Buffer::m_BufferList.find(cfg.second.buf);
|
||||
|
||||
if(it != WrappedID3D11Buffer::m_BufferList.end())
|
||||
vbs[1] = UNWRAP(WrappedID3D11Buffer, it->second.m_Buffer);
|
||||
if(it != WrappedID3D11Buffer::m_BufferList.end())
|
||||
vbs[1] = UNWRAP(WrappedID3D11Buffer, it->second.m_Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
PostVSData data = GetPostVSBuffers(frameID, events[0]);
|
||||
|
||||
if(cfg.type == eMeshDataStage_VSOut)
|
||||
vbs[0] = vbs[1] = UNWRAP(WrappedID3D11Buffer, data.vsout.buf);
|
||||
if(cfg.type == eMeshDataStage_GSOut)
|
||||
vbs[0] = vbs[1] = UNWRAP(WrappedID3D11Buffer, data.gsout.buf);
|
||||
}
|
||||
|
||||
m_pImmediateContext->IASetVertexBuffers(0, 2, vbs, str, offs);
|
||||
m_pImmediateContext->IASetInputLayout(m_MeshDisplayLayout);
|
||||
|
||||
@@ -4914,8 +4923,7 @@ void D3D11DebugManager::RenderMesh(uint32_t frameID, const vector<uint32_t> &eve
|
||||
}
|
||||
|
||||
// axis markers
|
||||
if(cfg.type == eMeshDataStage_VSIn ||
|
||||
(cfg.type == eMeshDataStage_VSOut && pipeState.m_HS.Shader != ResourceId()))
|
||||
if(!cfg.unproject)
|
||||
{
|
||||
m_pImmediateContext->PSSetConstantBuffers(0, 1, &m_DebugRender.GenericPSCBuffer);
|
||||
|
||||
@@ -5440,8 +5448,7 @@ void D3D11DebugManager::RenderMesh(uint32_t frameID, const vector<uint32_t> &eve
|
||||
}
|
||||
|
||||
// 'fake' helper frustum
|
||||
if((cfg.type != eMeshDataStage_VSIn && pipeState.m_HS.Shader == ResourceId()) ||
|
||||
(cfg.type == eMeshDataStage_GSOut && pipeState.m_HS.Shader != ResourceId()))
|
||||
if(cfg.unproject)
|
||||
{
|
||||
UINT strides[] = { sizeof(Vec3f) };
|
||||
UINT offsets[] = { 0 };
|
||||
|
||||
@@ -383,6 +383,7 @@ namespace renderdoc
|
||||
public UInt32 highlightVert;
|
||||
public MeshFormat position;
|
||||
public MeshFormat secondary;
|
||||
public bool unproject;
|
||||
|
||||
public FloatVector prevMeshColour = new FloatVector();
|
||||
public FloatVector currentMeshColour = new FloatVector();
|
||||
|
||||
@@ -2208,6 +2208,13 @@ namespace renderdocui.Windows
|
||||
m_MeshDisplay.position.compType = pos.format.compType;
|
||||
m_MeshDisplay.position.specialFormat = pos.format.special ? pos.format.specialFormat : SpecialFormat.Unknown;
|
||||
m_MeshDisplay.position.showAlpha = false;
|
||||
|
||||
m_MeshDisplay.unproject = false;
|
||||
|
||||
if ((ui.m_Stage == MeshDataStage.VSOut && !m_Core.CurPipelineState.IsTessellationEnabled) || ui.m_Stage == MeshDataStage.GSOut)
|
||||
{
|
||||
m_MeshDisplay.unproject = pos.name.ToUpperInvariant() == "SV_POSITION";
|
||||
}
|
||||
}
|
||||
|
||||
if (ui.m_Input == null || ui.m_Input.BufferFormats == null ||
|
||||
@@ -2408,13 +2415,12 @@ namespace renderdocui.Windows
|
||||
if (m_Core.LogLoaded && MeshView)
|
||||
{
|
||||
m_ContextUIState = GetUIState(sender);
|
||||
bool input = (m_ContextUIState == m_VSIn);
|
||||
|
||||
if (e.Button == MouseButtons.Right &&
|
||||
m_ContextUIState.m_Input != null &&
|
||||
m_ContextUIState.m_Input.BufferFormats != null)
|
||||
{
|
||||
selectColumnAsPositionToolStripMenuItem.Visible = input;
|
||||
selectColumnAsPositionToolStripMenuItem.Visible = true;
|
||||
selectAlphaAsSecondaryToolStripMenuItem.Visible = true;
|
||||
|
||||
m_ContextColumn = 0;
|
||||
|
||||
Reference in New Issue
Block a user