Fix dumping of FXC compile flags

The logic was incorrect, printing "D3DCOMPILE_OPTIMIZATION_LEVEL2" for
levels 0, 2, and 3.

Bug: dawn:1162
Change-Id: I6ab7d9d3d22556b6602c778bddd99e5f2274b02b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70705
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2021-11-24 20:05:57 +00:00 committed by Dawn LUCI CQ
parent 2ec09921cc
commit 13712ba4f3
1 changed files with 16 additions and 9 deletions

View File

@ -351,7 +351,8 @@ namespace dawn_native { namespace d3d12 {
if (compileFlags & D3DCOMPILE_IEEE_STRICTNESS) {
arguments.push_back(L"/Gis");
}
if (compileFlags & D3DCOMPILE_OPTIMIZATION_LEVEL2) {
constexpr uint32_t d3dCompileFlagsBits = D3DCOMPILE_OPTIMIZATION_LEVEL2;
if (compileFlags & d3dCompileFlagsBits) {
switch (compileFlags & D3DCOMPILE_OPTIMIZATION_LEVEL2) {
case D3DCOMPILE_OPTIMIZATION_LEVEL0:
arguments.push_back(L"/O0");
@ -490,14 +491,20 @@ namespace dawn_native { namespace d3d12 {
// Optimization level must be handled separately as two bits are used, and the values
// don't map neatly to 0-3.
if ((compileFlags & D3DCOMPILE_OPTIMIZATION_LEVEL2) != 0) {
result += "D3DCOMPILE_OPTIMIZATION_LEVEL2";
} else if ((compileFlags & D3DCOMPILE_OPTIMIZATION_LEVEL0) != 0) {
result += "D3DCOMPILE_OPTIMIZATION_LEVEL0";
} else if ((compileFlags & D3DCOMPILE_OPTIMIZATION_LEVEL3) != 0) {
result += "D3DCOMPILE_OPTIMIZATION_LEVEL3";
} else {
result += "D3DCOMPILE_OPTIMIZATION_LEVEL1";
constexpr uint32_t d3dCompileFlagsBits = D3DCOMPILE_OPTIMIZATION_LEVEL2;
switch (compileFlags & d3dCompileFlagsBits) {
case D3DCOMPILE_OPTIMIZATION_LEVEL0:
result += "D3DCOMPILE_OPTIMIZATION_LEVEL0";
break;
case D3DCOMPILE_OPTIMIZATION_LEVEL1:
result += "D3DCOMPILE_OPTIMIZATION_LEVEL1";
break;
case D3DCOMPILE_OPTIMIZATION_LEVEL2:
result += "D3DCOMPILE_OPTIMIZATION_LEVEL2";
break;
case D3DCOMPILE_OPTIMIZATION_LEVEL3:
result += "D3DCOMPILE_OPTIMIZATION_LEVEL3";
break;
}
result += std::string("\n");