2016-01-08 03:40:35 +00:00
|
|
|
// Copyright 2011 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-02-01 15:56:13 +00:00
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
2016-06-24 11:14:10 +00:00
|
|
|
#include "VideoBackends/D3D12/D3DBase.h"
|
2017-04-04 13:55:36 +00:00
|
|
|
#include "VideoCommon/TextureConversionShader.h"
|
2017-04-04 12:52:48 +00:00
|
|
|
#include "VideoCommon/VideoCommon.h"
|
2016-01-08 03:40:35 +00:00
|
|
|
|
|
|
|
namespace DX12
|
|
|
|
{
|
2017-04-04 12:52:48 +00:00
|
|
|
class PSTextureEncoder final
|
2016-01-08 03:40:35 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
PSTextureEncoder();
|
2016-01-08 03:40:35 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
void Init();
|
|
|
|
void Shutdown();
|
2017-04-04 13:55:36 +00:00
|
|
|
void Encode(u8* dst, const EFBCopyFormat& format, u32 native_width, u32 bytes_per_row,
|
|
|
|
u32 num_blocks_y, u32 memory_stride, bool is_depth_copy, const EFBRectangle& src_rect,
|
|
|
|
bool scale_by_half);
|
2016-01-08 03:40:35 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-04 13:55:36 +00:00
|
|
|
D3D12_SHADER_BYTECODE GetEncodingPixelShader(const EFBCopyFormat& format);
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
bool m_ready = false;
|
2016-01-08 03:40:35 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
ID3D12Resource* m_out = nullptr;
|
|
|
|
D3D12_CPU_DESCRIPTOR_HANDLE m_out_rtv_cpu = {};
|
2016-01-08 03:40:35 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
ID3D12Resource* m_out_readback_buffer = nullptr;
|
2016-01-08 03:40:35 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
ID3D12Resource* m_encode_params_buffer = nullptr;
|
|
|
|
void* m_encode_params_buffer_data = nullptr;
|
2016-01-08 03:40:35 +00:00
|
|
|
|
2017-04-04 13:55:36 +00:00
|
|
|
std::map<EFBCopyFormat, D3D12_SHADER_BYTECODE> m_encoding_shaders;
|
|
|
|
std::vector<ID3DBlob*> m_shader_blobs;
|
2016-01-08 03:40:35 +00:00
|
|
|
};
|
|
|
|
}
|