[D3D12] Minor FINE_GRAINED_DRAW_SCOPES refactoring

This commit is contained in:
Triang3l 2020-10-04 21:49:10 +03:00
parent e0916be5cd
commit 81ee7b4c39
7 changed files with 24 additions and 24 deletions

View File

@ -1798,9 +1798,9 @@ bool D3D12CommandProcessor::IssueDraw(xenos::PrimitiveType primitive_type,
auto device = GetD3D12Context().GetD3D12Provider().GetDevice();
auto& regs = *register_file_;
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
xenos::ModeControl enable_mode = regs.Get<reg::RB_MODECONTROL>().edram_mode;
if (enable_mode == xenos::ModeControl::kIgnore) {
@ -2336,9 +2336,9 @@ void D3D12CommandProcessor::InitializeTrace() {
void D3D12CommandProcessor::FinalizeTrace() {}
bool D3D12CommandProcessor::IssueCopy() {
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
BeginSubmission(true);
uint32_t written_address, written_length;
if (!render_target_cache_->Resolve(*memory_, *shared_memory_, *texture_cache_,
@ -2472,9 +2472,9 @@ void D3D12CommandProcessor::CheckSubmissionFence(uint64_t await_submission) {
}
void D3D12CommandProcessor::BeginSubmission(bool is_guest_command) {
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
bool is_opening_frame = is_guest_command && !frame_open_;
if (submission_open_ && !is_opening_frame) {
@ -2741,9 +2741,9 @@ void D3D12CommandProcessor::ClearCommandAllocatorCache() {
void D3D12CommandProcessor::UpdateFixedFunctionState(bool primitive_two_faced) {
auto& regs = *register_file_;
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_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
@ -2911,9 +2911,9 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
const RenderTargetCache::PipelineRenderTarget render_targets[4]) {
auto& regs = *register_file_;
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
auto pa_cl_clip_cntl = regs.Get<reg::PA_CL_CLIP_CNTL>();
auto pa_cl_vte_cntl = regs.Get<reg::PA_CL_VTE_CNTL>();
@ -3513,9 +3513,9 @@ bool D3D12CommandProcessor::UpdateBindings(
auto device = provider.GetDevice();
auto& regs = *register_file_;
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
// Set the new root signature.
if (current_graphics_root_signature_ != root_signature) {

View File

@ -931,9 +931,9 @@ bool PipelineCache::ConfigurePipeline(
const RenderTargetCache::PipelineRenderTarget render_targets[5],
void** pipeline_state_handle_out,
ID3D12RootSignature** root_signature_out) {
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
assert_not_null(pipeline_state_handle_out);
assert_not_null(root_signature_out);

View File

@ -223,9 +223,9 @@ PrimitiveConverter::ConversionResult PrimitiveConverter::ConvertPrimitives(
return ConversionResult::kConversionNotNeeded;
}
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
// Exit early for clearly empty draws, without even reading the memory.
uint32_t index_count_min;

View File

@ -606,9 +606,9 @@ bool RenderTargetCache::UpdateRenderTargets(const D3D12Shader* pixel_shader) {
const auto& regs = register_file_;
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
auto rb_surface_info = regs.Get<reg::RB_SURFACE_INFO>();
uint32_t surface_pitch = std::min(rb_surface_info.surface_pitch, 2560u);

View File

@ -1179,9 +1179,9 @@ void TextureCache::EndFrame() {
void TextureCache::RequestTextures(uint32_t used_texture_mask) {
const auto& regs = register_file_;
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_f("gpu");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
if (texture_invalidated_.exchange(false, std::memory_order_acquire)) {
// Clear the bindings not only for this draw call, but entirely, because
@ -1418,12 +1418,12 @@ void TextureCache::WriteActiveTextureBindfulSRV(
}
auto device = provider.GetDevice();
{
#if FINE_GRAINED_DRAW_SCOPES
#if XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
SCOPE_profile_cpu_i(
"gpu",
"xe::gpu::d3d12::TextureCache::WriteActiveTextureBindfulSRV->"
"CopyDescriptorsSimple");
#endif // FINE_GRAINED_DRAW_SCOPES
#endif // XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES
device->CopyDescriptorsSimple(1, handle, source_handle,
D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
}

View File

@ -16,8 +16,6 @@
#include "xenia/ui/d3d12/d3d12_provider.h"
#include "xenia/ui/graphics_context.h"
#define FINE_GRAINED_DRAW_SCOPES 1
namespace xe {
namespace ui {
namespace d3d12 {

View File

@ -15,6 +15,8 @@
#include "xenia/ui/d3d12/d3d12_api.h"
#include "xenia/ui/graphics_provider.h"
#define XE_UI_D3D12_FINE_GRAINED_DRAW_SCOPES 1
namespace xe {
namespace ui {
namespace d3d12 {