mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-23 04:16:57 +02:00
add agc ver 13
This commit is contained in:
+3
-2
@@ -25,6 +25,7 @@
|
||||
#include "libs/libs.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
@@ -142,8 +143,8 @@ struct RegisterDefaultsStorage {
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
static constexpr uint32_t GRAPHICS_REGISTER_DEFAULTS_MAX_VERSION = 12;
|
||||
static constexpr uint32_t GRAPHICS_REGISTER_DEFAULTS_FALLBACK_VERSION = 11;
|
||||
static constexpr uint32_t GRAPHICS_REGISTER_DEFAULTS_MAX_VERSION = 13;
|
||||
static constexpr uint32_t GRAPHICS_REGISTER_DEFAULTS_FALLBACK_VERSION = 13;
|
||||
static constexpr uint32_t GRAPHICS_INIT_NO_FEATURE_STATE = 0;
|
||||
|
||||
static std::mutex g_register_defaults_mutex;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// No-feature, non-0x840f00 AgcGetRegisterDefaults2 dispatch, versions 0..12.
|
||||
// No-feature, non-0x840f00 AgcGetRegisterDefaults2 dispatch, versions 0..13.
|
||||
// Type entries keep the pointer index in bits 0..9; higher bits are AGC flags.
|
||||
|
||||
// g_agc_internal_reg_defaults_v0: regs=(1, 12, 0, 4), ptrs=(1, 12, 0, 2), types=15.
|
||||
@@ -185,6 +185,45 @@ static CompactRegisterDefaults g_agc_internal_reg_defaults_v11 = {
|
||||
g_agc_internal_reg_defaults_v11_types, 24,
|
||||
};
|
||||
|
||||
// Version 13 takes the version-11 fallback and selects the >=13 state-0 lookup bank.
|
||||
// Only two internal table-1 values differ in that bank.
|
||||
static auto g_agc_internal_reg_defaults_v13_tbl1_regs = [] {
|
||||
constexpr auto count = sizeof(g_agc_internal_reg_defaults_v11_tbl1_regs) /
|
||||
sizeof(g_agc_internal_reg_defaults_v11_tbl1_regs[0]);
|
||||
std::array<ShaderRegister, count> regs {};
|
||||
std::copy_n(g_agc_internal_reg_defaults_v11_tbl1_regs, count, regs.begin());
|
||||
|
||||
for (auto& reg: regs) {
|
||||
if (reg.offset == 0x0081) {
|
||||
reg.value = 0x00000001;
|
||||
} else if (reg.offset == 0x0101) {
|
||||
reg.value = 0x00000003;
|
||||
}
|
||||
}
|
||||
return regs;
|
||||
}();
|
||||
|
||||
static CompactRegisterDefaults g_agc_internal_reg_defaults_v13 = {
|
||||
g_agc_internal_reg_defaults_v11_tbl0_regs,
|
||||
8,
|
||||
g_agc_internal_reg_defaults_v11_tbl0_ptrs,
|
||||
8,
|
||||
g_agc_internal_reg_defaults_v13_tbl1_regs.data(),
|
||||
12,
|
||||
g_agc_internal_reg_defaults_v11_tbl1_ptrs,
|
||||
12,
|
||||
g_agc_internal_reg_defaults_v11_tbl2_regs,
|
||||
1,
|
||||
g_agc_internal_reg_defaults_v11_tbl2_ptrs,
|
||||
1,
|
||||
g_agc_internal_reg_defaults_v11_tbl3_regs,
|
||||
6,
|
||||
g_agc_internal_reg_defaults_v11_tbl3_ptrs,
|
||||
3,
|
||||
g_agc_internal_reg_defaults_v11_types,
|
||||
24,
|
||||
};
|
||||
|
||||
// g_agc_internal_reg_defaults_v4: regs=(2, 15, 0, 4), ptrs=(2, 15, 0, 2), types=19.
|
||||
static ShaderRegister g_agc_internal_reg_defaults_v4_tbl0_regs[] = {
|
||||
{0x02af, 0x00040000},
|
||||
@@ -1366,8 +1405,28 @@ static uint32_t g_agc_public_reg_defaults_v11_types[] = {
|
||||
0x036ac8a6, 0x000c0452, 0x00000000,
|
||||
};
|
||||
|
||||
template <std::size_t Size>
|
||||
static std::array<ShaderRegister, Size>
|
||||
make_v11_plus_public_tbl0(const ShaderRegister (&source)[Size]) {
|
||||
std::array<ShaderRegister, Size> regs {};
|
||||
std::copy_n(source, Size, regs.begin());
|
||||
|
||||
for (auto& reg: regs) {
|
||||
if (reg.offset == 0x0201) {
|
||||
reg.value |= 0x00010000;
|
||||
}
|
||||
}
|
||||
return regs;
|
||||
}
|
||||
|
||||
// The common setup helper forces this table-0 patch for every version >= 11.
|
||||
static auto g_agc_public_reg_defaults_v11_tbl0_effective =
|
||||
make_v11_plus_public_tbl0(g_agc_public_reg_defaults_v11_tbl0_regs);
|
||||
static auto g_agc_public_reg_defaults_v12_tbl0_effective =
|
||||
make_v11_plus_public_tbl0(g_agc_public_reg_defaults_v10_tbl0_regs);
|
||||
|
||||
static CompactRegisterDefaults g_agc_public_reg_defaults_v11 = {
|
||||
g_agc_public_reg_defaults_v11_tbl0_regs,
|
||||
g_agc_public_reg_defaults_v11_tbl0_effective.data(),
|
||||
488,
|
||||
g_agc_public_reg_defaults_v11_tbl0_ptrs,
|
||||
84,
|
||||
@@ -1387,6 +1446,27 @@ static CompactRegisterDefaults g_agc_public_reg_defaults_v11 = {
|
||||
137,
|
||||
};
|
||||
|
||||
static CompactRegisterDefaults g_agc_public_reg_defaults_v12 = {
|
||||
g_agc_public_reg_defaults_v12_tbl0_effective.data(),
|
||||
482,
|
||||
g_agc_public_reg_defaults_v10_tbl0_ptrs,
|
||||
79,
|
||||
g_agc_public_reg_defaults_v10_tbl1_regs,
|
||||
159,
|
||||
g_agc_public_reg_defaults_v10_tbl1_ptrs,
|
||||
29,
|
||||
g_agc_public_reg_defaults_v10_tbl2_regs,
|
||||
55,
|
||||
g_agc_public_reg_defaults_v10_tbl2_ptrs,
|
||||
20,
|
||||
nullptr,
|
||||
0,
|
||||
nullptr,
|
||||
0,
|
||||
g_agc_public_reg_defaults_v10_types,
|
||||
128,
|
||||
};
|
||||
|
||||
// g_agc_public_reg_defaults_v4: regs=(488, 158, 43, 0), ptrs=(80, 28, 42, 0), types=150.
|
||||
static ShaderRegister g_agc_public_reg_defaults_v4_tbl0_regs[] = {
|
||||
{0x0202, 0x00cc0010}, {0x0109, 0x00000008}, {0x0104, 0x00000000}, {0x008f, 0x00000000},
|
||||
@@ -2825,7 +2905,8 @@ static CompactRegisterDefaults* g_agc_public_reg_defaults_by_version[] = {
|
||||
&g_agc_public_reg_defaults_v9, // version 9
|
||||
&g_agc_public_reg_defaults_v10, // version 10
|
||||
&g_agc_public_reg_defaults_v11, // version 11
|
||||
&g_agc_public_reg_defaults_v10, // version 12
|
||||
&g_agc_public_reg_defaults_v12, // version 12
|
||||
&g_agc_public_reg_defaults_v11, // version 13: v11 fallback with the >=13 state-0 bank
|
||||
};
|
||||
|
||||
static CompactRegisterDefaults* g_agc_internal_reg_defaults_by_version[] = {
|
||||
@@ -2842,4 +2923,5 @@ static CompactRegisterDefaults* g_agc_internal_reg_defaults_by_version[] = {
|
||||
&g_agc_internal_reg_defaults_v10, // version 10
|
||||
&g_agc_internal_reg_defaults_v11, // version 11
|
||||
&g_agc_internal_reg_defaults_v10, // version 12
|
||||
&g_agc_internal_reg_defaults_v13, // version 13
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user