| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <functional> |
| 7 |
#include "Common/CommonTypes.h" |
| 8 |
#include "VideoCommon/ShaderGenCommon.h" |
| 9 |
|
| 10 |
enum class APIType; |
| 11 |
|
| 12 |
namespace UberShader |
| 13 |
{ |
| 14 |
#pragma pack(1) |
| 15 |
struct pixel_ubershader_uid_data |
| 16 |
{ |
| 17 |
u32 num_texgens : 4; |
| 18 |
u32 early_depth : 1; |
| 19 |
u32 per_pixel_depth : 1; |
| 20 |
u32 uint_output : 1; |
| 21 |
u32 no_dual_src : 1; |
| 22 |
|
| 23 |
u32 NumValues() const { return sizeof(pixel_ubershader_uid_data); } |
| 24 |
}; |
| 25 |
#pragma pack() |
| 26 |
|
| 27 |
using PixelShaderUid = ShaderUid<pixel_ubershader_uid_data>; |
| 28 |
|
| 29 |
PixelShaderUid GetPixelShaderUid(); |
| 30 |
|
| 31 |
ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config, |
| 32 |
const pixel_ubershader_uid_data* uid_data); |
| 33 |
|
| 34 |
void EnumeratePixelShaderUids(const std::function<void(const PixelShaderUid&)>& callback); |
| 35 |
void ClearUnusedPixelShaderUidBits(APIType api_type, const ShaderHostConfig& host_config, |
| 36 |
PixelShaderUid* uid); |
| 37 |
} |
| 38 |
|
| 39 |
template <> |
| 40 |
struct fmt::formatter<UberShader::pixel_ubershader_uid_data> |
| 41 |
{ |
| 42 |
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } |
| 43 |
template <typename FormatContext> |
| 44 |
auto format(const UberShader::pixel_ubershader_uid_data& uid, FormatContext& ctx) const |
| 45 |
{ |
| 46 |
return fmt::format_to( |
| 47 |
ctx.out(), "Pixel UberShader for {} texgens{}{}{}{}", uid.num_texgens, |
| 48 |
uid.early_depth ? ", early-depth" : "", uid.per_pixel_depth ? ", per-pixel depth" : "", |
| 49 |
uid.uint_output ? ", uint output" : "", uid.no_dual_src ? ", no dual-source blending" : ""); |
| 50 |
} |
| 51 |
}; |