d3d10umd, meson: Allow naming d3d10umd DLLs

For graphics drivers on windows it is beneficial to have usermode DLLs
names matching driver overall name, example being vm3dum_10.dll and
nvwgf2um.dll for d3d10 usermode drivers from VMWare and Nvidia.

To implement that new meson option `gallium-d3d10-dll-name` that
names the resulting d3d10umd target DLL is introduced. Additionaly,
to avoid confusion `gallium-dll-name` is renamed to `gallium-wgl-dll-name`
as it corresponds to the name used in wgl target.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27416>
This commit is contained in:
Max R 2024-02-01 16:14:48 +03:00 committed by Marge Bot
parent 5ae2b4882a
commit 67da5a8f08
6 changed files with 30 additions and 22 deletions

View File

@ -177,13 +177,21 @@ option(
)
option(
'gallium-windows-dll-name',
'gallium-wgl-dll-name',
type : 'string',
value : 'libgallium_wgl',
description : 'name of gallium megadriver DLL built for Windows. ' +
description : 'name of gallium wgl target DLL built for Windows. ' +
'defaults to libgallium_wgl.dll to match DRI',
)
option(
'gallium-d3d10-dll-name',
type : 'string',
value : 'libgallium_d3d10',
description : 'name of gallium d3d10 target DLL built for Windows. ' +
'defaults to libgallium_d3d10.dll to match DRI',
)
option(
'opencl-spirv',
type : 'boolean',

View File

@ -1,15 +1,14 @@
The resulting d3d10sw.dll implements D3D10's software rendering interface, like
WARP.
When compiled with `gallium-driver=llvmpipe` or `gallium-driver=softpipe` the resulting libgallium_d3d10.dll implements D3D10's software rendering interface, like WARP.
It can be used directly from WLK 1.6 and WHCK 2.0 D3D10+ tests, via the -Src
and -SWDLL options. For example:
wgf11blend.exe -Debug -DoNotCatchExceptions -DXGI:1.1 -FeatureLevel:10.0 -Src:SW -SWDLL:d3d10sw.dll -LogClean -LogVerbose
wgf11blend.exe -Debug -DoNotCatchExceptions -DXGI:1.1 -FeatureLevel:10.0 -Src:SW -SWDLL:libgallium_d3d10.dll -LogClean -LogVerbose
However, as of WHCK version 2.1 this mechanism no longer works reliably.
Either you use WHCK 2.0 binaries, or you must use the alternative method
cribed below (of copying d3d10sw.dll into the executable directory and rename
described below (of copying libgallium_d3d10.dll into the executable directory and rename
it such that it matches the D3D10 UMD of the test machine).
@ -17,7 +16,7 @@ Examples can be easily modified to load it too:
D3D10CreateDeviceAndSwapChain(NULL,
D3D10_DRIVER_TYPE_SOFTWARE,
LoadLibraryA("d3d10sw"), /* Software */
LoadLibraryA("libgallium_d3d10"), /* Software */
Flags,
D3D10_SDK_VERSION,
&SwapChainDesc,
@ -26,7 +25,7 @@ Examples can be easily modified to load it too:
D3D11CreateDeviceAndSwapChain(NULL, /* pAdapter */
D3D_DRIVER_TYPE_SOFTWARE,
LoadLibraryA("d3d10sw"), /* Software */
LoadLibraryA("libgallium_d3d10"), /* Software */
Flags,
FeatureLevels,
sizeof FeatureLevels / sizeof FeatureLevels[0],

View File

@ -19,17 +19,18 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
d3d10_sw_def = custom_target(
'd3d10_sw.def',
input: 'd3d10_sw.def.in',
output : 'd3d10_sw.def',
libgallium_d3d10_def = custom_target(
'd3d10.def',
input: 'd3d10.def.in',
output : 'd3d10.def',
command : gen_vs_module_defs_normal_command,
)
libd3d10sw = shared_library(
'd3d10sw',
gallium_d3d10_name = get_option('gallium-d3d10-dll-name')
libgallium_d3d10 = shared_library(
gallium_d3d10_name,
['d3d10_gdi.c'],
vs_module_defs : d3d10_sw_def,
vs_module_defs : libgallium_d3d10_def,
include_directories : [
inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_d3d10umd, inc_gallium_winsys, inc_gallium_winsys_sw, inc_gallium_drivers, inc_winddk
],
@ -40,20 +41,20 @@ libd3d10sw = shared_library(
dependencies : [
dep_ws2_32, idep_nir, driver_swrast
],
name_prefix : '', # otherwise mingw will create libd3d10sw.dll
name_prefix: '',
install : true,
)
if with_tests
test(
'd3d10sw',
'd3d10',
executable(
'test_d3d10sw',
'test_d3d10',
files('tests/tri.cpp'),
cpp_args : [cpp_msvc_compat_args],
dependencies : [cpp.find_library('d3d11')],
link_with : [libd3d10sw],
link_with : [libgallium_d3d10],
),
suite : ['d3d10sw'],
suite : ['d3d10'],
)
endif

View File

@ -96,7 +96,7 @@ main(int argc, char *argv[])
D3D_FEATURE_LEVEL_10_0
};
HMODULE hSoftware = LoadLibraryA("d3d10sw.dll");
HMODULE hSoftware = LoadLibraryA("libgallium_d3d10.dll");
if (!hSoftware) {
return EXIT_FAILURE;
}

View File

@ -28,7 +28,7 @@ wgl_def = custom_target(
command : gen_vs_module_defs_normal_command,
)
gallium_wgl_name = get_option('gallium-windows-dll-name')
gallium_wgl_name = get_option('gallium-wgl-dll-name')
libgallium_wgl = shared_library(
gallium_wgl_name,
['wgl.c'],