@@ -731,6 +731,30 @@ namespace wgpu {
731
731
static_assert (offsetof(ChainedStruct, sType ) == offsetof(WGPUChainedStruct, sType ),
732
732
" offsetof mismatch for ChainedStruct::sType" );
733
733
734
+ // AdapterInfo
735
+
736
+ static_assert (sizeof (AdapterInfo) == sizeof (WGPUAdapterInfo), " sizeof mismatch for AdapterInfo" );
737
+ static_assert (alignof (AdapterInfo) == alignof (WGPUAdapterInfo), " alignof mismatch for AdapterInfo" );
738
+
739
+ static_assert (offsetof(AdapterInfo, nextInChain) == offsetof(WGPUAdapterInfo, nextInChain),
740
+ " offsetof mismatch for AdapterInfo::nextInChain" );
741
+ static_assert (offsetof(AdapterInfo, vendor) == offsetof(WGPUAdapterInfo, vendor),
742
+ " offsetof mismatch for AdapterInfo::vendor" );
743
+ static_assert (offsetof(AdapterInfo, architecture) == offsetof(WGPUAdapterInfo, architecture),
744
+ " offsetof mismatch for AdapterInfo::architecture" );
745
+ static_assert (offsetof(AdapterInfo, device) == offsetof(WGPUAdapterInfo, device),
746
+ " offsetof mismatch for AdapterInfo::device" );
747
+ static_assert (offsetof(AdapterInfo, description) == offsetof(WGPUAdapterInfo, description),
748
+ " offsetof mismatch for AdapterInfo::description" );
749
+ static_assert (offsetof(AdapterInfo, backendType) == offsetof(WGPUAdapterInfo, backendType),
750
+ " offsetof mismatch for AdapterInfo::backendType" );
751
+ static_assert (offsetof(AdapterInfo, adapterType) == offsetof(WGPUAdapterInfo, adapterType),
752
+ " offsetof mismatch for AdapterInfo::adapterType" );
753
+ static_assert (offsetof(AdapterInfo, vendorID) == offsetof(WGPUAdapterInfo, vendorID),
754
+ " offsetof mismatch for AdapterInfo::vendorID" );
755
+ static_assert (offsetof(AdapterInfo, deviceID) == offsetof(WGPUAdapterInfo, deviceID),
756
+ " offsetof mismatch for AdapterInfo::deviceID" );
757
+
734
758
// AdapterProperties
735
759
736
760
static_assert (sizeof (AdapterProperties) == sizeof (WGPUAdapterProperties), " sizeof mismatch for AdapterProperties" );
@@ -1924,6 +1948,55 @@ template <typename T>
1924
1948
static_assert (offsetof(RenderPipelineDescriptor, fragment) == offsetof(WGPURenderPipelineDescriptor, fragment),
1925
1949
" offsetof mismatch for RenderPipelineDescriptor::fragment" );
1926
1950
1951
+ // AdapterInfo implementation
1952
+ AdapterInfo::~AdapterInfo () {
1953
+ if (this ->vendor != nullptr || this ->architecture != nullptr || this ->device != nullptr || this ->description != nullptr ) {
1954
+ wgpuAdapterInfoFreeMembers (
1955
+ *reinterpret_cast <WGPUAdapterInfo*>(this ));
1956
+ }
1957
+ }
1958
+
1959
+ static void Reset (AdapterInfo& value) {
1960
+ AdapterInfo defaultValue{};
1961
+ AsNonConstReference (value.vendor ) = defaultValue.vendor ;
1962
+ AsNonConstReference (value.architecture ) = defaultValue.architecture ;
1963
+ AsNonConstReference (value.device ) = defaultValue.device ;
1964
+ AsNonConstReference (value.description ) = defaultValue.description ;
1965
+ AsNonConstReference (value.backendType ) = defaultValue.backendType ;
1966
+ AsNonConstReference (value.adapterType ) = defaultValue.adapterType ;
1967
+ AsNonConstReference (value.vendorID ) = defaultValue.vendorID ;
1968
+ AsNonConstReference (value.deviceID ) = defaultValue.deviceID ;
1969
+ }
1970
+
1971
+ AdapterInfo::AdapterInfo (AdapterInfo&& rhs)
1972
+ : vendor(rhs.vendor),
1973
+ architecture (rhs.architecture),
1974
+ device(rhs.device),
1975
+ description(rhs.description),
1976
+ backendType(rhs.backendType),
1977
+ adapterType(rhs.adapterType),
1978
+ vendorID(rhs.vendorID),
1979
+ deviceID(rhs.deviceID){
1980
+ Reset (rhs);
1981
+ }
1982
+
1983
+ AdapterInfo& AdapterInfo::operator =(AdapterInfo&& rhs) {
1984
+ if (&rhs == this ) {
1985
+ return *this ;
1986
+ }
1987
+ this ->~AdapterInfo ();
1988
+ AsNonConstReference (this ->vendor ) = std::move (rhs.vendor );
1989
+ AsNonConstReference (this ->architecture ) = std::move (rhs.architecture );
1990
+ AsNonConstReference (this ->device ) = std::move (rhs.device );
1991
+ AsNonConstReference (this ->description ) = std::move (rhs.description );
1992
+ AsNonConstReference (this ->backendType ) = std::move (rhs.backendType );
1993
+ AsNonConstReference (this ->adapterType ) = std::move (rhs.adapterType );
1994
+ AsNonConstReference (this ->vendorID ) = std::move (rhs.vendorID );
1995
+ AsNonConstReference (this ->deviceID ) = std::move (rhs.deviceID );
1996
+ Reset (rhs);
1997
+ return *this ;
1998
+ }
1999
+
1927
2000
// AdapterProperties
1928
2001
AdapterProperties::~AdapterProperties () {
1929
2002
if (this ->vendorName != nullptr || this ->architecture != nullptr || this ->name != nullptr || this ->driverDescription != nullptr ) {
@@ -1987,6 +2060,10 @@ template <typename T>
1987
2060
auto result = wgpuAdapterEnumerateFeatures (Get (), reinterpret_cast <WGPUFeatureName * >(features));
1988
2061
return result;
1989
2062
}
2063
+ void Adapter::GetInfo (AdapterInfo * info) const {
2064
+ *info = AdapterInfo ();
2065
+ wgpuAdapterGetInfo (Get (), reinterpret_cast <WGPUAdapterInfo * >(info));
2066
+ }
1990
2067
Bool Adapter::GetLimits (SupportedLimits * limits) const {
1991
2068
auto result = wgpuAdapterGetLimits (Get (), reinterpret_cast <WGPUSupportedLimits * >(limits));
1992
2069
return result;
0 commit comments