[jak 2] ETIE (#2326)

Definitely needs a clean up pass, but I think the functionality is very
close.

There's a few "hacks" still:
- I am using the emerc logic for environment mapping, which doesn't care
about the length of the normals. I can't figure out how the normal
scaling worked in etie. I want to do a little bit more experimentation
with this before merging.
- There is some part about adgifs for TIE and ETIE that I don't
understand. The clearly correct behavior of TIE/ETIE is that the alpha
settings from the adgif shader are overwritten by the settings from the
renderer. But I can't figure out how this happens in all cases.
- Fade out is completely disabled. I think this is fine because the
performance difference isn't bad. But if you are comparing screenshots
with PCSX2, it will make things look a tiny bit different.
This commit is contained in:
water111
2023-03-17 20:35:26 -04:00
committed by GitHub
parent 6670124296
commit 2fa4a23ea1
41 changed files with 9101 additions and 858 deletions
+4 -1
View File
@@ -16,7 +16,8 @@ void TextureDB::add_texture(u32 tpage,
u16 h,
const std::string& tex_name,
const std::string& tpage_name,
const std::vector<std::string>& level_names) {
const std::vector<std::string>& level_names,
u32 num_mips) {
auto existing_tpage_name = tpage_names.find(tpage);
if (existing_tpage_name == tpage_names.end()) {
tpage_names[tpage] = tpage_name;
@@ -32,6 +33,7 @@ void TextureDB::add_texture(u32 tpage,
ASSERT(existing_tex->second.h == h);
ASSERT(existing_tex->second.rgba_bytes == data);
ASSERT(existing_tex->second.page == tpage);
ASSERT(existing_tex->second.num_mips == num_mips);
} else {
auto& new_tex = textures[combo_id];
new_tex.rgba_bytes = data;
@@ -39,6 +41,7 @@ void TextureDB::add_texture(u32 tpage,
new_tex.w = w;
new_tex.h = h;
new_tex.page = tpage;
new_tex.num_mips = num_mips;
}
for (const auto& level_name : level_names) {
texture_ids_per_level[level_name].insert(combo_id);
+3 -1
View File
@@ -15,6 +15,7 @@ struct TextureDB {
std::string name;
u32 page;
std::vector<u32> rgba_bytes;
u32 num_mips = -1;
};
std::unordered_map<u32, TextureData> textures;
@@ -28,7 +29,8 @@ struct TextureDB {
u16 h,
const std::string& tex_name,
const std::string& tpage_name,
const std::vector<std::string>& level_names);
const std::vector<std::string>& level_names,
u32 num_mips);
void replace_textures(const fs::path& path);
};
+6 -6
View File
@@ -537,7 +537,7 @@ TPageResultStats process_tpage(ObjectFileData& data,
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
tex.w, tex.h);
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
texture_page.name, level_names);
texture_page.name, level_names, tex.num_mips);
stats.successful_textures++;
} else if (tex.psm == int(PSM::PSMT8) && tex.clutpsm == int(CPSM::PSMCT16)) {
// will store output pixels, rgba (8888)
@@ -580,7 +580,7 @@ TPageResultStats process_tpage(ObjectFileData& data,
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
tex.w, tex.h);
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
texture_page.name, level_names);
texture_page.name, level_names, tex.num_mips);
stats.successful_textures++;
} else if (tex.psm == int(PSM::PSMCT16) && tex.clutpsm == 0) {
// not a clut.
@@ -605,7 +605,7 @@ TPageResultStats process_tpage(ObjectFileData& data,
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
tex.w, tex.h);
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
texture_page.name, level_names);
texture_page.name, level_names, tex.num_mips);
stats.successful_textures++;
} else if (tex.psm == int(PSM::PSMT4) && tex.clutpsm == int(CPSM::PSMCT16)) {
// will store output pixels, rgba (8888)
@@ -646,7 +646,7 @@ TPageResultStats process_tpage(ObjectFileData& data,
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
tex.w, tex.h);
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
texture_page.name, level_names);
texture_page.name, level_names, tex.num_mips);
stats.successful_textures++;
} else if (tex.psm == int(PSM::PSMT4) && tex.clutpsm == int(CPSM::PSMCT32)) {
// will store output pixels, rgba (8888)
@@ -687,7 +687,7 @@ TPageResultStats process_tpage(ObjectFileData& data,
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
tex.w, tex.h);
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
texture_page.name, level_names);
texture_page.name, level_names, tex.num_mips);
stats.successful_textures++;
} else if (tex.psm == int(PSM::PSMCT32) && tex.clutpsm == 0) {
// not a clut.
@@ -712,7 +712,7 @@ TPageResultStats process_tpage(ObjectFileData& data,
file_util::write_rgba_png(texture_dump_dir / fmt::format("{}.png", tex.name), out.data(),
tex.w, tex.h);
texture_db.add_texture(texture_page.id, tex_id, out, tex.w, tex.h, tex.name,
texture_page.name, level_names);
texture_page.name, level_names, tex.num_mips);
stats.successful_textures++;
}