summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader_cache.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-23 09:28:34 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:30 +0200
commitd621e96d0de212cc16897eadf71e8a1b2e1eb5dc (patch)
tree8695f2f4dddf2564b63e4574d6616ccb0e79568c /src/video_core/shader_cache.cpp
parentspirv: Be aware of NAN unaware drivers (diff)
downloadyuzu-d621e96d0de212cc16897eadf71e8a1b2e1eb5dc.tar
yuzu-d621e96d0de212cc16897eadf71e8a1b2e1eb5dc.tar.gz
yuzu-d621e96d0de212cc16897eadf71e8a1b2e1eb5dc.tar.bz2
yuzu-d621e96d0de212cc16897eadf71e8a1b2e1eb5dc.tar.lz
yuzu-d621e96d0de212cc16897eadf71e8a1b2e1eb5dc.tar.xz
yuzu-d621e96d0de212cc16897eadf71e8a1b2e1eb5dc.tar.zst
yuzu-d621e96d0de212cc16897eadf71e8a1b2e1eb5dc.zip
Diffstat (limited to 'src/video_core/shader_cache.cpp')
-rw-r--r--src/video_core/shader_cache.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/video_core/shader_cache.cpp b/src/video_core/shader_cache.cpp
index b8b8eace5..78bf90c48 100644
--- a/src/video_core/shader_cache.cpp
+++ b/src/video_core/shader_cache.cpp
@@ -91,6 +91,23 @@ const ShaderInfo* ShaderCache::ComputeShader() {
return MakeShaderInfo(env, *cpu_shader_addr);
}
+void ShaderCache::GetGraphicsEnvironments(GraphicsEnvironments& result,
+ const std::array<u64, NUM_PROGRAMS>& unique_hashes) {
+ size_t env_index{};
+ const GPUVAddr base_addr{maxwell3d.regs.code_address.CodeAddress()};
+ for (size_t index = 0; index < NUM_PROGRAMS; ++index) {
+ if (unique_hashes[index] == 0) {
+ continue;
+ }
+ const auto program{static_cast<Tegra::Engines::Maxwell3D::Regs::ShaderProgram>(index)};
+ auto& env{result.envs[index]};
+ const u32 start_address{maxwell3d.regs.shader_config[index].offset};
+ env = GraphicsEnvironment{maxwell3d, gpu_memory, program, base_addr, start_address};
+ env.SetCachedSize(shader_infos[index]->size_bytes);
+ result.env_ptrs[env_index++] = &env;
+ }
+}
+
ShaderInfo* ShaderCache::TryGet(VAddr addr) const {
std::scoped_lock lock{lookup_mutex};