Merge pull request #12552 from lioncash/custom

CustomPipeline: Resolve unused variable warning
This commit is contained in:
Admiral H. Curtiss 2024-02-02 20:31:52 +01:00 committed by GitHub
commit 3b01531958
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,15 +17,17 @@ namespace
{ {
bool IsQualifier(std::string_view value) bool IsQualifier(std::string_view value)
{ {
static std::array<std::string_view, 7> qualifiers = {"attribute", "const", "highp", "lowp", static constexpr std::array<std::string_view, 7> qualifiers = {
"mediump", "uniform", "varying"}; "attribute", "const", "highp", "lowp", "mediump", "uniform", "varying",
};
return std::find(qualifiers.begin(), qualifiers.end(), value) != qualifiers.end(); return std::find(qualifiers.begin(), qualifiers.end(), value) != qualifiers.end();
} }
bool IsBuiltInMacro(std::string_view value) bool IsBuiltInMacro(std::string_view value)
{ {
static std::array<std::string_view, 5> built_in = {"__LINE__", "__FILE__", "__VERSION__", static constexpr std::array<std::string_view, 5> built_in = {
"GL_core_profile", "GL_compatibility_profile"}; "__LINE__", "__FILE__", "__VERSION__", "GL_core_profile", "GL_compatibility_profile",
};
return std::find(built_in.begin(), built_in.end(), value) != built_in.end(); return std::find(built_in.begin(), built_in.end(), value) != built_in.end();
} }
@ -101,7 +103,7 @@ std::vector<std::string> GlobalConflicts(std::string_view source)
{ {
i++; i++;
} }
global_result.push_back(std::string{parse_identifier()}); global_result.emplace_back(parse_identifier());
parse_until_end_of_preprocessor(); parse_until_end_of_preprocessor();
} }
else else
@ -121,11 +123,11 @@ std::vector<std::string> GlobalConflicts(std::string_view source)
// Since we handle equality, we can assume the identifier // Since we handle equality, we can assume the identifier
// before '(' is a function definition // before '(' is a function definition
global_result.push_back(std::string{last_identifier}); global_result.emplace_back(last_identifier);
} }
else if (source[i] == '=') else if (source[i] == '=')
{ {
global_result.push_back(std::string{last_identifier}); global_result.emplace_back(last_identifier);
i++; i++;
for (; i < source.size(); i++) for (; i < source.size(); i++)
{ {
@ -197,8 +199,7 @@ void CustomPipeline::UpdatePixelData(
{ {
max_material_data_size += VideoCommon::MaterialProperty::GetMemorySize(property); max_material_data_size += VideoCommon::MaterialProperty::GetMemorySize(property);
VideoCommon::MaterialProperty::WriteAsShaderCode(m_last_generated_material_code, property); VideoCommon::MaterialProperty::WriteAsShaderCode(m_last_generated_material_code, property);
if (auto* texture_asset_id = if (std::holds_alternative<VideoCommon::CustomAssetLibrary::AssetID>(property.m_value))
std::get_if<VideoCommon::CustomAssetLibrary::AssetID>(&property.m_value))
{ {
texture_count++; texture_count++;
} }