[GPU] Unified clear_memory_page_state to be used in D3D12 & Vulkan
This commit is contained in:
parent
91f976e524
commit
2a4d7feaae
|
@ -52,9 +52,9 @@ DECLARE_string(hid);
|
||||||
|
|
||||||
DECLARE_bool(guide_button);
|
DECLARE_bool(guide_button);
|
||||||
|
|
||||||
DECLARE_bool(d3d12_readback_resolve);
|
DECLARE_bool(clear_memory_page_state);
|
||||||
|
|
||||||
DECLARE_bool(d3d12_clear_memory_page_state);
|
DECLARE_bool(d3d12_readback_resolve);
|
||||||
|
|
||||||
DEFINE_bool(fullscreen, false, "Whether to launch the emulator in fullscreen.",
|
DEFINE_bool(fullscreen, false, "Whether to launch the emulator in fullscreen.",
|
||||||
"Display");
|
"Display");
|
||||||
|
@ -1265,7 +1265,7 @@ EmulatorWindow::ControllerHotKey EmulatorWindow::ProcessControllerHotkey(
|
||||||
ToggleGPUSetting(gpu_cvar::ClearMemoryPageState);
|
ToggleGPUSetting(gpu_cvar::ClearMemoryPageState);
|
||||||
|
|
||||||
// Assume the user wants ClearCaches as well
|
// Assume the user wants ClearCaches as well
|
||||||
if (cvars::d3d12_clear_memory_page_state) {
|
if (cvars::clear_memory_page_state) {
|
||||||
GpuClearCaches();
|
GpuClearCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1407,8 +1407,8 @@ void EmulatorWindow::GamepadHotKeys() {
|
||||||
void EmulatorWindow::ToggleGPUSetting(gpu_cvar value) {
|
void EmulatorWindow::ToggleGPUSetting(gpu_cvar value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case gpu_cvar::ClearMemoryPageState:
|
case gpu_cvar::ClearMemoryPageState:
|
||||||
D3D12SaveGPUSetting(D3D12GPUSetting::ClearMemoryPageState,
|
CommonSaveGPUSetting(CommonGPUSetting::ClearMemoryPageState,
|
||||||
!cvars::d3d12_clear_memory_page_state);
|
!cvars::clear_memory_page_state);
|
||||||
break;
|
break;
|
||||||
case gpu_cvar::ReadbackResolve:
|
case gpu_cvar::ReadbackResolve:
|
||||||
D3D12SaveGPUSetting(D3D12GPUSetting::ReadbackResolve,
|
D3D12SaveGPUSetting(D3D12GPUSetting::ReadbackResolve,
|
||||||
|
@ -1479,7 +1479,7 @@ void EmulatorWindow::DisplayHotKeysConfig() {
|
||||||
msg += "\n";
|
msg += "\n";
|
||||||
|
|
||||||
msg += "Clear Memory Page State: " +
|
msg += "Clear Memory Page State: " +
|
||||||
xe::string_util::BoolToString(cvars::d3d12_clear_memory_page_state);
|
xe::string_util::BoolToString(cvars::clear_memory_page_state);
|
||||||
msg += "\n";
|
msg += "\n";
|
||||||
|
|
||||||
msg += "Controller Hotkeys: " +
|
msg += "Controller Hotkeys: " +
|
||||||
|
|
|
@ -45,9 +45,22 @@ DEFINE_bool(
|
||||||
"of the guest thread that wrote the new read position.",
|
"of the guest thread that wrote the new read position.",
|
||||||
"GPU");
|
"GPU");
|
||||||
|
|
||||||
|
DEFINE_bool(clear_memory_page_state, false,
|
||||||
|
"Refresh state of memory pages to enable gpu written data. (Use "
|
||||||
|
"for 'Team Ninja' Games to fix missing character models)",
|
||||||
|
"GPU");
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
|
|
||||||
|
void CommonSaveGPUSetting(CommonGPUSetting setting, uint64_t value) {
|
||||||
|
switch (setting) {
|
||||||
|
case CommonGPUSetting::ClearMemoryPageState:
|
||||||
|
OVERRIDE_bool(clear_memory_page_state, (bool)value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
using namespace xe::gpu::xenos;
|
using namespace xe::gpu::xenos;
|
||||||
|
|
||||||
CommandProcessor::CommandProcessor(GraphicsSystem* graphics_system,
|
CommandProcessor::CommandProcessor(GraphicsSystem* graphics_system,
|
||||||
|
|
|
@ -33,6 +33,12 @@ class ByteStream;
|
||||||
|
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
|
|
||||||
|
enum class CommonGPUSetting {
|
||||||
|
ClearMemoryPageState,
|
||||||
|
};
|
||||||
|
|
||||||
|
void CommonSaveGPUSetting(CommonGPUSetting setting, uint64_t value);
|
||||||
|
|
||||||
class GraphicsSystem;
|
class GraphicsSystem;
|
||||||
class Shader;
|
class Shader;
|
||||||
|
|
||||||
|
|
|
@ -49,19 +49,14 @@ DEFINE_bool(d3d12_submit_on_primary_buffer_end, true,
|
||||||
"Submit the command list when a PM4 primary buffer ends if it's "
|
"Submit the command list when a PM4 primary buffer ends if it's "
|
||||||
"possible to submit immediately to try to reduce frame latency.",
|
"possible to submit immediately to try to reduce frame latency.",
|
||||||
"D3D12");
|
"D3D12");
|
||||||
DEFINE_bool(d3d12_clear_memory_page_state, false,
|
|
||||||
"Refresh state of memory pages to enable gpu written data. (Use "
|
DECLARE_bool(clear_memory_page_state);
|
||||||
"for 'Team Ninja' Games to fix missing character models)",
|
|
||||||
"D3D12");
|
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
|
|
||||||
void D3D12SaveGPUSetting(D3D12GPUSetting setting, uint64_t value) {
|
void D3D12SaveGPUSetting(D3D12GPUSetting setting, uint64_t value) {
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case D3D12GPUSetting::ClearMemoryPageState:
|
|
||||||
OVERRIDE_bool(d3d12_clear_memory_page_state, (bool)value);
|
|
||||||
break;
|
|
||||||
case D3D12GPUSetting::ReadbackResolve:
|
case D3D12GPUSetting::ReadbackResolve:
|
||||||
OVERRIDE_bool(d3d12_readback_resolve, (bool)value);
|
OVERRIDE_bool(d3d12_readback_resolve, (bool)value);
|
||||||
break;
|
break;
|
||||||
|
@ -3564,7 +3559,7 @@ bool D3D12CommandProcessor::EndSubmission(bool is_swap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_closing_frame) {
|
if (is_closing_frame) {
|
||||||
if (cvars::d3d12_clear_memory_page_state) {
|
if (cvars::clear_memory_page_state) {
|
||||||
shared_memory_->SetSystemPageBlocksValidWithGpuDataWritten();
|
shared_memory_->SetSystemPageBlocksValidWithGpuDataWritten();
|
||||||
}
|
}
|
||||||
// Close the capture after submitting.
|
// Close the capture after submitting.
|
||||||
|
|
|
@ -45,7 +45,6 @@ namespace gpu {
|
||||||
|
|
||||||
enum class D3D12GPUSetting {
|
enum class D3D12GPUSetting {
|
||||||
ReadbackResolve,
|
ReadbackResolve,
|
||||||
ClearMemoryPageState,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void D3D12SaveGPUSetting(D3D12GPUSetting setting, uint64_t value);
|
void D3D12SaveGPUSetting(D3D12GPUSetting setting, uint64_t value);
|
||||||
|
|
|
@ -38,6 +38,9 @@
|
||||||
#include "xenia/ui/vulkan/vulkan_presenter.h"
|
#include "xenia/ui/vulkan/vulkan_presenter.h"
|
||||||
#include "xenia/ui/vulkan/vulkan_provider.h"
|
#include "xenia/ui/vulkan/vulkan_provider.h"
|
||||||
#include "xenia/ui/vulkan/vulkan_util.h"
|
#include "xenia/ui/vulkan/vulkan_util.h"
|
||||||
|
|
||||||
|
DECLARE_bool(clear_memory_page_state);
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
namespace vulkan {
|
namespace vulkan {
|
||||||
|
@ -3125,6 +3128,10 @@ bool VulkanCommandProcessor::EndSubmission(bool is_swap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_closing_frame) {
|
if (is_closing_frame) {
|
||||||
|
if (cvars::clear_memory_page_state) {
|
||||||
|
shared_memory_->SetSystemPageBlocksValidWithGpuDataWritten();
|
||||||
|
}
|
||||||
|
|
||||||
frame_open_ = false;
|
frame_open_ = false;
|
||||||
// Submission already closed now, so minus 1.
|
// Submission already closed now, so minus 1.
|
||||||
closed_frame_submissions_[(frame_current_++) % kMaxFramesInFlight] =
|
closed_frame_submissions_[(frame_current_++) % kMaxFramesInFlight] =
|
||||||
|
|
Loading…
Reference in New Issue