Files
filament/libs/matdbg/src/CommonWriter.cpp
T
Mathias AgopianandPowei Feng 7da2a08df6 replace Variant::VSM with MNT and S2D (#9750)
The VSM variant bit was overloaded, it meant two different things
depending on the DEP bit (depth).

For standard variants (DEP = 0), it decides the type of the shadow
sampler used (PCF or 2D).

For depth variants (DEP = 1), it decides what is written during the
shadow pass (nothing, i.e. depth only, or EVSM depth moments).

We now clearly separate the two bits throughout the code.

This change should be purely source-cosmetic, there shouldn't be any
behavior changes.

Co-authored-by: Powei Feng <powei@google.com>
2026-02-25 16:16:07 -08:00

64 lines
2.4 KiB
C++

/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "CommonWriter.h"
#include <private/filament/EngineEnums.h>
#include <private/filament/Variant.h>
namespace filament::matdbg {
std::string formatVariantString(Variant variant, MaterialDomain domain) noexcept {
if (domain == MaterialDomain::COMPUTE) {
// Currently we have no variants for compute materials
return "---";
}
if (domain == MaterialDomain::POST_PROCESS) {
switch (PostProcessVariant{variant.key}) {
case PostProcessVariant::OPAQUE: return "OPA";
case PostProcessVariant::TRANSLUCENT: return "TRN";
}
return "UNK";
}
std::string variantString = "";
// NOTE: The 3-character nomenclature used here is consistent with the ASCII art seen in the
// Variant header file and allows the information to fit in a reasonable amount of space on
// the page. The HTML file has a legend.
if (variant.key) {
if (variant.key & Variant::DIR) variantString += "DIR|";
if (variant.key & Variant::DYN) variantString += "DYN|";
if (variant.key & Variant::SRE) variantString += "SRE|";
if (variant.key & Variant::SKN) variantString += "SKN|";
if (variant.key & Variant::DEP) variantString += "DEP|";
if (variant.key & Variant::DEP) {
if (variant.key & Variant::PCK) variantString += "PCK|";
if (variant.key & Variant::MNT) variantString += "MNT|";
} else {
if (variant.key & Variant::FOG) variantString += "FOG|";
if (variant.key & Variant::S2D) variantString += "S2D|";
}
if (variant.key & Variant::STE) variantString += "STE|";
variantString = variantString.substr(0, variantString.length() - 1);
}
return variantString;
}
} // namespace filament::matdbg