[D3D12] Switch from gflags to cvars
This commit is contained in:
@@ -9,19 +9,17 @@
|
||||
|
||||
#include "xenia/ui/d3d12/d3d12_context.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "xenia/base/cvar.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/gpu/gpu_flags.h"
|
||||
#include "xenia/ui/d3d12/d3d12_immediate_drawer.h"
|
||||
#include "xenia/ui/d3d12/d3d12_provider.h"
|
||||
#include "xenia/ui/window.h"
|
||||
|
||||
DEFINE_bool(d3d12_random_clear_color, false,
|
||||
"Randomize presentation back buffer clear color.");
|
||||
"Randomize presentation back buffer clear color.", "D3D12");
|
||||
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
@@ -267,7 +265,7 @@ void D3D12Context::BeginSwap() {
|
||||
graphics_command_list->OMSetRenderTargets(1, &back_buffer_rtv, TRUE,
|
||||
nullptr);
|
||||
float clear_color[4];
|
||||
if (FLAGS_d3d12_random_clear_color) {
|
||||
if (cvars::d3d12_random_clear_color) {
|
||||
clear_color[0] =
|
||||
rand() / float(RAND_MAX); // NOLINT(runtime/threadsafe_fn)
|
||||
clear_color[1] = 1.0f;
|
||||
@@ -303,7 +301,7 @@ void D3D12Context::EndSwap() {
|
||||
graphics_command_list->ResourceBarrier(1, &barrier);
|
||||
command_list->Execute();
|
||||
// Present and check if the context was lost.
|
||||
HRESULT result = swap_chain_->Present(FLAGS_vsync ? 1 : 0, 0);
|
||||
HRESULT result = swap_chain_->Present(0, 0);
|
||||
if (result == DXGI_ERROR_DEVICE_RESET ||
|
||||
result == DXGI_ERROR_DEVICE_REMOVED) {
|
||||
context_lost_ = true;
|
||||
|
||||
@@ -9,18 +9,19 @@
|
||||
|
||||
#include "xenia/ui/d3d12/d3d12_provider.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "xenia/base/cvar.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/ui/d3d12/d3d12_context.h"
|
||||
|
||||
DEFINE_bool(d3d12_debug, false, "Enable Direct3D 12 and DXGI debug layer.");
|
||||
DEFINE_bool(d3d12_debug, false, "Enable Direct3D 12 and DXGI debug layer.",
|
||||
"D3D12");
|
||||
DEFINE_int32(d3d12_adapter, -1,
|
||||
"Index of the DXGI adapter to use. "
|
||||
"-1 for any physical adapter, -2 for WARP software rendering.");
|
||||
"-1 for any physical adapter, -2 for WARP software rendering.",
|
||||
"D3D12");
|
||||
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
@@ -107,7 +108,7 @@ D3D12Provider::InitializationResult D3D12Provider::Initialize() {
|
||||
}
|
||||
|
||||
// Enable the debug layer.
|
||||
bool debug = FLAGS_d3d12_debug;
|
||||
bool debug = cvars::d3d12_debug;
|
||||
if (debug) {
|
||||
ID3D12Debug* debug_interface;
|
||||
if (SUCCEEDED(
|
||||
@@ -136,11 +137,11 @@ D3D12Provider::InitializationResult D3D12Provider::Initialize() {
|
||||
if (SUCCEEDED(adapter->GetDesc1(&adapter_desc))) {
|
||||
if (SUCCEEDED(pfn_d3d12_create_device_(adapter, D3D_FEATURE_LEVEL_11_0,
|
||||
_uuidof(ID3D12Device), nullptr))) {
|
||||
if (FLAGS_d3d12_adapter >= 0) {
|
||||
if (adapter_index == FLAGS_d3d12_adapter) {
|
||||
if (cvars::d3d12_adapter >= 0) {
|
||||
if (adapter_index == cvars::d3d12_adapter) {
|
||||
break;
|
||||
}
|
||||
} else if (FLAGS_d3d12_adapter == -2) {
|
||||
} else if (cvars::d3d12_adapter == -2) {
|
||||
if (adapter_desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user