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"
|
2016-01-08 03:40:35 +00:00
|
|
|
#include "VideoBackends/D3D12/TextureEncoder.h"
|
|
|
|
|
|
|
|
namespace DX12
|
|
|
|
{
|
|
|
|
class PSTextureEncoder final : public TextureEncoder
|
|
|
|
{
|
|
|
|
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();
|
|
|
|
void Encode(u8* dst, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y,
|
2016-12-26 19:54:37 +00:00
|
|
|
u32 memory_stride, bool is_depth_copy, const EFBRectangle& src_rect,
|
2016-06-24 08:43:46 +00:00
|
|
|
bool is_intensity, bool scale_by_half);
|
2016-01-08 03:40:35 +00:00
|
|
|
|
|
|
|
private:
|
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
|
|
|
|
2016-12-26 19:54:37 +00:00
|
|
|
D3D12_SHADER_BYTECODE SetStaticShader(unsigned int dst_format, bool is_depth_copy,
|
2016-06-24 08:43:46 +00:00
|
|
|
bool is_intensity, bool scale_by_half);
|
2016-01-08 03:40:35 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
using ComboKey = unsigned int; // Key for a shader combination
|
2016-12-26 19:54:37 +00:00
|
|
|
static ComboKey MakeComboKey(unsigned int dst_format, bool is_depth_copy, bool is_intensity,
|
|
|
|
bool scale_by_half)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
2016-12-26 19:54:37 +00:00
|
|
|
return (dst_format << 4) | (is_depth_copy << 2) | (is_intensity ? (1 << 1) : 0) |
|
2016-06-24 08:43:46 +00:00
|
|
|
(scale_by_half ? (1 << 0) : 0);
|
|
|
|
}
|
2016-01-08 03:40:35 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
using ComboMap = std::map<ComboKey, D3D12_SHADER_BYTECODE>;
|
|
|
|
ComboMap m_static_shaders_map;
|
|
|
|
std::vector<ID3DBlob*> m_static_shaders_blobs;
|
2016-01-08 03:40:35 +00:00
|
|
|
};
|
|
|
|
}
|