From cb15157c13fcfe1ac45ea274e2c7c5b68591863c Mon Sep 17 00:00:00 2001 From: blackbird806 Date: Tue, 19 Mar 2024 21:17:15 +0100 Subject: [PATCH] shader: Replace std map by std array to store shader code in convert_gxp_usse_to_spirv (#3252) --- vita3k/shader/src/usse_translator_entry.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vita3k/shader/src/usse_translator_entry.cpp b/vita3k/shader/src/usse_translator_entry.cpp index 77e84e4218..027e19a777 100644 --- a/vita3k/shader/src/usse_translator_entry.cpp +++ b/vita3k/shader/src/usse_translator_entry.cpp @@ -25,7 +25,6 @@ #include #include -#include #include namespace shader::usse { @@ -1078,13 +1077,13 @@ void convert_gxp_usse_to_spirv(spv::Builder &b, const SceGxmProgram &program, co const uint64_t *secondary_program_start = program.secondary_program_start(); const uint64_t *secondary_program_end = program.secondary_program_end(); - std::map> shader_code; + std::array, (size_t)ShaderPhase::Max> shader_code; // Collect instructions of Pixel (primary) phase - shader_code[ShaderPhase::Pixel] = std::make_pair(primary_program, primary_program_instr_count); + shader_code[static_cast(ShaderPhase::Pixel)] = std::make_pair(primary_program, primary_program_instr_count); // Collect instructions of Sample rate (secondary) phase - shader_code[ShaderPhase::SampleRate] = std::make_pair(secondary_program_start, secondary_program_end - secondary_program_start); + shader_code[static_cast(ShaderPhase::SampleRate)] = std::make_pair(secondary_program_start, secondary_program_end - secondary_program_start); if (begin_hook_func) b.createFunctionCall(begin_hook_func, {}); @@ -1094,7 +1093,7 @@ void convert_gxp_usse_to_spirv(spv::Builder &b, const SceGxmProgram &program, co usse::USSERecompiler recomp(b, program, features, parameters, utils, end_hook_func, queries, render_info_id); for (uint32_t phase = 0; phase < static_cast(ShaderPhase::Max); ++phase) { - const auto cur_phase_code = shader_code[(ShaderPhase)phase]; + const auto cur_phase_code = shader_code[phase]; if (cur_phase_code.second != 0) { if (static_cast(phase) == ShaderPhase::SampleRate) {