@@ -314,6 +314,21 @@ def check_struct(struct_name, d):
314
314
if invalid_keys :
315
315
raise ValueError (f"Invalid keys in { struct_name } : { invalid_keys } " )
316
316
317
+ # forcing in the dynamic dx12 compiler to see if it works...
318
+ dxil_path = r"C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxil.dll"
319
+ dxc_path = r"C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxcompiler.dll"
320
+
321
+ _instance_extras = new_struct_p ("WGPUInstanceExtras *" ,
322
+ backends = 8 , #lib.WGPUInstanceBackend_DX12, #TODO: this isn't evaluated for importing or available in flags.py
323
+ dx12ShaderCompiler = lib .WGPUDx12Compiler_Dxc ,
324
+ dxilPath = to_c_string_view (dxil_path ),
325
+ dxcPath = to_c_string_view (dxc_path ),
326
+ dxcMaxShaderModel = lib .WGPUDxcMaxShaderModel_V6_7 ,
327
+ flags = 3 ,#lib.WGPUInstanceFlag_Debug, # figure out if this works or not.
328
+ )
329
+ _instance_extras .chain .sType = lib .WGPUSType_InstanceExtras
330
+ def get_wgpu_instance_dx12 ():
331
+ return get_wgpu_instance (extras = _instance_extras )
317
332
318
333
def _get_limits (id : int , device : bool = False , adapter : bool = False ):
319
334
"""Gets the limits for a device or an adapter"""
@@ -570,7 +585,7 @@ def finalizer(adapter_id):
570
585
)
571
586
572
587
# H: WGPUFuture f(WGPUInstance instance, WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo)
573
- libf .wgpuInstanceRequestAdapter (get_wgpu_instance (), struct , callback_info )
588
+ libf .wgpuInstanceRequestAdapter (get_wgpu_instance_dx12 (), struct , callback_info )
574
589
575
590
return awaitable
576
591
@@ -591,7 +606,7 @@ def _enumerate_adapters(self):
591
606
# The first call is to get the number of adapters, and the second call
592
607
# is to get the actual adapters. Note that the second arg (now NULL) can
593
608
# be a `WGPUInstanceEnumerateAdapterOptions` to filter by backend.
594
- instance = get_wgpu_instance ()
609
+ instance = get_wgpu_instance_dx12 ()
595
610
# H: size_t f(WGPUInstance instance, WGPUInstanceEnumerateAdapterOptions const * options, WGPUAdapter * adapters)
596
611
count = libf .wgpuInstanceEnumerateAdapters (instance , ffi .NULL , ffi .NULL )
597
612
adapters = new_array ("WGPUAdapter[]" , count )
0 commit comments