mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu-mainline.git
				synced 2025-03-21 01:53:15 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									1c5636e690
								
							
						
					
					
						commit
						2081ed7db2
					
				@ -34,6 +34,8 @@ void GPU::WriteReg(u32 method, u32 subchannel, u32 value, u32 remaining_params)
 | 
			
		||||
              "{:08X} remaining params {}",
 | 
			
		||||
              method, subchannel, value, remaining_params);
 | 
			
		||||
 | 
			
		||||
    ASSERT(subchannel < bound_engines.size());
 | 
			
		||||
 | 
			
		||||
    if (method == static_cast<u32>(BufferMethods::BindObject)) {
 | 
			
		||||
        // Bind the current subchannel to the desired engine id.
 | 
			
		||||
        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)
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ASSERT(bound_engines.find(subchannel) != bound_engines.end());
 | 
			
		||||
 | 
			
		||||
    const EngineID engine = bound_engines[subchannel];
 | 
			
		||||
 | 
			
		||||
    switch (engine) {
 | 
			
		||||
 | 
			
		||||
@ -4,8 +4,8 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <array>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <unordered_map>
 | 
			
		||||
#include "common/common_types.h"
 | 
			
		||||
#include "core/hle/service/nvflinger/buffer_queue.h"
 | 
			
		||||
#include "video_core/memory_manager.h"
 | 
			
		||||
@ -136,7 +136,7 @@ private:
 | 
			
		||||
    std::unique_ptr<Tegra::MemoryManager> memory_manager;
 | 
			
		||||
 | 
			
		||||
    /// Mapping of command subchannels to their bound engine ids.
 | 
			
		||||
    std::unordered_map<u32, EngineID> bound_engines;
 | 
			
		||||
    std::array<EngineID, 8> bound_engines = {};
 | 
			
		||||
 | 
			
		||||
    /// 3D engine
 | 
			
		||||
    std::unique_ptr<Engines::Maxwell3D> maxwell_3d;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user