Skip to content

Resolve some default error warnings #7191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/DxilValidation/DxilContainerValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,12 @@ void PSVContentVerifier::VerifySignatureElement(

PSVSignatureElement PSVSE(StrTab, IndexTab, PSVSE0);
if (SE.IsArbitrary())
Mismatch |= strcmp(PSVSE.GetSemanticName(), SE.GetName());
Mismatch |=
strcmp(PSVSE.GetSemanticName(), SE.GetName()) == 0 ? false : true;
else
Mismatch |= PSVSE0->SemanticKind != static_cast<uint8_t>(SE.GetKind());
Mismatch |= PSVSE0->SemanticKind != static_cast<uint8_t>(SE.GetKind()) == 0
Copy link
Contributor

@tex3d tex3d Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was unnecessary, plus it scares me a bit how we would be dependent on a left to right order of evaluating the comparison operations without parentheses to enforce the correct order (and the final comparison is basically (bool) == (int)).

Also, we could use != 0 everywhere instead of == 0 ? false : true. That would be keeping with most of the other similar code elsewhere in this file, and it's easier to read.

? false
: true;

ModulePSVSE0.SemanticName = PSVSE0->SemanticName;
// Compare all fields.
Expand Down Expand Up @@ -494,7 +497,8 @@ void PSVContentVerifier::Verify(unsigned ValMajor, unsigned ValMinor,
std::to_string(ShaderStage));
return;
}
if (PSV1->UsesViewID != DM.m_ShaderFlags.GetViewID())
bool ViewIDUsed = PSV1->UsesViewID == 0 ? false : true;
if (ViewIDUsed != DM.m_ShaderFlags.GetViewID())
EmitMismatchError("UsesViewID", std::to_string(PSV1->UsesViewID),
std::to_string(DM.m_ShaderFlags.GetViewID()));

Expand Down