[D3D12] Code cleanup
This commit is contained in:
@@ -40,6 +40,12 @@ namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d12 {
|
||||
|
||||
constexpr uint32_t
|
||||
D3D12CommandProcessor::RootExtraParameterIndices::kUnavailable;
|
||||
constexpr uint32_t D3D12CommandProcessor::kSwapTextureWidth;
|
||||
constexpr uint32_t D3D12CommandProcessor::kSwapTextureHeight;
|
||||
constexpr uint32_t D3D12CommandProcessor::kScratchBufferSizeIncrement;
|
||||
|
||||
D3D12CommandProcessor::D3D12CommandProcessor(
|
||||
D3D12GraphicsSystem* graphics_system, kernel::KernelState* kernel_state)
|
||||
: CommandProcessor(graphics_system, kernel_state) {}
|
||||
|
||||
@@ -18,6 +18,11 @@ namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d12 {
|
||||
|
||||
constexpr uint32_t D3D12Shader::kMaxTextureSRVIndexBits;
|
||||
constexpr uint32_t D3D12Shader::kMaxTextureSRVs;
|
||||
constexpr uint32_t D3D12Shader::kMaxSamplerBindingIndexBits;
|
||||
constexpr uint32_t D3D12Shader::kMaxSamplerBindings;
|
||||
|
||||
D3D12Shader::D3D12Shader(ShaderType shader_type, uint64_t data_hash,
|
||||
const uint32_t* dword_ptr, uint32_t dword_count)
|
||||
: Shader(shader_type, data_hash, dword_ptr, dword_count) {}
|
||||
|
||||
@@ -24,6 +24,11 @@ namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d12 {
|
||||
|
||||
constexpr uint32_t PrimitiveConverter::kMaxNonIndexedVertices;
|
||||
constexpr uint32_t PrimitiveConverter::kStaticIBTriangleFanOffset;
|
||||
constexpr uint32_t PrimitiveConverter::kStaticIBTriangleFanCount;
|
||||
constexpr uint32_t PrimitiveConverter::kStaticIBTotalCount;
|
||||
|
||||
PrimitiveConverter::PrimitiveConverter(D3D12CommandProcessor* command_processor,
|
||||
RegisterFile* register_file,
|
||||
Memory* memory)
|
||||
|
||||
@@ -46,6 +46,9 @@ namespace d3d12 {
|
||||
#include "xenia/gpu/d3d12/shaders/dxbc/resolve_ps.h"
|
||||
#include "xenia/gpu/d3d12/shaders/dxbc/resolve_vs.h"
|
||||
|
||||
constexpr uint32_t RenderTargetCache::kHeap4MBPages;
|
||||
constexpr uint32_t RenderTargetCache::kRenderTargetDescriptorHeapSize;
|
||||
|
||||
const RenderTargetCache::EDRAMLoadStoreModeInfo
|
||||
RenderTargetCache::edram_load_store_mode_info_[size_t(
|
||||
RenderTargetCache::EDRAMLoadStoreMode::kCount)] = {
|
||||
@@ -79,7 +82,7 @@ bool RenderTargetCache::Initialize() {
|
||||
// Create the buffer for reinterpreting EDRAM contents.
|
||||
D3D12_RESOURCE_DESC edram_buffer_desc;
|
||||
ui::d3d12::util::FillBufferResourceDesc(
|
||||
edram_buffer_desc, kEDRAMBufferSize,
|
||||
edram_buffer_desc, GetEDRAMBufferSize(),
|
||||
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS);
|
||||
// The first operation will be a clear.
|
||||
edram_buffer_state_ = D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
|
||||
@@ -1094,7 +1097,7 @@ bool RenderTargetCache::ResolveCopy(SharedMemory* shared_memory,
|
||||
return false;
|
||||
}
|
||||
ui::d3d12::util::CreateRawBufferSRV(device, descriptor_cpu_start,
|
||||
edram_buffer_, kEDRAMBufferSize);
|
||||
edram_buffer_, GetEDRAMBufferSize());
|
||||
shared_memory->CreateRawUAV(
|
||||
provider->OffsetViewDescriptor(descriptor_cpu_start, 1));
|
||||
|
||||
@@ -1246,7 +1249,7 @@ bool RenderTargetCache::ResolveCopy(SharedMemory* shared_memory,
|
||||
0);
|
||||
|
||||
ui::d3d12::util::CreateRawBufferSRV(device, descriptor_cpu_start,
|
||||
edram_buffer_, kEDRAMBufferSize);
|
||||
edram_buffer_, GetEDRAMBufferSize());
|
||||
ui::d3d12::util::CreateRawBufferUAV(
|
||||
device, provider->OffsetViewDescriptor(descriptor_cpu_start, 1),
|
||||
copy_buffer, render_target->copy_buffer_size);
|
||||
@@ -1540,7 +1543,7 @@ bool RenderTargetCache::ResolveClear(uint32_t edram_base,
|
||||
command_list->SetComputeRoot32BitConstants(
|
||||
0, sizeof(root_constants) / sizeof(uint32_t), &root_constants, 0);
|
||||
ui::d3d12::util::CreateRawBufferUAV(device, descriptor_cpu_start,
|
||||
edram_buffer_, kEDRAMBufferSize);
|
||||
edram_buffer_, GetEDRAMBufferSize());
|
||||
command_list->SetComputeRootDescriptorTable(1, descriptor_gpu_start);
|
||||
// 1 group per 80x16 samples.
|
||||
command_list->Dispatch(row_width_ss_div_80, rows, 1);
|
||||
@@ -1722,7 +1725,7 @@ void RenderTargetCache::CreateEDRAMUint32UAV(
|
||||
desc.Format = DXGI_FORMAT_R32_UINT;
|
||||
desc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER;
|
||||
desc.Buffer.FirstElement = 0;
|
||||
desc.Buffer.NumElements = kEDRAMBufferSize / sizeof(uint32_t);
|
||||
desc.Buffer.NumElements = GetEDRAMBufferSize() / sizeof(uint32_t);
|
||||
desc.Buffer.StructureByteStride = 0;
|
||||
desc.Buffer.CounterOffsetInBytes = 0;
|
||||
desc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_NONE;
|
||||
@@ -1774,6 +1777,17 @@ DXGI_FORMAT RenderTargetCache::GetColorDXGIFormat(
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
uint32_t RenderTargetCache::GetEDRAMBufferSize() const {
|
||||
uint32_t size = 2048 * 5120;
|
||||
if (!command_processor_->IsROVUsedForEDRAM()) {
|
||||
// Two 10 MB pages, one containing color and integer depth data, another
|
||||
// with 32-bit float depth when 20e4 depth is used to allow for multipass
|
||||
// drawing without precision loss in case of EDRAM store/load.
|
||||
size *= 2;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
void RenderTargetCache::TransitionEDRAMBuffer(D3D12_RESOURCE_STATES new_state) {
|
||||
command_processor_->PushTransitionBarrier(edram_buffer_, edram_buffer_state_,
|
||||
new_state);
|
||||
@@ -2112,7 +2126,7 @@ void RenderTargetCache::StoreRenderTargetsToEDRAM() {
|
||||
copy_buffer_size);
|
||||
ui::d3d12::util::CreateRawBufferUAV(
|
||||
device, provider->OffsetViewDescriptor(descriptor_cpu_start, 1),
|
||||
edram_buffer_, kEDRAMBufferSize);
|
||||
edram_buffer_, GetEDRAMBufferSize());
|
||||
command_list->SetComputeRootDescriptorTable(1, descriptor_gpu_start);
|
||||
|
||||
// Sort the bindings in ascending order of EDRAM base so data in the render
|
||||
@@ -2264,7 +2278,7 @@ void RenderTargetCache::LoadRenderTargetsFromEDRAM(
|
||||
auto device = provider->GetDevice();
|
||||
command_list->SetComputeRootSignature(edram_load_store_root_signature_);
|
||||
ui::d3d12::util::CreateRawBufferSRV(device, descriptor_cpu_start,
|
||||
edram_buffer_, kEDRAMBufferSize);
|
||||
edram_buffer_, GetEDRAMBufferSize());
|
||||
ui::d3d12::util::CreateRawBufferUAV(
|
||||
device, provider->OffsetViewDescriptor(descriptor_cpu_start, 1),
|
||||
copy_buffer, copy_buffer_size);
|
||||
|
||||
@@ -390,6 +390,8 @@ class RenderTargetCache {
|
||||
uint32_t copy_buffer_size;
|
||||
};
|
||||
|
||||
uint32_t GetEDRAMBufferSize() const;
|
||||
|
||||
void TransitionEDRAMBuffer(D3D12_RESOURCE_STATES new_state);
|
||||
|
||||
void ClearBindings();
|
||||
@@ -460,10 +462,6 @@ class RenderTargetCache {
|
||||
|
||||
// The EDRAM buffer allowing color and depth data to be reinterpreted.
|
||||
ID3D12Resource* edram_buffer_ = nullptr;
|
||||
// Two 10 MB pages, one containing color and integer depth data, another with
|
||||
// 32-bit float depth when 20e4 depth is used to allow for multipass drawing
|
||||
// without precision loss in case of EDRAM store/load.
|
||||
static constexpr uint32_t kEDRAMBufferSize = 2 * 2048 * 5120;
|
||||
D3D12_RESOURCE_STATES edram_buffer_state_;
|
||||
bool edram_buffer_cleared_;
|
||||
|
||||
|
||||
@@ -32,6 +32,18 @@ namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d12 {
|
||||
|
||||
constexpr uint32_t SharedMemory::kBufferSizeLog2;
|
||||
constexpr uint32_t SharedMemory::kBufferSize;
|
||||
constexpr uint32_t SharedMemory::kAddressMask;
|
||||
constexpr uint32_t SharedMemory::kTileSizeLog2;
|
||||
constexpr uint32_t SharedMemory::kTileSize;
|
||||
constexpr uint32_t SharedMemory::kHeapSizeLog2;
|
||||
constexpr uint32_t SharedMemory::kHeapSize;
|
||||
constexpr uint32_t SharedMemory::kWatchBucketSizeLog2;
|
||||
constexpr uint32_t SharedMemory::kWatchBucketCount;
|
||||
constexpr uint32_t SharedMemory::kWatchRangePoolSize;
|
||||
constexpr uint32_t SharedMemory::kWatchNodePoolSize;
|
||||
|
||||
SharedMemory::SharedMemory(D3D12CommandProcessor* command_processor,
|
||||
Memory* memory)
|
||||
: command_processor_(command_processor), memory_(memory) {
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace d3d12 {
|
||||
#include "xenia/gpu/d3d12/shaders/dxbc/texture_tile_64bpp_cs.h"
|
||||
#include "xenia/gpu/d3d12/shaders/dxbc/texture_tile_8bpp_cs.h"
|
||||
|
||||
constexpr uint32_t TextureCache::LoadConstants::kGuestPitchTiled;
|
||||
|
||||
const TextureCache::HostFormat TextureCache::host_formats_[64] = {
|
||||
// k_1_REVERSE
|
||||
{DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN,
|
||||
|
||||
Reference in New Issue
Block a user