Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions wgpu/backends/rs.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,24 @@ def request_adapter(self, *, canvas, power_preference=None):
else:
surface_id = get_surface_id_from_canvas(canvas)

# Force Vulkan on Windows, to avoid DX12 which seems to ignore
# the NVidia control panel settings. I guess Vulkan is more
# mature than Metal too, so let's just force that for now.
# Try to read the WGPU_BACKEND_TYPE environment variable to see
# if a backend should be forced. When you run into trouble with
# the automatic selection of wgpu, you can use this variable
# to force a specific backend. For instance, on Windows you
# might want to force Vulkan, to avoid DX12 which seems to ignore
# the NVidia control panel settings.
# See https://github.com/gfx-rs/wgpu/issues/1416
# force_backend = lib.WGPUBackendType_Vulkan
force_backend = enum_str2int["BackendType"]["Vulkan"]
force_backend = enum_str2int["BackendType"]["Null"]
if "WGPU_BACKEND_TYPE" in os.environ:
try:
backend = os.environ["WGPU_BACKEND_TYPE"]
force_backend = enum_str2int["BackendType"][backend]
logger.warn(f"Forcing backend: {backend} ({force_backend})")
except KeyError:
logger.warn(
f"Invalid value for WGPU_BACKEND_TYPE: '{backend}'.\n"
f"Valid values are: {list(enum_str2int['BackendType'].keys())}"
)

# H: chain: WGPUChainedStruct, backend: WGPUBackendType
extras = new_struct_p(
Expand Down