Looking for advice on testing my code's portability

Using Vulkan as a hobbyist, I find myself worrying about whether the code I’m writing is actually portable. As useful as the validation layers are they can only really validate that the code works on this hardware with this OS in this environment. The problem is that I don’t know of a way of testing it on a large variety of hardware without a large budget.

For example, my Arc B580 reports it can handle 1x1 image extents. If I write code that tries to unconditionally make a 1x1 image, the validation layers can’t flag that because it can’t know if I checked minImageExtent properly. I can’t know my code is wrong until someone else tries to run my code on another card that, say, reports a minimum 8x8 image extent (as I believe my old GTX 1070 did).

I could of course get a bunch of hardware to test it in different setups (and I’m sure the teams that work on major engines do this), but that would add up to a lot of money and time spent (read: more than I have).

I’m wondering if there are tools that would allow you to simulate other hardware? In particular artificially narrowing acceptable ranges (like image extent, maxMemoryAllocationCount, etc.), reporting certain extensions as missing, pretending ReBAR is disabled, banning some image formats, etc.

Maybe this is related to your query? Vulkan-Profiles/layer/TUTORIAL.md at main · KhronosGroup/Vulkan-Profiles · GitHub

The Profiles Layer is a Vulkan layer that can modify the results of Vulkan PhysicalDevice queries based on a profiles file (JSON format), thus simulating some of the capabilities of a device by overriding the capabilities of the actual device under test.

You could use the profiles for different pieces of hardware and test it against your application to see if it is able to run if e.g. a certain extension is not available.