VideoBackends: Support updated texture encoding shader generators

This commit is contained in:
Stenzek
2017-04-04 23:55:36 +10:00
parent 3847e226ab
commit e9850aa0f2
20 changed files with 194 additions and 279 deletions

View File

@ -9,6 +9,7 @@
#include "Common/CommonTypes.h"
#include "VideoBackends/D3D12/D3DBase.h"
#include "VideoCommon/TextureConversionShader.h"
#include "VideoCommon/VideoCommon.h"
namespace DX12
@ -20,11 +21,13 @@ public:
void Init();
void Shutdown();
void Encode(u8* dst, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y,
u32 memory_stride, bool is_depth_copy, const EFBRectangle& src_rect,
bool is_intensity, bool scale_by_half);
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);
private:
D3D12_SHADER_BYTECODE GetEncodingPixelShader(const EFBCopyFormat& format);
bool m_ready = false;
ID3D12Resource* m_out = nullptr;
@ -35,19 +38,7 @@ private:
ID3D12Resource* m_encode_params_buffer = nullptr;
void* m_encode_params_buffer_data = nullptr;
D3D12_SHADER_BYTECODE SetStaticShader(unsigned int dst_format, bool is_depth_copy,
bool is_intensity, bool scale_by_half);
using ComboKey = unsigned int; // Key for a shader combination
static ComboKey MakeComboKey(unsigned int dst_format, bool is_depth_copy, bool is_intensity,
bool scale_by_half)
{
return (dst_format << 4) | (is_depth_copy << 2) | (is_intensity ? (1 << 1) : 0) |
(scale_by_half ? (1 << 0) : 0);
}
using ComboMap = std::map<ComboKey, D3D12_SHADER_BYTECODE>;
ComboMap m_static_shaders_map;
std::vector<ID3DBlob*> m_static_shaders_blobs;
std::map<EFBCopyFormat, D3D12_SHADER_BYTECODE> m_encoding_shaders;
std::vector<ID3DBlob*> m_shader_blobs;
};
}