On Fri Jan 5 21:46:51 2024 +0000, Giovanni Mascellani wrote:
What about SQLite? AFAIK it is pure C, very permissing licensing, easy to embed and relatively small. It's possible that size-wise it's still a significant increase over vkd3d, but personally I'd still prefer a significant increase over having to deal with all the complications of doing a database right.
We don't need the SQL query machinery as the cache database is a simple key-value store. My systems libsqlite.so is about 1.5 mb vs a stripped vkd3d at 377kb. That said, I think Windows recently started shipping a build of sqlite itself. If we add this to Wine vkd3d could use externally provided sqlite in both a Unix and Win32 configuration.
(Interestingly msi.dll reimplements SQL queries itself, but msi has to support a bespoke file format anyway)
I also tried to identify Microsoft's shader cache format, hoping that they reused an existing database system. However, no file format identification tool I tried identified it.
We can change the format in the future. Our own cache can be thrown away, so we don't necessarily need to maintain backwards compatibility with existing files (although we can, if we want to). It's worth waiting and seeing how games will use ID3D12ShaderCacheSession. I don't think the API is meant to allow games to ship pre-created cache files and depending on their contents, but that hasn't stopped Windows applications before. If we run into this kind of situation we'll have to reverse engineer Microsoft's format anyway.