mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Fix highlight boxes to not have a little pixel missing in the corner
* Also in the HLSL version, we were indexing off the end of an array since we were drawing 5 lines but only had 4 verts in the array. Oops! * We can remove D3D's OutlineStripVB, as we're doing it all in the shader.
This commit is contained in:
@@ -33,6 +33,7 @@ v2f RENDERDOC_DebugVS(uint vertID : SV_VertexID)
|
||||
float2(0.0f, -1.0f),
|
||||
float2(1.0f, 0.0f),
|
||||
float2(1.0f, -1.0f),
|
||||
float2(0.0f, 0.0f),
|
||||
};
|
||||
|
||||
float2 pos = positions[vertID];
|
||||
@@ -40,10 +41,11 @@ v2f RENDERDOC_DebugVS(uint vertID : SV_VertexID)
|
||||
if(LineStrip)
|
||||
{
|
||||
float2 strippositions[] = {
|
||||
float2(0.0f, 0.0f),
|
||||
float2(1.0f, 0.0f),
|
||||
float2(1.0f, -1.0f),
|
||||
float2(0.0f, -1.0f),
|
||||
float2(1.0f, -1.0f),
|
||||
float2(1.0f, 0.0f),
|
||||
float2(0.0f, 0.0f),
|
||||
float2(0.0f, -1.1f),
|
||||
};
|
||||
|
||||
pos = strippositions[vertID];
|
||||
|
||||
@@ -1022,37 +1022,6 @@ bool D3D11DebugManager::InitDebugRendering()
|
||||
}
|
||||
|
||||
RenderDoc::Inst().SetProgress(DebugManagerInit, 0.9f);
|
||||
|
||||
if(RenderDoc::Inst().IsReplayApp())
|
||||
{
|
||||
float data[] = {
|
||||
0.0f, -1.0f, 0.0f,
|
||||
1.0f, -1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f,
|
||||
0.0f, -1.0f, 0.0f,
|
||||
};
|
||||
|
||||
D3D11_SUBRESOURCE_DATA initialPos;
|
||||
|
||||
initialPos.pSysMem = data;
|
||||
initialPos.SysMemPitch = initialPos.SysMemSlicePitch = 0;
|
||||
|
||||
D3D11_BUFFER_DESC bufDesc;
|
||||
|
||||
bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
bufDesc.Usage = D3D11_USAGE_IMMUTABLE;
|
||||
bufDesc.ByteWidth = sizeof(data);
|
||||
bufDesc.CPUAccessFlags = 0;
|
||||
bufDesc.MiscFlags = 0;
|
||||
|
||||
hr = m_pDevice->CreateBuffer(&bufDesc, &initialPos, &m_DebugRender.OutlineStripVB);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
RDCERR("Failed to create outline strip buffer %08x", hr);
|
||||
}
|
||||
}
|
||||
|
||||
if(RenderDoc::Inst().IsReplayApp())
|
||||
{
|
||||
@@ -3636,7 +3605,6 @@ void D3D11DebugManager::RenderHighlightBox(float w, float h, float scale)
|
||||
|
||||
m_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP);
|
||||
m_pImmediateContext->IASetInputLayout(NULL);
|
||||
m_pImmediateContext->IASetVertexBuffers(0, 1, &m_DebugRender.OutlineStripVB, &stride, &offs);
|
||||
|
||||
m_pImmediateContext->VSSetShader(m_DebugRender.GenericVS, NULL, 0);
|
||||
m_pImmediateContext->PSSetShader(m_DebugRender.OverlayPS, NULL, 0);
|
||||
|
||||
@@ -398,7 +398,6 @@ class D3D11DebugManager
|
||||
{
|
||||
SAFE_RELEASE(StageBuffer);
|
||||
|
||||
SAFE_RELEASE(OutlineStripVB);
|
||||
SAFE_RELEASE(RastState);
|
||||
SAFE_RELEASE(BlendState);
|
||||
SAFE_RELEASE(NopBlendState);
|
||||
@@ -483,7 +482,6 @@ class D3D11DebugManager
|
||||
|
||||
ID3D11Buffer *StageBuffer;
|
||||
|
||||
ID3D11Buffer *OutlineStripVB;
|
||||
ID3D11RasterizerState *RastState;
|
||||
ID3D11SamplerState *PointSampState, *LinearSampState;
|
||||
ID3D11BlendState *BlendState, *NopBlendState;
|
||||
|
||||
@@ -282,6 +282,7 @@ void GLReplay::InitDebugData()
|
||||
1.0f, -1.0f, 0.0f, 1.0f,
|
||||
1.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, -1.1f, 0.0f, 1.0f,
|
||||
};
|
||||
|
||||
gl.glGenBuffers(1, &DebugData.outlineStripVB);
|
||||
@@ -1395,7 +1396,7 @@ void GLReplay::RenderHighlightBox(float w, float h, float scale)
|
||||
gl.glDisable(eGL_DEPTH_TEST);
|
||||
|
||||
gl.glBindVertexArray(DebugData.outlineStripVAO);
|
||||
gl.glDrawArrays(eGL_LINE_LOOP, 0, 4);
|
||||
gl.glDrawArrays(eGL_LINE_STRIP, 0, 5);
|
||||
|
||||
offsetVal = Vec4f(-xpixdim, ypixdim, 0.0f, 0.0f);
|
||||
scaleVal = Vec4f(xdim+xpixdim*2, ydim+ypixdim*2, 1.0f, 1.0f);
|
||||
@@ -1406,7 +1407,7 @@ void GLReplay::RenderHighlightBox(float w, float h, float scale)
|
||||
gl.glUniform4fv(colLoc, 1, &colVal.x);
|
||||
|
||||
gl.glBindVertexArray(DebugData.outlineStripVAO);
|
||||
gl.glDrawArrays(eGL_LINE_LOOP, 0, 4);
|
||||
gl.glDrawArrays(eGL_LINE_STRIP, 0, 5);
|
||||
}
|
||||
|
||||
void GLReplay::SetupOverlayPipeline(GLuint Program, GLuint Pipeline, GLuint fragProgram)
|
||||
|
||||
Reference in New Issue
Block a user