mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 05:27:01 +00:00
Backends: DX10/DX11: Minor tweaks.
This commit is contained in:
parent
1e9abf60d1
commit
099091280f
@ -342,29 +342,29 @@ bool ImGui_ImplDX10_CreateDeviceObjects()
|
|||||||
static const char* vertexShader =
|
static const char* vertexShader =
|
||||||
"cbuffer vertexBuffer : register(b0) \
|
"cbuffer vertexBuffer : register(b0) \
|
||||||
{\
|
{\
|
||||||
float4x4 ProjectionMatrix; \
|
float4x4 ProjectionMatrix; \
|
||||||
};\
|
};\
|
||||||
struct VS_INPUT\
|
struct VS_INPUT\
|
||||||
{\
|
{\
|
||||||
float2 pos : POSITION;\
|
float2 pos : POSITION;\
|
||||||
float4 col : COLOR0;\
|
float4 col : COLOR0;\
|
||||||
float2 uv : TEXCOORD0;\
|
float2 uv : TEXCOORD0;\
|
||||||
};\
|
};\
|
||||||
\
|
\
|
||||||
struct PS_INPUT\
|
struct PS_INPUT\
|
||||||
{\
|
{\
|
||||||
float4 pos : SV_POSITION;\
|
float4 pos : SV_POSITION;\
|
||||||
float4 col : COLOR0;\
|
float4 col : COLOR0;\
|
||||||
float2 uv : TEXCOORD0;\
|
float2 uv : TEXCOORD0;\
|
||||||
};\
|
};\
|
||||||
\
|
\
|
||||||
PS_INPUT main(VS_INPUT input)\
|
PS_INPUT main(VS_INPUT input)\
|
||||||
{\
|
{\
|
||||||
PS_INPUT output;\
|
PS_INPUT output;\
|
||||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
|
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
|
||||||
output.col = input.col;\
|
output.col = input.col;\
|
||||||
output.uv = input.uv;\
|
output.uv = input.uv;\
|
||||||
return output;\
|
return output;\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
ID3DBlob* vertexShaderBlob;
|
ID3DBlob* vertexShaderBlob;
|
||||||
@ -379,9 +379,9 @@ bool ImGui_ImplDX10_CreateDeviceObjects()
|
|||||||
// Create the input layout
|
// Create the input layout
|
||||||
D3D10_INPUT_ELEMENT_DESC local_layout[] =
|
D3D10_INPUT_ELEMENT_DESC local_layout[] =
|
||||||
{
|
{
|
||||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->pos), D3D10_INPUT_PER_VERTEX_DATA, 0 },
|
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, pos), D3D10_INPUT_PER_VERTEX_DATA, 0 },
|
||||||
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->uv), D3D10_INPUT_PER_VERTEX_DATA, 0 },
|
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, uv), D3D10_INPUT_PER_VERTEX_DATA, 0 },
|
||||||
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (size_t)(&((ImDrawVert*)0)->col), D3D10_INPUT_PER_VERTEX_DATA, 0 },
|
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)IM_OFFSETOF(ImDrawVert, col), D3D10_INPUT_PER_VERTEX_DATA, 0 },
|
||||||
};
|
};
|
||||||
if (g_pd3dDevice->CreateInputLayout(local_layout, 3, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &g_pInputLayout) != S_OK)
|
if (g_pd3dDevice->CreateInputLayout(local_layout, 3, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &g_pInputLayout) != S_OK)
|
||||||
{
|
{
|
||||||
|
@ -354,29 +354,29 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
|
|||||||
static const char* vertexShader =
|
static const char* vertexShader =
|
||||||
"cbuffer vertexBuffer : register(b0) \
|
"cbuffer vertexBuffer : register(b0) \
|
||||||
{\
|
{\
|
||||||
float4x4 ProjectionMatrix; \
|
float4x4 ProjectionMatrix; \
|
||||||
};\
|
};\
|
||||||
struct VS_INPUT\
|
struct VS_INPUT\
|
||||||
{\
|
{\
|
||||||
float2 pos : POSITION;\
|
float2 pos : POSITION;\
|
||||||
float4 col : COLOR0;\
|
float4 col : COLOR0;\
|
||||||
float2 uv : TEXCOORD0;\
|
float2 uv : TEXCOORD0;\
|
||||||
};\
|
};\
|
||||||
\
|
\
|
||||||
struct PS_INPUT\
|
struct PS_INPUT\
|
||||||
{\
|
{\
|
||||||
float4 pos : SV_POSITION;\
|
float4 pos : SV_POSITION;\
|
||||||
float4 col : COLOR0;\
|
float4 col : COLOR0;\
|
||||||
float2 uv : TEXCOORD0;\
|
float2 uv : TEXCOORD0;\
|
||||||
};\
|
};\
|
||||||
\
|
\
|
||||||
PS_INPUT main(VS_INPUT input)\
|
PS_INPUT main(VS_INPUT input)\
|
||||||
{\
|
{\
|
||||||
PS_INPUT output;\
|
PS_INPUT output;\
|
||||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
|
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
|
||||||
output.col = input.col;\
|
output.col = input.col;\
|
||||||
output.uv = input.uv;\
|
output.uv = input.uv;\
|
||||||
return output;\
|
return output;\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
ID3DBlob* vertexShaderBlob;
|
ID3DBlob* vertexShaderBlob;
|
||||||
@ -391,9 +391,9 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
|
|||||||
// Create the input layout
|
// Create the input layout
|
||||||
D3D11_INPUT_ELEMENT_DESC local_layout[] =
|
D3D11_INPUT_ELEMENT_DESC local_layout[] =
|
||||||
{
|
{
|
||||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||||
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||||
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (size_t)(&((ImDrawVert*)0)->col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)IM_OFFSETOF(ImDrawVert, col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||||
};
|
};
|
||||||
if (g_pd3dDevice->CreateInputLayout(local_layout, 3, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &g_pInputLayout) != S_OK)
|
if (g_pd3dDevice->CreateInputLayout(local_layout, 3, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &g_pInputLayout) != S_OK)
|
||||||
{
|
{
|
||||||
|
@ -585,14 +585,11 @@ bool ImGui_ImplDX12_CreateDeviceObjects()
|
|||||||
desc.BackFace = desc.FrontFace;
|
desc.BackFace = desc.FrontFace;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pd3dDevice->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&g_pPipelineState)) != S_OK)
|
HRESULT result_pipeline_state = g_pd3dDevice->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&g_pPipelineState));
|
||||||
{
|
|
||||||
vertexShaderBlob->Release();
|
|
||||||
pixelShaderBlob->Release();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
vertexShaderBlob->Release();
|
vertexShaderBlob->Release();
|
||||||
pixelShaderBlob->Release();
|
pixelShaderBlob->Release();
|
||||||
|
if (result_pipeline_state != S_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
ImGui_ImplDX12_CreateFontsTexture();
|
ImGui_ImplDX12_CreateFontsTexture();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user