DXC Validation Error Difficult to See in AP Window (#4982)
* DXC Validation Error Difficult to See in AP Window Renamed ReportErrorMessages() as ReportMessages() All the message will be printed as a single AZ_Error() or AZ_Warning() instead of mingled AZ_Error/AZ_Warning/AZ_TRacePrintf which was making the output hard to read. Signed-off-by: garrieta <garrieta@amazon.com>
This commit is contained in:
@@ -477,8 +477,8 @@ namespace AZ
|
||||
preprocessorOptions.m_predefinedMacros.end(), macroDefinitionsToAdd.begin(), macroDefinitionsToAdd.end());
|
||||
// Run the preprocessor.
|
||||
PreprocessorData output;
|
||||
PreprocessFile(prependedAzslFilePath, output, preprocessorOptions, true, true);
|
||||
RHI::ReportErrorMessages(ShaderAssetBuilderName, output.diagnostics);
|
||||
const bool preprocessorSuccess = PreprocessFile(prependedAzslFilePath, output, preprocessorOptions, true, true);
|
||||
RHI::ReportMessages(ShaderAssetBuilderName, output.diagnostics, !preprocessorSuccess);
|
||||
// Dump the preprocessed string as a flat AZSL file with extension .azslin, which will be given to AZSLc to generate the HLSL file.
|
||||
AZStd::string superVariantAzslinStemName = shaderFileName;
|
||||
if (!supervariantInfo.m_name.IsEmpty())
|
||||
|
||||
@@ -83,11 +83,12 @@ namespace AZ
|
||||
const AZStd::string& shaderSourcePathForDebug,
|
||||
const char* toolNameForLog);
|
||||
|
||||
//! Reports error messages to AZ_Error and/or AZ_Warning, given a text blob that potentially contains many lines of errors and warnings.
|
||||
//! @param window Debug window name used for AZ Trace functions
|
||||
//! @param errorMessages String that may contain many lines of errors and warnings
|
||||
//! @param return true if Errors were detected and reported (Warnings don't count)
|
||||
bool ReportErrorMessages(AZStd::string_view window, AZStd::string_view errorMessages);
|
||||
//! Reports messages with AZ_Error or AZ_Warning (See @reportAsErrors).
|
||||
//! @param window Debug window name used for AZ Trace functions.
|
||||
//! @param errorMessages Message string.
|
||||
//! @param reportAsErrors If true, messages are traced with AZ_Error, otherwise AZ_Warning is used.
|
||||
//! @returns true If the input text blob contains at least one line with the "error" string.
|
||||
bool ReportMessages(AZStd::string_view window, AZStd::string_view errorMessages, bool reportAsErrors);
|
||||
|
||||
//! Converts from a RHI::ShaderHardwareStage to an RHI::ShaderStage
|
||||
ShaderStage ToRHIShaderStage(ShaderHardwareStage stageType);
|
||||
|
||||
@@ -330,7 +330,7 @@ namespace AZ
|
||||
// Pump one last time to make sure the streams have been flushed
|
||||
pumpOuputStreams();
|
||||
|
||||
const bool reportedErrors = ReportErrorMessages(toolNameForLog, errorMessages);
|
||||
const bool reportedErrors = ReportMessages(toolNameForLog, errorMessages, exitCode != 0);
|
||||
|
||||
if (timedOut)
|
||||
{
|
||||
@@ -367,32 +367,20 @@ namespace AZ
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReportErrorMessages([[maybe_unused]] AZStd::string_view window, AZStd::string_view errorMessages)
|
||||
bool ReportMessages([[maybe_unused]] AZStd::string_view window, AZStd::string_view errorMessages, bool reportAsErrors)
|
||||
{
|
||||
// There are more efficient ways to do this, but this approach is simple and gets us moving for now.
|
||||
AZStd::vector<AZStd::string> lines;
|
||||
AzFramework::StringFunc::Tokenize(errorMessages.data(), lines, "\n\r");
|
||||
|
||||
bool foundErrors = false;
|
||||
|
||||
for (auto& line : lines)
|
||||
if (reportAsErrors)
|
||||
{
|
||||
if (AZStd::string::npos != AzFramework::StringFunc::Find(line, "error"))
|
||||
{
|
||||
AZ_Error(window.data(), false, "%s", line.data());
|
||||
foundErrors = true;
|
||||
}
|
||||
else if (AZStd::string::npos != AzFramework::StringFunc::Find(line, "warning"))
|
||||
{
|
||||
AZ_Warning(window.data(), false, "%s", line.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_TracePrintf(window.data(), "%s", line.data());
|
||||
}
|
||||
AZ_Error(window.data(), false, "%.*s", aznumeric_cast<int>(errorMessages.size()), errorMessages.data());
|
||||
}
|
||||
|
||||
return foundErrors;
|
||||
else
|
||||
{
|
||||
// Using AZ_Warning instead of AZ_TracePrintf because this function is commonly
|
||||
// used to report messages from stderr when executing applications. Applications
|
||||
// when ran successfully, only output to stderr for errors or warnings.
|
||||
AZ_Warning(window.data(), false, "%.*s", aznumeric_cast<int>(errorMessages.size()), errorMessages.data());
|
||||
}
|
||||
return AZStd::string::npos != AzFramework::StringFunc::Find(errorMessages, "error");
|
||||
}
|
||||
|
||||
ShaderStage ToRHIShaderStage(ShaderHardwareStage stageType)
|
||||
|
||||
Reference in New Issue
Block a user