mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
This commit is contained in:
parent
656b1e848c
commit
2ef766a1ce
@ -34,6 +34,7 @@ static ID3D10SamplerState* g_pFontSampler = NULL;
|
|||||||
static ID3D10ShaderResourceView*g_pFontTextureView = NULL;
|
static ID3D10ShaderResourceView*g_pFontTextureView = NULL;
|
||||||
static ID3D10RasterizerState* g_pRasterizerState = NULL;
|
static ID3D10RasterizerState* g_pRasterizerState = NULL;
|
||||||
static ID3D10BlendState* g_pBlendState = NULL;
|
static ID3D10BlendState* g_pBlendState = NULL;
|
||||||
|
static ID3D10DepthStencilState* g_pDepthStencilState = NULL;
|
||||||
static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;
|
static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;
|
||||||
|
|
||||||
struct VERTEX_CONSTANT_BUFFER
|
struct VERTEX_CONSTANT_BUFFER
|
||||||
@ -125,6 +126,8 @@ void ImGui_ImplDX10_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
ID3D10BlendState* BlendState;
|
ID3D10BlendState* BlendState;
|
||||||
FLOAT BlendFactor[4];
|
FLOAT BlendFactor[4];
|
||||||
UINT SampleMask;
|
UINT SampleMask;
|
||||||
|
UINT StencilRef;
|
||||||
|
ID3D10DepthStencilState* DepthStencilState;
|
||||||
ID3D10ShaderResourceView* PSShaderResource;
|
ID3D10ShaderResourceView* PSShaderResource;
|
||||||
ID3D10SamplerState* PSSampler;
|
ID3D10SamplerState* PSSampler;
|
||||||
ID3D10PixelShader* PS;
|
ID3D10PixelShader* PS;
|
||||||
@ -141,6 +144,7 @@ void ImGui_ImplDX10_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
ctx->RSGetViewports(&old.ViewportsCount, old.Viewports);
|
ctx->RSGetViewports(&old.ViewportsCount, old.Viewports);
|
||||||
ctx->RSGetState(&old.RS);
|
ctx->RSGetState(&old.RS);
|
||||||
ctx->OMGetBlendState(&old.BlendState, old.BlendFactor, &old.SampleMask);
|
ctx->OMGetBlendState(&old.BlendState, old.BlendFactor, &old.SampleMask);
|
||||||
|
ctx->OMGetDepthStencilState(&old.DepthStencilState, &old.StencilRef);
|
||||||
ctx->PSGetShaderResources(0, 1, &old.PSShaderResource);
|
ctx->PSGetShaderResources(0, 1, &old.PSShaderResource);
|
||||||
ctx->PSGetSamplers(0, 1, &old.PSSampler);
|
ctx->PSGetSamplers(0, 1, &old.PSSampler);
|
||||||
ctx->PSGetShader(&old.PS);
|
ctx->PSGetShader(&old.PS);
|
||||||
@ -176,6 +180,7 @@ void ImGui_ImplDX10_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
// Setup render state
|
// Setup render state
|
||||||
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->OMSetDepthStencilState(g_pDepthStencilState, 0);
|
||||||
ctx->RSSetState(g_pRasterizerState);
|
ctx->RSSetState(g_pRasterizerState);
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
@ -208,6 +213,7 @@ void ImGui_ImplDX10_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
ctx->RSSetViewports(old.ViewportsCount, old.Viewports);
|
ctx->RSSetViewports(old.ViewportsCount, old.Viewports);
|
||||||
ctx->RSSetState(old.RS); if (old.RS) old.RS->Release();
|
ctx->RSSetState(old.RS); if (old.RS) old.RS->Release();
|
||||||
ctx->OMSetBlendState(old.BlendState, old.BlendFactor, old.SampleMask); if (old.BlendState) old.BlendState->Release();
|
ctx->OMSetBlendState(old.BlendState, old.BlendFactor, old.SampleMask); if (old.BlendState) old.BlendState->Release();
|
||||||
|
ctx->OMSetDepthStencilState(old.DepthStencilState, old.StencilRef); if (old.DepthStencilState) old.DepthStencilState->Release();
|
||||||
ctx->PSSetShaderResources(0, 1, &old.PSShaderResource); if (old.PSShaderResource) old.PSShaderResource->Release();
|
ctx->PSSetShaderResources(0, 1, &old.PSShaderResource); if (old.PSShaderResource) old.PSShaderResource->Release();
|
||||||
ctx->PSSetSamplers(0, 1, &old.PSSampler); if (old.PSSampler) old.PSSampler->Release();
|
ctx->PSSetSamplers(0, 1, &old.PSSampler); if (old.PSSampler) old.PSSampler->Release();
|
||||||
ctx->PSSetShader(old.PS); if (old.PS) old.PS->Release();
|
ctx->PSSetShader(old.PS); if (old.PS) old.PS->Release();
|
||||||
@ -447,6 +453,20 @@ bool ImGui_ImplDX10_CreateDeviceObjects()
|
|||||||
g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);
|
g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create depth-stencil State
|
||||||
|
{
|
||||||
|
D3D10_DEPTH_STENCIL_DESC desc;
|
||||||
|
ZeroMemory(&desc, sizeof(desc));
|
||||||
|
desc.DepthEnable = false;
|
||||||
|
desc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL;
|
||||||
|
desc.DepthFunc = D3D10_COMPARISON_ALWAYS;
|
||||||
|
desc.StencilEnable = false;
|
||||||
|
desc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D10_STENCIL_OP_KEEP;
|
||||||
|
desc.FrontFace.StencilFunc = D3D10_COMPARISON_ALWAYS;
|
||||||
|
desc.BackFace = desc.FrontFace;
|
||||||
|
g_pd3dDevice->CreateDepthStencilState(&desc, &g_pDepthStencilState);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui_ImplDX10_CreateFontsTexture();
|
ImGui_ImplDX10_CreateFontsTexture();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -463,6 +483,7 @@ void ImGui_ImplDX10_InvalidateDeviceObjects()
|
|||||||
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
||||||
|
|
||||||
if (g_pBlendState) { g_pBlendState->Release(); g_pBlendState = NULL; }
|
if (g_pBlendState) { g_pBlendState->Release(); g_pBlendState = NULL; }
|
||||||
|
if (g_pDepthStencilState) { g_pDepthStencilState->Release(); g_pDepthStencilState = NULL; }
|
||||||
if (g_pRasterizerState) { g_pRasterizerState->Release(); g_pRasterizerState = NULL; }
|
if (g_pRasterizerState) { g_pRasterizerState->Release(); g_pRasterizerState = NULL; }
|
||||||
if (g_pPixelShader) { g_pPixelShader->Release(); g_pPixelShader = NULL; }
|
if (g_pPixelShader) { g_pPixelShader->Release(); g_pPixelShader = NULL; }
|
||||||
if (g_pPixelShaderBlob) { g_pPixelShaderBlob->Release(); g_pPixelShaderBlob = NULL; }
|
if (g_pPixelShaderBlob) { g_pPixelShaderBlob->Release(); g_pPixelShaderBlob = NULL; }
|
||||||
|
Loading…
Reference in New Issue
Block a user