Merge remote-tracking branch 'xenia-master/master' into canary_experimental

This commit is contained in:
Herman S.
2026-03-06 14:10:00 +09:00
65 changed files with 1497 additions and 2231 deletions

View File

@@ -71,76 +71,41 @@ namespace gpu {
const TextureCache::LoadShaderInfo
TextureCache::load_shader_info_[kLoadShaderCount] = {
// k8bpb
{3, 4, 1, 4},
// k16bpb
{4, 4, 2, 4},
// k32bpb
{4, 4, 4, 3},
// k64bpb
{4, 4, 8, 2},
// k128bpb
{4, 4, 16, 1},
// kR5G5B5A1ToB5G5R5A1
{4, 4, 2, 4},
// kR5G6B5ToB5G6R5
{4, 4, 2, 4},
// kR5G5B6ToB5G6R5WithRBGASwizzle
{4, 4, 2, 4},
// kRGBA4ToBGRA4
{4, 4, 2, 4},
// kRGBA4ToARGB4
{4, 4, 2, 4},
// kGBGR8ToGRGB8
{4, 4, 4, 3},
// kGBGR8ToRGB8
{4, 4, 8, 3},
// kBGRG8ToRGBG8
{4, 4, 4, 3},
// kBGRG8ToRGB8
{4, 4, 8, 3},
// kR10G11B11ToRGBA16
{4, 4, 8, 3},
// kR10G11B11ToRGBA16SNorm
{4, 4, 8, 3},
// kR11G11B10ToRGBA16
{4, 4, 8, 3},
// kR11G11B10ToRGBA16SNorm
{4, 4, 8, 3},
// kR16UNormToFloat
{4, 4, 2, 4},
// kR16SNormToFloat
{4, 4, 2, 4},
// kRG16UNormToFloat
{4, 4, 4, 3},
// kRG16SNormToFloat
{4, 4, 4, 3},
// kRGBA16UNormToFloat
{4, 4, 8, 2},
// kRGBA16SNormToFloat
{4, 4, 8, 2},
// kDXT1ToRGBA8
{4, 4, 4, 2},
// kDXT3ToRGBA8
{4, 4, 4, 1},
// kDXT5ToRGBA8
{4, 4, 4, 1},
// kDXNToRG8
{4, 4, 2, 1},
// kDXT3A
{4, 4, 1, 2},
// kDXT3AAs1111ToBGRA4
{4, 4, 2, 2},
// kDXT3AAs1111ToARGB4
{4, 4, 2, 2},
// kDXT5AToR8
{4, 4, 1, 2},
// kCTX1
{4, 4, 2, 2},
// kDepthUnorm
{4, 4, 4, 3},
// kDepthFloat
{4, 4, 4, 3},
{1, 4}, // k8bpb
{2, 4}, // k16bpb
{4, 3}, // k32bpb
{8, 2}, // k64bpb
{16, 1}, // k128bpb
{2, 4}, // kR5G5B5A1ToB5G5R5A1
{2, 4}, // kR5G6B5ToB5G6R5
{2, 4}, // kR5G5B6ToB5G6R5WithRBGASwizzle
{2, 4}, // kRGBA4ToBGRA4
{2, 4}, // kRGBA4ToARGB4
{4, 3}, // kGBGR8ToGRGB8
{8, 3}, // kGBGR8ToRGB8
{4, 3}, // kBGRG8ToRGBG8
{8, 3}, // kBGRG8ToRGB8
{8, 3}, // kR10G11B11ToRGBA16
{8, 3}, // kR10G11B11ToRGBA16SNorm
{8, 3}, // kR11G11B10ToRGBA16
{8, 3}, // kR11G11B10ToRGBA16SNorm
{2, 4}, // kR16UNormToFloat
{2, 4}, // kR16SNormToFloat
{4, 3}, // kRG16UNormToFloat
{4, 3}, // kRG16SNormToFloat
{8, 2}, // kRGBA16UNormToFloat
{8, 2}, // kRGBA16SNormToFloat
{4, 2}, // kDXT1ToRGBA8
{4, 1}, // kDXT3ToRGBA8
{4, 1}, // kDXT5ToRGBA8
{2, 1}, // kDXNToRG8
{1, 2}, // kDXT3A
{2, 2}, // kDXT3AAs1111ToBGRA4
{2, 2}, // kDXT3AAs1111ToARGB4
{1, 2}, // kDXT5AToR8
{2, 2}, // kCTX1
{4, 3}, // kDepthUnorm
{4, 3}, // kDepthFloat
};
TextureCache::TextureCache(const RegisterFile& register_file,
@@ -329,7 +294,7 @@ void TextureCache::MarkRangeAsResolved(uint32_t start_unscaled,
// Invalidate textures. Toggling individual textures between scaled and
// unscaled also relies on invalidation through shared memory.
shared_memory().RangeWrittenByGpu(start_unscaled, length_unscaled, true);
shared_memory().RangeWrittenByGpu(start_unscaled, length_unscaled);
}
uint32_t TextureCache::GuestToHostSwizzle(uint32_t guest_swizzle,
@@ -508,8 +473,6 @@ TextureCache::Texture::Texture(TextureCache& texture_cache,
: texture_cache_(texture_cache),
key_(key),
guest_layout_(key.GetGuestLayout()),
base_resolved_(key.scaled_resolve),
mips_resolved_(key.scaled_resolve),
last_usage_submission_index_(texture_cache.current_submission_index_),
last_usage_time_(texture_cache.current_submission_time_),
used_previous_(track_usage ? texture_cache.texture_used_last_ : nullptr),
@@ -767,21 +730,17 @@ void TextureCache::LoadTexturesData(Texture** textures, uint32_t n_textures) {
// portion of its pages is invalidated, in this case we'll need the texture
// from the shared memory to load the unscaled parts.
// TODO(Triang3l): Load unscaled parts.
bool base_resolved = texture.GetBaseResolved();
if (index_base_outdated & (1ULL << i)) {
if (!shared_memory().RequestRange(
texture_key.base_page << 12,
xe::align(texture.GetGuestBaseSize(), UINT32_C(16)),
texture_key.scaled_resolve ? nullptr : &base_resolved)) {
xe::align(texture.GetGuestBaseSize(), UINT32_C(16)))) {
continue;
}
}
bool mips_resolved = texture.GetMipsResolved();
if (index_mips_outdated & (1ULL << i)) {
if (!shared_memory().RequestRange(
texture_key.mip_page << 12,
xe::align(texture.GetGuestMipsSize(), UINT32_C(16)),
texture_key.scaled_resolve ? nullptr : &mips_resolved)) {
xe::align(texture.GetGuestMipsSize(), UINT32_C(16)))) {
continue;
}
}
@@ -807,13 +766,6 @@ void TextureCache::LoadTexturesData(Texture** textures, uint32_t n_textures) {
continue;
}
// Update the source of the texture (resolve vs. CPU or memexport) for
// purposes of handling piecewise gamma emulation via sRGB and for
// resolution scale in sampling offsets.
if (!texture_key.scaled_resolve) {
texture.SetBaseResolved(base_resolved);
texture.SetMipsResolved(mips_resolved);
}
// reque for makeuptodatandwatch
textures[i] = &texture;
}
@@ -870,21 +822,17 @@ bool TextureCache::LoadTextureData(Texture& texture) {
// its pages is invalidated, in this case we'll need the texture from the
// shared memory to load the unscaled parts.
// TODO(Triang3l): Load unscaled parts.
bool base_resolved = texture.GetBaseResolved();
if (base_outdated) {
if (!shared_memory().RequestRange(
texture_key.base_page << 12,
xe::align(texture.GetGuestBaseSize(), UINT32_C(16)),
texture_key.scaled_resolve ? nullptr : &base_resolved)) {
xe::align(texture.GetGuestBaseSize(), UINT32_C(16)))) {
return false;
}
}
bool mips_resolved = texture.GetMipsResolved();
if (mips_outdated) {
if (!shared_memory().RequestRange(
texture_key.mip_page << 12,
xe::align(texture.GetGuestMipsSize(), UINT32_C(16)),
texture_key.scaled_resolve ? nullptr : &mips_resolved)) {
xe::align(texture.GetGuestMipsSize(), UINT32_C(16)))) {
return false;
}
}
@@ -909,14 +857,6 @@ bool TextureCache::LoadTextureData(Texture& texture) {
return false;
}
// Update the source of the texture (resolve vs. CPU or memexport) for
// purposes of handling piecewise gamma emulation via sRGB and for resolution
// scale in sampling offsets.
if (!texture_key.scaled_resolve) {
texture.SetBaseResolved(base_resolved);
texture.SetMipsResolved(mips_resolved);
}
// Mark the ranges as uploaded and watch them. This is needed for scaled
// resolves as well to detect when the CPU wants to reuse the memory for a
// regular texture or a vertex buffer, and thus the scaled resolve version is