texture_cache: Fix depth pitch

This commit is contained in:
IndecisiveTurtle 2024-09-03 19:34:22 +03:00
parent e2b63bf4c8
commit 36a515f4ee
6 changed files with 7 additions and 5 deletions

View file

@ -536,7 +536,7 @@ void BufferCache::SynchronizeBuffer(Buffer& buffer, VAddr device_addr, u32 size,
}
bool BufferCache::SynchronizeBufferFromImage(Buffer& buffer, VAddr device_addr, u32 size) {
constexpr FindFlags flags = FindFlags::NoCreate | FindFlags::ExactSize | FindFlags::RelaxDim;
constexpr FindFlags flags = FindFlags::NoCreate | FindFlags::FullOverlap | FindFlags::RelaxDim;
ImageInfo info{};
info.guest_address = device_addr;
info.guest_size_bytes = size;

View file

@ -297,6 +297,7 @@ bool Instance::CreateDevice() {
.shaderFloat16 = vk12_features.shaderFloat16,
.scalarBlockLayout = vk12_features.scalarBlockLayout,
.uniformBufferStandardLayout = vk12_features.uniformBufferStandardLayout,
.separateDepthStencilLayouts = vk12_features.separateDepthStencilLayouts,
.hostQueryReset = vk12_features.hostQueryReset,
.timelineSemaphore = vk12_features.timelineSemaphore,
},

View file

@ -179,7 +179,7 @@ const ComputePipeline* PipelineCache::GetComputePipeline() {
}
bool ShouldSkipShader(u64 shader_hash, const char* shader_type) {
static constexpr std::array<u64, 0> skip_hashes = {};
static constexpr std::array<u64, 7> skip_hashes = {0x42f2a521, 0x2da7fe60, 0x8e3f8dc4, 0xa509af23, 0x4ca76892, 0xa954e79d, 0x1635154c};
if (std::ranges::contains(skip_hashes, shader_hash)) {
LOG_WARNING(Render_Vulkan, "Skipped {} shader hash {:#x}.", shader_type, shader_hash);
return true;

View file

@ -42,6 +42,7 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL DebugUtilsCallback(
switch (static_cast<u32>(callback_data->messageIdNumber)) {
case 0x609a13b: // Vertex attribute at location not consumed by shader
case 0xc81ad50e:
case 0xb7c39078:
case 0x92d66fc1: // `pMultisampleState is NULL` for depth only passes (confirmed VL error)
return VK_FALSE;
default:

View file

@ -187,7 +187,7 @@ ImageInfo::ImageInfo(const AmdGpu::Liverpool::DepthBuffer& buffer, u32 num_slice
size.width = hint.Valid() ? hint.width : buffer.Pitch();
size.height = hint.Valid() ? hint.height : buffer.Height();
size.depth = 1;
pitch = size.width;
pitch = buffer.Pitch();
resources.layers = num_slices;
meta_info.htile_addr = buffer.z_info.tile_surface_en ? htile_address : 0;
usage.depth_target = true;

View file

@ -38,12 +38,12 @@ TextureCache::TextureCache(const Vulkan::Instance& instance_, Vulkan::Scheduler&
TextureCache::~TextureCache() = default;
void TextureCache::InvalidateMemory(VAddr address, size_t size) {
static constexpr size_t MaxInvalidateDist = 512_MB;
static constexpr size_t MaxInvalidateDist = 128_MB;
std::unique_lock lock{mutex};
ForEachImageInRegion(address, size, [&](ImageId image_id, Image& image) {
const size_t image_dist =
image.cpu_addr > address ? image.cpu_addr - address : address - image.cpu_addr;
if (image_dist < MaxInvalidateDist) {
if (image_dist < MaxInvalidateDist && image.info.size.width != 1) {
// Ensure image is reuploaded when accessed again.
image.flags |= ImageFlagBits::CpuModified;
}