d3d12: Build shader in debug mode if debug output is enabled.

This commit is contained in:
Vincent Lejeune 2015-09-15 14:31:32 +02:00
parent 05c5058dfd
commit 7d15cc0dfd

View File

@ -13,15 +13,20 @@ void Shader::Compile(const std::string &code, SHADER_TYPE st)
{
HRESULT hr;
ComPtr<ID3DBlob> errorBlob;
UINT compileFlags;
if (Ini.GSDebugOutputEnable.GetValue())
compileFlags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
else
compileFlags = 0;
switch (st)
{
case SHADER_TYPE::SHADER_TYPE_VERTEX:
hr = D3DCompile(code.c_str(), code.size(), "VertexProgram.hlsl", nullptr, nullptr, "main", "vs_5_0", 0, 0, &bytecode, errorBlob.GetAddressOf());
hr = D3DCompile(code.c_str(), code.size(), "VertexProgram.hlsl", nullptr, nullptr, "main", "vs_5_0", compileFlags, 0, &bytecode, errorBlob.GetAddressOf());
if (hr != S_OK)
LOG_ERROR(RSX, "VS build failed:%s", errorBlob->GetBufferPointer());
break;
case SHADER_TYPE::SHADER_TYPE_FRAGMENT:
hr = D3DCompile(code.c_str(), code.size(), "FragmentProgram.hlsl", nullptr, nullptr, "main", "ps_5_0", 0, 0, &bytecode, errorBlob.GetAddressOf());
hr = D3DCompile(code.c_str(), code.size(), "FragmentProgram.hlsl", nullptr, nullptr, "main", "ps_5_0", compileFlags, 0, &bytecode, errorBlob.GetAddressOf());
if (hr != S_OK)
LOG_ERROR(RSX, "FS build failed:%s", errorBlob->GetBufferPointer());
break;