Ditch position buffer for all but fonts. Closes #102

This commit is contained in:
baldurk
2014-10-31 18:41:10 +00:00
parent 63d1f868ac
commit 8193c80697
4 changed files with 18 additions and 18 deletions
-5
View File
@@ -25,11 +25,6 @@
// this file provides a couple of functions that, given the basic type, will go and
// figure out which resource to sample from and load from it then return the value
struct a2v
{
float3 pos : POSITION;
};
struct v2f
{
float4 pos : SV_Position;
+13 -3
View File
@@ -24,11 +24,21 @@
v2f RENDERDOC_DebugVS(a2v IN)
v2f RENDERDOC_DebugVS(uint vertID : SV_VertexID)
{
v2f OUT = (v2f)0;
OUT.pos = float4(Position.xy + (float2(IN.pos.z,0) + IN.pos.xy*TextureResolution.xy)*Scale*ScreenAspect.xy, 0, 1)-float4(1.0,-1.0,0,0);
OUT.tex.xy = float2(IN.pos.x, -IN.pos.y);
float2 positions[] = {
float2(0.0f, 0.0f),
float2(0.0f, -1.0f),
float2(1.0f, 0.0f),
float2(1.0f, -1.0f),
};
float2 pos = positions[vertID];
OUT.pos = float4(Position.xy + pos.xy*TextureResolution.xy*Scale*ScreenAspect.xy, 0, 1)-float4(1.0,-1.0,0,0);
OUT.tex.xy = float2(pos.x, -pos.y);
return OUT;
}
+2 -7
View File
@@ -1493,7 +1493,7 @@ bool D3D11DebugManager::InitFontRendering()
bufDesc.CPUAccessFlags = 0;
bufDesc.MiscFlags = 0;
hr = m_pDevice->CreateBuffer(&bufDesc, &initialPos, &m_DebugRender.PosBuffer);
hr = m_pDevice->CreateBuffer(&bufDesc, &initialPos, &m_Font.PosBuffer);
if(FAILED(hr))
{
@@ -3241,7 +3241,7 @@ void D3D11DebugManager::RenderTextInternal(float x, float y, const char *text)
}
m_pImmediateContext->Unmap(m_Font.CharBuffer, 0);
ID3D11Buffer *bufs[2] = { m_DebugRender.PosBuffer, m_Font.CharBuffer };
ID3D11Buffer *bufs[2] = { m_Font.PosBuffer, m_Font.CharBuffer };
UINT strides[2] = { 3*sizeof(float), sizeof(long) };
UINT offsets[2] = { 0, 0 };
@@ -3477,7 +3477,6 @@ bool D3D11DebugManager::RenderTexture(TextureDisplay cfg, bool blendAlpha)
pixelData.MipLevel = (float)cfg.mip;
ID3D11Buffer *bufs[2] = { m_DebugRender.PosBuffer, m_Font.CharBuffer };
UINT stride = 3*sizeof(float);
UINT offset = 0;
@@ -3546,9 +3545,7 @@ bool D3D11DebugManager::RenderTexture(TextureDisplay cfg, bool blendAlpha)
// can't just clear state because we need to keep things like render targets.
{
m_pImmediateContext->IASetInputLayout(m_DebugRender.GenericLayout);
m_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
m_pImmediateContext->IASetVertexBuffers(0, 1, &m_DebugRender.PosBuffer, &stride, &offset);
m_pImmediateContext->VSSetShader(m_DebugRender.GenericVS, NULL, 0);
m_pImmediateContext->VSSetConstantBuffers(0, 1, &m_DebugRender.GenericVSCBuffer);
@@ -3687,9 +3684,7 @@ void D3D11DebugManager::RenderCheckerboard(Vec3f light, Vec3f dark)
// can't just clear state because we need to keep things like render targets.
{
m_pImmediateContext->IASetInputLayout(m_DebugRender.GenericLayout);
m_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
m_pImmediateContext->IASetVertexBuffers(0, 1, &m_DebugRender.PosBuffer, &stride, &offset);
m_pImmediateContext->VSSetShader(m_DebugRender.GenericVS, NULL, 0);
m_pImmediateContext->VSSetConstantBuffers(0, 1, &m_DebugRender.GenericVSCBuffer);
+3 -3
View File
@@ -362,6 +362,7 @@ class D3D11DebugManager
SAFE_RELEASE(Tex);
SAFE_RELEASE(CBuffer);
SAFE_RELEASE(GlyphData);
SAFE_RELEASE(PosBuffer);
SAFE_RELEASE(CharBuffer);
SAFE_RELEASE(VS);
SAFE_RELEASE(PS);
@@ -371,7 +372,7 @@ class D3D11DebugManager
ID3D11ShaderResourceView *Tex;
ID3D11Buffer *CBuffer;
ID3D11Buffer *GlyphData;
ID3D11Buffer *CharBuffer;
ID3D11Buffer *PosBuffer, *CharBuffer;
ID3D11VertexShader *VS;
ID3D11PixelShader *PS;
@@ -386,7 +387,6 @@ class D3D11DebugManager
{
SAFE_RELEASE(StageBuffer);
SAFE_RELEASE(PosBuffer);
SAFE_RELEASE(OutlineStripVB);
SAFE_RELEASE(RastState);
SAFE_RELEASE(BlendState);
@@ -471,7 +471,7 @@ class D3D11DebugManager
ID3D11Buffer *StageBuffer;
ID3D11Buffer *PosBuffer, *OutlineStripVB;
ID3D11Buffer *OutlineStripVB;
ID3D11RasterizerState *RastState;
ID3D11SamplerState *PointSampState, *LinearSampState;
ID3D11BlendState *BlendState, *NopBlendState;