Added more prebuilt shader

Skyrim deployed its own d3dcompile dll that nullifies shaders compilation, so you either have to load the one in C:\Windows\System32|SysWow64 or use prebuilt.
I use prebuilt
This commit is contained in:
Nemirtingas 2020-01-11 14:42:00 +01:00
parent d118aca0f6
commit dc3dee9ce8
3 changed files with 1300 additions and 71 deletions

View File

@ -382,23 +382,71 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
const char* target;
switch (g_pd3dDevice->GetFeatureLevel())
{
case D3D_FEATURE_LEVEL_9_1: target = "vs_4_0_level_9_1"; break;
case D3D_FEATURE_LEVEL_9_2: target = "vs_4_0_level_9_2"; break;
case D3D_FEATURE_LEVEL_9_3: target = "vs_4_0_level_9_3"; break;
case D3D_FEATURE_LEVEL_10_0: target = "vs_4_0_level_10_0"; break;
case D3D_FEATURE_LEVEL_10_1: target = "vs_4_0_level_10_1"; break;
case D3D_FEATURE_LEVEL_11_0: target = "vs_4_0_level_11_0"; break;
case D3D_FEATURE_LEVEL_11_1: target = "vs_4_0_level_11_1"; break;
default: target = "vs_4_0";
case D3D_FEATURE_LEVEL_9_1: target = "vs_4_0_level_9_1"; break;
case D3D_FEATURE_LEVEL_9_2: target = "vs_4_0_level_9_2"; break;
case D3D_FEATURE_LEVEL_9_3: target = "vs_4_0_level_9_3"; break;
case D3D_FEATURE_LEVEL_10_0: target = "vs_4_0"; break;
case D3D_FEATURE_LEVEL_10_1: target = "vs_4_1"; break;
case D3D_FEATURE_LEVEL_11_0: target = "vs_5_0"; break;
case D3D_FEATURE_LEVEL_11_1: target = "vs_5_0"; break;
default: target = "vs_4_0";
}
D3DCompile(vertexShader, strlen(vertexShader), NULL, NULL, NULL, "main", target, 0, 0, &g_pVertexShaderBlob, NULL);
if (g_pVertexShaderBlob == NULL) // NB: Pass ID3D10Blob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
return false;
if (g_pd3dDevice->CreateVertexShader((DWORD*)g_pVertexShaderBlob->GetBufferPointer(), g_pVertexShaderBlob->GetBufferSize(), NULL, &g_pVertexShader) != S_OK)
return false;
#else
if (g_pd3dDevice->CreateVertexShader(ImGui_vertexShaderDX11, ImGui_vertexShaderDX11_len, NULL, &g_pVertexShader) != S_OK)
unsigned char* byteCode;
SIZE_T byteCodeSize;
switch (g_pd3dDevice->GetFeatureLevel())
{
case D3D_FEATURE_LEVEL_9_1:
byteCode = ImGui_vertexShaderDX11_9_1;
byteCodeSize = ImGui_vertexShaderDX11_9_1_len;
break;
case D3D_FEATURE_LEVEL_9_2:
byteCode = ImGui_vertexShaderDX11_9_2;
byteCodeSize = ImGui_vertexShaderDX11_9_2_len;
break;
case D3D_FEATURE_LEVEL_9_3:
byteCode = ImGui_vertexShaderDX11_9_3;
byteCodeSize = ImGui_vertexShaderDX11_9_3_len;
break;
case D3D_FEATURE_LEVEL_10_0:
byteCode = ImGui_vertexShaderDX11_10_0;
byteCodeSize = ImGui_vertexShaderDX11_10_0_len;
break;
case D3D_FEATURE_LEVEL_10_1:
byteCode = ImGui_vertexShaderDX11_10_1;
byteCodeSize = ImGui_vertexShaderDX11_10_1_len;
break;
case D3D_FEATURE_LEVEL_11_0:
byteCode = ImGui_vertexShaderDX11_11_0;
byteCodeSize = ImGui_vertexShaderDX11_11_0_len;
break;
case D3D_FEATURE_LEVEL_11_1:
byteCode = ImGui_vertexShaderDX11_11_1;
byteCodeSize = ImGui_vertexShaderDX11_11_1_len;
break;
default:
byteCode = ImGui_vertexShaderDX11;
byteCodeSize = ImGui_vertexShaderDX11_len;
}
auto x = g_pd3dDevice->CreateVertexShader(byteCode, byteCodeSize, NULL, &g_pVertexShader);
if (x != S_OK)
return false;
#endif
@ -451,14 +499,14 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
const char* target;
switch (g_pd3dDevice->GetFeatureLevel())
{
case D3D_FEATURE_LEVEL_9_1: target = "ps_4_0_level_9_1"; break;
case D3D_FEATURE_LEVEL_9_2: target = "ps_4_0_level_9_2"; break;
case D3D_FEATURE_LEVEL_9_3: target = "ps_4_0_level_9_3"; break;
case D3D_FEATURE_LEVEL_10_0: target = "ps_4_0_level_10_0"; break;
case D3D_FEATURE_LEVEL_10_1: target = "ps_4_0_level_10_1"; break;
case D3D_FEATURE_LEVEL_11_0: target = "ps_4_0_level_11_0"; break;
case D3D_FEATURE_LEVEL_11_1: target = "ps_4_0_level_11_1"; break;
default: target = "ps_4_0";
case D3D_FEATURE_LEVEL_9_1: target = "ps_4_0_level_9_1"; break;
case D3D_FEATURE_LEVEL_9_2: target = "ps_4_0_level_9_2"; break;
case D3D_FEATURE_LEVEL_9_3: target = "ps_4_0_level_9_3"; break;
case D3D_FEATURE_LEVEL_10_0: target = "ps_4_0"; break;
case D3D_FEATURE_LEVEL_10_1: target = "ps_4_1"; break;
case D3D_FEATURE_LEVEL_11_0: target = "ps_5_0"; break;
case D3D_FEATURE_LEVEL_11_1: target = "ps_5_0"; break;
default: target = "ps_4_0";
}
D3DCompile(pixelShader, strlen(pixelShader), NULL, NULL, NULL, "main", target, 0, 0, &g_pPixelShaderBlob, NULL);
@ -468,7 +516,52 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
return false;
#else
if (g_pd3dDevice->CreatePixelShader(ImGui_pixelShaderDX11, ImGui_pixelShaderDX11_len, NULL, &g_pPixelShader) != S_OK)
unsigned char* byteCode;
SIZE_T byteCodeSize;
switch (g_pd3dDevice->GetFeatureLevel())
{
case D3D_FEATURE_LEVEL_9_1:
byteCode = ImGui_pixelShaderDX11_9_1;
byteCodeSize = ImGui_pixelShaderDX11_9_1_len;
break;
case D3D_FEATURE_LEVEL_9_2:
byteCode = ImGui_pixelShaderDX11_9_2;
byteCodeSize = ImGui_pixelShaderDX11_9_2_len;
break;
case D3D_FEATURE_LEVEL_9_3:
byteCode = ImGui_pixelShaderDX11_9_3;
byteCodeSize = ImGui_pixelShaderDX11_9_3_len;
break;
case D3D_FEATURE_LEVEL_10_0:
byteCode = ImGui_pixelShaderDX11_10_0;
byteCodeSize = ImGui_pixelShaderDX11_10_0_len;
break;
case D3D_FEATURE_LEVEL_10_1:
byteCode = ImGui_pixelShaderDX11_10_1;
byteCodeSize = ImGui_pixelShaderDX11_10_1_len;
break;
case D3D_FEATURE_LEVEL_11_0:
byteCode = ImGui_pixelShaderDX11_11_0;
byteCodeSize = ImGui_pixelShaderDX11_11_0_len;
break;
case D3D_FEATURE_LEVEL_11_1:
byteCode = ImGui_pixelShaderDX11_11_1;
byteCodeSize = ImGui_pixelShaderDX11_11_1_len;
break;
default:
byteCode = ImGui_pixelShaderDX11;
byteCodeSize = ImGui_pixelShaderDX11_len;
}
if (g_pd3dDevice->CreatePixelShader(byteCode, byteCodeSize, NULL, &g_pPixelShader) != S_OK)
return false;
#endif
}

