2017-08-04 15:56:24 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-08-04 15:56:24 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-12-09 22:00:08 +00:00
|
|
|
#include <fmt/format.h>
|
|
|
|
#include <string>
|
|
|
|
|
2017-08-04 15:56:24 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2021-12-09 22:00:08 +00:00
|
|
|
|
2017-08-04 15:56:24 +00:00
|
|
|
#include "VideoCommon/ShaderGenCommon.h"
|
|
|
|
#include "VideoCommon/TextureDecoder.h"
|
|
|
|
|
|
|
|
enum class APIType;
|
|
|
|
|
2017-11-25 10:07:14 +00:00
|
|
|
namespace TextureConversionShaderGen
|
|
|
|
{
|
2017-08-04 15:56:24 +00:00
|
|
|
#pragma pack(1)
|
2017-11-25 10:07:14 +00:00
|
|
|
struct UidData
|
2017-08-04 15:56:24 +00:00
|
|
|
{
|
2017-11-25 10:07:14 +00:00
|
|
|
u32 NumValues() const { return sizeof(UidData); }
|
2017-08-04 15:56:24 +00:00
|
|
|
EFBCopyFormat dst_format;
|
|
|
|
|
|
|
|
u32 efb_has_alpha : 1;
|
|
|
|
u32 is_depth_copy : 1;
|
|
|
|
u32 is_intensity : 1;
|
|
|
|
u32 scale_by_half : 1;
|
2018-05-03 04:09:32 +00:00
|
|
|
u32 copy_filter : 1;
|
2017-08-04 15:56:24 +00:00
|
|
|
};
|
|
|
|
#pragma pack()
|
|
|
|
|
2017-11-25 10:07:14 +00:00
|
|
|
using TCShaderUid = ShaderUid<UidData>;
|
|
|
|
|
2019-02-15 01:59:50 +00:00
|
|
|
ShaderCode GenerateVertexShader(APIType api_type);
|
|
|
|
ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data);
|
2017-08-04 15:56:24 +00:00
|
|
|
|
2017-11-25 10:07:14 +00:00
|
|
|
TCShaderUid GetShaderUid(EFBCopyFormat dst_format, bool is_depth_copy, bool is_intensity,
|
2018-05-03 04:09:32 +00:00
|
|
|
bool scale_by_half, bool copy_filter);
|
2017-08-04 15:56:24 +00:00
|
|
|
|
2017-11-25 10:07:14 +00:00
|
|
|
} // namespace TextureConversionShaderGen
|
2021-12-09 22:00:08 +00:00
|
|
|
|
|
|
|
template <>
|
|
|
|
struct fmt::formatter<TextureConversionShaderGen::UidData>
|
|
|
|
{
|
|
|
|
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
|
|
|
|
template <typename FormatContext>
|
|
|
|
auto format(const TextureConversionShaderGen::UidData& uid, FormatContext& ctx)
|
|
|
|
{
|
|
|
|
std::string dst_format;
|
|
|
|
if (uid.dst_format == EFBCopyFormat::XFB)
|
|
|
|
dst_format = "XFB";
|
|
|
|
else
|
|
|
|
dst_format = fmt::to_string(uid.dst_format);
|
|
|
|
return format_to(ctx.out(),
|
|
|
|
"dst_format: {}, efb_has_alpha: {}, is_depth_copy: {}, is_intensity: {}, "
|
|
|
|
"scale_by_half: {}, copy_filter: {}",
|
|
|
|
dst_format, uid.efb_has_alpha, uid.is_depth_copy, uid.is_intensity,
|
|
|
|
uid.scale_by_half, uid.copy_filter);
|
|
|
|
}
|
|
|
|
};
|