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.

I am finding this same problem with my windows vulkan implementation.
Except, the error message is evident when trying to create a compute shader pipeline.

UNASSIGNED-CoreValidation-Shader-InconsistentSpirv(ERROR / SPEC): msgNum: 7060244 - Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x1ec99bd0180, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Invalid storage class operand: 3452816845
Objects: 1
[0] 0x1ec99bd0180, type: 3, name: NULL

Is this related to the same problem?

I am using glslc.exe to compile glsl into spirv, and no errors turn up from that system call during runtime. I ensured spirv was written to an empty file, and extracted both spirv data and spirv byte count from the file for the vulkan shader module constructor (which completes successfully), but an error only turns up when i attempt to create compute shader pipeline, which then crashes the program.

The glslc command is :

VulkanSDK\1.2.135.0\Bin32\glslc.exe shader.comp -o shader.spv

Both files are empty prior to writing to them.

The build environment is in visual studio. I tested it both in the vs environment, and as an executable.

As mentioned, i am not sure if this is related to the same layer interference problem (I have also disabled implicit layers but this was not the solution to this experience). Thus I can initiate discussion in another thread, if need be.

Might be. Use vkEnumerateDeviceLayers to find out which implicit layers got enabled.
Then go to the json of the layer to find out the safeword, and use that to disable it.

If no layers are running, then it is obviously something in your code\shader.