File diff suppressed because it is too large Load Diff

View File

@ -17,18 +17,62 @@
#define ImGui_vertexShaderDX10_len 876
extern unsigned char ImGui_vertexShaderDX10[ImGui_vertexShaderDX10_len];
#define ImGui_pixelShaderDX10_len 660
extern unsigned char ImGui_pixelShaderDX10[ImGui_pixelShaderDX10_len];
#define ImGui_vertexShaderDX11_len 1104
extern unsigned char ImGui_vertexShaderDX11[ImGui_vertexShaderDX11_len];
#define ImGui_vertexShaderDX11_len ImGui_vertexShaderDX10_len
#define ImGui_vertexShaderDX11 ImGui_vertexShaderDX10
#define ImGui_vertexShaderDX11_9_1_len 1104
extern unsigned char ImGui_vertexShaderDX11_9_1[ImGui_vertexShaderDX11_9_1_len];
#define ImGui_pixelShaderDX11_len ImGui_pixelShaderDX10_len
#define ImGui_pixelShaderDX11 ImGui_pixelShaderDX10
#define ImGui_vertexShaderDX11_9_2_len ImGui_vertexShaderDX11_9_1_len
#define ImGui_vertexShaderDX11_9_2 ImGui_vertexShaderDX11_9_1
#define ImGui_vertexShaderDX11_9_3_len 1104
extern unsigned char ImGui_vertexShaderDX11_9_3[ImGui_vertexShaderDX11_9_3_len];
#define ImGui_vertexShaderDX11_10_0_len 876
extern unsigned char ImGui_vertexShaderDX11_10_0[ImGui_vertexShaderDX11_10_0_len];
#define ImGui_vertexShaderDX11_10_1_len 880
extern unsigned char ImGui_vertexShaderDX11_10_1[ImGui_vertexShaderDX11_10_1_len];
#define ImGui_vertexShaderDX11_11_0_len 988
extern unsigned char ImGui_vertexShaderDX11_11_0[ImGui_vertexShaderDX11_11_0_len];
#define ImGui_vertexShaderDX11_11_1_len 988
extern unsigned char ImGui_vertexShaderDX11_11_1[ImGui_vertexShaderDX11_11_1_len];
#define ImGui_vertexShaderDX12_len 988
extern unsigned char ImGui_vertexShaderDX12[ImGui_vertexShaderDX12_len];
#define ImGui_pixelShaderDX10_len 660
extern unsigned char ImGui_pixelShaderDX10[ImGui_pixelShaderDX10_len];
#define ImGui_pixelShaderDX11_len 1104
extern unsigned char ImGui_pixelShaderDX11[ImGui_pixelShaderDX11_len];
#define ImGui_pixelShaderDX11_9_1_len 800
extern unsigned char ImGui_pixelShaderDX11_9_1[ImGui_pixelShaderDX11_9_1_len];
#define ImGui_pixelShaderDX11_9_2_len ImGui_pixelShaderDX11_9_1_len
#define ImGui_pixelShaderDX11_9_2 ImGui_pixelShaderDX11_9_1
#define ImGui_pixelShaderDX11_9_3_len 800
extern unsigned char ImGui_pixelShaderDX11_9_3[ImGui_pixelShaderDX11_9_3_len];
#define ImGui_pixelShaderDX11_10_0_len 660
extern unsigned char ImGui_pixelShaderDX11_10_0[ImGui_pixelShaderDX11_10_0_len];
#define ImGui_pixelShaderDX11_10_1_len 664
extern unsigned char ImGui_pixelShaderDX11_10_1[ImGui_pixelShaderDX11_10_1_len];
#define ImGui_pixelShaderDX11_11_0_len 736
extern unsigned char ImGui_pixelShaderDX11_11_0[ImGui_pixelShaderDX11_11_0_len];
#define ImGui_pixelShaderDX11_11_1_len 736
extern unsigned char ImGui_pixelShaderDX11_11_1[ImGui_pixelShaderDX11_11_1_len];
#define ImGui_pixelShaderDX12_len 736
extern unsigned char ImGui_pixelShaderDX12[ImGui_pixelShaderDX12_len];