D3D12: Implement non-blocking EFB access when EFB has not been modified

This commit is contained in:
Stenzek
2016-02-21 17:18:02 +10:00
parent 6bbf836ea9
commit 1d909ec7a4
4 changed files with 279 additions and 227 deletions

View File

@ -61,11 +61,7 @@ public:
~FramebufferManager();
static D3DTexture2D*& GetEFBColorTexture();
static ID3D12Resource*& GetEFBColorStagingBuffer();
static D3DTexture2D*& GetEFBDepthTexture();
static D3DTexture2D*& GetEFBDepthReadTexture();
static ID3D12Resource*& GetEFBDepthStagingBuffer();
static D3DTexture2D*& GetResolvedEFBColorTexture();
static D3DTexture2D*& GetResolvedEFBDepthTexture();
@ -74,6 +70,17 @@ public:
static void ResolveDepthTexture();
// Access EFB from CPU
static u32 ReadEFBColorAccessCopy(u32 x, u32 y);
static float ReadEFBDepthAccessCopy(u32 x, u32 y);
static void UpdateEFBColorAccessCopy(u32 x, u32 y, u32 color);
static void UpdateEFBDepthAccessCopy(u32 x, u32 y, float depth);
static void InitializeEFBAccessCopies();
static void MapEFBColorAccessCopy();
static void MapEFBDepthAccessCopy();
static void InvalidateEFBAccessCopies();
static void DestroyEFBAccessCopies();
private:
std::unique_ptr<XFBSourceBase> CreateXFBSource(unsigned int target_width, unsigned int target_height, unsigned int layers) override;
void GetTargetSize(unsigned int* width, unsigned int* height) override;
@ -83,18 +90,24 @@ private:
static struct Efb
{
D3DTexture2D* color_tex;
ID3D12Resource* color_staging_buf;
D3DTexture2D* depth_tex;
ID3D12Resource* depth_staging_buf;
D3DTexture2D* depth_read_texture;
D3DTexture2D* color_temp_tex;
D3DTexture2D* resolved_color_tex;
D3DTexture2D* resolved_depth_tex;
D3DTexture2D* color_access_resize_tex;
ID3D12Resource* color_access_readback_buffer;
u8* color_access_readback_map;
u32 color_access_readback_pitch;
D3DTexture2D* depth_access_resize_tex;
ID3D12Resource* depth_access_readback_buffer;
u8* depth_access_readback_map;
u32 depth_access_readback_pitch;
int slices;
} m_efb;