113 {
114 DawnProcTable backendProcs = dawn::native::GetProcs();
115 dawnProcSetProcs(&backendProcs);
116
117 static constexpr const char* kAdapterToggles[] = {
118 "allow_unsafe_apis",
119 "use_user_defined_labels_in_backend",
120 };
121 wgpu::DawnTogglesDescriptor adapterTogglesDesc;
122 adapterTogglesDesc.enabledToggleCount =
std::size(kAdapterToggles);
123 adapterTogglesDesc.enabledToggles = kAdapterToggles;
124
125 wgpu::RequestAdapterOptions adapterOptions;
126 adapterOptions.backendType =
type;
127 adapterOptions.nextInChain = &adapterTogglesDesc;
128
129 std::vector<dawn::native::Adapter> adapters =
fInstance->EnumerateAdapters(&adapterOptions);
130 if (adapters.empty()) {
131 return nullptr;
132 }
133
134 wgpu::Adapter adapter = adapters[0].Get();
135
136 std::vector<wgpu::FeatureName> features;
137 features.push_back(wgpu::FeatureName::SurfaceCapabilities);
138 if (adapter.HasFeature(wgpu::FeatureName::MSAARenderToSingleSampled)) {
139 features.push_back(wgpu::FeatureName::MSAARenderToSingleSampled);
140 }
141 if (adapter.HasFeature(wgpu::FeatureName::TransientAttachments)) {
142 features.push_back(wgpu::FeatureName::TransientAttachments);
143 }
144 if (adapter.HasFeature(wgpu::FeatureName::Unorm16TextureFormats)) {
145 features.push_back(wgpu::FeatureName::Unorm16TextureFormats);
146 }
147 if (adapter.HasFeature(wgpu::FeatureName::DualSourceBlending)) {
148 features.push_back(wgpu::FeatureName::DualSourceBlending);
149 }
150 if (adapter.HasFeature(wgpu::FeatureName::FramebufferFetch)) {
151 features.push_back(wgpu::FeatureName::FramebufferFetch);
152 }
153 if (adapter.HasFeature(wgpu::FeatureName::BufferMapExtendedUsages)) {
154 features.push_back(wgpu::FeatureName::BufferMapExtendedUsages);
155 }
156 if (adapter.HasFeature(wgpu::FeatureName::TextureCompressionETC2)) {
157 features.push_back(wgpu::FeatureName::TextureCompressionETC2);
158 }
159 if (adapter.HasFeature(wgpu::FeatureName::TextureCompressionBC)) {
160 features.push_back(wgpu::FeatureName::TextureCompressionBC);
161 }
162 if (adapter.HasFeature(wgpu::FeatureName::R8UnormStorage)) {
163 features.push_back(wgpu::FeatureName::R8UnormStorage);
164 }
165 if (adapter.HasFeature(wgpu::FeatureName::DawnLoadResolveTexture)) {
166 features.push_back(wgpu::FeatureName::DawnLoadResolveTexture);
167 }
168
169 wgpu::DeviceDescriptor deviceDescriptor;
170 deviceDescriptor.requiredFeatures = features.data();
171 deviceDescriptor.requiredFeatureCount = features.size();
172 deviceDescriptor.deviceLostCallbackInfo.callback =
173 [](WGPUDeviceImpl *
const *, WGPUDeviceLostReason reason,
const char*
message,
void*) {
174 if (reason != WGPUDeviceLostReason_Destroyed &&
175 reason != WGPUDeviceLostReason_InstanceDropped) {
177 }
178 };
179
180 wgpu::DawnTogglesDescriptor deviceTogglesDesc;
181
183 static constexpr const char* kOptionalDeviceToggles[] = {
184 "disable_symbol_renaming",
185 };
186 deviceTogglesDesc.enabledToggleCount =
std::size(kOptionalDeviceToggles);
187 deviceTogglesDesc.enabledToggles = kOptionalDeviceToggles;
188
189
190
191 deviceTogglesDesc.nextInChain = deviceDescriptor.nextInChain;
192 deviceDescriptor.nextInChain = &deviceTogglesDesc;
193 }
194
195 auto device = adapter.CreateDevice(&deviceDescriptor);
197 return nullptr;
198 }
199
200 device.SetUncapturedErrorCallback(
201 [](WGPUErrorType
type,
const char*
message,
void*) {
204 },
205 nullptr);
207}
#define SK_ABORT(message,...)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
DisplayParams fDisplayParams
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size