mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Add better error messages when failing to load images.
* This includes an enum for unsupported (but recognised) image formats instead of just a generic 'file corrupted' or misleading 'API unsupported' error.
This commit is contained in:
@@ -490,6 +490,7 @@ enum ReplayCreateStatus
|
||||
eReplayCreate_FileIOFailed,
|
||||
eReplayCreate_FileIncompatibleVersion,
|
||||
eReplayCreate_FileCorrupted,
|
||||
eReplayCreate_ImageUnsupported,
|
||||
eReplayCreate_APIUnsupported,
|
||||
eReplayCreate_APIInitFailed,
|
||||
eReplayCreate_APIIncompatibleVersion,
|
||||
|
||||
@@ -311,7 +311,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d
|
||||
RDCERR(
|
||||
"EXR file detected, but couldn't load with ParseMultiChannelEXRHeaderFromMemory %d: '%s'",
|
||||
ret, err);
|
||||
return eReplayCreate_APIUnsupported;
|
||||
return eReplayCreate_ImageUnsupported;
|
||||
}
|
||||
}
|
||||
else if(stbi_is_hdr_from_file(f))
|
||||
@@ -325,7 +325,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d
|
||||
{
|
||||
FileIO::fclose(f);
|
||||
RDCERR("HDR file recognised, but couldn't load with stbi_loadf_from_file");
|
||||
return eReplayCreate_FileCorrupted;
|
||||
return eReplayCreate_ImageUnsupported;
|
||||
}
|
||||
|
||||
free(data);
|
||||
@@ -339,7 +339,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d
|
||||
{
|
||||
FileIO::fclose(f);
|
||||
RDCERR("DDS file recognised, but couldn't load");
|
||||
return eReplayCreate_FileCorrupted;
|
||||
return eReplayCreate_ImageUnsupported;
|
||||
}
|
||||
|
||||
for(int i = 0; i < read_data.slices * read_data.mips; i++)
|
||||
@@ -359,7 +359,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d
|
||||
if(ret == 0 || width == 0 || width == ~0U || height == 0 || height == ~0U)
|
||||
{
|
||||
FileIO::fclose(f);
|
||||
return eReplayCreate_APIUnsupported;
|
||||
return eReplayCreate_ImageUnsupported;
|
||||
}
|
||||
|
||||
byte *data = stbi_load_from_file(f, &ignore, &ignore, &ignore, 4);
|
||||
@@ -368,7 +368,7 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d
|
||||
{
|
||||
FileIO::fclose(f);
|
||||
RDCERR("File recognised, but couldn't load with stbi_load_from_file");
|
||||
return eReplayCreate_FileCorrupted;
|
||||
return eReplayCreate_ImageUnsupported;
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
@@ -525,7 +525,7 @@ namespace renderdocui.Code
|
||||
"Check diagnostic log in Help menu for more details.", logFile, replayHost, errmsg),
|
||||
"Error opening log", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
else
|
||||
MessageBox.Show(String.Format("{0}\nFailed to open logfile for replay: {1}.\n\n" +
|
||||
MessageBox.Show(String.Format("{0}\nFailed to open file for replay: {1}.\n\n" +
|
||||
"Check diagnostic log in Help menu for more details.", logFile, errmsg),
|
||||
"Error opening log", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
|
||||
@@ -501,6 +501,7 @@ namespace renderdoc
|
||||
FileIOFailed,
|
||||
FileIncompatibleVersion,
|
||||
FileCorrupted,
|
||||
ImageUnsupported,
|
||||
APIUnsupported,
|
||||
APIInitFailed,
|
||||
APIIncompatibleVersion,
|
||||
@@ -582,11 +583,12 @@ namespace renderdoc
|
||||
case ReplayCreateStatus.InternalError: return "Internal Error";
|
||||
case ReplayCreateStatus.NetworkIOFailed: return "Network I/O operation failed";
|
||||
case ReplayCreateStatus.FileIOFailed: return "File I/O operation failed";
|
||||
case ReplayCreateStatus.FileIncompatibleVersion: return "Logfile is of an incompatible version";
|
||||
case ReplayCreateStatus.FileCorrupted: return "Logfile data is corrupted";
|
||||
case ReplayCreateStatus.APIUnsupported: return "API used in logfile is not supported";
|
||||
case ReplayCreateStatus.FileIncompatibleVersion: return "File is of an incompatible version";
|
||||
case ReplayCreateStatus.FileCorrupted: return "File is corrupted or unrecognisable format";
|
||||
case ReplayCreateStatus.ImageUnsupported: return "The contents or format of the image is not supported";
|
||||
case ReplayCreateStatus.APIUnsupported: return "API used is not supported";
|
||||
case ReplayCreateStatus.APIInitFailed: return "Replay API failed to initialise";
|
||||
case ReplayCreateStatus.APIIncompatibleVersion: return "API-specific data used in logfile is of an incompatible version";
|
||||
case ReplayCreateStatus.APIIncompatibleVersion: return "API-specific data used is of an incompatible version";
|
||||
case ReplayCreateStatus.APIHardwareUnsupported: return "Your hardware or software configuration doesn't meet this API's minimum requirements";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user