[GPU] Improvements to GPU settings modification
- Renamed CommonGPUSetting to GPUSetting - Removed readback_resolve and memexport from d3d12 exclusive option. In the future it will be available for Vulkan too. - Removed unused enum class: gpu_cvar - Removed OS specific code from emulator_window
This commit is contained in:
@@ -50,17 +50,52 @@ DEFINE_bool(clear_memory_page_state, false,
|
||||
"for 'Team Ninja' Games to fix missing character models)",
|
||||
"GPU");
|
||||
|
||||
DEFINE_bool(
|
||||
readback_resolve, false,
|
||||
"[D3D12 Only] Read render-to-texture results on the CPU. This may be "
|
||||
"needed in some games, for instance, for screenshots in saved games, but "
|
||||
"causes mid-frame synchronization, so it has a huge performance impact.",
|
||||
"GPU");
|
||||
|
||||
DEFINE_bool(
|
||||
readback_memexport, false,
|
||||
"[D3D12 Only] Read data written by memory export in shaders on the CPU. "
|
||||
"This may be needed in some games (but many only access exported data on "
|
||||
"the GPU, and this flag isn't needed to handle such behavior), but causes "
|
||||
"mid-frame synchronization, so it has a huge performance impact.",
|
||||
"GPU");
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
void CommonSaveGPUSetting(CommonGPUSetting setting, uint64_t value) {
|
||||
// This should be written completely differently with support for different
|
||||
// types.
|
||||
void SaveGPUSetting(GPUSetting setting, uint64_t value) {
|
||||
switch (setting) {
|
||||
case CommonGPUSetting::ClearMemoryPageState:
|
||||
OVERRIDE_bool(clear_memory_page_state, (bool)value);
|
||||
case GPUSetting::ClearMemoryPageState:
|
||||
OVERRIDE_bool(clear_memory_page_state, static_cast<bool>(value));
|
||||
break;
|
||||
case GPUSetting::ReadbackResolve:
|
||||
OVERRIDE_bool(readback_resolve, static_cast<bool>(value));
|
||||
break;
|
||||
case GPUSetting::ReadbackMemexport:
|
||||
OVERRIDE_bool(readback_memexport, static_cast<bool>(value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool GetGPUSetting(GPUSetting setting) {
|
||||
switch (setting) {
|
||||
case GPUSetting::ClearMemoryPageState:
|
||||
return cvars::clear_memory_page_state;
|
||||
case GPUSetting::ReadbackResolve:
|
||||
return cvars::readback_resolve;
|
||||
case GPUSetting::ReadbackMemexport:
|
||||
return cvars::readback_memexport;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
using namespace xe::gpu::xenos;
|
||||
|
||||
CommandProcessor::CommandProcessor(GraphicsSystem* graphics_system,
|
||||
|
||||
@@ -33,11 +33,14 @@ class ByteStream;
|
||||
|
||||
namespace gpu {
|
||||
|
||||
enum class CommonGPUSetting {
|
||||
enum class GPUSetting {
|
||||
ClearMemoryPageState,
|
||||
ReadbackResolve,
|
||||
ReadbackMemexport
|
||||
};
|
||||
|
||||
void CommonSaveGPUSetting(CommonGPUSetting setting, uint64_t value);
|
||||
void SaveGPUSetting(GPUSetting setting, uint64_t value);
|
||||
bool GetGPUSetting(GPUSetting setting);
|
||||
|
||||
class GraphicsSystem;
|
||||
class Shader;
|
||||
|
||||
@@ -32,19 +32,7 @@ DEFINE_bool(d3d12_bindless, true,
|
||||
"Use bindless resources where available - may improve performance, "
|
||||
"but may make debugging more complicated.",
|
||||
"D3D12");
|
||||
DEFINE_bool(d3d12_readback_memexport, false,
|
||||
"Read data written by memory export in shaders on the CPU. This "
|
||||
"may be needed in some games (but many only access exported data "
|
||||
"on the GPU, and this flag isn't needed to handle such behavior), "
|
||||
"but causes mid-frame synchronization, so it has a huge "
|
||||
"performance impact.",
|
||||
"D3D12");
|
||||
DEFINE_bool(d3d12_readback_resolve, false,
|
||||
"Read render-to-texture results on the CPU. This may be needed in "
|
||||
"some games, for instance, for screenshots in saved games, but "
|
||||
"causes mid-frame synchronization, so it has a huge performance "
|
||||
"impact.",
|
||||
"D3D12");
|
||||
|
||||
DEFINE_bool(d3d12_submit_on_primary_buffer_end, true,
|
||||
"Submit the command list when a PM4 primary buffer ends if it's "
|
||||
"possible to submit immediately to try to reduce frame latency.",
|
||||
@@ -54,15 +42,6 @@ DECLARE_bool(clear_memory_page_state);
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
void D3D12SaveGPUSetting(D3D12GPUSetting setting, uint64_t value) {
|
||||
switch (setting) {
|
||||
case D3D12GPUSetting::ReadbackResolve:
|
||||
OVERRIDE_bool(d3d12_readback_resolve, (bool)value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d3d12 {
|
||||
|
||||
// Generated with `xb buildshaders`.
|
||||
@@ -3011,7 +2990,7 @@ bool D3D12CommandProcessor::IssueDraw(xenos::PrimitiveType primitive_type,
|
||||
memexport_range.base_address_dwords << 2, memexport_range.size_bytes,
|
||||
false);
|
||||
}
|
||||
if (cvars::d3d12_readback_memexport) {
|
||||
if (GetGPUSetting(GPUSetting::ReadbackResolve)) {
|
||||
// Read the exported data on the CPU.
|
||||
uint32_t memexport_total_size = 0;
|
||||
for (const draw_util::MemExportRange& memexport_range :
|
||||
@@ -3091,7 +3070,7 @@ bool D3D12CommandProcessor::IssueCopy() {
|
||||
if (!BeginSubmission(true)) {
|
||||
return false;
|
||||
}
|
||||
if (!cvars::d3d12_readback_resolve) {
|
||||
if (!GetGPUSetting(GPUSetting::ReadbackResolve)) {
|
||||
uint32_t written_address, written_length;
|
||||
return render_target_cache_->Resolve(*memory_, *shared_memory_,
|
||||
*texture_cache_, written_address,
|
||||
|
||||
Reference in New Issue
Block a user