Skip to content

Commit 2dcd51c

Browse files
DeepMindcopybara-github
authored andcommitted
Add support to pass through a variety of gpu modes to the emulators.
PiperOrigin-RevId: 776583298
1 parent 0be7d50 commit 2dcd51c

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

android_env/components/config_classes.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Dataclass definitions used for instantiating AndroidEnv components."""
1717

1818
import dataclasses
19+
import enum
1920

2021

2122
@dataclasses.dataclass
@@ -79,6 +80,15 @@ class SimulatorConfig:
7980
interaction_rate_sec: float = 0.0
8081

8182

83+
@enum.unique
84+
class GPUMode(enum.Enum):
85+
"""Emulator GPU Mode."""
86+
87+
HOST = 'host'
88+
SWANGLE_INDIRECT = 'swangle_indirect'
89+
SWIFTSHADER_INDIRECT = 'swiftshader_indirect'
90+
91+
8292
@dataclasses.dataclass
8393
class EmulatorLauncherConfig:
8494
"""Config class for EmulatorLauncher."""
@@ -104,7 +114,7 @@ class EmulatorLauncherConfig:
104114
# GPU mode override.
105115
# Please see
106116
# https://developer.android.com/studio/run/emulator-acceleration#accel-graphics.
107-
gpu_mode: str = 'swangle_indirect' # Alternative: swiftshader_indirect, host
117+
gpu_mode: str = GPUMode.SWANGLE_INDIRECT.value
108118
# Whether to run in headless mode (i.e. without a graphical window).
109119
run_headless: bool = True
110120
# Whether to restrict network access.

0 commit comments

Comments
 (0)