Skip to content

Commit

Permalink
vk_compute_pipeline: Add missing meta check
Browse files Browse the repository at this point in the history
  • Loading branch information
polybiusproxy committed Oct 30, 2024
1 parent 7794fc3 commit 1620481
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
19 changes: 17 additions & 2 deletions src/video_core/renderer_vulkan/vk_compute_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,33 @@ bool ComputePipeline::BindResources(VideoCore::BufferCache& buffer_cache,
// we can skip the whole dispatch and update the tracked state instead. Also, it is not
// intended to be consumed and in such rare cases (e.g. HTile introspection, CRAA) we
// will need its full emulation anyways. For cases of metadata read a warning will be logged.
for (const auto& desc : info->texture_buffers) {
const auto IsMetaUpdate = [&](const auto& desc) {
const VAddr address = desc.GetSharp(*info).base_address;
if (desc.is_written) {
if (texture_cache.TouchMeta(address, true)) {
LOG_TRACE(Render_Vulkan, "Metadata update skipped");
return false;
return true;
}
} else {
if (texture_cache.IsMeta(address)) {
LOG_WARNING(Render_Vulkan, "Unexpected metadata read by a CS shader (buffer)");
}
}
return false;
};

for (const auto& desc : info->buffers) {
if (desc.is_gds_buffer) {
continue;
}
if (IsMetaUpdate(desc)) {
return false;
}
}
for (const auto& desc : info->texture_buffers) {
if (IsMetaUpdate(desc)) {
return false;
}
}

BindBuffers(buffer_cache, texture_cache, *info, binding, push_data, set_writes,
Expand Down
2 changes: 1 addition & 1 deletion src/video_core/texture_cache/texture_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ ImageId TextureCache::FindImage(const ImageInfo& info, FindFlags flags) {
!IsVulkanFormatCompatible(info.pixel_format, cache_image.info.pixel_format)) {
continue;
}
ASSERT(cache_image.info.type == info.type || True(flags & FindFlags::RelaxFmt));
ASSERT((cache_image.info.type == info.type || info.size == Extent3D{1, 1, 1} || True(flags & FindFlags::RelaxFmt)));
image_id = cache_id;
}

Expand Down
4 changes: 4 additions & 0 deletions src/video_core/texture_cache/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ struct Extent3D {
u32 depth;

auto operator<=>(const Extent3D&) const = default;

bool operator==(const Extent3D& other) const {
return width == other.width && height == other.height && depth == other.depth;
}
};

struct SubresourceLayers {
Expand Down

0 comments on commit 1620481

Please sign in to comment.