Strange SPIR-V error messages during vkCreateDevice

The following happens only on one of my machines: a notebook that has a GeForce GTX 965M and an Intel HD 530. No matter which one of these two physical devices I chose, I get the same three error messages from the validation layers:

Id[7060244|UNASSIGNED-CoreValidation-Shader-InconsistentSpirv], Message[Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x21702cc5bf8, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Vulkan spec doesn’t allow BuiltIn VertexId/InstanceId to be used.
%gl_VertexID = OpVariable %_ptr_Input_int Input]

and messages 2 and 3 are actually the same message (but I get it twice):

Id[7060244|UNASSIGNED-CoreValidation-Shader-InconsistentSpirv], Message[Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x21702cc5bf8, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: In the Vulkan environment, the OriginLowerLeft execution mode must not be used.
OpExecutionMode %main OriginLowerLeft]

They originate from the call to vkCreateDevice. What is this? Why do they occur? I’ve even disabled/removed any requested device features, required extensions, and even the queue create info.

Drivers for both, NVIDIA and Intel, are up to date. It happens for all Vulkan 1.2 SDK versions. (Didn’t test with older SDKs)

If that’s really the case, if you’re not ever actually compiling a shader module, then it’s likely that some layer is misbehaving.

Yes, I don’t create shader modules up to this point where I get the validation error.

I guess, KhronosGroup/ Vulkan-ValidationLayers is the right place to file a bug report in this case, so I’ll go ahead and do that.

I wouldn’t suspect the validation layers to cause those problems, esp. as they don’t load any shaders. It’s more likely that this is caused by an implicit layers. Those are getting installed without your consent by lots of applications like Steam, Epic Store, MSI Afterburner, etc. So first thing to do is to disable all implicit layers and see if the problem persists.

Lol, interesting! On the PC I’m currently working on, I have a bunch of implicit layers activated:

SteamFossilizeVulkanLayer64.json
SteamOverlayVulkanLayer64.json
VK_LAYER_NV_GPU_Trace_release_public_2020_1_1.json
VK_LAYER_NV_nomad_release_public_2020_1_1.json

But I’ll have to check if that is also the case on the notebook.

Is it sufficient to delete all entries under HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ImplicitLayers on Windows to get rid of all implicit layers? Can I programmatically query which layers are active at runtime?

Do not mess with registry. Go to the json, and use the disable safeword that is mentioned therein. Add to env something like set DISABLE_WHATEVER = 1.

Can I programmatically query which layers are active at runtime?

Yes. Pretty early on Device layers were deprecated. That means vkEnumerateDeviceLayers now instead returns all layers that are enabled.

You were completely right with your assumption! I had two implicit layers: one from Nsight and another one from Steam: SteamOverlayVulkanLayer64.json. The latter causes the validation errors during vkCreateDevice. Disabling it – I just messed around in the registry ¯\_(ツ)_/¯ – and leaving only the Nsight implicit layer results in no more validation errors during vkCreateDevice.

Yea, usual offender; not sure why it even runs on non-steam apps. I have updated the json itself to be disabled by default. So far it survived across Steam updates.