Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

Shader_IR: Allow constant access of guest driver.

Fernando Sahmkow5fb788107799
diff --git a/src/video_core/engines/const_buffer_engine_interface.h b/src/video_core/engines/const_buffer_engine_interface.h
index c29156e346..d56a47710a 100644
--- a/src/video_core/engines/const_buffer_engine_interface.h
+++ b/src/video_core/engines/const_buffer_engine_interface.h
@@ -109,6 +109,7 @@ public:
virtual u32 GetBoundBuffer() const = 0;
virtual VideoCore::GuestDriverProfile& AccessGuestDriverProfile() = 0;
+ virtual const VideoCore::GuestDriverProfile& AccessGuestDriverProfile() const = 0;
};
} // namespace Tegra::Engines
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp
index f177ae9381..4b824aa4e4 100644
--- a/src/video_core/engines/kepler_compute.cpp
+++ b/src/video_core/engines/kepler_compute.cpp
@@ -98,6 +98,10 @@ VideoCore::GuestDriverProfile& KeplerCompute::AccessGuestDriverProfile() {
return rasterizer.AccessGuestDriverProfile();
}
+const VideoCore::GuestDriverProfile& KeplerCompute::AccessGuestDriverProfile() const {
+ return rasterizer.AccessGuestDriverProfile();
+}
+
void KeplerCompute::ProcessLaunch() {
const GPUVAddr launch_desc_loc = regs.launch_desc_loc.Address();
memory_manager.ReadBlockUnsafe(launch_desc_loc, &launch_description,
diff --git a/src/video_core/engines/kepler_compute.h b/src/video_core/engines/kepler_compute.h
index 99c82a9afc..eeb79c56fc 100644
--- a/src/video_core/engines/kepler_compute.h
+++ b/src/video_core/engines/kepler_compute.h
@@ -220,6 +220,8 @@ public:
VideoCore::GuestDriverProfile& AccessGuestDriverProfile() override;
+ const VideoCore::GuestDriverProfile& AccessGuestDriverProfile() const override;
+
private:
Core::System& system;
VideoCore::RasterizerInterface& rasterizer;
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 8167864c0a..7cea146f01 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -788,4 +788,8 @@ VideoCore::GuestDriverProfile& Maxwell3D::AccessGuestDriverProfile() {
return rasterizer.AccessGuestDriverProfile();
}
+const VideoCore::GuestDriverProfile& Maxwell3D::AccessGuestDriverProfile() const {
+ return rasterizer.AccessGuestDriverProfile();
+}
+
} // namespace Tegra::Engines
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 08ef954106..8808bbf76b 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1308,6 +1308,8 @@ public:
VideoCore::GuestDriverProfile& AccessGuestDriverProfile() override;
+ const VideoCore::GuestDriverProfile& AccessGuestDriverProfile() const override;
+
/// Memory for macro code - it's undetermined how big this is, however 1MB is much larger than
/// we've seen used.
using MacroMemory = std::array<u32, 0x40000>;
diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h
index 149f79af39..1b0cc56f11 100644
--- a/src/video_core/rasterizer_interface.h
+++ b/src/video_core/rasterizer_interface.h
@@ -84,6 +84,10 @@ public:
return guest_driver_profile;
}
+ const GuestDriverProfile& AccessGuestDriverProfile() const {
+ return guest_driver_profile;
+ }
+
private:
GuestDriverProfile guest_driver_profile{};
};
diff --git a/src/video_core/shader/const_buffer_locker.h b/src/video_core/shader/const_buffer_locker.h
index c7b72fa5ef..f5655ac643 100644
--- a/src/video_core/shader/const_buffer_locker.h
+++ b/src/video_core/shader/const_buffer_locker.h
@@ -81,7 +81,7 @@ public:
return bound_buffer;
}
- VideoCore::GuestDriverProfile* AccessGuestDriverProfile() {
+ VideoCore::GuestDriverProfile* AccessGuestDriverProfile() const {
if (engine) {
return &(engine->AccessGuestDriverProfile());
}