Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit261bad6

Browse files
committed
replace adapter properties with info
1 parent08e816d commit261bad6

File tree

8 files changed

+35
-29
lines changed

8 files changed

+35
-29
lines changed

‎Demos/DemoBoids/main.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let vertexData = [
3131
letinstance=createInstance()
3232

3333
letadapter=tryawait instance.requestAdapter()
34-
print("Using adapter:\(adapter.properties.name??"Unknown")")
34+
print("Using adapter:\(adapter.info.device)")
3535

3636
letdevice=tryawait adapter.requestDevice()
3737

‎Demos/DemoClearColor/main.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import WindowUtils
44
letinstance=createInstance()
55

66
letadapter=tryawait instance.requestAdapter()
7-
print("Using adapter:\(adapter.properties.name??"Unknown")")
7+
print("Using adapter:\(adapter.info.device)")
88

99
letdevice=tryawait adapter.requestDevice()
1010

‎Demos/DemoCube/main.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct Camera {
1010
letinstance=createInstance()
1111

1212
letadapter=tryawait instance.requestAdapter()
13-
print("Using adapter:\(adapter.properties.name??"Unknown")")
13+
print("Using adapter:\(adapter.info.device)")
1414

1515
letdevice=tryawait adapter.requestDevice()
1616

‎Demos/DemoInfo/main.swift‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ print()
1111
print(title:"Adapters (\(adapters.count))")
1212
withIndent{
1313
for(i, adapter)in adapters.enumerated(){
14-
letproperties= adapter.properties
14+
letinfo= adapter.info
1515

16-
print(subtitle:"[\(i)]\(properties.name??"Unknown")")
16+
print(subtitle:"[\(i)]\(info.device)")
1717
withIndent{
18-
iflet description= properties.driverDescription, !description.isEmpty{
19-
print(description)
20-
}
21-
print(key:"vendorId", value:hex(properties.vendorId))
22-
print(key:"deviceId", value:hex(properties.deviceId))
23-
print(key:"adapterType", value:properties.adapterType)
24-
print(key:"backendType", value:properties.backendType)
18+
print(info.description)
19+
print(key:"vendor", value: info.vendor)
20+
print(key:"vendorId", value:hex(info.vendorId))
21+
print(key:"deviceId", value:hex(info.deviceId))
22+
print(key:"adapterType", value:info.adapterType)
23+
print(key:"backendType", value:info.backendType)
24+
print(key:"architecture", value:info.architecture)
2525
}
2626
print()
2727
}

‎Demos/DemoTriangle/main.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct Vertex {
99
letinstance=createInstance()
1010

1111
letadapter=tryawait instance.requestAdapter()
12-
print("Using adapter:\(adapter.properties.name??"Unknown")")
12+
print("Using adapter:\(adapter.info.device)")
1313

1414
letdevice=tryawait adapter.requestDevice()
1515

‎Sources/CDawnNative/dawn_native.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ WGPUAdapter dawnNativeAdapterGet(DawnNativeAdapter cAdapter) {
4242
return adapter->Get();
4343
}
4444

45-
voiddawnNativeAdapterGetProperties(DawnNativeAdapter cAdapter,WGPUAdapterProperties* properties) {
45+
WGPUStatusdawnNativeAdapterGetInfo(DawnNativeAdapter cAdapter,WGPUAdapterInfo* info) {
4646
auto adapter =reinterpret_cast<dawn::native::Adapter*>(cAdapter);
47-
adapter->GetProperties(reinterpret_cast<wgpu::AdapterProperties*>(properties));
47+
returnWGPUStatus(adapter->GetInfo(info));
4848
}
4949

5050
WGPUDevicedawnNativeAdapterCreateDevice(DawnNativeInstance cAdapter) {

‎Sources/CDawnNative/include/dawn_native.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void dawnNativeInstanceEnumerateAdapters(DawnNativeInstance instance, size_t* ad
1212
voiddawnNativeInstanceRelease(DawnNativeInstanceinstance);
1313

1414
WGPUAdapterdawnNativeAdapterGet(DawnNativeAdapteradapter);
15-
voiddawnNativeAdapterGetProperties(DawnNativeAdapteradapter,WGPUAdapterProperties*properties);
15+
WGPUStatusdawnNativeAdapterGetInfo(DawnNativeAdapteradapter,WGPUAdapterInfo*info);
1616
WGPUDevicedawnNativeAdapterCreateDevice(DawnNativeInstanceadapter);
1717
voiddawnNativeAdapterRelease(DawnNativeAdapteradapter);
1818

‎Sources/DawnNative/DawnNative.swift‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,25 @@ public class Adapter {
5252
returnWebGPU.Adapter(handle: object!)
5353
}
5454

55-
publicvarproperties:AdapterProperties{
56-
varcProps=WGPUAdapterProperties()
57-
dawnNativeAdapterGetProperties(self.adapter,&cProps)
58-
returnAdapterProperties(
59-
vendorId: cProps.vendorID,
60-
vendorName:String(cString: cProps.vendorName),
61-
architecture:String(cString: cProps.architecture),
62-
deviceId: cProps.deviceID,
63-
name:String(cString: cProps.name),
64-
driverDescription:String(cString: cProps.driverDescription),
65-
adapterType:AdapterType(rawValue: cProps.adapterType.rawValue)!,
66-
backendType:BackendType(rawValue: cProps.backendType.rawValue)!
67-
)
55+
publicvarinfo:AdapterInfo{
56+
varcInfo=WGPUAdapterInfo()
57+
dawnNativeAdapterGetInfo(self.adapter,&cInfo)
58+
59+
func convertString(_ cString:WGPUStringView)->String{
60+
letbytes=UnsafeRawBufferPointer(start: cString.data, count: cString.length)
61+
returnString(decoding: bytes, as:UTF8.self)
62+
}
63+
64+
returnAdapterInfo(
65+
vendor:convertString(cInfo.vendor),
66+
architecture:convertString(cInfo.architecture),
67+
device:convertString(cInfo.device),
68+
description:convertString(cInfo.description),
69+
backendType:BackendType(rawValue: cInfo.backendType.rawValue)!,
70+
adapterType:AdapterType(rawValue: cInfo.adapterType.rawValue)!,
71+
vendorId: cInfo.vendorID,
72+
deviceId: cInfo.deviceID,
73+
compatibilityMode: cInfo.compatibilityMode!=0)
6874
}
6975

7076
publicfunc createDevice()->Device?{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp