diff options
| author | 2024-02-23 22:38:21 -0500 | |
|---|---|---|
| committer | 2024-02-26 11:16:14 -0500 | |
| commit | d66ca8b73145c9e891415f11ce68125ff2b99b9b (patch) | |
| tree | 70c4d8b3e8aa80222940fe6e490d62bf42bc0443 /src/video_core/control | |
| parent | Merge pull request #13164 from merryhime/reset-submodules (diff) | |
| download | yuzu-d66ca8b73145c9e891415f11ce68125ff2b99b9b.tar.gz yuzu-d66ca8b73145c9e891415f11ce68125ff2b99b9b.tar.xz yuzu-d66ca8b73145c9e891415f11ce68125ff2b99b9b.zip | |
video_core: make gpu context aware of rendering program
Diffstat (limited to 'src/video_core/control')
| -rw-r--r-- | src/video_core/control/channel_state.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/control/channel_state.h | 3 | ||||
| -rw-r--r-- | src/video_core/control/channel_state_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/control/channel_state_cache.h | 8 | ||||
| -rw-r--r-- | src/video_core/control/channel_state_cache.inc | 2 |
5 files changed, 12 insertions, 6 deletions
diff --git a/src/video_core/control/channel_state.cpp b/src/video_core/control/channel_state.cpp index 832025d75..2539997d5 100644 --- a/src/video_core/control/channel_state.cpp +++ b/src/video_core/control/channel_state.cpp | |||
| @@ -16,8 +16,9 @@ namespace Tegra::Control { | |||
| 16 | 16 | ||
| 17 | ChannelState::ChannelState(s32 bind_id_) : bind_id{bind_id_}, initialized{} {} | 17 | ChannelState::ChannelState(s32 bind_id_) : bind_id{bind_id_}, initialized{} {} |
| 18 | 18 | ||
| 19 | void ChannelState::Init(Core::System& system, GPU& gpu) { | 19 | void ChannelState::Init(Core::System& system, GPU& gpu, u64 program_id_) { |
| 20 | ASSERT(memory_manager); | 20 | ASSERT(memory_manager); |
| 21 | program_id = program_id_; | ||
| 21 | dma_pusher = std::make_unique<Tegra::DmaPusher>(system, gpu, *memory_manager, *this); | 22 | dma_pusher = std::make_unique<Tegra::DmaPusher>(system, gpu, *memory_manager, *this); |
| 22 | maxwell_3d = std::make_unique<Engines::Maxwell3D>(system, *memory_manager); | 23 | maxwell_3d = std::make_unique<Engines::Maxwell3D>(system, *memory_manager); |
| 23 | fermi_2d = std::make_unique<Engines::Fermi2D>(*memory_manager); | 24 | fermi_2d = std::make_unique<Engines::Fermi2D>(*memory_manager); |
diff --git a/src/video_core/control/channel_state.h b/src/video_core/control/channel_state.h index 3a7b9872c..b385f4939 100644 --- a/src/video_core/control/channel_state.h +++ b/src/video_core/control/channel_state.h | |||
| @@ -40,11 +40,12 @@ struct ChannelState { | |||
| 40 | ChannelState(ChannelState&& other) noexcept = default; | 40 | ChannelState(ChannelState&& other) noexcept = default; |
| 41 | ChannelState& operator=(ChannelState&& other) noexcept = default; | 41 | ChannelState& operator=(ChannelState&& other) noexcept = default; |
| 42 | 42 | ||
| 43 | void Init(Core::System& system, GPU& gpu); | 43 | void Init(Core::System& system, GPU& gpu, u64 program_id); |
| 44 | 44 | ||
| 45 | void BindRasterizer(VideoCore::RasterizerInterface* rasterizer); | 45 | void BindRasterizer(VideoCore::RasterizerInterface* rasterizer); |
| 46 | 46 | ||
| 47 | s32 bind_id = -1; | 47 | s32 bind_id = -1; |
| 48 | u64 program_id = 0; | ||
| 48 | /// 3D engine | 49 | /// 3D engine |
| 49 | std::unique_ptr<Engines::Maxwell3D> maxwell_3d; | 50 | std::unique_ptr<Engines::Maxwell3D> maxwell_3d; |
| 50 | /// 2D engine | 51 | /// 2D engine |
diff --git a/src/video_core/control/channel_state_cache.cpp b/src/video_core/control/channel_state_cache.cpp index 4ebeb6356..f8c6a762d 100644 --- a/src/video_core/control/channel_state_cache.cpp +++ b/src/video_core/control/channel_state_cache.cpp | |||
| @@ -7,7 +7,7 @@ namespace VideoCommon { | |||
| 7 | 7 | ||
| 8 | ChannelInfo::ChannelInfo(Tegra::Control::ChannelState& channel_state) | 8 | ChannelInfo::ChannelInfo(Tegra::Control::ChannelState& channel_state) |
| 9 | : maxwell3d{*channel_state.maxwell_3d}, kepler_compute{*channel_state.kepler_compute}, | 9 | : maxwell3d{*channel_state.maxwell_3d}, kepler_compute{*channel_state.kepler_compute}, |
| 10 | gpu_memory{*channel_state.memory_manager} {} | 10 | gpu_memory{*channel_state.memory_manager}, program_id{channel_state.program_id} {} |
| 11 | 11 | ||
| 12 | template class VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo>; | 12 | template class VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo>; |
| 13 | 13 | ||
diff --git a/src/video_core/control/channel_state_cache.h b/src/video_core/control/channel_state_cache.h index 1dbfda299..7480d60d1 100644 --- a/src/video_core/control/channel_state_cache.h +++ b/src/video_core/control/channel_state_cache.h | |||
| @@ -39,6 +39,7 @@ public: | |||
| 39 | Tegra::Engines::Maxwell3D& maxwell3d; | 39 | Tegra::Engines::Maxwell3D& maxwell3d; |
| 40 | Tegra::Engines::KeplerCompute& kepler_compute; | 40 | Tegra::Engines::KeplerCompute& kepler_compute; |
| 41 | Tegra::MemoryManager& gpu_memory; | 41 | Tegra::MemoryManager& gpu_memory; |
| 42 | u64 program_id; | ||
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 44 | template <class P> | 45 | template <class P> |
| @@ -77,9 +78,10 @@ protected: | |||
| 77 | P* channel_state; | 78 | P* channel_state; |
| 78 | size_t current_channel_id{UNSET_CHANNEL}; | 79 | size_t current_channel_id{UNSET_CHANNEL}; |
| 79 | size_t current_address_space{}; | 80 | size_t current_address_space{}; |
| 80 | Tegra::Engines::Maxwell3D* maxwell3d; | 81 | Tegra::Engines::Maxwell3D* maxwell3d{}; |
| 81 | Tegra::Engines::KeplerCompute* kepler_compute; | 82 | Tegra::Engines::KeplerCompute* kepler_compute{}; |
| 82 | Tegra::MemoryManager* gpu_memory; | 83 | Tegra::MemoryManager* gpu_memory{}; |
| 84 | u64 program_id{}; | ||
| 83 | 85 | ||
| 84 | std::deque<P> channel_storage; | 86 | std::deque<P> channel_storage; |
| 85 | std::deque<size_t> free_channel_ids; | 87 | std::deque<size_t> free_channel_ids; |
diff --git a/src/video_core/control/channel_state_cache.inc b/src/video_core/control/channel_state_cache.inc index 31f792ddd..d882d8222 100644 --- a/src/video_core/control/channel_state_cache.inc +++ b/src/video_core/control/channel_state_cache.inc | |||
| @@ -58,6 +58,7 @@ void ChannelSetupCaches<P>::BindToChannel(s32 id) { | |||
| 58 | maxwell3d = &channel_state->maxwell3d; | 58 | maxwell3d = &channel_state->maxwell3d; |
| 59 | kepler_compute = &channel_state->kepler_compute; | 59 | kepler_compute = &channel_state->kepler_compute; |
| 60 | gpu_memory = &channel_state->gpu_memory; | 60 | gpu_memory = &channel_state->gpu_memory; |
| 61 | program_id = channel_state->program_id; | ||
| 61 | current_address_space = gpu_memory->GetID(); | 62 | current_address_space = gpu_memory->GetID(); |
| 62 | } | 63 | } |
| 63 | 64 | ||
| @@ -76,6 +77,7 @@ void ChannelSetupCaches<P>::EraseChannel(s32 id) { | |||
| 76 | maxwell3d = nullptr; | 77 | maxwell3d = nullptr; |
| 77 | kepler_compute = nullptr; | 78 | kepler_compute = nullptr; |
| 78 | gpu_memory = nullptr; | 79 | gpu_memory = nullptr; |
| 80 | program_id = 0; | ||
| 79 | } else if (current_channel_id != UNSET_CHANNEL) { | 81 | } else if (current_channel_id != UNSET_CHANNEL) { |
| 80 | channel_state = &channel_storage[current_channel_id]; | 82 | channel_state = &channel_storage[current_channel_id]; |
| 81 | } | 83 | } |