summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Markus Wick2018-09-04 13:54:50 +0200
committerGravatar Markus Wick2018-09-04 14:10:05 +0200
commit2081ed7db22d62b82acfddcd4b7c10a03bb3daaf (patch)
tree70d38dd3466dee6e9cd05ab83cedb7deb375a5af /src
parentMerge pull request #1231 from lioncash/global (diff)
downloadyuzu-2081ed7db22d62b82acfddcd4b7c10a03bb3daaf.tar.gz
yuzu-2081ed7db22d62b82acfddcd4b7c10a03bb3daaf.tar.xz
yuzu-2081ed7db22d62b82acfddcd4b7c10a03bb3daaf.zip
command_processor: Use std::array for bound_engines.
subchannel is a 3 bit field. So there must not be more than 8 bound engines. And using a hashmap for up to 8 values is a bit overpowered.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/command_processor.cpp4
-rw-r--r--src/video_core/gpu.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index dc485e811..d5831e752 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -34,6 +34,8 @@ void GPU::WriteReg(u32 method, u32 subchannel, u32 value, u32 remaining_params)
34 "{:08X} remaining params {}", 34 "{:08X} remaining params {}",
35 method, subchannel, value, remaining_params); 35 method, subchannel, value, remaining_params);
36 36
37 ASSERT(subchannel < bound_engines.size());
38
37 if (method == static_cast<u32>(BufferMethods::BindObject)) { 39 if (method == static_cast<u32>(BufferMethods::BindObject)) {
38 // Bind the current subchannel to the desired engine id. 40 // Bind the current subchannel to the desired engine id.
39 LOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", subchannel, value); 41 LOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", subchannel, value);
@@ -47,8 +49,6 @@ void GPU::WriteReg(u32 method, u32 subchannel, u32 value, u32 remaining_params)
47 return; 49 return;
48 } 50 }
49 51
50 ASSERT(bound_engines.find(subchannel) != bound_engines.end());
51
52 const EngineID engine = bound_engines[subchannel]; 52 const EngineID engine = bound_engines[subchannel];
53 53
54 switch (engine) { 54 switch (engine) {
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 2c3dbd97b..d29f31f52 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -4,8 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <array>
7#include <memory> 8#include <memory>
8#include <unordered_map>
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "core/hle/service/nvflinger/buffer_queue.h" 10#include "core/hle/service/nvflinger/buffer_queue.h"
11#include "video_core/memory_manager.h" 11#include "video_core/memory_manager.h"
@@ -136,7 +136,7 @@ private:
136 std::unique_ptr<Tegra::MemoryManager> memory_manager; 136 std::unique_ptr<Tegra::MemoryManager> memory_manager;
137 137
138 /// Mapping of command subchannels to their bound engine ids. 138 /// Mapping of command subchannels to their bound engine ids.
139 std::unordered_map<u32, EngineID> bound_engines; 139 std::array<EngineID, 8> bound_engines = {};
140 140
141 /// 3D engine 141 /// 3D engine
142 std::unique_ptr<Engines::Maxwell3D> maxwell_3d; 142 std::unique_ptr<Engines::Maxwell3D> maxwell_3d;