diff options
-rwxr-xr-x | README.md | 2 | ||||
-rwxr-xr-x | src/common/settings.h | 2 | ||||
-rwxr-xr-x | src/core/core.cpp | 8 | ||||
-rwxr-xr-x | src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | 21 | ||||
-rwxr-xr-x | src/core/hle/service/nvdrv/devices/nvhost_gpu.h | 3 | ||||
-rwxr-xr-x | src/video_core/buffer_cache/usage_tracker.h | 6 | ||||
-rwxr-xr-x | src/video_core/control/channel_state.cpp | 3 | ||||
-rwxr-xr-x | src/video_core/control/channel_state.h | 3 | ||||
-rwxr-xr-x | src/video_core/control/channel_state_cache.cpp | 2 | ||||
-rwxr-xr-x | src/video_core/control/channel_state_cache.h | 8 | ||||
-rwxr-xr-x | src/video_core/control/channel_state_cache.inc | 2 | ||||
-rwxr-xr-x | src/video_core/gpu.cpp | 8 | ||||
-rwxr-xr-x | src/video_core/gpu.h | 2 | ||||
-rwxr-xr-x | src/video_core/renderer_opengl/gl_shader_cache.cpp | 1 | ||||
-rwxr-xr-x | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 4 | ||||
-rwxr-xr-x | src/video_core/vulkan_common/vulkan_device.cpp | 7 | ||||
-rwxr-xr-x | src/video_core/vulkan_common/vulkan_device.h | 14 |
17 files changed, 66 insertions, 30 deletions
@@ -1,7 +1,7 @@ | |||
1 | yuzu emulator early access | 1 | yuzu emulator early access |
2 | ============= | 2 | ============= |
3 | 3 | ||
4 | This is the source code for early-access 4173. | 4 | This is the source code for early-access 4174. |
5 | 5 | ||
6 | ## Legal Notice | 6 | ## Legal Notice |
7 | 7 | ||
diff --git a/src/common/settings.h b/src/common/settings.h index 4e4071189..0c7d22073 100755 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
@@ -435,8 +435,6 @@ struct Values { | |||
435 | linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; | 435 | linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; |
436 | Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey", | 436 | Setting<bool> enable_renderdoc_hotkey{linkage, false, "renderdoc_hotkey", |
437 | Category::RendererDebug}; | 437 | Category::RendererDebug}; |
438 | // TODO: remove this once AMDVLK supports VK_EXT_depth_bias_control | ||
439 | bool renderer_amdvlk_depth_bias_workaround{}; | ||
440 | Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder", | 438 | Setting<bool> disable_buffer_reorder{linkage, false, "disable_buffer_reorder", |
441 | Category::RendererDebug}; | 439 | Category::RendererDebug}; |
442 | 440 | ||
diff --git a/src/core/core.cpp b/src/core/core.cpp index 6ea4c7849..ee06615d5 100755 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
@@ -394,11 +394,6 @@ struct System::Impl { | |||
394 | room_member->SendGameInfo(game_info); | 394 | room_member->SendGameInfo(game_info); |
395 | } | 395 | } |
396 | 396 | ||
397 | // Workarounds: | ||
398 | // Activate this in Super Smash Brothers Ultimate, it only affects AMD cards using AMDVLK | ||
399 | Settings::values.renderer_amdvlk_depth_bias_workaround = | ||
400 | params.program_id == 0x1006A800016E000ULL; | ||
401 | |||
402 | status = SystemResultStatus::Success; | 397 | status = SystemResultStatus::Success; |
403 | return status; | 398 | return status; |
404 | } | 399 | } |
@@ -457,9 +452,6 @@ struct System::Impl { | |||
457 | room_member->SendGameInfo(game_info); | 452 | room_member->SendGameInfo(game_info); |
458 | } | 453 | } |
459 | 454 | ||
460 | // Workarounds | ||
461 | Settings::values.renderer_amdvlk_depth_bias_workaround = false; | ||
462 | |||
463 | // Reset all glue registrations | 455 | // Reset all glue registrations |
464 | arp_manager.ResetAll(); | 456 | arp_manager.ResetAll(); |
465 | 457 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index e71c58aa9..616c387e9 100755 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
6 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
7 | #include "core/core.h" | 7 | #include "core/core.h" |
8 | #include "core/hle/kernel/k_process.h" | ||
8 | #include "core/hle/service/nvdrv/core/container.h" | 9 | #include "core/hle/service/nvdrv/core/container.h" |
9 | #include "core/hle/service/nvdrv/core/nvmap.h" | 10 | #include "core/hle/service/nvdrv/core/nvmap.h" |
10 | #include "core/hle/service/nvdrv/core/syncpoint_manager.h" | 11 | #include "core/hle/service/nvdrv/core/syncpoint_manager.h" |
@@ -75,7 +76,7 @@ NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> inpu | |||
75 | case 0xd: | 76 | case 0xd: |
76 | return WrapFixed(this, &nvhost_gpu::SetChannelPriority, input, output); | 77 | return WrapFixed(this, &nvhost_gpu::SetChannelPriority, input, output); |
77 | case 0x1a: | 78 | case 0x1a: |
78 | return WrapFixed(this, &nvhost_gpu::AllocGPFIFOEx2, input, output); | 79 | return WrapFixed(this, &nvhost_gpu::AllocGPFIFOEx2, input, output, fd); |
79 | case 0x1b: | 80 | case 0x1b: |
80 | return WrapFixedVariable(this, &nvhost_gpu::SubmitGPFIFOBase1, input, output, true); | 81 | return WrapFixedVariable(this, &nvhost_gpu::SubmitGPFIFOBase1, input, output, true); |
81 | case 0x1d: | 82 | case 0x1d: |
@@ -120,8 +121,13 @@ NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inpu | |||
120 | return NvResult::NotImplemented; | 121 | return NvResult::NotImplemented; |
121 | } | 122 | } |
122 | 123 | ||
123 | void nvhost_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {} | 124 | void nvhost_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) { |
124 | void nvhost_gpu::OnClose(DeviceFD fd) {} | 125 | sessions[fd] = session_id; |
126 | } | ||
127 | |||
128 | void nvhost_gpu::OnClose(DeviceFD fd) { | ||
129 | sessions.erase(fd); | ||
130 | } | ||
125 | 131 | ||
126 | NvResult nvhost_gpu::SetNVMAPfd(IoctlSetNvmapFD& params) { | 132 | NvResult nvhost_gpu::SetNVMAPfd(IoctlSetNvmapFD& params) { |
127 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); | 133 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); |
@@ -161,7 +167,7 @@ NvResult nvhost_gpu::SetChannelPriority(IoctlChannelSetPriority& params) { | |||
161 | return NvResult::Success; | 167 | return NvResult::Success; |
162 | } | 168 | } |
163 | 169 | ||
164 | NvResult nvhost_gpu::AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params) { | 170 | NvResult nvhost_gpu::AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params, DeviceFD fd) { |
165 | LOG_WARNING(Service_NVDRV, | 171 | LOG_WARNING(Service_NVDRV, |
166 | "(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, " | 172 | "(STUBBED) called, num_entries={:X}, flags={:X}, unk0={:X}, " |
167 | "unk1={:X}, unk2={:X}, unk3={:X}", | 173 | "unk1={:X}, unk2={:X}, unk3={:X}", |
@@ -173,7 +179,12 @@ NvResult nvhost_gpu::AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params) { | |||
173 | return NvResult::AlreadyAllocated; | 179 | return NvResult::AlreadyAllocated; |
174 | } | 180 | } |
175 | 181 | ||
176 | system.GPU().InitChannel(*channel_state); | 182 | u64 program_id{}; |
183 | if (auto* const session = core.GetSession(sessions[fd]); session != nullptr) { | ||
184 | program_id = session->process->GetProgramId(); | ||
185 | } | ||
186 | |||
187 | system.GPU().InitChannel(*channel_state, program_id); | ||
177 | 188 | ||
178 | params.fence_out = syncpoint_manager.GetSyncpointFence(channel_syncpoint); | 189 | params.fence_out = syncpoint_manager.GetSyncpointFence(channel_syncpoint); |
179 | 190 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 40c2291b1..cde3418ad 100755 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h | |||
@@ -192,7 +192,7 @@ private: | |||
192 | NvResult ZCullBind(IoctlZCullBind& params); | 192 | NvResult ZCullBind(IoctlZCullBind& params); |
193 | NvResult SetErrorNotifier(IoctlSetErrorNotifier& params); | 193 | NvResult SetErrorNotifier(IoctlSetErrorNotifier& params); |
194 | NvResult SetChannelPriority(IoctlChannelSetPriority& params); | 194 | NvResult SetChannelPriority(IoctlChannelSetPriority& params); |
195 | NvResult AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params); | 195 | NvResult AllocGPFIFOEx2(IoctlAllocGpfifoEx2& params, DeviceFD fd); |
196 | NvResult AllocateObjectContext(IoctlAllocObjCtx& params); | 196 | NvResult AllocateObjectContext(IoctlAllocObjCtx& params); |
197 | 197 | ||
198 | NvResult SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, Tegra::CommandList&& entries); | 198 | NvResult SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, Tegra::CommandList&& entries); |
@@ -210,6 +210,7 @@ private: | |||
210 | NvCore::SyncpointManager& syncpoint_manager; | 210 | NvCore::SyncpointManager& syncpoint_manager; |
211 | NvCore::NvMap& nvmap; | 211 | NvCore::NvMap& nvmap; |
212 | std::shared_ptr<Tegra::Control::ChannelState> channel_state; | 212 | std::shared_ptr<Tegra::Control::ChannelState> channel_state; |
213 | std::unordered_map<DeviceFD, NvCore::SessionId> sessions; | ||
213 | u32 channel_syncpoint; | 214 | u32 channel_syncpoint; |
214 | std::mutex channel_mutex; | 215 | std::mutex channel_mutex; |
215 | 216 | ||
diff --git a/src/video_core/buffer_cache/usage_tracker.h b/src/video_core/buffer_cache/usage_tracker.h index 5f8688d31..ae511ccb6 100755 --- a/src/video_core/buffer_cache/usage_tracker.h +++ b/src/video_core/buffer_cache/usage_tracker.h | |||
@@ -26,6 +26,9 @@ public: | |||
26 | void Track(u64 offset, u64 size) noexcept { | 26 | void Track(u64 offset, u64 size) noexcept { |
27 | const size_t page = offset >> PAGE_SHIFT; | 27 | const size_t page = offset >> PAGE_SHIFT; |
28 | const size_t page_end = (offset + size) >> PAGE_SHIFT; | 28 | const size_t page_end = (offset + size) >> PAGE_SHIFT; |
29 | if (page_end < page || page_end >= pages.size()) { | ||
30 | return; | ||
31 | } | ||
29 | TrackPage(page, offset, size); | 32 | TrackPage(page, offset, size); |
30 | if (page == page_end) { | 33 | if (page == page_end) { |
31 | return; | 34 | return; |
@@ -41,6 +44,9 @@ public: | |||
41 | [[nodiscard]] bool IsUsed(u64 offset, u64 size) const noexcept { | 44 | [[nodiscard]] bool IsUsed(u64 offset, u64 size) const noexcept { |
42 | const size_t page = offset >> PAGE_SHIFT; | 45 | const size_t page = offset >> PAGE_SHIFT; |
43 | const size_t page_end = (offset + size) >> PAGE_SHIFT; | 46 | const size_t page_end = (offset + size) >> PAGE_SHIFT; |
47 | if (page_end < page || page_end >= pages.size()) { | ||
48 | return false; | ||
49 | } | ||
44 | if (IsPageUsed(page, offset, size)) { | 50 | if (IsPageUsed(page, offset, size)) { |
45 | return true; | 51 | return true; |
46 | } | 52 | } |
diff --git a/src/video_core/control/channel_state.cpp b/src/video_core/control/channel_state.cpp index d182bad57..a3780a046 100755 --- 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 ceaa92647..12fb84811 100755 --- 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 eb59d65c5..d225de7ac 100755 --- 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 efc992d83..5d7c411b9 100755 --- 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 5a6ab0052..e3d2b4447 100755 --- 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 | } |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 59356015b..d325608c9 100755 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
@@ -67,8 +67,8 @@ struct GPU::Impl { | |||
67 | return CreateChannel(new_channel_id++); | 67 | return CreateChannel(new_channel_id++); |
68 | } | 68 | } |
69 | 69 | ||
70 | void InitChannel(Control::ChannelState& to_init) { | 70 | void InitChannel(Control::ChannelState& to_init, u64 program_id) { |
71 | to_init.Init(system, gpu); | 71 | to_init.Init(system, gpu, program_id); |
72 | to_init.BindRasterizer(rasterizer); | 72 | to_init.BindRasterizer(rasterizer); |
73 | rasterizer->InitializeChannel(to_init); | 73 | rasterizer->InitializeChannel(to_init); |
74 | } | 74 | } |
@@ -387,8 +387,8 @@ std::shared_ptr<Control::ChannelState> GPU::AllocateChannel() { | |||
387 | return impl->AllocateChannel(); | 387 | return impl->AllocateChannel(); |
388 | } | 388 | } |
389 | 389 | ||
390 | void GPU::InitChannel(Control::ChannelState& to_init) { | 390 | void GPU::InitChannel(Control::ChannelState& to_init, u64 program_id) { |
391 | impl->InitChannel(to_init); | 391 | impl->InitChannel(to_init, program_id); |
392 | } | 392 | } |
393 | 393 | ||
394 | void GPU::BindChannel(s32 channel_id) { | 394 | void GPU::BindChannel(s32 channel_id) { |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 25c75a109..a4726ce13 100755 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
@@ -149,7 +149,7 @@ public: | |||
149 | 149 | ||
150 | std::shared_ptr<Control::ChannelState> AllocateChannel(); | 150 | std::shared_ptr<Control::ChannelState> AllocateChannel(); |
151 | 151 | ||
152 | void InitChannel(Control::ChannelState& to_init); | 152 | void InitChannel(Control::ChannelState& to_init, u64 program_id); |
153 | 153 | ||
154 | void BindChannel(s32 channel_id); | 154 | void BindChannel(s32 channel_id); |
155 | 155 | ||
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 5ada85685..c3530c79c 100755 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
@@ -215,6 +215,7 @@ ShaderCache::ShaderCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, | |||
215 | .support_gl_variable_aoffi = device.HasVariableAoffi(), | 215 | .support_gl_variable_aoffi = device.HasVariableAoffi(), |
216 | .support_gl_sparse_textures = device.HasSparseTexture2(), | 216 | .support_gl_sparse_textures = device.HasSparseTexture2(), |
217 | .support_gl_derivative_control = device.HasDerivativeControl(), | 217 | .support_gl_derivative_control = device.HasDerivativeControl(), |
218 | .support_geometry_streams = true, | ||
218 | 219 | ||
219 | .warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyLargerThanGuest(), | 220 | .warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyLargerThanGuest(), |
220 | 221 | ||
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index d9b43379c..cc47eb345 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
@@ -1082,8 +1082,8 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) { | |||
1082 | regs.zeta.format == Tegra::DepthFormat::X8Z24_UNORM || | 1082 | regs.zeta.format == Tegra::DepthFormat::X8Z24_UNORM || |
1083 | regs.zeta.format == Tegra::DepthFormat::S8Z24_UNORM || | 1083 | regs.zeta.format == Tegra::DepthFormat::S8Z24_UNORM || |
1084 | regs.zeta.format == Tegra::DepthFormat::V8Z24_UNORM; | 1084 | regs.zeta.format == Tegra::DepthFormat::V8Z24_UNORM; |
1085 | if (is_d24 && !device.SupportsD24DepthBuffer() && | 1085 | if (is_d24 && !device.SupportsD24DepthBuffer() && program_id == 0x1006A800016E000ULL) { |
1086 | Settings::values.renderer_amdvlk_depth_bias_workaround) { | 1086 | // Only activate this in Super Smash Brothers Ultimate |
1087 | // the base formulas can be obtained from here: | 1087 | // the base formulas can be obtained from here: |
1088 | // https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias | 1088 | // https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias |
1089 | const double rescale_factor = | 1089 | const double rescale_factor = |
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 7f183bacc..f11d0ba16 100755 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp | |||
@@ -1137,6 +1137,13 @@ void Device::RemoveUnsuitableExtensions() { | |||
1137 | RemoveExtensionFeatureIfUnsuitable(extensions.custom_border_color, features.custom_border_color, | 1137 | RemoveExtensionFeatureIfUnsuitable(extensions.custom_border_color, features.custom_border_color, |
1138 | VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME); | 1138 | VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME); |
1139 | 1139 | ||
1140 | // VK_EXT_depth_bias_control | ||
1141 | extensions.depth_bias_control = | ||
1142 | features.depth_bias_control.depthBiasControl && | ||
1143 | features.depth_bias_control.leastRepresentableValueForceUnormRepresentation; | ||
1144 | RemoveExtensionFeatureIfUnsuitable(extensions.depth_bias_control, features.depth_bias_control, | ||
1145 | VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME); | ||
1146 | |||
1140 | // VK_EXT_depth_clip_control | 1147 | // VK_EXT_depth_clip_control |
1141 | extensions.depth_clip_control = features.depth_clip_control.depthClipControl; | 1148 | extensions.depth_clip_control = features.depth_clip_control.depthClipControl; |
1142 | RemoveExtensionFeatureIfUnsuitable(extensions.depth_clip_control, features.depth_clip_control, | 1149 | RemoveExtensionFeatureIfUnsuitable(extensions.depth_clip_control, features.depth_clip_control, |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index f0cb2b2dc..e6e4a3089 100755 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
@@ -41,6 +41,7 @@ VK_DEFINE_HANDLE(VmaAllocator) | |||
41 | // Define all features which may be used by the implementation and require an extension here. | 41 | // Define all features which may be used by the implementation and require an extension here. |
42 | #define FOR_EACH_VK_FEATURE_EXT(FEATURE) \ | 42 | #define FOR_EACH_VK_FEATURE_EXT(FEATURE) \ |
43 | FEATURE(EXT, CustomBorderColor, CUSTOM_BORDER_COLOR, custom_border_color) \ | 43 | FEATURE(EXT, CustomBorderColor, CUSTOM_BORDER_COLOR, custom_border_color) \ |
44 | FEATURE(EXT, DepthBiasControl, DEPTH_BIAS_CONTROL, depth_bias_control) \ | ||
44 | FEATURE(EXT, DepthClipControl, DEPTH_CLIP_CONTROL, depth_clip_control) \ | 45 | FEATURE(EXT, DepthClipControl, DEPTH_CLIP_CONTROL, depth_clip_control) \ |
45 | FEATURE(EXT, ExtendedDynamicState, EXTENDED_DYNAMIC_STATE, extended_dynamic_state) \ | 46 | FEATURE(EXT, ExtendedDynamicState, EXTENDED_DYNAMIC_STATE, extended_dynamic_state) \ |
46 | FEATURE(EXT, ExtendedDynamicState2, EXTENDED_DYNAMIC_STATE_2, extended_dynamic_state2) \ | 47 | FEATURE(EXT, ExtendedDynamicState2, EXTENDED_DYNAMIC_STATE_2, extended_dynamic_state2) \ |
@@ -96,6 +97,7 @@ VK_DEFINE_HANDLE(VmaAllocator) | |||
96 | #define FOR_EACH_VK_RECOMMENDED_EXTENSION(EXTENSION_NAME) \ | 97 | #define FOR_EACH_VK_RECOMMENDED_EXTENSION(EXTENSION_NAME) \ |
97 | EXTENSION_NAME(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME) \ | 98 | EXTENSION_NAME(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME) \ |
98 | EXTENSION_NAME(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME) \ | 99 | EXTENSION_NAME(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME) \ |
100 | EXTENSION_NAME(VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME) \ | ||
99 | EXTENSION_NAME(VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME) \ | 101 | EXTENSION_NAME(VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME) \ |
100 | EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME) \ | 102 | EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME) \ |
101 | EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME) \ | 103 | EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME) \ |
@@ -148,6 +150,9 @@ VK_DEFINE_HANDLE(VmaAllocator) | |||
148 | // Define features where the absence of the feature may result in a degraded experience. | 150 | // Define features where the absence of the feature may result in a degraded experience. |
149 | #define FOR_EACH_VK_RECOMMENDED_FEATURE(FEATURE_NAME) \ | 151 | #define FOR_EACH_VK_RECOMMENDED_FEATURE(FEATURE_NAME) \ |
150 | FEATURE_NAME(custom_border_color, customBorderColors) \ | 152 | FEATURE_NAME(custom_border_color, customBorderColors) \ |
153 | FEATURE_NAME(depth_bias_control, depthBiasControl) \ | ||
154 | FEATURE_NAME(depth_bias_control, leastRepresentableValueForceUnormRepresentation) \ | ||
155 | FEATURE_NAME(depth_bias_control, depthBiasExact) \ | ||
151 | FEATURE_NAME(extended_dynamic_state, extendedDynamicState) \ | 156 | FEATURE_NAME(extended_dynamic_state, extendedDynamicState) \ |
152 | FEATURE_NAME(format_a4b4g4r4, formatA4B4G4R4) \ | 157 | FEATURE_NAME(format_a4b4g4r4, formatA4B4G4R4) \ |
153 | FEATURE_NAME(index_type_uint8, indexTypeUint8) \ | 158 | FEATURE_NAME(index_type_uint8, indexTypeUint8) \ |
@@ -474,6 +479,11 @@ public: | |||
474 | return extensions.depth_clip_control; | 479 | return extensions.depth_clip_control; |
475 | } | 480 | } |
476 | 481 | ||
482 | /// Returns true if the device supports VK_EXT_depth_bias_control. | ||
483 | bool IsExtDepthBiasControlSupported() const { | ||
484 | return extensions.depth_bias_control; | ||
485 | } | ||
486 | |||
477 | /// Returns true if the device supports VK_EXT_shader_viewport_index_layer. | 487 | /// Returns true if the device supports VK_EXT_shader_viewport_index_layer. |
478 | bool IsExtShaderViewportIndexLayerSupported() const { | 488 | bool IsExtShaderViewportIndexLayerSupported() const { |
479 | return extensions.shader_viewport_index_layer; | 489 | return extensions.shader_viewport_index_layer; |
@@ -644,6 +654,10 @@ public: | |||
644 | return features.robustness2.nullDescriptor; | 654 | return features.robustness2.nullDescriptor; |
645 | } | 655 | } |
646 | 656 | ||
657 | bool HasExactDepthBiasControl() const { | ||
658 | return features.depth_bias_control.depthBiasExact; | ||
659 | } | ||
660 | |||
647 | u32 GetMaxVertexInputAttributes() const { | 661 | u32 GetMaxVertexInputAttributes() const { |
648 | return properties.properties.limits.maxVertexInputAttributes; | 662 | return properties.properties.limits.maxVertexInputAttributes; |
649 | } | 663 | } |