Add cases for new dxc exeptions (#3691)

These shouldn't ever really get hit, but there is a chance that the
exception is thrown inside a block that returns the hresult and discards
the exception with its message. We'd rather preserve the message, but as
a last resort, these messages are better than nothing
This commit is contained in:
Greg Roth 2021-04-27 07:25:58 -06:00 коммит произвёл GitHub
Родитель e1f594323b
Коммит 2d38a6a510
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 28 добавлений и 8 удалений

Просмотреть файл

@ -1378,30 +1378,50 @@ int dxc::main(int argc, const char **argv_) {
Unicode::acp_char printBuffer[128]; // printBuffer is safe to treat as
// UTF-8 because we use ASCII only errors
if (msg == nullptr || *msg == '\0') {
if (hlslException.hr == DXC_E_DUPLICATE_PART) {
switch (hlslException.hr) {
case DXC_E_DUPLICATE_PART:
sprintf_s(
printBuffer, _countof(printBuffer),
"dxc failed : DXIL container already contains the given part.");
} else if (hlslException.hr == DXC_E_MISSING_PART) {
break;
case DXC_E_MISSING_PART:
sprintf_s(
printBuffer, _countof(printBuffer),
"dxc failed : DXIL container does not contain the given part.");
} else if (hlslException.hr == DXC_E_CONTAINER_INVALID) {
break;
case DXC_E_CONTAINER_INVALID:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : Invalid DXIL container.");
} else if (hlslException.hr == DXC_E_CONTAINER_MISSING_DXIL) {
break;
case DXC_E_CONTAINER_MISSING_DXIL:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : DXIL container is missing DXIL part.");
} else if (hlslException.hr == DXC_E_CONTAINER_MISSING_DEBUG) {
break;
case DXC_E_CONTAINER_MISSING_DEBUG:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : DXIL container is missing Debug Info part.");
} else if (hlslException.hr == E_OUTOFMEMORY) {
break;
case DXC_E_LLVM_FATAL_ERROR:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : Internal Compiler Error - LLVM Fatal Error!");
break;
case DXC_E_LLVM_UNREACHABLE:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : Internal Compiler Error - UNREACHABLE executed!");
break;
case DXC_E_LLVM_CAST_ERROR:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : Internal Compiler Error - Cast of incompatible type!");
break;
case E_OUTOFMEMORY:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : Out of Memory.");
} else if (hlslException.hr == E_INVALIDARG) {
break;
case E_INVALIDARG:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : Invalid argument.");
} else {
break;
default:
sprintf_s(printBuffer, _countof(printBuffer),
"dxc failed : error code 0x%08x.\n", hlslException.hr);
}