mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Merge branch 'master' of https://github.com/josiahmanson/imgui into josiahmanson-master
This commit is contained in:
commit
1e9c9df6de
@ -35,6 +35,7 @@ static ID3D11ShaderResourceView*g_pFontTextureView = NULL;
|
|||||||
static ID3D11RasterizerState* g_pRasterizerState = NULL;
|
static ID3D11RasterizerState* g_pRasterizerState = NULL;
|
||||||
static ID3D11BlendState* g_pBlendState = NULL;
|
static ID3D11BlendState* g_pBlendState = NULL;
|
||||||
static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;
|
static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;
|
||||||
|
static ID3D11DepthStencilState* g_pDSState = NULL;
|
||||||
|
|
||||||
struct VERTEX_CONSTANT_BUFFER
|
struct VERTEX_CONSTANT_BUFFER
|
||||||
{
|
{
|
||||||
@ -138,6 +139,8 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
UINT IndexBufferOffset, VertexBufferStride, VertexBufferOffset;
|
UINT IndexBufferOffset, VertexBufferStride, VertexBufferOffset;
|
||||||
DXGI_FORMAT IndexBufferFormat;
|
DXGI_FORMAT IndexBufferFormat;
|
||||||
ID3D11InputLayout* InputLayout;
|
ID3D11InputLayout* InputLayout;
|
||||||
|
ID3D11DepthStencilState* DepthStencilState;
|
||||||
|
UINT StencilRef;
|
||||||
};
|
};
|
||||||
BACKUP_DX11_STATE old;
|
BACKUP_DX11_STATE old;
|
||||||
old.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
old.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
||||||
@ -155,6 +158,7 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
ctx->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);
|
ctx->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);
|
||||||
ctx->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);
|
ctx->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);
|
||||||
ctx->IAGetInputLayout(&old.InputLayout);
|
ctx->IAGetInputLayout(&old.InputLayout);
|
||||||
|
ctx->OMGetDepthStencilState(&old.DepthStencilState, &old.StencilRef);
|
||||||
|
|
||||||
// Setup viewport
|
// Setup viewport
|
||||||
D3D11_VIEWPORT vp;
|
D3D11_VIEWPORT vp;
|
||||||
@ -182,6 +186,7 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
|
const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
|
||||||
ctx->OMSetBlendState(g_pBlendState, blend_factor, 0xffffffff);
|
ctx->OMSetBlendState(g_pBlendState, blend_factor, 0xffffffff);
|
||||||
ctx->RSSetState(g_pRasterizerState);
|
ctx->RSSetState(g_pRasterizerState);
|
||||||
|
ctx->OMSetDepthStencilState( g_pDSState, 1 );
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
int vtx_offset = 0;
|
int vtx_offset = 0;
|
||||||
@ -224,6 +229,7 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
ctx->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();
|
ctx->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();
|
||||||
ctx->IASetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset); if (old.VertexBuffer) old.VertexBuffer->Release();
|
ctx->IASetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset); if (old.VertexBuffer) old.VertexBuffer->Release();
|
||||||
ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
|
ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
|
||||||
|
ctx->OMSetDepthStencilState(old.DepthStencilState, old.StencilRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
IMGUI_API LRESULT ImGui_ImplDX11_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
|
IMGUI_API LRESULT ImGui_ImplDX11_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
@ -448,6 +454,18 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
|
|||||||
g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);
|
g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create Depth-Stencil State
|
||||||
|
{
|
||||||
|
D3D11_DEPTH_STENCIL_DESC desc;
|
||||||
|
ZeroMemory(&desc, sizeof(desc));
|
||||||
|
desc.StencilEnable = false;
|
||||||
|
desc.DepthEnable = true;
|
||||||
|
desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
||||||
|
desc.DepthFunc = D3D11_COMPARISON_ALWAYS;
|
||||||
|
g_pd3dDevice->CreateDepthStencilState( &desc, &g_pDSState );
|
||||||
|
}
|
||||||
|
|
||||||
ImGui_ImplDX11_CreateFontsTexture();
|
ImGui_ImplDX11_CreateFontsTexture();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -471,6 +489,7 @@ void ImGui_ImplDX11_InvalidateDeviceObjects()
|
|||||||
if (g_pInputLayout) { g_pInputLayout->Release(); g_pInputLayout = NULL; }
|
if (g_pInputLayout) { g_pInputLayout->Release(); g_pInputLayout = NULL; }
|
||||||
if (g_pVertexShader) { g_pVertexShader->Release(); g_pVertexShader = NULL; }
|
if (g_pVertexShader) { g_pVertexShader->Release(); g_pVertexShader = NULL; }
|
||||||
if (g_pVertexShaderBlob) { g_pVertexShaderBlob->Release(); g_pVertexShaderBlob = NULL; }
|
if (g_pVertexShaderBlob) { g_pVertexShaderBlob->Release(); g_pVertexShaderBlob = NULL; }
|
||||||
|
if (g_pDSState) { g_pDSState->Release(); g_pDSState = NULL; }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContext* device_context)
|
bool ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContext* device_context)
|
||||||
|
Loading…
Reference in New Issue
Block a user