[D3D12] Clear present back buffer, more profiling scopes, remove logging in shared memory
This commit is contained in:
parent
bf0f20df9b
commit
8d6b75418d
|
@ -884,6 +884,10 @@ void D3D12CommandProcessor::UpdateFixedFunctionState(
|
|||
ID3D12GraphicsCommandList* command_list) {
|
||||
auto& regs = *register_file_;
|
||||
|
||||
#if FINE_GRAINED_DRAW_SCOPES
|
||||
SCOPE_profile_cpu_f("gpu");
|
||||
#endif // FINE_GRAINED_DRAW_SCOPES
|
||||
|
||||
// Window parameters.
|
||||
// http://ftp.tku.edu.tw/NetBSD/NetBSD-current/xsrc/external/mit/xf86-video-ati/dist/src/r600_reg_auto_r6xx.h
|
||||
// See r200UpdateWindow:
|
||||
|
@ -1025,6 +1029,11 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
|||
Endian index_endian,
|
||||
const RenderTargetCache::PipelineRenderTarget render_targets[4]) {
|
||||
auto& regs = *register_file_;
|
||||
|
||||
#if FINE_GRAINED_DRAW_SCOPES
|
||||
SCOPE_profile_cpu_f("gpu");
|
||||
#endif // FINE_GRAINED_DRAW_SCOPES
|
||||
|
||||
uint32_t vgt_indx_offset = regs[XE_GPU_REG_VGT_INDX_OFFSET].u32;
|
||||
uint32_t pa_cl_vte_cntl = regs[XE_GPU_REG_PA_CL_VTE_CNTL].u32;
|
||||
uint32_t pa_cl_clip_cntl = regs[XE_GPU_REG_PA_CL_CLIP_CNTL].u32;
|
||||
|
@ -1190,6 +1199,10 @@ bool D3D12CommandProcessor::UpdateBindings(
|
|||
auto device = provider->GetDevice();
|
||||
auto& regs = *register_file_;
|
||||
|
||||
#if FINE_GRAINED_DRAW_SCOPES
|
||||
SCOPE_profile_cpu_f("gpu");
|
||||
#endif // FINE_GRAINED_DRAW_SCOPES
|
||||
|
||||
// Bind the new root signature.
|
||||
if (current_graphics_root_signature_ != root_signature) {
|
||||
current_graphics_root_signature_ = root_signature;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/memory.h"
|
||||
#include "xenia/base/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
@ -126,7 +127,10 @@ bool SharedMemory::RequestRange(uint32_t start, uint32_t length,
|
|||
return false;
|
||||
}
|
||||
uint32_t last = start + length - 1;
|
||||
// XELOGGPU("Shared memory: Range %.8X-%.8X is being used", start, last);
|
||||
|
||||
#if FINE_GRAINED_DRAW_SCOPES
|
||||
SCOPE_profile_cpu_f("gpu");
|
||||
#endif // FINE_GRAINED_DRAW_SCOPES
|
||||
|
||||
// Ensure all tile heaps are present.
|
||||
if (FLAGS_d3d12_tiled_resources) {
|
||||
|
@ -188,10 +192,6 @@ bool SharedMemory::RequestRange(uint32_t start, uint32_t length,
|
|||
uint32_t upload_range_start = upload_range.first;
|
||||
uint32_t upload_range_length = upload_range.second;
|
||||
while (upload_range_length != 0) {
|
||||
XELOGGPU(
|
||||
"Shared memory: Uploading %.8X:%.8X",
|
||||
upload_range_start << page_size_log2_,
|
||||
((upload_range_start + upload_range_length) << page_size_log2_) - 1);
|
||||
ID3D12Resource* upload_buffer;
|
||||
uint32_t upload_buffer_offset, upload_buffer_size;
|
||||
uint8_t* upload_buffer_mapping = upload_buffer_pool_->RequestPartial(
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/profiling.h"
|
||||
#include "xenia/gpu/d3d12/d3d12_command_processor.h"
|
||||
#include "xenia/gpu/texture_info.h"
|
||||
#include "xenia/gpu/texture_util.h"
|
||||
|
@ -253,6 +254,10 @@ void TextureCache::RequestTextures(uint32_t used_vertex_texture_mask,
|
|||
}
|
||||
auto& regs = *register_file_;
|
||||
|
||||
#if FINE_GRAINED_DRAW_SCOPES
|
||||
SCOPE_profile_cpu_f("gpu");
|
||||
#endif // FINE_GRAINED_DRAW_SCOPES
|
||||
|
||||
// Update the texture keys and the textures.
|
||||
uint32_t used_texture_mask =
|
||||
used_vertex_texture_mask | used_pixel_texture_mask;
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
|
||||
#include "xenia/ui/d3d12/d3d12_context.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/gpu/gpu_flags.h"
|
||||
|
@ -16,6 +20,9 @@
|
|||
#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.");
|
||||
|
||||
namespace xe {
|
||||
namespace ui {
|
||||
namespace d3d12 {
|
||||
|
@ -244,7 +251,7 @@ void D3D12Context::BeginSwap() {
|
|||
}
|
||||
}
|
||||
|
||||
// Make the back buffer a render target.
|
||||
// Bind the back buffer as a render target and clear it.
|
||||
auto command_list = swap_command_lists_[current_queue_frame_].get();
|
||||
auto graphics_command_list = command_list->BeginRecording();
|
||||
D3D12_RESOURCE_BARRIER barrier;
|
||||
|
@ -256,10 +263,23 @@ void D3D12Context::BeginSwap() {
|
|||
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_PRESENT;
|
||||
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
graphics_command_list->ResourceBarrier(1, &barrier);
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE back_buffer_rtv = GetSwapChainBackBufferRTV();
|
||||
graphics_command_list->OMSetRenderTargets(1, &back_buffer_rtv, TRUE,
|
||||
nullptr);
|
||||
float clear_color[4];
|
||||
if (FLAGS_d3d12_random_clear_color) {
|
||||
clear_color[0] =
|
||||
rand() / float(RAND_MAX); // NOLINT(runtime/threadsafe_fn)
|
||||
clear_color[1] = 1.0f;
|
||||
clear_color[2] = 0.0f;
|
||||
} else {
|
||||
clear_color[0] = 238.0f / 255.0f;
|
||||
clear_color[1] = 238.0f / 255.0f;
|
||||
clear_color[2] = 238.0f / 255.0f;
|
||||
}
|
||||
clear_color[3] = 1.0f;
|
||||
graphics_command_list->ClearRenderTargetView(back_buffer_rtv, clear_color,
|
||||
0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue