I want to give others (@giomasce and @zfigura in particular) a chance to comment/review this as well, but broadly I think this is in decent shape. Still a couple of comments though:
+/* Strip __attribute__((ms_abi)) defined in vkd3d_windows.h as dxcompiler does not use it. */ +cpp_quote("#ifdef __x86_64__") +cpp_quote("# pragma push_macro(\"__stdcall\")") +cpp_quote("# undef __stdcall") +cpp_quote("# define __stdcall") +cpp_quote("#endif")
I don't think the explanation here is terribly clear. If my understanding is correct, the issue is that the Linux version of dxcompiler uses sysv_abi for these interfaces, while vkd3d uses ms_abi for its COM interfaces. (Do the 32-bit calling conventions match? Or does dxcompiler just not support 32-bit builds?) The Windows version of dxcompiler does use the ms_abi calling convention, right? Provided that's all correct, could you update the comment to say something to that effect?
I'm not sure I like moving the minimum/maximum shader model handling entirely into shader_runner.c, but there's something to so for it, so I'll wait for other opinions. If we do go that way there's really no point in keeping d3d9_runner_check_requirements() though, or introducing d3d12_runner_check_requirements(). The latter doesn't seem quite correct regardless.
+#ifdef _WIN32 +static const char dxcompiler_name[] = "dxcompiler.dll"; +#else +static const char dxcompiler_name[] = "libdxcompiler.so"; +#endif
Not quite a blocker, but I'd prefer having a SONAME_LIBDXCOMPILER for this, much like how shader_runner_vulkan.c uses SONAME_LIBVULKAN.
+HRESULT dxcompiler_compile_shader(enum shader_type type, const char *hlsl, ID3D10Blob **blob_out, + ID3D10Blob **errors_out) +{ ... + if (!(dll = vkd3d_dlopen(dxcompiler_name))) + { + trace("Failed to load dxcompiler library, %s.\n", vkd3d_dlerror()); + return E_FAIL; + } + create_instance = (DxcCreateInstanceProc)vkd3d_dlsym(dll, "DxcCreateInstance");
That adds loading the dll and "DxcCreateInstance" to each invocation of dxcompiler_compile_shader(). That's probably not the end of the world, but it might be better to do that in the START_TEST block, particularly since this patch already introduces a "vkd3d_dlopen(dxcompiler_name)" there anyway.
else if (match_directive_substring(src, "notimpl", &src)) { - *expect_hr = E_NOTIMPL; + if (runner->minimum_shader_model < SHADER_MODEL_6_0) + *expect_hr = E_NOTIMPL; } else {
There are probably few enough of these that we could make that "notimpl(sm<6)".