shader_recompiler: Always mark buffers as storage buffers. (#2914)

This commit is contained in:
squidbus 2025-05-12 10:46:40 -07:00 committed by GitHub
parent 678f18ddb9
commit 8909d9bb89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -62,7 +62,14 @@ struct BufferResource {
}
bool IsStorage(const AmdGpu::Buffer& buffer, const Profile& profile) const noexcept {
return buffer.GetSize() > profile.max_ubo_size || is_written;
// When using uniform buffers, a size is required at compilation time, so we need to
// either compile a lot of shader specializations to handle each size or just force it to
// the maximum possible size always. However, for some vendors the shader-supplied size is
// used for bounds checking uniform buffer accesses, so the latter would effectively turn
// off buffer robustness behavior. Instead, force storage buffers which are bounds checked
// using the actual buffer size. We are assuming the performance hit from this is
// acceptable.
return true; // buffer.GetSize() > profile.max_ubo_size || is_written;
}
[[nodiscard]] constexpr AmdGpu::Buffer GetSharp(const Info& info) const noexcept;