webgpu_cpp.cpp 144 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053
  1. #include "webgpu/webgpu_cpp.h"
  2. namespace wgpu {
  3. // AdapterType
  4. static_assert(sizeof(AdapterType) == sizeof(WGPUAdapterType), "sizeof mismatch for AdapterType");
  5. static_assert(alignof(AdapterType) == alignof(WGPUAdapterType), "alignof mismatch for AdapterType");
  6. static_assert(static_cast<uint32_t>(AdapterType::DiscreteGPU) == WGPUAdapterType_DiscreteGPU, "value mismatch for AdapterType::DiscreteGPU");
  7. static_assert(static_cast<uint32_t>(AdapterType::IntegratedGPU) == WGPUAdapterType_IntegratedGPU, "value mismatch for AdapterType::IntegratedGPU");
  8. static_assert(static_cast<uint32_t>(AdapterType::CPU) == WGPUAdapterType_CPU, "value mismatch for AdapterType::CPU");
  9. static_assert(static_cast<uint32_t>(AdapterType::Unknown) == WGPUAdapterType_Unknown, "value mismatch for AdapterType::Unknown");
  10. // AddressMode
  11. static_assert(sizeof(AddressMode) == sizeof(WGPUAddressMode), "sizeof mismatch for AddressMode");
  12. static_assert(alignof(AddressMode) == alignof(WGPUAddressMode), "alignof mismatch for AddressMode");
  13. static_assert(static_cast<uint32_t>(AddressMode::Repeat) == WGPUAddressMode_Repeat, "value mismatch for AddressMode::Repeat");
  14. static_assert(static_cast<uint32_t>(AddressMode::MirrorRepeat) == WGPUAddressMode_MirrorRepeat, "value mismatch for AddressMode::MirrorRepeat");
  15. static_assert(static_cast<uint32_t>(AddressMode::ClampToEdge) == WGPUAddressMode_ClampToEdge, "value mismatch for AddressMode::ClampToEdge");
  16. // BackendType
  17. static_assert(sizeof(BackendType) == sizeof(WGPUBackendType), "sizeof mismatch for BackendType");
  18. static_assert(alignof(BackendType) == alignof(WGPUBackendType), "alignof mismatch for BackendType");
  19. static_assert(static_cast<uint32_t>(BackendType::Null) == WGPUBackendType_Null, "value mismatch for BackendType::Null");
  20. static_assert(static_cast<uint32_t>(BackendType::D3D11) == WGPUBackendType_D3D11, "value mismatch for BackendType::D3D11");
  21. static_assert(static_cast<uint32_t>(BackendType::D3D12) == WGPUBackendType_D3D12, "value mismatch for BackendType::D3D12");
  22. static_assert(static_cast<uint32_t>(BackendType::Metal) == WGPUBackendType_Metal, "value mismatch for BackendType::Metal");
  23. static_assert(static_cast<uint32_t>(BackendType::Vulkan) == WGPUBackendType_Vulkan, "value mismatch for BackendType::Vulkan");
  24. static_assert(static_cast<uint32_t>(BackendType::OpenGL) == WGPUBackendType_OpenGL, "value mismatch for BackendType::OpenGL");
  25. static_assert(static_cast<uint32_t>(BackendType::OpenGLES) == WGPUBackendType_OpenGLES, "value mismatch for BackendType::OpenGLES");
  26. // BindingType
  27. static_assert(sizeof(BindingType) == sizeof(WGPUBindingType), "sizeof mismatch for BindingType");
  28. static_assert(alignof(BindingType) == alignof(WGPUBindingType), "alignof mismatch for BindingType");
  29. static_assert(static_cast<uint32_t>(BindingType::Undefined) == WGPUBindingType_Undefined, "value mismatch for BindingType::Undefined");
  30. static_assert(static_cast<uint32_t>(BindingType::UniformBuffer) == WGPUBindingType_UniformBuffer, "value mismatch for BindingType::UniformBuffer");
  31. static_assert(static_cast<uint32_t>(BindingType::StorageBuffer) == WGPUBindingType_StorageBuffer, "value mismatch for BindingType::StorageBuffer");
  32. static_assert(static_cast<uint32_t>(BindingType::ReadonlyStorageBuffer) == WGPUBindingType_ReadonlyStorageBuffer, "value mismatch for BindingType::ReadonlyStorageBuffer");
  33. static_assert(static_cast<uint32_t>(BindingType::Sampler) == WGPUBindingType_Sampler, "value mismatch for BindingType::Sampler");
  34. static_assert(static_cast<uint32_t>(BindingType::ComparisonSampler) == WGPUBindingType_ComparisonSampler, "value mismatch for BindingType::ComparisonSampler");
  35. static_assert(static_cast<uint32_t>(BindingType::SampledTexture) == WGPUBindingType_SampledTexture, "value mismatch for BindingType::SampledTexture");
  36. static_assert(static_cast<uint32_t>(BindingType::MultisampledTexture) == WGPUBindingType_MultisampledTexture, "value mismatch for BindingType::MultisampledTexture");
  37. static_assert(static_cast<uint32_t>(BindingType::ReadonlyStorageTexture) == WGPUBindingType_ReadonlyStorageTexture, "value mismatch for BindingType::ReadonlyStorageTexture");
  38. static_assert(static_cast<uint32_t>(BindingType::WriteonlyStorageTexture) == WGPUBindingType_WriteonlyStorageTexture, "value mismatch for BindingType::WriteonlyStorageTexture");
  39. // BlendFactor
  40. static_assert(sizeof(BlendFactor) == sizeof(WGPUBlendFactor), "sizeof mismatch for BlendFactor");
  41. static_assert(alignof(BlendFactor) == alignof(WGPUBlendFactor), "alignof mismatch for BlendFactor");
  42. static_assert(static_cast<uint32_t>(BlendFactor::Zero) == WGPUBlendFactor_Zero, "value mismatch for BlendFactor::Zero");
  43. static_assert(static_cast<uint32_t>(BlendFactor::One) == WGPUBlendFactor_One, "value mismatch for BlendFactor::One");
  44. static_assert(static_cast<uint32_t>(BlendFactor::SrcColor) == WGPUBlendFactor_SrcColor, "value mismatch for BlendFactor::SrcColor");
  45. static_assert(static_cast<uint32_t>(BlendFactor::OneMinusSrcColor) == WGPUBlendFactor_OneMinusSrcColor, "value mismatch for BlendFactor::OneMinusSrcColor");
  46. static_assert(static_cast<uint32_t>(BlendFactor::SrcAlpha) == WGPUBlendFactor_SrcAlpha, "value mismatch for BlendFactor::SrcAlpha");
  47. static_assert(static_cast<uint32_t>(BlendFactor::OneMinusSrcAlpha) == WGPUBlendFactor_OneMinusSrcAlpha, "value mismatch for BlendFactor::OneMinusSrcAlpha");
  48. static_assert(static_cast<uint32_t>(BlendFactor::DstColor) == WGPUBlendFactor_DstColor, "value mismatch for BlendFactor::DstColor");
  49. static_assert(static_cast<uint32_t>(BlendFactor::OneMinusDstColor) == WGPUBlendFactor_OneMinusDstColor, "value mismatch for BlendFactor::OneMinusDstColor");
  50. static_assert(static_cast<uint32_t>(BlendFactor::DstAlpha) == WGPUBlendFactor_DstAlpha, "value mismatch for BlendFactor::DstAlpha");
  51. static_assert(static_cast<uint32_t>(BlendFactor::OneMinusDstAlpha) == WGPUBlendFactor_OneMinusDstAlpha, "value mismatch for BlendFactor::OneMinusDstAlpha");
  52. static_assert(static_cast<uint32_t>(BlendFactor::SrcAlphaSaturated) == WGPUBlendFactor_SrcAlphaSaturated, "value mismatch for BlendFactor::SrcAlphaSaturated");
  53. static_assert(static_cast<uint32_t>(BlendFactor::BlendColor) == WGPUBlendFactor_BlendColor, "value mismatch for BlendFactor::BlendColor");
  54. static_assert(static_cast<uint32_t>(BlendFactor::OneMinusBlendColor) == WGPUBlendFactor_OneMinusBlendColor, "value mismatch for BlendFactor::OneMinusBlendColor");
  55. // BlendOperation
  56. static_assert(sizeof(BlendOperation) == sizeof(WGPUBlendOperation), "sizeof mismatch for BlendOperation");
  57. static_assert(alignof(BlendOperation) == alignof(WGPUBlendOperation), "alignof mismatch for BlendOperation");
  58. static_assert(static_cast<uint32_t>(BlendOperation::Add) == WGPUBlendOperation_Add, "value mismatch for BlendOperation::Add");
  59. static_assert(static_cast<uint32_t>(BlendOperation::Subtract) == WGPUBlendOperation_Subtract, "value mismatch for BlendOperation::Subtract");
  60. static_assert(static_cast<uint32_t>(BlendOperation::ReverseSubtract) == WGPUBlendOperation_ReverseSubtract, "value mismatch for BlendOperation::ReverseSubtract");
  61. static_assert(static_cast<uint32_t>(BlendOperation::Min) == WGPUBlendOperation_Min, "value mismatch for BlendOperation::Min");
  62. static_assert(static_cast<uint32_t>(BlendOperation::Max) == WGPUBlendOperation_Max, "value mismatch for BlendOperation::Max");
  63. // BufferBindingType
  64. static_assert(sizeof(BufferBindingType) == sizeof(WGPUBufferBindingType), "sizeof mismatch for BufferBindingType");
  65. static_assert(alignof(BufferBindingType) == alignof(WGPUBufferBindingType), "alignof mismatch for BufferBindingType");
  66. static_assert(static_cast<uint32_t>(BufferBindingType::Undefined) == WGPUBufferBindingType_Undefined, "value mismatch for BufferBindingType::Undefined");
  67. static_assert(static_cast<uint32_t>(BufferBindingType::Uniform) == WGPUBufferBindingType_Uniform, "value mismatch for BufferBindingType::Uniform");
  68. static_assert(static_cast<uint32_t>(BufferBindingType::Storage) == WGPUBufferBindingType_Storage, "value mismatch for BufferBindingType::Storage");
  69. static_assert(static_cast<uint32_t>(BufferBindingType::ReadOnlyStorage) == WGPUBufferBindingType_ReadOnlyStorage, "value mismatch for BufferBindingType::ReadOnlyStorage");
  70. // BufferMapAsyncStatus
  71. static_assert(sizeof(BufferMapAsyncStatus) == sizeof(WGPUBufferMapAsyncStatus), "sizeof mismatch for BufferMapAsyncStatus");
  72. static_assert(alignof(BufferMapAsyncStatus) == alignof(WGPUBufferMapAsyncStatus), "alignof mismatch for BufferMapAsyncStatus");
  73. static_assert(static_cast<uint32_t>(BufferMapAsyncStatus::Success) == WGPUBufferMapAsyncStatus_Success, "value mismatch for BufferMapAsyncStatus::Success");
  74. static_assert(static_cast<uint32_t>(BufferMapAsyncStatus::Error) == WGPUBufferMapAsyncStatus_Error, "value mismatch for BufferMapAsyncStatus::Error");
  75. static_assert(static_cast<uint32_t>(BufferMapAsyncStatus::Unknown) == WGPUBufferMapAsyncStatus_Unknown, "value mismatch for BufferMapAsyncStatus::Unknown");
  76. static_assert(static_cast<uint32_t>(BufferMapAsyncStatus::DeviceLost) == WGPUBufferMapAsyncStatus_DeviceLost, "value mismatch for BufferMapAsyncStatus::DeviceLost");
  77. static_assert(static_cast<uint32_t>(BufferMapAsyncStatus::DestroyedBeforeCallback) == WGPUBufferMapAsyncStatus_DestroyedBeforeCallback, "value mismatch for BufferMapAsyncStatus::DestroyedBeforeCallback");
  78. static_assert(static_cast<uint32_t>(BufferMapAsyncStatus::UnmappedBeforeCallback) == WGPUBufferMapAsyncStatus_UnmappedBeforeCallback, "value mismatch for BufferMapAsyncStatus::UnmappedBeforeCallback");
  79. // CompareFunction
  80. static_assert(sizeof(CompareFunction) == sizeof(WGPUCompareFunction), "sizeof mismatch for CompareFunction");
  81. static_assert(alignof(CompareFunction) == alignof(WGPUCompareFunction), "alignof mismatch for CompareFunction");
  82. static_assert(static_cast<uint32_t>(CompareFunction::Undefined) == WGPUCompareFunction_Undefined, "value mismatch for CompareFunction::Undefined");
  83. static_assert(static_cast<uint32_t>(CompareFunction::Never) == WGPUCompareFunction_Never, "value mismatch for CompareFunction::Never");
  84. static_assert(static_cast<uint32_t>(CompareFunction::Less) == WGPUCompareFunction_Less, "value mismatch for CompareFunction::Less");
  85. static_assert(static_cast<uint32_t>(CompareFunction::LessEqual) == WGPUCompareFunction_LessEqual, "value mismatch for CompareFunction::LessEqual");
  86. static_assert(static_cast<uint32_t>(CompareFunction::Greater) == WGPUCompareFunction_Greater, "value mismatch for CompareFunction::Greater");
  87. static_assert(static_cast<uint32_t>(CompareFunction::GreaterEqual) == WGPUCompareFunction_GreaterEqual, "value mismatch for CompareFunction::GreaterEqual");
  88. static_assert(static_cast<uint32_t>(CompareFunction::Equal) == WGPUCompareFunction_Equal, "value mismatch for CompareFunction::Equal");
  89. static_assert(static_cast<uint32_t>(CompareFunction::NotEqual) == WGPUCompareFunction_NotEqual, "value mismatch for CompareFunction::NotEqual");
  90. static_assert(static_cast<uint32_t>(CompareFunction::Always) == WGPUCompareFunction_Always, "value mismatch for CompareFunction::Always");
  91. // CreateReadyPipelineStatus
  92. static_assert(sizeof(CreateReadyPipelineStatus) == sizeof(WGPUCreateReadyPipelineStatus), "sizeof mismatch for CreateReadyPipelineStatus");
  93. static_assert(alignof(CreateReadyPipelineStatus) == alignof(WGPUCreateReadyPipelineStatus), "alignof mismatch for CreateReadyPipelineStatus");
  94. static_assert(static_cast<uint32_t>(CreateReadyPipelineStatus::Success) == WGPUCreateReadyPipelineStatus_Success, "value mismatch for CreateReadyPipelineStatus::Success");
  95. static_assert(static_cast<uint32_t>(CreateReadyPipelineStatus::Error) == WGPUCreateReadyPipelineStatus_Error, "value mismatch for CreateReadyPipelineStatus::Error");
  96. static_assert(static_cast<uint32_t>(CreateReadyPipelineStatus::DeviceLost) == WGPUCreateReadyPipelineStatus_DeviceLost, "value mismatch for CreateReadyPipelineStatus::DeviceLost");
  97. static_assert(static_cast<uint32_t>(CreateReadyPipelineStatus::DeviceDestroyed) == WGPUCreateReadyPipelineStatus_DeviceDestroyed, "value mismatch for CreateReadyPipelineStatus::DeviceDestroyed");
  98. static_assert(static_cast<uint32_t>(CreateReadyPipelineStatus::Unknown) == WGPUCreateReadyPipelineStatus_Unknown, "value mismatch for CreateReadyPipelineStatus::Unknown");
  99. // CullMode
  100. static_assert(sizeof(CullMode) == sizeof(WGPUCullMode), "sizeof mismatch for CullMode");
  101. static_assert(alignof(CullMode) == alignof(WGPUCullMode), "alignof mismatch for CullMode");
  102. static_assert(static_cast<uint32_t>(CullMode::None) == WGPUCullMode_None, "value mismatch for CullMode::None");
  103. static_assert(static_cast<uint32_t>(CullMode::Front) == WGPUCullMode_Front, "value mismatch for CullMode::Front");
  104. static_assert(static_cast<uint32_t>(CullMode::Back) == WGPUCullMode_Back, "value mismatch for CullMode::Back");
  105. // ErrorFilter
  106. static_assert(sizeof(ErrorFilter) == sizeof(WGPUErrorFilter), "sizeof mismatch for ErrorFilter");
  107. static_assert(alignof(ErrorFilter) == alignof(WGPUErrorFilter), "alignof mismatch for ErrorFilter");
  108. static_assert(static_cast<uint32_t>(ErrorFilter::None) == WGPUErrorFilter_None, "value mismatch for ErrorFilter::None");
  109. static_assert(static_cast<uint32_t>(ErrorFilter::Validation) == WGPUErrorFilter_Validation, "value mismatch for ErrorFilter::Validation");
  110. static_assert(static_cast<uint32_t>(ErrorFilter::OutOfMemory) == WGPUErrorFilter_OutOfMemory, "value mismatch for ErrorFilter::OutOfMemory");
  111. // ErrorType
  112. static_assert(sizeof(ErrorType) == sizeof(WGPUErrorType), "sizeof mismatch for ErrorType");
  113. static_assert(alignof(ErrorType) == alignof(WGPUErrorType), "alignof mismatch for ErrorType");
  114. static_assert(static_cast<uint32_t>(ErrorType::NoError) == WGPUErrorType_NoError, "value mismatch for ErrorType::NoError");
  115. static_assert(static_cast<uint32_t>(ErrorType::Validation) == WGPUErrorType_Validation, "value mismatch for ErrorType::Validation");
  116. static_assert(static_cast<uint32_t>(ErrorType::OutOfMemory) == WGPUErrorType_OutOfMemory, "value mismatch for ErrorType::OutOfMemory");
  117. static_assert(static_cast<uint32_t>(ErrorType::Unknown) == WGPUErrorType_Unknown, "value mismatch for ErrorType::Unknown");
  118. static_assert(static_cast<uint32_t>(ErrorType::DeviceLost) == WGPUErrorType_DeviceLost, "value mismatch for ErrorType::DeviceLost");
  119. // FenceCompletionStatus
  120. static_assert(sizeof(FenceCompletionStatus) == sizeof(WGPUFenceCompletionStatus), "sizeof mismatch for FenceCompletionStatus");
  121. static_assert(alignof(FenceCompletionStatus) == alignof(WGPUFenceCompletionStatus), "alignof mismatch for FenceCompletionStatus");
  122. static_assert(static_cast<uint32_t>(FenceCompletionStatus::Success) == WGPUFenceCompletionStatus_Success, "value mismatch for FenceCompletionStatus::Success");
  123. static_assert(static_cast<uint32_t>(FenceCompletionStatus::Error) == WGPUFenceCompletionStatus_Error, "value mismatch for FenceCompletionStatus::Error");
  124. static_assert(static_cast<uint32_t>(FenceCompletionStatus::Unknown) == WGPUFenceCompletionStatus_Unknown, "value mismatch for FenceCompletionStatus::Unknown");
  125. static_assert(static_cast<uint32_t>(FenceCompletionStatus::DeviceLost) == WGPUFenceCompletionStatus_DeviceLost, "value mismatch for FenceCompletionStatus::DeviceLost");
  126. // FilterMode
  127. static_assert(sizeof(FilterMode) == sizeof(WGPUFilterMode), "sizeof mismatch for FilterMode");
  128. static_assert(alignof(FilterMode) == alignof(WGPUFilterMode), "alignof mismatch for FilterMode");
  129. static_assert(static_cast<uint32_t>(FilterMode::Nearest) == WGPUFilterMode_Nearest, "value mismatch for FilterMode::Nearest");
  130. static_assert(static_cast<uint32_t>(FilterMode::Linear) == WGPUFilterMode_Linear, "value mismatch for FilterMode::Linear");
  131. // FrontFace
  132. static_assert(sizeof(FrontFace) == sizeof(WGPUFrontFace), "sizeof mismatch for FrontFace");
  133. static_assert(alignof(FrontFace) == alignof(WGPUFrontFace), "alignof mismatch for FrontFace");
  134. static_assert(static_cast<uint32_t>(FrontFace::CCW) == WGPUFrontFace_CCW, "value mismatch for FrontFace::CCW");
  135. static_assert(static_cast<uint32_t>(FrontFace::CW) == WGPUFrontFace_CW, "value mismatch for FrontFace::CW");
  136. // IndexFormat
  137. static_assert(sizeof(IndexFormat) == sizeof(WGPUIndexFormat), "sizeof mismatch for IndexFormat");
  138. static_assert(alignof(IndexFormat) == alignof(WGPUIndexFormat), "alignof mismatch for IndexFormat");
  139. static_assert(static_cast<uint32_t>(IndexFormat::Undefined) == WGPUIndexFormat_Undefined, "value mismatch for IndexFormat::Undefined");
  140. static_assert(static_cast<uint32_t>(IndexFormat::Uint16) == WGPUIndexFormat_Uint16, "value mismatch for IndexFormat::Uint16");
  141. static_assert(static_cast<uint32_t>(IndexFormat::Uint32) == WGPUIndexFormat_Uint32, "value mismatch for IndexFormat::Uint32");
  142. // InputStepMode
  143. static_assert(sizeof(InputStepMode) == sizeof(WGPUInputStepMode), "sizeof mismatch for InputStepMode");
  144. static_assert(alignof(InputStepMode) == alignof(WGPUInputStepMode), "alignof mismatch for InputStepMode");
  145. static_assert(static_cast<uint32_t>(InputStepMode::Vertex) == WGPUInputStepMode_Vertex, "value mismatch for InputStepMode::Vertex");
  146. static_assert(static_cast<uint32_t>(InputStepMode::Instance) == WGPUInputStepMode_Instance, "value mismatch for InputStepMode::Instance");
  147. // LoadOp
  148. static_assert(sizeof(LoadOp) == sizeof(WGPULoadOp), "sizeof mismatch for LoadOp");
  149. static_assert(alignof(LoadOp) == alignof(WGPULoadOp), "alignof mismatch for LoadOp");
  150. static_assert(static_cast<uint32_t>(LoadOp::Clear) == WGPULoadOp_Clear, "value mismatch for LoadOp::Clear");
  151. static_assert(static_cast<uint32_t>(LoadOp::Load) == WGPULoadOp_Load, "value mismatch for LoadOp::Load");
  152. // PipelineStatisticName
  153. static_assert(sizeof(PipelineStatisticName) == sizeof(WGPUPipelineStatisticName), "sizeof mismatch for PipelineStatisticName");
  154. static_assert(alignof(PipelineStatisticName) == alignof(WGPUPipelineStatisticName), "alignof mismatch for PipelineStatisticName");
  155. static_assert(static_cast<uint32_t>(PipelineStatisticName::VertexShaderInvocations) == WGPUPipelineStatisticName_VertexShaderInvocations, "value mismatch for PipelineStatisticName::VertexShaderInvocations");
  156. static_assert(static_cast<uint32_t>(PipelineStatisticName::ClipperInvocations) == WGPUPipelineStatisticName_ClipperInvocations, "value mismatch for PipelineStatisticName::ClipperInvocations");
  157. static_assert(static_cast<uint32_t>(PipelineStatisticName::ClipperPrimitivesOut) == WGPUPipelineStatisticName_ClipperPrimitivesOut, "value mismatch for PipelineStatisticName::ClipperPrimitivesOut");
  158. static_assert(static_cast<uint32_t>(PipelineStatisticName::FragmentShaderInvocations) == WGPUPipelineStatisticName_FragmentShaderInvocations, "value mismatch for PipelineStatisticName::FragmentShaderInvocations");
  159. static_assert(static_cast<uint32_t>(PipelineStatisticName::ComputeShaderInvocations) == WGPUPipelineStatisticName_ComputeShaderInvocations, "value mismatch for PipelineStatisticName::ComputeShaderInvocations");
  160. // PresentMode
  161. static_assert(sizeof(PresentMode) == sizeof(WGPUPresentMode), "sizeof mismatch for PresentMode");
  162. static_assert(alignof(PresentMode) == alignof(WGPUPresentMode), "alignof mismatch for PresentMode");
  163. static_assert(static_cast<uint32_t>(PresentMode::Immediate) == WGPUPresentMode_Immediate, "value mismatch for PresentMode::Immediate");
  164. static_assert(static_cast<uint32_t>(PresentMode::Mailbox) == WGPUPresentMode_Mailbox, "value mismatch for PresentMode::Mailbox");
  165. static_assert(static_cast<uint32_t>(PresentMode::Fifo) == WGPUPresentMode_Fifo, "value mismatch for PresentMode::Fifo");
  166. // PrimitiveTopology
  167. static_assert(sizeof(PrimitiveTopology) == sizeof(WGPUPrimitiveTopology), "sizeof mismatch for PrimitiveTopology");
  168. static_assert(alignof(PrimitiveTopology) == alignof(WGPUPrimitiveTopology), "alignof mismatch for PrimitiveTopology");
  169. static_assert(static_cast<uint32_t>(PrimitiveTopology::PointList) == WGPUPrimitiveTopology_PointList, "value mismatch for PrimitiveTopology::PointList");
  170. static_assert(static_cast<uint32_t>(PrimitiveTopology::LineList) == WGPUPrimitiveTopology_LineList, "value mismatch for PrimitiveTopology::LineList");
  171. static_assert(static_cast<uint32_t>(PrimitiveTopology::LineStrip) == WGPUPrimitiveTopology_LineStrip, "value mismatch for PrimitiveTopology::LineStrip");
  172. static_assert(static_cast<uint32_t>(PrimitiveTopology::TriangleList) == WGPUPrimitiveTopology_TriangleList, "value mismatch for PrimitiveTopology::TriangleList");
  173. static_assert(static_cast<uint32_t>(PrimitiveTopology::TriangleStrip) == WGPUPrimitiveTopology_TriangleStrip, "value mismatch for PrimitiveTopology::TriangleStrip");
  174. // QueryType
  175. static_assert(sizeof(QueryType) == sizeof(WGPUQueryType), "sizeof mismatch for QueryType");
  176. static_assert(alignof(QueryType) == alignof(WGPUQueryType), "alignof mismatch for QueryType");
  177. static_assert(static_cast<uint32_t>(QueryType::Occlusion) == WGPUQueryType_Occlusion, "value mismatch for QueryType::Occlusion");
  178. static_assert(static_cast<uint32_t>(QueryType::PipelineStatistics) == WGPUQueryType_PipelineStatistics, "value mismatch for QueryType::PipelineStatistics");
  179. static_assert(static_cast<uint32_t>(QueryType::Timestamp) == WGPUQueryType_Timestamp, "value mismatch for QueryType::Timestamp");
  180. // SType
  181. static_assert(sizeof(SType) == sizeof(WGPUSType), "sizeof mismatch for SType");
  182. static_assert(alignof(SType) == alignof(WGPUSType), "alignof mismatch for SType");
  183. static_assert(static_cast<uint32_t>(SType::Invalid) == WGPUSType_Invalid, "value mismatch for SType::Invalid");
  184. static_assert(static_cast<uint32_t>(SType::SurfaceDescriptorFromMetalLayer) == WGPUSType_SurfaceDescriptorFromMetalLayer, "value mismatch for SType::SurfaceDescriptorFromMetalLayer");
  185. static_assert(static_cast<uint32_t>(SType::SurfaceDescriptorFromWindowsHWND) == WGPUSType_SurfaceDescriptorFromWindowsHWND, "value mismatch for SType::SurfaceDescriptorFromWindowsHWND");
  186. static_assert(static_cast<uint32_t>(SType::SurfaceDescriptorFromXlib) == WGPUSType_SurfaceDescriptorFromXlib, "value mismatch for SType::SurfaceDescriptorFromXlib");
  187. static_assert(static_cast<uint32_t>(SType::SurfaceDescriptorFromCanvasHTMLSelector) == WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector, "value mismatch for SType::SurfaceDescriptorFromCanvasHTMLSelector");
  188. static_assert(static_cast<uint32_t>(SType::ShaderModuleSPIRVDescriptor) == WGPUSType_ShaderModuleSPIRVDescriptor, "value mismatch for SType::ShaderModuleSPIRVDescriptor");
  189. static_assert(static_cast<uint32_t>(SType::ShaderModuleWGSLDescriptor) == WGPUSType_ShaderModuleWGSLDescriptor, "value mismatch for SType::ShaderModuleWGSLDescriptor");
  190. static_assert(static_cast<uint32_t>(SType::SamplerDescriptorDummyAnisotropicFiltering) == WGPUSType_SamplerDescriptorDummyAnisotropicFiltering, "value mismatch for SType::SamplerDescriptorDummyAnisotropicFiltering");
  191. static_assert(static_cast<uint32_t>(SType::RenderPipelineDescriptorDummyExtension) == WGPUSType_RenderPipelineDescriptorDummyExtension, "value mismatch for SType::RenderPipelineDescriptorDummyExtension");
  192. // SamplerBindingType
  193. static_assert(sizeof(SamplerBindingType) == sizeof(WGPUSamplerBindingType), "sizeof mismatch for SamplerBindingType");
  194. static_assert(alignof(SamplerBindingType) == alignof(WGPUSamplerBindingType), "alignof mismatch for SamplerBindingType");
  195. static_assert(static_cast<uint32_t>(SamplerBindingType::Undefined) == WGPUSamplerBindingType_Undefined, "value mismatch for SamplerBindingType::Undefined");
  196. static_assert(static_cast<uint32_t>(SamplerBindingType::Filtering) == WGPUSamplerBindingType_Filtering, "value mismatch for SamplerBindingType::Filtering");
  197. static_assert(static_cast<uint32_t>(SamplerBindingType::NonFiltering) == WGPUSamplerBindingType_NonFiltering, "value mismatch for SamplerBindingType::NonFiltering");
  198. static_assert(static_cast<uint32_t>(SamplerBindingType::Comparison) == WGPUSamplerBindingType_Comparison, "value mismatch for SamplerBindingType::Comparison");
  199. // StencilOperation
  200. static_assert(sizeof(StencilOperation) == sizeof(WGPUStencilOperation), "sizeof mismatch for StencilOperation");
  201. static_assert(alignof(StencilOperation) == alignof(WGPUStencilOperation), "alignof mismatch for StencilOperation");
  202. static_assert(static_cast<uint32_t>(StencilOperation::Keep) == WGPUStencilOperation_Keep, "value mismatch for StencilOperation::Keep");
  203. static_assert(static_cast<uint32_t>(StencilOperation::Zero) == WGPUStencilOperation_Zero, "value mismatch for StencilOperation::Zero");
  204. static_assert(static_cast<uint32_t>(StencilOperation::Replace) == WGPUStencilOperation_Replace, "value mismatch for StencilOperation::Replace");
  205. static_assert(static_cast<uint32_t>(StencilOperation::Invert) == WGPUStencilOperation_Invert, "value mismatch for StencilOperation::Invert");
  206. static_assert(static_cast<uint32_t>(StencilOperation::IncrementClamp) == WGPUStencilOperation_IncrementClamp, "value mismatch for StencilOperation::IncrementClamp");
  207. static_assert(static_cast<uint32_t>(StencilOperation::DecrementClamp) == WGPUStencilOperation_DecrementClamp, "value mismatch for StencilOperation::DecrementClamp");
  208. static_assert(static_cast<uint32_t>(StencilOperation::IncrementWrap) == WGPUStencilOperation_IncrementWrap, "value mismatch for StencilOperation::IncrementWrap");
  209. static_assert(static_cast<uint32_t>(StencilOperation::DecrementWrap) == WGPUStencilOperation_DecrementWrap, "value mismatch for StencilOperation::DecrementWrap");
  210. // StorageTextureAccess
  211. static_assert(sizeof(StorageTextureAccess) == sizeof(WGPUStorageTextureAccess), "sizeof mismatch for StorageTextureAccess");
  212. static_assert(alignof(StorageTextureAccess) == alignof(WGPUStorageTextureAccess), "alignof mismatch for StorageTextureAccess");
  213. static_assert(static_cast<uint32_t>(StorageTextureAccess::Undefined) == WGPUStorageTextureAccess_Undefined, "value mismatch for StorageTextureAccess::Undefined");
  214. static_assert(static_cast<uint32_t>(StorageTextureAccess::ReadOnly) == WGPUStorageTextureAccess_ReadOnly, "value mismatch for StorageTextureAccess::ReadOnly");
  215. static_assert(static_cast<uint32_t>(StorageTextureAccess::WriteOnly) == WGPUStorageTextureAccess_WriteOnly, "value mismatch for StorageTextureAccess::WriteOnly");
  216. // StoreOp
  217. static_assert(sizeof(StoreOp) == sizeof(WGPUStoreOp), "sizeof mismatch for StoreOp");
  218. static_assert(alignof(StoreOp) == alignof(WGPUStoreOp), "alignof mismatch for StoreOp");
  219. static_assert(static_cast<uint32_t>(StoreOp::Store) == WGPUStoreOp_Store, "value mismatch for StoreOp::Store");
  220. static_assert(static_cast<uint32_t>(StoreOp::Clear) == WGPUStoreOp_Clear, "value mismatch for StoreOp::Clear");
  221. // TextureAspect
  222. static_assert(sizeof(TextureAspect) == sizeof(WGPUTextureAspect), "sizeof mismatch for TextureAspect");
  223. static_assert(alignof(TextureAspect) == alignof(WGPUTextureAspect), "alignof mismatch for TextureAspect");
  224. static_assert(static_cast<uint32_t>(TextureAspect::All) == WGPUTextureAspect_All, "value mismatch for TextureAspect::All");
  225. static_assert(static_cast<uint32_t>(TextureAspect::StencilOnly) == WGPUTextureAspect_StencilOnly, "value mismatch for TextureAspect::StencilOnly");
  226. static_assert(static_cast<uint32_t>(TextureAspect::DepthOnly) == WGPUTextureAspect_DepthOnly, "value mismatch for TextureAspect::DepthOnly");
  227. // TextureComponentType
  228. static_assert(sizeof(TextureComponentType) == sizeof(WGPUTextureComponentType), "sizeof mismatch for TextureComponentType");
  229. static_assert(alignof(TextureComponentType) == alignof(WGPUTextureComponentType), "alignof mismatch for TextureComponentType");
  230. static_assert(static_cast<uint32_t>(TextureComponentType::Float) == WGPUTextureComponentType_Float, "value mismatch for TextureComponentType::Float");
  231. static_assert(static_cast<uint32_t>(TextureComponentType::Sint) == WGPUTextureComponentType_Sint, "value mismatch for TextureComponentType::Sint");
  232. static_assert(static_cast<uint32_t>(TextureComponentType::Uint) == WGPUTextureComponentType_Uint, "value mismatch for TextureComponentType::Uint");
  233. static_assert(static_cast<uint32_t>(TextureComponentType::DepthComparison) == WGPUTextureComponentType_DepthComparison, "value mismatch for TextureComponentType::DepthComparison");
  234. // TextureDimension
  235. static_assert(sizeof(TextureDimension) == sizeof(WGPUTextureDimension), "sizeof mismatch for TextureDimension");
  236. static_assert(alignof(TextureDimension) == alignof(WGPUTextureDimension), "alignof mismatch for TextureDimension");
  237. static_assert(static_cast<uint32_t>(TextureDimension::e1D) == WGPUTextureDimension_1D, "value mismatch for TextureDimension::e1D");
  238. static_assert(static_cast<uint32_t>(TextureDimension::e2D) == WGPUTextureDimension_2D, "value mismatch for TextureDimension::e2D");
  239. static_assert(static_cast<uint32_t>(TextureDimension::e3D) == WGPUTextureDimension_3D, "value mismatch for TextureDimension::e3D");
  240. // TextureFormat
  241. static_assert(sizeof(TextureFormat) == sizeof(WGPUTextureFormat), "sizeof mismatch for TextureFormat");
  242. static_assert(alignof(TextureFormat) == alignof(WGPUTextureFormat), "alignof mismatch for TextureFormat");
  243. static_assert(static_cast<uint32_t>(TextureFormat::Undefined) == WGPUTextureFormat_Undefined, "value mismatch for TextureFormat::Undefined");
  244. static_assert(static_cast<uint32_t>(TextureFormat::R8Unorm) == WGPUTextureFormat_R8Unorm, "value mismatch for TextureFormat::R8Unorm");
  245. static_assert(static_cast<uint32_t>(TextureFormat::R8Snorm) == WGPUTextureFormat_R8Snorm, "value mismatch for TextureFormat::R8Snorm");
  246. static_assert(static_cast<uint32_t>(TextureFormat::R8Uint) == WGPUTextureFormat_R8Uint, "value mismatch for TextureFormat::R8Uint");
  247. static_assert(static_cast<uint32_t>(TextureFormat::R8Sint) == WGPUTextureFormat_R8Sint, "value mismatch for TextureFormat::R8Sint");
  248. static_assert(static_cast<uint32_t>(TextureFormat::R16Uint) == WGPUTextureFormat_R16Uint, "value mismatch for TextureFormat::R16Uint");
  249. static_assert(static_cast<uint32_t>(TextureFormat::R16Sint) == WGPUTextureFormat_R16Sint, "value mismatch for TextureFormat::R16Sint");
  250. static_assert(static_cast<uint32_t>(TextureFormat::R16Float) == WGPUTextureFormat_R16Float, "value mismatch for TextureFormat::R16Float");
  251. static_assert(static_cast<uint32_t>(TextureFormat::RG8Unorm) == WGPUTextureFormat_RG8Unorm, "value mismatch for TextureFormat::RG8Unorm");
  252. static_assert(static_cast<uint32_t>(TextureFormat::RG8Snorm) == WGPUTextureFormat_RG8Snorm, "value mismatch for TextureFormat::RG8Snorm");
  253. static_assert(static_cast<uint32_t>(TextureFormat::RG8Uint) == WGPUTextureFormat_RG8Uint, "value mismatch for TextureFormat::RG8Uint");
  254. static_assert(static_cast<uint32_t>(TextureFormat::RG8Sint) == WGPUTextureFormat_RG8Sint, "value mismatch for TextureFormat::RG8Sint");
  255. static_assert(static_cast<uint32_t>(TextureFormat::R32Float) == WGPUTextureFormat_R32Float, "value mismatch for TextureFormat::R32Float");
  256. static_assert(static_cast<uint32_t>(TextureFormat::R32Uint) == WGPUTextureFormat_R32Uint, "value mismatch for TextureFormat::R32Uint");
  257. static_assert(static_cast<uint32_t>(TextureFormat::R32Sint) == WGPUTextureFormat_R32Sint, "value mismatch for TextureFormat::R32Sint");
  258. static_assert(static_cast<uint32_t>(TextureFormat::RG16Uint) == WGPUTextureFormat_RG16Uint, "value mismatch for TextureFormat::RG16Uint");
  259. static_assert(static_cast<uint32_t>(TextureFormat::RG16Sint) == WGPUTextureFormat_RG16Sint, "value mismatch for TextureFormat::RG16Sint");
  260. static_assert(static_cast<uint32_t>(TextureFormat::RG16Float) == WGPUTextureFormat_RG16Float, "value mismatch for TextureFormat::RG16Float");
  261. static_assert(static_cast<uint32_t>(TextureFormat::RGBA8Unorm) == WGPUTextureFormat_RGBA8Unorm, "value mismatch for TextureFormat::RGBA8Unorm");
  262. static_assert(static_cast<uint32_t>(TextureFormat::RGBA8UnormSrgb) == WGPUTextureFormat_RGBA8UnormSrgb, "value mismatch for TextureFormat::RGBA8UnormSrgb");
  263. static_assert(static_cast<uint32_t>(TextureFormat::RGBA8Snorm) == WGPUTextureFormat_RGBA8Snorm, "value mismatch for TextureFormat::RGBA8Snorm");
  264. static_assert(static_cast<uint32_t>(TextureFormat::RGBA8Uint) == WGPUTextureFormat_RGBA8Uint, "value mismatch for TextureFormat::RGBA8Uint");
  265. static_assert(static_cast<uint32_t>(TextureFormat::RGBA8Sint) == WGPUTextureFormat_RGBA8Sint, "value mismatch for TextureFormat::RGBA8Sint");
  266. static_assert(static_cast<uint32_t>(TextureFormat::BGRA8Unorm) == WGPUTextureFormat_BGRA8Unorm, "value mismatch for TextureFormat::BGRA8Unorm");
  267. static_assert(static_cast<uint32_t>(TextureFormat::BGRA8UnormSrgb) == WGPUTextureFormat_BGRA8UnormSrgb, "value mismatch for TextureFormat::BGRA8UnormSrgb");
  268. static_assert(static_cast<uint32_t>(TextureFormat::RGB10A2Unorm) == WGPUTextureFormat_RGB10A2Unorm, "value mismatch for TextureFormat::RGB10A2Unorm");
  269. static_assert(static_cast<uint32_t>(TextureFormat::RG11B10Ufloat) == WGPUTextureFormat_RG11B10Ufloat, "value mismatch for TextureFormat::RG11B10Ufloat");
  270. static_assert(static_cast<uint32_t>(TextureFormat::RGB9E5Ufloat) == WGPUTextureFormat_RGB9E5Ufloat, "value mismatch for TextureFormat::RGB9E5Ufloat");
  271. static_assert(static_cast<uint32_t>(TextureFormat::RG32Float) == WGPUTextureFormat_RG32Float, "value mismatch for TextureFormat::RG32Float");
  272. static_assert(static_cast<uint32_t>(TextureFormat::RG32Uint) == WGPUTextureFormat_RG32Uint, "value mismatch for TextureFormat::RG32Uint");
  273. static_assert(static_cast<uint32_t>(TextureFormat::RG32Sint) == WGPUTextureFormat_RG32Sint, "value mismatch for TextureFormat::RG32Sint");
  274. static_assert(static_cast<uint32_t>(TextureFormat::RGBA16Uint) == WGPUTextureFormat_RGBA16Uint, "value mismatch for TextureFormat::RGBA16Uint");
  275. static_assert(static_cast<uint32_t>(TextureFormat::RGBA16Sint) == WGPUTextureFormat_RGBA16Sint, "value mismatch for TextureFormat::RGBA16Sint");
  276. static_assert(static_cast<uint32_t>(TextureFormat::RGBA16Float) == WGPUTextureFormat_RGBA16Float, "value mismatch for TextureFormat::RGBA16Float");
  277. static_assert(static_cast<uint32_t>(TextureFormat::RGBA32Float) == WGPUTextureFormat_RGBA32Float, "value mismatch for TextureFormat::RGBA32Float");
  278. static_assert(static_cast<uint32_t>(TextureFormat::RGBA32Uint) == WGPUTextureFormat_RGBA32Uint, "value mismatch for TextureFormat::RGBA32Uint");
  279. static_assert(static_cast<uint32_t>(TextureFormat::RGBA32Sint) == WGPUTextureFormat_RGBA32Sint, "value mismatch for TextureFormat::RGBA32Sint");
  280. static_assert(static_cast<uint32_t>(TextureFormat::Depth32Float) == WGPUTextureFormat_Depth32Float, "value mismatch for TextureFormat::Depth32Float");
  281. static_assert(static_cast<uint32_t>(TextureFormat::Depth24Plus) == WGPUTextureFormat_Depth24Plus, "value mismatch for TextureFormat::Depth24Plus");
  282. static_assert(static_cast<uint32_t>(TextureFormat::Depth24PlusStencil8) == WGPUTextureFormat_Depth24PlusStencil8, "value mismatch for TextureFormat::Depth24PlusStencil8");
  283. static_assert(static_cast<uint32_t>(TextureFormat::BC1RGBAUnorm) == WGPUTextureFormat_BC1RGBAUnorm, "value mismatch for TextureFormat::BC1RGBAUnorm");
  284. static_assert(static_cast<uint32_t>(TextureFormat::BC1RGBAUnormSrgb) == WGPUTextureFormat_BC1RGBAUnormSrgb, "value mismatch for TextureFormat::BC1RGBAUnormSrgb");
  285. static_assert(static_cast<uint32_t>(TextureFormat::BC2RGBAUnorm) == WGPUTextureFormat_BC2RGBAUnorm, "value mismatch for TextureFormat::BC2RGBAUnorm");
  286. static_assert(static_cast<uint32_t>(TextureFormat::BC2RGBAUnormSrgb) == WGPUTextureFormat_BC2RGBAUnormSrgb, "value mismatch for TextureFormat::BC2RGBAUnormSrgb");
  287. static_assert(static_cast<uint32_t>(TextureFormat::BC3RGBAUnorm) == WGPUTextureFormat_BC3RGBAUnorm, "value mismatch for TextureFormat::BC3RGBAUnorm");
  288. static_assert(static_cast<uint32_t>(TextureFormat::BC3RGBAUnormSrgb) == WGPUTextureFormat_BC3RGBAUnormSrgb, "value mismatch for TextureFormat::BC3RGBAUnormSrgb");
  289. static_assert(static_cast<uint32_t>(TextureFormat::BC4RUnorm) == WGPUTextureFormat_BC4RUnorm, "value mismatch for TextureFormat::BC4RUnorm");
  290. static_assert(static_cast<uint32_t>(TextureFormat::BC4RSnorm) == WGPUTextureFormat_BC4RSnorm, "value mismatch for TextureFormat::BC4RSnorm");
  291. static_assert(static_cast<uint32_t>(TextureFormat::BC5RGUnorm) == WGPUTextureFormat_BC5RGUnorm, "value mismatch for TextureFormat::BC5RGUnorm");
  292. static_assert(static_cast<uint32_t>(TextureFormat::BC5RGSnorm) == WGPUTextureFormat_BC5RGSnorm, "value mismatch for TextureFormat::BC5RGSnorm");
  293. static_assert(static_cast<uint32_t>(TextureFormat::BC6HRGBUfloat) == WGPUTextureFormat_BC6HRGBUfloat, "value mismatch for TextureFormat::BC6HRGBUfloat");
  294. static_assert(static_cast<uint32_t>(TextureFormat::BC6HRGBFloat) == WGPUTextureFormat_BC6HRGBFloat, "value mismatch for TextureFormat::BC6HRGBFloat");
  295. static_assert(static_cast<uint32_t>(TextureFormat::BC7RGBAUnorm) == WGPUTextureFormat_BC7RGBAUnorm, "value mismatch for TextureFormat::BC7RGBAUnorm");
  296. static_assert(static_cast<uint32_t>(TextureFormat::BC7RGBAUnormSrgb) == WGPUTextureFormat_BC7RGBAUnormSrgb, "value mismatch for TextureFormat::BC7RGBAUnormSrgb");
  297. // TextureSampleType
  298. static_assert(sizeof(TextureSampleType) == sizeof(WGPUTextureSampleType), "sizeof mismatch for TextureSampleType");
  299. static_assert(alignof(TextureSampleType) == alignof(WGPUTextureSampleType), "alignof mismatch for TextureSampleType");
  300. static_assert(static_cast<uint32_t>(TextureSampleType::Undefined) == WGPUTextureSampleType_Undefined, "value mismatch for TextureSampleType::Undefined");
  301. static_assert(static_cast<uint32_t>(TextureSampleType::Float) == WGPUTextureSampleType_Float, "value mismatch for TextureSampleType::Float");
  302. static_assert(static_cast<uint32_t>(TextureSampleType::UnfilterableFloat) == WGPUTextureSampleType_UnfilterableFloat, "value mismatch for TextureSampleType::UnfilterableFloat");
  303. static_assert(static_cast<uint32_t>(TextureSampleType::Depth) == WGPUTextureSampleType_Depth, "value mismatch for TextureSampleType::Depth");
  304. static_assert(static_cast<uint32_t>(TextureSampleType::Sint) == WGPUTextureSampleType_Sint, "value mismatch for TextureSampleType::Sint");
  305. static_assert(static_cast<uint32_t>(TextureSampleType::Uint) == WGPUTextureSampleType_Uint, "value mismatch for TextureSampleType::Uint");
  306. // TextureViewDimension
  307. static_assert(sizeof(TextureViewDimension) == sizeof(WGPUTextureViewDimension), "sizeof mismatch for TextureViewDimension");
  308. static_assert(alignof(TextureViewDimension) == alignof(WGPUTextureViewDimension), "alignof mismatch for TextureViewDimension");
  309. static_assert(static_cast<uint32_t>(TextureViewDimension::Undefined) == WGPUTextureViewDimension_Undefined, "value mismatch for TextureViewDimension::Undefined");
  310. static_assert(static_cast<uint32_t>(TextureViewDimension::e1D) == WGPUTextureViewDimension_1D, "value mismatch for TextureViewDimension::e1D");
  311. static_assert(static_cast<uint32_t>(TextureViewDimension::e2D) == WGPUTextureViewDimension_2D, "value mismatch for TextureViewDimension::e2D");
  312. static_assert(static_cast<uint32_t>(TextureViewDimension::e2DArray) == WGPUTextureViewDimension_2DArray, "value mismatch for TextureViewDimension::e2DArray");
  313. static_assert(static_cast<uint32_t>(TextureViewDimension::Cube) == WGPUTextureViewDimension_Cube, "value mismatch for TextureViewDimension::Cube");
  314. static_assert(static_cast<uint32_t>(TextureViewDimension::CubeArray) == WGPUTextureViewDimension_CubeArray, "value mismatch for TextureViewDimension::CubeArray");
  315. static_assert(static_cast<uint32_t>(TextureViewDimension::e3D) == WGPUTextureViewDimension_3D, "value mismatch for TextureViewDimension::e3D");
  316. // VertexFormat
  317. static_assert(sizeof(VertexFormat) == sizeof(WGPUVertexFormat), "sizeof mismatch for VertexFormat");
  318. static_assert(alignof(VertexFormat) == alignof(WGPUVertexFormat), "alignof mismatch for VertexFormat");
  319. static_assert(static_cast<uint32_t>(VertexFormat::UChar2) == WGPUVertexFormat_UChar2, "value mismatch for VertexFormat::UChar2");
  320. static_assert(static_cast<uint32_t>(VertexFormat::UChar4) == WGPUVertexFormat_UChar4, "value mismatch for VertexFormat::UChar4");
  321. static_assert(static_cast<uint32_t>(VertexFormat::Char2) == WGPUVertexFormat_Char2, "value mismatch for VertexFormat::Char2");
  322. static_assert(static_cast<uint32_t>(VertexFormat::Char4) == WGPUVertexFormat_Char4, "value mismatch for VertexFormat::Char4");
  323. static_assert(static_cast<uint32_t>(VertexFormat::UChar2Norm) == WGPUVertexFormat_UChar2Norm, "value mismatch for VertexFormat::UChar2Norm");
  324. static_assert(static_cast<uint32_t>(VertexFormat::UChar4Norm) == WGPUVertexFormat_UChar4Norm, "value mismatch for VertexFormat::UChar4Norm");
  325. static_assert(static_cast<uint32_t>(VertexFormat::Char2Norm) == WGPUVertexFormat_Char2Norm, "value mismatch for VertexFormat::Char2Norm");
  326. static_assert(static_cast<uint32_t>(VertexFormat::Char4Norm) == WGPUVertexFormat_Char4Norm, "value mismatch for VertexFormat::Char4Norm");
  327. static_assert(static_cast<uint32_t>(VertexFormat::UShort2) == WGPUVertexFormat_UShort2, "value mismatch for VertexFormat::UShort2");
  328. static_assert(static_cast<uint32_t>(VertexFormat::UShort4) == WGPUVertexFormat_UShort4, "value mismatch for VertexFormat::UShort4");
  329. static_assert(static_cast<uint32_t>(VertexFormat::Short2) == WGPUVertexFormat_Short2, "value mismatch for VertexFormat::Short2");
  330. static_assert(static_cast<uint32_t>(VertexFormat::Short4) == WGPUVertexFormat_Short4, "value mismatch for VertexFormat::Short4");
  331. static_assert(static_cast<uint32_t>(VertexFormat::UShort2Norm) == WGPUVertexFormat_UShort2Norm, "value mismatch for VertexFormat::UShort2Norm");
  332. static_assert(static_cast<uint32_t>(VertexFormat::UShort4Norm) == WGPUVertexFormat_UShort4Norm, "value mismatch for VertexFormat::UShort4Norm");
  333. static_assert(static_cast<uint32_t>(VertexFormat::Short2Norm) == WGPUVertexFormat_Short2Norm, "value mismatch for VertexFormat::Short2Norm");
  334. static_assert(static_cast<uint32_t>(VertexFormat::Short4Norm) == WGPUVertexFormat_Short4Norm, "value mismatch for VertexFormat::Short4Norm");
  335. static_assert(static_cast<uint32_t>(VertexFormat::Half2) == WGPUVertexFormat_Half2, "value mismatch for VertexFormat::Half2");
  336. static_assert(static_cast<uint32_t>(VertexFormat::Half4) == WGPUVertexFormat_Half4, "value mismatch for VertexFormat::Half4");
  337. static_assert(static_cast<uint32_t>(VertexFormat::Float) == WGPUVertexFormat_Float, "value mismatch for VertexFormat::Float");
  338. static_assert(static_cast<uint32_t>(VertexFormat::Float2) == WGPUVertexFormat_Float2, "value mismatch for VertexFormat::Float2");
  339. static_assert(static_cast<uint32_t>(VertexFormat::Float3) == WGPUVertexFormat_Float3, "value mismatch for VertexFormat::Float3");
  340. static_assert(static_cast<uint32_t>(VertexFormat::Float4) == WGPUVertexFormat_Float4, "value mismatch for VertexFormat::Float4");
  341. static_assert(static_cast<uint32_t>(VertexFormat::UInt) == WGPUVertexFormat_UInt, "value mismatch for VertexFormat::UInt");
  342. static_assert(static_cast<uint32_t>(VertexFormat::UInt2) == WGPUVertexFormat_UInt2, "value mismatch for VertexFormat::UInt2");
  343. static_assert(static_cast<uint32_t>(VertexFormat::UInt3) == WGPUVertexFormat_UInt3, "value mismatch for VertexFormat::UInt3");
  344. static_assert(static_cast<uint32_t>(VertexFormat::UInt4) == WGPUVertexFormat_UInt4, "value mismatch for VertexFormat::UInt4");
  345. static_assert(static_cast<uint32_t>(VertexFormat::Int) == WGPUVertexFormat_Int, "value mismatch for VertexFormat::Int");
  346. static_assert(static_cast<uint32_t>(VertexFormat::Int2) == WGPUVertexFormat_Int2, "value mismatch for VertexFormat::Int2");
  347. static_assert(static_cast<uint32_t>(VertexFormat::Int3) == WGPUVertexFormat_Int3, "value mismatch for VertexFormat::Int3");
  348. static_assert(static_cast<uint32_t>(VertexFormat::Int4) == WGPUVertexFormat_Int4, "value mismatch for VertexFormat::Int4");
  349. // BufferUsage
  350. static_assert(sizeof(BufferUsage) == sizeof(WGPUBufferUsageFlags), "sizeof mismatch for BufferUsage");
  351. static_assert(alignof(BufferUsage) == alignof(WGPUBufferUsageFlags), "alignof mismatch for BufferUsage");
  352. static_assert(static_cast<uint32_t>(BufferUsage::None) == WGPUBufferUsage_None, "value mismatch for BufferUsage::None");
  353. static_assert(static_cast<uint32_t>(BufferUsage::MapRead) == WGPUBufferUsage_MapRead, "value mismatch for BufferUsage::MapRead");
  354. static_assert(static_cast<uint32_t>(BufferUsage::MapWrite) == WGPUBufferUsage_MapWrite, "value mismatch for BufferUsage::MapWrite");
  355. static_assert(static_cast<uint32_t>(BufferUsage::CopySrc) == WGPUBufferUsage_CopySrc, "value mismatch for BufferUsage::CopySrc");
  356. static_assert(static_cast<uint32_t>(BufferUsage::CopyDst) == WGPUBufferUsage_CopyDst, "value mismatch for BufferUsage::CopyDst");
  357. static_assert(static_cast<uint32_t>(BufferUsage::Index) == WGPUBufferUsage_Index, "value mismatch for BufferUsage::Index");
  358. static_assert(static_cast<uint32_t>(BufferUsage::Vertex) == WGPUBufferUsage_Vertex, "value mismatch for BufferUsage::Vertex");
  359. static_assert(static_cast<uint32_t>(BufferUsage::Uniform) == WGPUBufferUsage_Uniform, "value mismatch for BufferUsage::Uniform");
  360. static_assert(static_cast<uint32_t>(BufferUsage::Storage) == WGPUBufferUsage_Storage, "value mismatch for BufferUsage::Storage");
  361. static_assert(static_cast<uint32_t>(BufferUsage::Indirect) == WGPUBufferUsage_Indirect, "value mismatch for BufferUsage::Indirect");
  362. static_assert(static_cast<uint32_t>(BufferUsage::QueryResolve) == WGPUBufferUsage_QueryResolve, "value mismatch for BufferUsage::QueryResolve");
  363. // ColorWriteMask
  364. static_assert(sizeof(ColorWriteMask) == sizeof(WGPUColorWriteMaskFlags), "sizeof mismatch for ColorWriteMask");
  365. static_assert(alignof(ColorWriteMask) == alignof(WGPUColorWriteMaskFlags), "alignof mismatch for ColorWriteMask");
  366. static_assert(static_cast<uint32_t>(ColorWriteMask::None) == WGPUColorWriteMask_None, "value mismatch for ColorWriteMask::None");
  367. static_assert(static_cast<uint32_t>(ColorWriteMask::Red) == WGPUColorWriteMask_Red, "value mismatch for ColorWriteMask::Red");
  368. static_assert(static_cast<uint32_t>(ColorWriteMask::Green) == WGPUColorWriteMask_Green, "value mismatch for ColorWriteMask::Green");
  369. static_assert(static_cast<uint32_t>(ColorWriteMask::Blue) == WGPUColorWriteMask_Blue, "value mismatch for ColorWriteMask::Blue");
  370. static_assert(static_cast<uint32_t>(ColorWriteMask::Alpha) == WGPUColorWriteMask_Alpha, "value mismatch for ColorWriteMask::Alpha");
  371. static_assert(static_cast<uint32_t>(ColorWriteMask::All) == WGPUColorWriteMask_All, "value mismatch for ColorWriteMask::All");
  372. // MapMode
  373. static_assert(sizeof(MapMode) == sizeof(WGPUMapModeFlags), "sizeof mismatch for MapMode");
  374. static_assert(alignof(MapMode) == alignof(WGPUMapModeFlags), "alignof mismatch for MapMode");
  375. static_assert(static_cast<uint32_t>(MapMode::None) == WGPUMapMode_None, "value mismatch for MapMode::None");
  376. static_assert(static_cast<uint32_t>(MapMode::Read) == WGPUMapMode_Read, "value mismatch for MapMode::Read");
  377. static_assert(static_cast<uint32_t>(MapMode::Write) == WGPUMapMode_Write, "value mismatch for MapMode::Write");
  378. // ShaderStage
  379. static_assert(sizeof(ShaderStage) == sizeof(WGPUShaderStageFlags), "sizeof mismatch for ShaderStage");
  380. static_assert(alignof(ShaderStage) == alignof(WGPUShaderStageFlags), "alignof mismatch for ShaderStage");
  381. static_assert(static_cast<uint32_t>(ShaderStage::None) == WGPUShaderStage_None, "value mismatch for ShaderStage::None");
  382. static_assert(static_cast<uint32_t>(ShaderStage::Vertex) == WGPUShaderStage_Vertex, "value mismatch for ShaderStage::Vertex");
  383. static_assert(static_cast<uint32_t>(ShaderStage::Fragment) == WGPUShaderStage_Fragment, "value mismatch for ShaderStage::Fragment");
  384. static_assert(static_cast<uint32_t>(ShaderStage::Compute) == WGPUShaderStage_Compute, "value mismatch for ShaderStage::Compute");
  385. // TextureUsage
  386. static_assert(sizeof(TextureUsage) == sizeof(WGPUTextureUsageFlags), "sizeof mismatch for TextureUsage");
  387. static_assert(alignof(TextureUsage) == alignof(WGPUTextureUsageFlags), "alignof mismatch for TextureUsage");
  388. static_assert(static_cast<uint32_t>(TextureUsage::None) == WGPUTextureUsage_None, "value mismatch for TextureUsage::None");
  389. static_assert(static_cast<uint32_t>(TextureUsage::CopySrc) == WGPUTextureUsage_CopySrc, "value mismatch for TextureUsage::CopySrc");
  390. static_assert(static_cast<uint32_t>(TextureUsage::CopyDst) == WGPUTextureUsage_CopyDst, "value mismatch for TextureUsage::CopyDst");
  391. static_assert(static_cast<uint32_t>(TextureUsage::Sampled) == WGPUTextureUsage_Sampled, "value mismatch for TextureUsage::Sampled");
  392. static_assert(static_cast<uint32_t>(TextureUsage::Storage) == WGPUTextureUsage_Storage, "value mismatch for TextureUsage::Storage");
  393. static_assert(static_cast<uint32_t>(TextureUsage::OutputAttachment) == WGPUTextureUsage_OutputAttachment, "value mismatch for TextureUsage::OutputAttachment");
  394. static_assert(static_cast<uint32_t>(TextureUsage::RenderAttachment) == WGPUTextureUsage_RenderAttachment, "value mismatch for TextureUsage::RenderAttachment");
  395. static_assert(static_cast<uint32_t>(TextureUsage::Present) == WGPUTextureUsage_Present, "value mismatch for TextureUsage::Present");
  396. // ChainedStruct
  397. static_assert(sizeof(ChainedStruct) == sizeof(WGPUChainedStruct),
  398. "sizeof mismatch for ChainedStruct");
  399. static_assert(alignof(ChainedStruct) == alignof(WGPUChainedStruct),
  400. "alignof mismatch for ChainedStruct");
  401. static_assert(offsetof(ChainedStruct, nextInChain) == offsetof(WGPUChainedStruct, next),
  402. "offsetof mismatch for ChainedStruct::nextInChain");
  403. static_assert(offsetof(ChainedStruct, sType) == offsetof(WGPUChainedStruct, sType),
  404. "offsetof mismatch for ChainedStruct::sType");
  405. // AdapterProperties
  406. static_assert(sizeof(AdapterProperties) == sizeof(WGPUAdapterProperties), "sizeof mismatch for AdapterProperties");
  407. static_assert(alignof(AdapterProperties) == alignof(WGPUAdapterProperties), "alignof mismatch for AdapterProperties");
  408. static_assert(offsetof(AdapterProperties, nextInChain) == offsetof(WGPUAdapterProperties, nextInChain),
  409. "offsetof mismatch for AdapterProperties::nextInChain");
  410. static_assert(offsetof(AdapterProperties, deviceID) == offsetof(WGPUAdapterProperties, deviceID),
  411. "offsetof mismatch for AdapterProperties::deviceID");
  412. static_assert(offsetof(AdapterProperties, vendorID) == offsetof(WGPUAdapterProperties, vendorID),
  413. "offsetof mismatch for AdapterProperties::vendorID");
  414. static_assert(offsetof(AdapterProperties, name) == offsetof(WGPUAdapterProperties, name),
  415. "offsetof mismatch for AdapterProperties::name");
  416. static_assert(offsetof(AdapterProperties, driverDescription) == offsetof(WGPUAdapterProperties, driverDescription),
  417. "offsetof mismatch for AdapterProperties::driverDescription");
  418. static_assert(offsetof(AdapterProperties, adapterType) == offsetof(WGPUAdapterProperties, adapterType),
  419. "offsetof mismatch for AdapterProperties::adapterType");
  420. static_assert(offsetof(AdapterProperties, backendType) == offsetof(WGPUAdapterProperties, backendType),
  421. "offsetof mismatch for AdapterProperties::backendType");
  422. // BindGroupEntry
  423. static_assert(sizeof(BindGroupEntry) == sizeof(WGPUBindGroupEntry), "sizeof mismatch for BindGroupEntry");
  424. static_assert(alignof(BindGroupEntry) == alignof(WGPUBindGroupEntry), "alignof mismatch for BindGroupEntry");
  425. static_assert(offsetof(BindGroupEntry, binding) == offsetof(WGPUBindGroupEntry, binding),
  426. "offsetof mismatch for BindGroupEntry::binding");
  427. static_assert(offsetof(BindGroupEntry, buffer) == offsetof(WGPUBindGroupEntry, buffer),
  428. "offsetof mismatch for BindGroupEntry::buffer");
  429. static_assert(offsetof(BindGroupEntry, offset) == offsetof(WGPUBindGroupEntry, offset),
  430. "offsetof mismatch for BindGroupEntry::offset");
  431. static_assert(offsetof(BindGroupEntry, size) == offsetof(WGPUBindGroupEntry, size),
  432. "offsetof mismatch for BindGroupEntry::size");
  433. static_assert(offsetof(BindGroupEntry, sampler) == offsetof(WGPUBindGroupEntry, sampler),
  434. "offsetof mismatch for BindGroupEntry::sampler");
  435. static_assert(offsetof(BindGroupEntry, textureView) == offsetof(WGPUBindGroupEntry, textureView),
  436. "offsetof mismatch for BindGroupEntry::textureView");
  437. // BlendDescriptor
  438. static_assert(sizeof(BlendDescriptor) == sizeof(WGPUBlendDescriptor), "sizeof mismatch for BlendDescriptor");
  439. static_assert(alignof(BlendDescriptor) == alignof(WGPUBlendDescriptor), "alignof mismatch for BlendDescriptor");
  440. static_assert(offsetof(BlendDescriptor, operation) == offsetof(WGPUBlendDescriptor, operation),
  441. "offsetof mismatch for BlendDescriptor::operation");
  442. static_assert(offsetof(BlendDescriptor, srcFactor) == offsetof(WGPUBlendDescriptor, srcFactor),
  443. "offsetof mismatch for BlendDescriptor::srcFactor");
  444. static_assert(offsetof(BlendDescriptor, dstFactor) == offsetof(WGPUBlendDescriptor, dstFactor),
  445. "offsetof mismatch for BlendDescriptor::dstFactor");
  446. // BufferBindingLayout
  447. static_assert(sizeof(BufferBindingLayout) == sizeof(WGPUBufferBindingLayout), "sizeof mismatch for BufferBindingLayout");
  448. static_assert(alignof(BufferBindingLayout) == alignof(WGPUBufferBindingLayout), "alignof mismatch for BufferBindingLayout");
  449. static_assert(offsetof(BufferBindingLayout, nextInChain) == offsetof(WGPUBufferBindingLayout, nextInChain),
  450. "offsetof mismatch for BufferBindingLayout::nextInChain");
  451. static_assert(offsetof(BufferBindingLayout, type) == offsetof(WGPUBufferBindingLayout, type),
  452. "offsetof mismatch for BufferBindingLayout::type");
  453. static_assert(offsetof(BufferBindingLayout, hasDynamicOffset) == offsetof(WGPUBufferBindingLayout, hasDynamicOffset),
  454. "offsetof mismatch for BufferBindingLayout::hasDynamicOffset");
  455. static_assert(offsetof(BufferBindingLayout, minBindingSize) == offsetof(WGPUBufferBindingLayout, minBindingSize),
  456. "offsetof mismatch for BufferBindingLayout::minBindingSize");
  457. // BufferDescriptor
  458. static_assert(sizeof(BufferDescriptor) == sizeof(WGPUBufferDescriptor), "sizeof mismatch for BufferDescriptor");
  459. static_assert(alignof(BufferDescriptor) == alignof(WGPUBufferDescriptor), "alignof mismatch for BufferDescriptor");
  460. static_assert(offsetof(BufferDescriptor, nextInChain) == offsetof(WGPUBufferDescriptor, nextInChain),
  461. "offsetof mismatch for BufferDescriptor::nextInChain");
  462. static_assert(offsetof(BufferDescriptor, label) == offsetof(WGPUBufferDescriptor, label),
  463. "offsetof mismatch for BufferDescriptor::label");
  464. static_assert(offsetof(BufferDescriptor, usage) == offsetof(WGPUBufferDescriptor, usage),
  465. "offsetof mismatch for BufferDescriptor::usage");
  466. static_assert(offsetof(BufferDescriptor, size) == offsetof(WGPUBufferDescriptor, size),
  467. "offsetof mismatch for BufferDescriptor::size");
  468. static_assert(offsetof(BufferDescriptor, mappedAtCreation) == offsetof(WGPUBufferDescriptor, mappedAtCreation),
  469. "offsetof mismatch for BufferDescriptor::mappedAtCreation");
  470. // Color
  471. static_assert(sizeof(Color) == sizeof(WGPUColor), "sizeof mismatch for Color");
  472. static_assert(alignof(Color) == alignof(WGPUColor), "alignof mismatch for Color");
  473. static_assert(offsetof(Color, r) == offsetof(WGPUColor, r),
  474. "offsetof mismatch for Color::r");
  475. static_assert(offsetof(Color, g) == offsetof(WGPUColor, g),
  476. "offsetof mismatch for Color::g");
  477. static_assert(offsetof(Color, b) == offsetof(WGPUColor, b),
  478. "offsetof mismatch for Color::b");
  479. static_assert(offsetof(Color, a) == offsetof(WGPUColor, a),
  480. "offsetof mismatch for Color::a");
  481. // CommandBufferDescriptor
  482. static_assert(sizeof(CommandBufferDescriptor) == sizeof(WGPUCommandBufferDescriptor), "sizeof mismatch for CommandBufferDescriptor");
  483. static_assert(alignof(CommandBufferDescriptor) == alignof(WGPUCommandBufferDescriptor), "alignof mismatch for CommandBufferDescriptor");
  484. static_assert(offsetof(CommandBufferDescriptor, nextInChain) == offsetof(WGPUCommandBufferDescriptor, nextInChain),
  485. "offsetof mismatch for CommandBufferDescriptor::nextInChain");
  486. static_assert(offsetof(CommandBufferDescriptor, label) == offsetof(WGPUCommandBufferDescriptor, label),
  487. "offsetof mismatch for CommandBufferDescriptor::label");
  488. // CommandEncoderDescriptor
  489. static_assert(sizeof(CommandEncoderDescriptor) == sizeof(WGPUCommandEncoderDescriptor), "sizeof mismatch for CommandEncoderDescriptor");
  490. static_assert(alignof(CommandEncoderDescriptor) == alignof(WGPUCommandEncoderDescriptor), "alignof mismatch for CommandEncoderDescriptor");
  491. static_assert(offsetof(CommandEncoderDescriptor, nextInChain) == offsetof(WGPUCommandEncoderDescriptor, nextInChain),
  492. "offsetof mismatch for CommandEncoderDescriptor::nextInChain");
  493. static_assert(offsetof(CommandEncoderDescriptor, label) == offsetof(WGPUCommandEncoderDescriptor, label),
  494. "offsetof mismatch for CommandEncoderDescriptor::label");
  495. // ComputePassDescriptor
  496. static_assert(sizeof(ComputePassDescriptor) == sizeof(WGPUComputePassDescriptor), "sizeof mismatch for ComputePassDescriptor");
  497. static_assert(alignof(ComputePassDescriptor) == alignof(WGPUComputePassDescriptor), "alignof mismatch for ComputePassDescriptor");
  498. static_assert(offsetof(ComputePassDescriptor, nextInChain) == offsetof(WGPUComputePassDescriptor, nextInChain),
  499. "offsetof mismatch for ComputePassDescriptor::nextInChain");
  500. static_assert(offsetof(ComputePassDescriptor, label) == offsetof(WGPUComputePassDescriptor, label),
  501. "offsetof mismatch for ComputePassDescriptor::label");
  502. // CopyTextureForBrowserOptions
  503. static_assert(sizeof(CopyTextureForBrowserOptions) == sizeof(WGPUCopyTextureForBrowserOptions), "sizeof mismatch for CopyTextureForBrowserOptions");
  504. static_assert(alignof(CopyTextureForBrowserOptions) == alignof(WGPUCopyTextureForBrowserOptions), "alignof mismatch for CopyTextureForBrowserOptions");
  505. static_assert(offsetof(CopyTextureForBrowserOptions, nextInChain) == offsetof(WGPUCopyTextureForBrowserOptions, nextInChain),
  506. "offsetof mismatch for CopyTextureForBrowserOptions::nextInChain");
  507. static_assert(offsetof(CopyTextureForBrowserOptions, flipY) == offsetof(WGPUCopyTextureForBrowserOptions, flipY),
  508. "offsetof mismatch for CopyTextureForBrowserOptions::flipY");
  509. // DeviceProperties
  510. static_assert(sizeof(DeviceProperties) == sizeof(WGPUDeviceProperties), "sizeof mismatch for DeviceProperties");
  511. static_assert(alignof(DeviceProperties) == alignof(WGPUDeviceProperties), "alignof mismatch for DeviceProperties");
  512. static_assert(offsetof(DeviceProperties, textureCompressionBC) == offsetof(WGPUDeviceProperties, textureCompressionBC),
  513. "offsetof mismatch for DeviceProperties::textureCompressionBC");
  514. static_assert(offsetof(DeviceProperties, shaderFloat16) == offsetof(WGPUDeviceProperties, shaderFloat16),
  515. "offsetof mismatch for DeviceProperties::shaderFloat16");
  516. static_assert(offsetof(DeviceProperties, pipelineStatisticsQuery) == offsetof(WGPUDeviceProperties, pipelineStatisticsQuery),
  517. "offsetof mismatch for DeviceProperties::pipelineStatisticsQuery");
  518. static_assert(offsetof(DeviceProperties, timestampQuery) == offsetof(WGPUDeviceProperties, timestampQuery),
  519. "offsetof mismatch for DeviceProperties::timestampQuery");
  520. // Extent3D
  521. static_assert(sizeof(Extent3D) == sizeof(WGPUExtent3D), "sizeof mismatch for Extent3D");
  522. static_assert(alignof(Extent3D) == alignof(WGPUExtent3D), "alignof mismatch for Extent3D");
  523. static_assert(offsetof(Extent3D, width) == offsetof(WGPUExtent3D, width),
  524. "offsetof mismatch for Extent3D::width");
  525. static_assert(offsetof(Extent3D, height) == offsetof(WGPUExtent3D, height),
  526. "offsetof mismatch for Extent3D::height");
  527. static_assert(offsetof(Extent3D, depth) == offsetof(WGPUExtent3D, depth),
  528. "offsetof mismatch for Extent3D::depth");
  529. // FenceDescriptor
  530. static_assert(sizeof(FenceDescriptor) == sizeof(WGPUFenceDescriptor), "sizeof mismatch for FenceDescriptor");
  531. static_assert(alignof(FenceDescriptor) == alignof(WGPUFenceDescriptor), "alignof mismatch for FenceDescriptor");
  532. static_assert(offsetof(FenceDescriptor, nextInChain) == offsetof(WGPUFenceDescriptor, nextInChain),
  533. "offsetof mismatch for FenceDescriptor::nextInChain");
  534. static_assert(offsetof(FenceDescriptor, label) == offsetof(WGPUFenceDescriptor, label),
  535. "offsetof mismatch for FenceDescriptor::label");
  536. static_assert(offsetof(FenceDescriptor, initialValue) == offsetof(WGPUFenceDescriptor, initialValue),
  537. "offsetof mismatch for FenceDescriptor::initialValue");
  538. // InstanceDescriptor
  539. static_assert(sizeof(InstanceDescriptor) == sizeof(WGPUInstanceDescriptor), "sizeof mismatch for InstanceDescriptor");
  540. static_assert(alignof(InstanceDescriptor) == alignof(WGPUInstanceDescriptor), "alignof mismatch for InstanceDescriptor");
  541. static_assert(offsetof(InstanceDescriptor, nextInChain) == offsetof(WGPUInstanceDescriptor, nextInChain),
  542. "offsetof mismatch for InstanceDescriptor::nextInChain");
  543. // Origin3D
  544. static_assert(sizeof(Origin3D) == sizeof(WGPUOrigin3D), "sizeof mismatch for Origin3D");
  545. static_assert(alignof(Origin3D) == alignof(WGPUOrigin3D), "alignof mismatch for Origin3D");
  546. static_assert(offsetof(Origin3D, x) == offsetof(WGPUOrigin3D, x),
  547. "offsetof mismatch for Origin3D::x");
  548. static_assert(offsetof(Origin3D, y) == offsetof(WGPUOrigin3D, y),
  549. "offsetof mismatch for Origin3D::y");
  550. static_assert(offsetof(Origin3D, z) == offsetof(WGPUOrigin3D, z),
  551. "offsetof mismatch for Origin3D::z");
  552. // PipelineLayoutDescriptor
  553. static_assert(sizeof(PipelineLayoutDescriptor) == sizeof(WGPUPipelineLayoutDescriptor), "sizeof mismatch for PipelineLayoutDescriptor");
  554. static_assert(alignof(PipelineLayoutDescriptor) == alignof(WGPUPipelineLayoutDescriptor), "alignof mismatch for PipelineLayoutDescriptor");
  555. static_assert(offsetof(PipelineLayoutDescriptor, nextInChain) == offsetof(WGPUPipelineLayoutDescriptor, nextInChain),
  556. "offsetof mismatch for PipelineLayoutDescriptor::nextInChain");
  557. static_assert(offsetof(PipelineLayoutDescriptor, label) == offsetof(WGPUPipelineLayoutDescriptor, label),
  558. "offsetof mismatch for PipelineLayoutDescriptor::label");
  559. static_assert(offsetof(PipelineLayoutDescriptor, bindGroupLayoutCount) == offsetof(WGPUPipelineLayoutDescriptor, bindGroupLayoutCount),
  560. "offsetof mismatch for PipelineLayoutDescriptor::bindGroupLayoutCount");
  561. static_assert(offsetof(PipelineLayoutDescriptor, bindGroupLayouts) == offsetof(WGPUPipelineLayoutDescriptor, bindGroupLayouts),
  562. "offsetof mismatch for PipelineLayoutDescriptor::bindGroupLayouts");
  563. // ProgrammableStageDescriptor
  564. static_assert(sizeof(ProgrammableStageDescriptor) == sizeof(WGPUProgrammableStageDescriptor), "sizeof mismatch for ProgrammableStageDescriptor");
  565. static_assert(alignof(ProgrammableStageDescriptor) == alignof(WGPUProgrammableStageDescriptor), "alignof mismatch for ProgrammableStageDescriptor");
  566. static_assert(offsetof(ProgrammableStageDescriptor, nextInChain) == offsetof(WGPUProgrammableStageDescriptor, nextInChain),
  567. "offsetof mismatch for ProgrammableStageDescriptor::nextInChain");
  568. static_assert(offsetof(ProgrammableStageDescriptor, module) == offsetof(WGPUProgrammableStageDescriptor, module),
  569. "offsetof mismatch for ProgrammableStageDescriptor::module");
  570. static_assert(offsetof(ProgrammableStageDescriptor, entryPoint) == offsetof(WGPUProgrammableStageDescriptor, entryPoint),
  571. "offsetof mismatch for ProgrammableStageDescriptor::entryPoint");
  572. // QuerySetDescriptor
  573. static_assert(sizeof(QuerySetDescriptor) == sizeof(WGPUQuerySetDescriptor), "sizeof mismatch for QuerySetDescriptor");
  574. static_assert(alignof(QuerySetDescriptor) == alignof(WGPUQuerySetDescriptor), "alignof mismatch for QuerySetDescriptor");
  575. static_assert(offsetof(QuerySetDescriptor, nextInChain) == offsetof(WGPUQuerySetDescriptor, nextInChain),
  576. "offsetof mismatch for QuerySetDescriptor::nextInChain");
  577. static_assert(offsetof(QuerySetDescriptor, label) == offsetof(WGPUQuerySetDescriptor, label),
  578. "offsetof mismatch for QuerySetDescriptor::label");
  579. static_assert(offsetof(QuerySetDescriptor, type) == offsetof(WGPUQuerySetDescriptor, type),
  580. "offsetof mismatch for QuerySetDescriptor::type");
  581. static_assert(offsetof(QuerySetDescriptor, count) == offsetof(WGPUQuerySetDescriptor, count),
  582. "offsetof mismatch for QuerySetDescriptor::count");
  583. static_assert(offsetof(QuerySetDescriptor, pipelineStatistics) == offsetof(WGPUQuerySetDescriptor, pipelineStatistics),
  584. "offsetof mismatch for QuerySetDescriptor::pipelineStatistics");
  585. static_assert(offsetof(QuerySetDescriptor, pipelineStatisticsCount) == offsetof(WGPUQuerySetDescriptor, pipelineStatisticsCount),
  586. "offsetof mismatch for QuerySetDescriptor::pipelineStatisticsCount");
  587. // RasterizationStateDescriptor
  588. static_assert(sizeof(RasterizationStateDescriptor) == sizeof(WGPURasterizationStateDescriptor), "sizeof mismatch for RasterizationStateDescriptor");
  589. static_assert(alignof(RasterizationStateDescriptor) == alignof(WGPURasterizationStateDescriptor), "alignof mismatch for RasterizationStateDescriptor");
  590. static_assert(offsetof(RasterizationStateDescriptor, nextInChain) == offsetof(WGPURasterizationStateDescriptor, nextInChain),
  591. "offsetof mismatch for RasterizationStateDescriptor::nextInChain");
  592. static_assert(offsetof(RasterizationStateDescriptor, frontFace) == offsetof(WGPURasterizationStateDescriptor, frontFace),
  593. "offsetof mismatch for RasterizationStateDescriptor::frontFace");
  594. static_assert(offsetof(RasterizationStateDescriptor, cullMode) == offsetof(WGPURasterizationStateDescriptor, cullMode),
  595. "offsetof mismatch for RasterizationStateDescriptor::cullMode");
  596. static_assert(offsetof(RasterizationStateDescriptor, depthBias) == offsetof(WGPURasterizationStateDescriptor, depthBias),
  597. "offsetof mismatch for RasterizationStateDescriptor::depthBias");
  598. static_assert(offsetof(RasterizationStateDescriptor, depthBiasSlopeScale) == offsetof(WGPURasterizationStateDescriptor, depthBiasSlopeScale),
  599. "offsetof mismatch for RasterizationStateDescriptor::depthBiasSlopeScale");
  600. static_assert(offsetof(RasterizationStateDescriptor, depthBiasClamp) == offsetof(WGPURasterizationStateDescriptor, depthBiasClamp),
  601. "offsetof mismatch for RasterizationStateDescriptor::depthBiasClamp");
  602. // RenderBundleDescriptor
  603. static_assert(sizeof(RenderBundleDescriptor) == sizeof(WGPURenderBundleDescriptor), "sizeof mismatch for RenderBundleDescriptor");
  604. static_assert(alignof(RenderBundleDescriptor) == alignof(WGPURenderBundleDescriptor), "alignof mismatch for RenderBundleDescriptor");
  605. static_assert(offsetof(RenderBundleDescriptor, nextInChain) == offsetof(WGPURenderBundleDescriptor, nextInChain),
  606. "offsetof mismatch for RenderBundleDescriptor::nextInChain");
  607. static_assert(offsetof(RenderBundleDescriptor, label) == offsetof(WGPURenderBundleDescriptor, label),
  608. "offsetof mismatch for RenderBundleDescriptor::label");
  609. // RenderBundleEncoderDescriptor
  610. static_assert(sizeof(RenderBundleEncoderDescriptor) == sizeof(WGPURenderBundleEncoderDescriptor), "sizeof mismatch for RenderBundleEncoderDescriptor");
  611. static_assert(alignof(RenderBundleEncoderDescriptor) == alignof(WGPURenderBundleEncoderDescriptor), "alignof mismatch for RenderBundleEncoderDescriptor");
  612. static_assert(offsetof(RenderBundleEncoderDescriptor, nextInChain) == offsetof(WGPURenderBundleEncoderDescriptor, nextInChain),
  613. "offsetof mismatch for RenderBundleEncoderDescriptor::nextInChain");
  614. static_assert(offsetof(RenderBundleEncoderDescriptor, label) == offsetof(WGPURenderBundleEncoderDescriptor, label),
  615. "offsetof mismatch for RenderBundleEncoderDescriptor::label");
  616. static_assert(offsetof(RenderBundleEncoderDescriptor, colorFormatsCount) == offsetof(WGPURenderBundleEncoderDescriptor, colorFormatsCount),
  617. "offsetof mismatch for RenderBundleEncoderDescriptor::colorFormatsCount");
  618. static_assert(offsetof(RenderBundleEncoderDescriptor, colorFormats) == offsetof(WGPURenderBundleEncoderDescriptor, colorFormats),
  619. "offsetof mismatch for RenderBundleEncoderDescriptor::colorFormats");
  620. static_assert(offsetof(RenderBundleEncoderDescriptor, depthStencilFormat) == offsetof(WGPURenderBundleEncoderDescriptor, depthStencilFormat),
  621. "offsetof mismatch for RenderBundleEncoderDescriptor::depthStencilFormat");
  622. static_assert(offsetof(RenderBundleEncoderDescriptor, sampleCount) == offsetof(WGPURenderBundleEncoderDescriptor, sampleCount),
  623. "offsetof mismatch for RenderBundleEncoderDescriptor::sampleCount");
  624. // RenderPassDepthStencilAttachmentDescriptor
  625. static_assert(sizeof(RenderPassDepthStencilAttachmentDescriptor) == sizeof(WGPURenderPassDepthStencilAttachmentDescriptor), "sizeof mismatch for RenderPassDepthStencilAttachmentDescriptor");
  626. static_assert(alignof(RenderPassDepthStencilAttachmentDescriptor) == alignof(WGPURenderPassDepthStencilAttachmentDescriptor), "alignof mismatch for RenderPassDepthStencilAttachmentDescriptor");
  627. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, attachment) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, attachment),
  628. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::attachment");
  629. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, depthLoadOp) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, depthLoadOp),
  630. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::depthLoadOp");
  631. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, depthStoreOp) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, depthStoreOp),
  632. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::depthStoreOp");
  633. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, clearDepth) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, clearDepth),
  634. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::clearDepth");
  635. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, depthReadOnly) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, depthReadOnly),
  636. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::depthReadOnly");
  637. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, stencilLoadOp) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, stencilLoadOp),
  638. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::stencilLoadOp");
  639. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, stencilStoreOp) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, stencilStoreOp),
  640. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::stencilStoreOp");
  641. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, clearStencil) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, clearStencil),
  642. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::clearStencil");
  643. static_assert(offsetof(RenderPassDepthStencilAttachmentDescriptor, stencilReadOnly) == offsetof(WGPURenderPassDepthStencilAttachmentDescriptor, stencilReadOnly),
  644. "offsetof mismatch for RenderPassDepthStencilAttachmentDescriptor::stencilReadOnly");
  645. // SamplerBindingLayout
  646. static_assert(sizeof(SamplerBindingLayout) == sizeof(WGPUSamplerBindingLayout), "sizeof mismatch for SamplerBindingLayout");
  647. static_assert(alignof(SamplerBindingLayout) == alignof(WGPUSamplerBindingLayout), "alignof mismatch for SamplerBindingLayout");
  648. static_assert(offsetof(SamplerBindingLayout, nextInChain) == offsetof(WGPUSamplerBindingLayout, nextInChain),
  649. "offsetof mismatch for SamplerBindingLayout::nextInChain");
  650. static_assert(offsetof(SamplerBindingLayout, type) == offsetof(WGPUSamplerBindingLayout, type),
  651. "offsetof mismatch for SamplerBindingLayout::type");
  652. // SamplerDescriptor
  653. static_assert(sizeof(SamplerDescriptor) == sizeof(WGPUSamplerDescriptor), "sizeof mismatch for SamplerDescriptor");
  654. static_assert(alignof(SamplerDescriptor) == alignof(WGPUSamplerDescriptor), "alignof mismatch for SamplerDescriptor");
  655. static_assert(offsetof(SamplerDescriptor, nextInChain) == offsetof(WGPUSamplerDescriptor, nextInChain),
  656. "offsetof mismatch for SamplerDescriptor::nextInChain");
  657. static_assert(offsetof(SamplerDescriptor, label) == offsetof(WGPUSamplerDescriptor, label),
  658. "offsetof mismatch for SamplerDescriptor::label");
  659. static_assert(offsetof(SamplerDescriptor, addressModeU) == offsetof(WGPUSamplerDescriptor, addressModeU),
  660. "offsetof mismatch for SamplerDescriptor::addressModeU");
  661. static_assert(offsetof(SamplerDescriptor, addressModeV) == offsetof(WGPUSamplerDescriptor, addressModeV),
  662. "offsetof mismatch for SamplerDescriptor::addressModeV");
  663. static_assert(offsetof(SamplerDescriptor, addressModeW) == offsetof(WGPUSamplerDescriptor, addressModeW),
  664. "offsetof mismatch for SamplerDescriptor::addressModeW");
  665. static_assert(offsetof(SamplerDescriptor, magFilter) == offsetof(WGPUSamplerDescriptor, magFilter),
  666. "offsetof mismatch for SamplerDescriptor::magFilter");
  667. static_assert(offsetof(SamplerDescriptor, minFilter) == offsetof(WGPUSamplerDescriptor, minFilter),
  668. "offsetof mismatch for SamplerDescriptor::minFilter");
  669. static_assert(offsetof(SamplerDescriptor, mipmapFilter) == offsetof(WGPUSamplerDescriptor, mipmapFilter),
  670. "offsetof mismatch for SamplerDescriptor::mipmapFilter");
  671. static_assert(offsetof(SamplerDescriptor, lodMinClamp) == offsetof(WGPUSamplerDescriptor, lodMinClamp),
  672. "offsetof mismatch for SamplerDescriptor::lodMinClamp");
  673. static_assert(offsetof(SamplerDescriptor, lodMaxClamp) == offsetof(WGPUSamplerDescriptor, lodMaxClamp),
  674. "offsetof mismatch for SamplerDescriptor::lodMaxClamp");
  675. static_assert(offsetof(SamplerDescriptor, compare) == offsetof(WGPUSamplerDescriptor, compare),
  676. "offsetof mismatch for SamplerDescriptor::compare");
  677. static_assert(offsetof(SamplerDescriptor, maxAnisotropy) == offsetof(WGPUSamplerDescriptor, maxAnisotropy),
  678. "offsetof mismatch for SamplerDescriptor::maxAnisotropy");
  679. // SamplerDescriptorDummyAnisotropicFiltering
  680. static_assert(sizeof(SamplerDescriptorDummyAnisotropicFiltering) == sizeof(WGPUSamplerDescriptorDummyAnisotropicFiltering), "sizeof mismatch for SamplerDescriptorDummyAnisotropicFiltering");
  681. static_assert(alignof(SamplerDescriptorDummyAnisotropicFiltering) == alignof(WGPUSamplerDescriptorDummyAnisotropicFiltering), "alignof mismatch for SamplerDescriptorDummyAnisotropicFiltering");
  682. static_assert(offsetof(SamplerDescriptorDummyAnisotropicFiltering, maxAnisotropy) == offsetof(WGPUSamplerDescriptorDummyAnisotropicFiltering, maxAnisotropy),
  683. "offsetof mismatch for SamplerDescriptorDummyAnisotropicFiltering::maxAnisotropy");
  684. // ShaderModuleDescriptor
  685. static_assert(sizeof(ShaderModuleDescriptor) == sizeof(WGPUShaderModuleDescriptor), "sizeof mismatch for ShaderModuleDescriptor");
  686. static_assert(alignof(ShaderModuleDescriptor) == alignof(WGPUShaderModuleDescriptor), "alignof mismatch for ShaderModuleDescriptor");
  687. static_assert(offsetof(ShaderModuleDescriptor, nextInChain) == offsetof(WGPUShaderModuleDescriptor, nextInChain),
  688. "offsetof mismatch for ShaderModuleDescriptor::nextInChain");
  689. static_assert(offsetof(ShaderModuleDescriptor, label) == offsetof(WGPUShaderModuleDescriptor, label),
  690. "offsetof mismatch for ShaderModuleDescriptor::label");
  691. // ShaderModuleSPIRVDescriptor
  692. static_assert(sizeof(ShaderModuleSPIRVDescriptor) == sizeof(WGPUShaderModuleSPIRVDescriptor), "sizeof mismatch for ShaderModuleSPIRVDescriptor");
  693. static_assert(alignof(ShaderModuleSPIRVDescriptor) == alignof(WGPUShaderModuleSPIRVDescriptor), "alignof mismatch for ShaderModuleSPIRVDescriptor");
  694. static_assert(offsetof(ShaderModuleSPIRVDescriptor, codeSize) == offsetof(WGPUShaderModuleSPIRVDescriptor, codeSize),
  695. "offsetof mismatch for ShaderModuleSPIRVDescriptor::codeSize");
  696. static_assert(offsetof(ShaderModuleSPIRVDescriptor, code) == offsetof(WGPUShaderModuleSPIRVDescriptor, code),
  697. "offsetof mismatch for ShaderModuleSPIRVDescriptor::code");
  698. // ShaderModuleWGSLDescriptor
  699. static_assert(sizeof(ShaderModuleWGSLDescriptor) == sizeof(WGPUShaderModuleWGSLDescriptor), "sizeof mismatch for ShaderModuleWGSLDescriptor");
  700. static_assert(alignof(ShaderModuleWGSLDescriptor) == alignof(WGPUShaderModuleWGSLDescriptor), "alignof mismatch for ShaderModuleWGSLDescriptor");
  701. static_assert(offsetof(ShaderModuleWGSLDescriptor, source) == offsetof(WGPUShaderModuleWGSLDescriptor, source),
  702. "offsetof mismatch for ShaderModuleWGSLDescriptor::source");
  703. // StencilStateFaceDescriptor
  704. static_assert(sizeof(StencilStateFaceDescriptor) == sizeof(WGPUStencilStateFaceDescriptor), "sizeof mismatch for StencilStateFaceDescriptor");
  705. static_assert(alignof(StencilStateFaceDescriptor) == alignof(WGPUStencilStateFaceDescriptor), "alignof mismatch for StencilStateFaceDescriptor");
  706. static_assert(offsetof(StencilStateFaceDescriptor, compare) == offsetof(WGPUStencilStateFaceDescriptor, compare),
  707. "offsetof mismatch for StencilStateFaceDescriptor::compare");
  708. static_assert(offsetof(StencilStateFaceDescriptor, failOp) == offsetof(WGPUStencilStateFaceDescriptor, failOp),
  709. "offsetof mismatch for StencilStateFaceDescriptor::failOp");
  710. static_assert(offsetof(StencilStateFaceDescriptor, depthFailOp) == offsetof(WGPUStencilStateFaceDescriptor, depthFailOp),
  711. "offsetof mismatch for StencilStateFaceDescriptor::depthFailOp");
  712. static_assert(offsetof(StencilStateFaceDescriptor, passOp) == offsetof(WGPUStencilStateFaceDescriptor, passOp),
  713. "offsetof mismatch for StencilStateFaceDescriptor::passOp");
  714. // StorageTextureBindingLayout
  715. static_assert(sizeof(StorageTextureBindingLayout) == sizeof(WGPUStorageTextureBindingLayout), "sizeof mismatch for StorageTextureBindingLayout");
  716. static_assert(alignof(StorageTextureBindingLayout) == alignof(WGPUStorageTextureBindingLayout), "alignof mismatch for StorageTextureBindingLayout");
  717. static_assert(offsetof(StorageTextureBindingLayout, nextInChain) == offsetof(WGPUStorageTextureBindingLayout, nextInChain),
  718. "offsetof mismatch for StorageTextureBindingLayout::nextInChain");
  719. static_assert(offsetof(StorageTextureBindingLayout, access) == offsetof(WGPUStorageTextureBindingLayout, access),
  720. "offsetof mismatch for StorageTextureBindingLayout::access");
  721. static_assert(offsetof(StorageTextureBindingLayout, format) == offsetof(WGPUStorageTextureBindingLayout, format),
  722. "offsetof mismatch for StorageTextureBindingLayout::format");
  723. static_assert(offsetof(StorageTextureBindingLayout, viewDimension) == offsetof(WGPUStorageTextureBindingLayout, viewDimension),
  724. "offsetof mismatch for StorageTextureBindingLayout::viewDimension");
  725. // SurfaceDescriptor
  726. static_assert(sizeof(SurfaceDescriptor) == sizeof(WGPUSurfaceDescriptor), "sizeof mismatch for SurfaceDescriptor");
  727. static_assert(alignof(SurfaceDescriptor) == alignof(WGPUSurfaceDescriptor), "alignof mismatch for SurfaceDescriptor");
  728. static_assert(offsetof(SurfaceDescriptor, nextInChain) == offsetof(WGPUSurfaceDescriptor, nextInChain),
  729. "offsetof mismatch for SurfaceDescriptor::nextInChain");
  730. static_assert(offsetof(SurfaceDescriptor, label) == offsetof(WGPUSurfaceDescriptor, label),
  731. "offsetof mismatch for SurfaceDescriptor::label");
  732. // SurfaceDescriptorFromCanvasHTMLSelector
  733. static_assert(sizeof(SurfaceDescriptorFromCanvasHTMLSelector) == sizeof(WGPUSurfaceDescriptorFromCanvasHTMLSelector), "sizeof mismatch for SurfaceDescriptorFromCanvasHTMLSelector");
  734. static_assert(alignof(SurfaceDescriptorFromCanvasHTMLSelector) == alignof(WGPUSurfaceDescriptorFromCanvasHTMLSelector), "alignof mismatch for SurfaceDescriptorFromCanvasHTMLSelector");
  735. static_assert(offsetof(SurfaceDescriptorFromCanvasHTMLSelector, selector) == offsetof(WGPUSurfaceDescriptorFromCanvasHTMLSelector, selector),
  736. "offsetof mismatch for SurfaceDescriptorFromCanvasHTMLSelector::selector");
  737. // SurfaceDescriptorFromMetalLayer
  738. static_assert(sizeof(SurfaceDescriptorFromMetalLayer) == sizeof(WGPUSurfaceDescriptorFromMetalLayer), "sizeof mismatch for SurfaceDescriptorFromMetalLayer");
  739. static_assert(alignof(SurfaceDescriptorFromMetalLayer) == alignof(WGPUSurfaceDescriptorFromMetalLayer), "alignof mismatch for SurfaceDescriptorFromMetalLayer");
  740. static_assert(offsetof(SurfaceDescriptorFromMetalLayer, layer) == offsetof(WGPUSurfaceDescriptorFromMetalLayer, layer),
  741. "offsetof mismatch for SurfaceDescriptorFromMetalLayer::layer");
  742. // SurfaceDescriptorFromWindowsHWND
  743. static_assert(sizeof(SurfaceDescriptorFromWindowsHWND) == sizeof(WGPUSurfaceDescriptorFromWindowsHWND), "sizeof mismatch for SurfaceDescriptorFromWindowsHWND");
  744. static_assert(alignof(SurfaceDescriptorFromWindowsHWND) == alignof(WGPUSurfaceDescriptorFromWindowsHWND), "alignof mismatch for SurfaceDescriptorFromWindowsHWND");
  745. static_assert(offsetof(SurfaceDescriptorFromWindowsHWND, hinstance) == offsetof(WGPUSurfaceDescriptorFromWindowsHWND, hinstance),
  746. "offsetof mismatch for SurfaceDescriptorFromWindowsHWND::hinstance");
  747. static_assert(offsetof(SurfaceDescriptorFromWindowsHWND, hwnd) == offsetof(WGPUSurfaceDescriptorFromWindowsHWND, hwnd),
  748. "offsetof mismatch for SurfaceDescriptorFromWindowsHWND::hwnd");
  749. // SurfaceDescriptorFromXlib
  750. static_assert(sizeof(SurfaceDescriptorFromXlib) == sizeof(WGPUSurfaceDescriptorFromXlib), "sizeof mismatch for SurfaceDescriptorFromXlib");
  751. static_assert(alignof(SurfaceDescriptorFromXlib) == alignof(WGPUSurfaceDescriptorFromXlib), "alignof mismatch for SurfaceDescriptorFromXlib");
  752. static_assert(offsetof(SurfaceDescriptorFromXlib, display) == offsetof(WGPUSurfaceDescriptorFromXlib, display),
  753. "offsetof mismatch for SurfaceDescriptorFromXlib::display");
  754. static_assert(offsetof(SurfaceDescriptorFromXlib, window) == offsetof(WGPUSurfaceDescriptorFromXlib, window),
  755. "offsetof mismatch for SurfaceDescriptorFromXlib::window");
  756. // SwapChainDescriptor
  757. static_assert(sizeof(SwapChainDescriptor) == sizeof(WGPUSwapChainDescriptor), "sizeof mismatch for SwapChainDescriptor");
  758. static_assert(alignof(SwapChainDescriptor) == alignof(WGPUSwapChainDescriptor), "alignof mismatch for SwapChainDescriptor");
  759. static_assert(offsetof(SwapChainDescriptor, nextInChain) == offsetof(WGPUSwapChainDescriptor, nextInChain),
  760. "offsetof mismatch for SwapChainDescriptor::nextInChain");
  761. static_assert(offsetof(SwapChainDescriptor, label) == offsetof(WGPUSwapChainDescriptor, label),
  762. "offsetof mismatch for SwapChainDescriptor::label");
  763. static_assert(offsetof(SwapChainDescriptor, usage) == offsetof(WGPUSwapChainDescriptor, usage),
  764. "offsetof mismatch for SwapChainDescriptor::usage");
  765. static_assert(offsetof(SwapChainDescriptor, format) == offsetof(WGPUSwapChainDescriptor, format),
  766. "offsetof mismatch for SwapChainDescriptor::format");
  767. static_assert(offsetof(SwapChainDescriptor, width) == offsetof(WGPUSwapChainDescriptor, width),
  768. "offsetof mismatch for SwapChainDescriptor::width");
  769. static_assert(offsetof(SwapChainDescriptor, height) == offsetof(WGPUSwapChainDescriptor, height),
  770. "offsetof mismatch for SwapChainDescriptor::height");
  771. static_assert(offsetof(SwapChainDescriptor, presentMode) == offsetof(WGPUSwapChainDescriptor, presentMode),
  772. "offsetof mismatch for SwapChainDescriptor::presentMode");
  773. static_assert(offsetof(SwapChainDescriptor, implementation) == offsetof(WGPUSwapChainDescriptor, implementation),
  774. "offsetof mismatch for SwapChainDescriptor::implementation");
  775. // TextureBindingLayout
  776. static_assert(sizeof(TextureBindingLayout) == sizeof(WGPUTextureBindingLayout), "sizeof mismatch for TextureBindingLayout");
  777. static_assert(alignof(TextureBindingLayout) == alignof(WGPUTextureBindingLayout), "alignof mismatch for TextureBindingLayout");
  778. static_assert(offsetof(TextureBindingLayout, nextInChain) == offsetof(WGPUTextureBindingLayout, nextInChain),
  779. "offsetof mismatch for TextureBindingLayout::nextInChain");
  780. static_assert(offsetof(TextureBindingLayout, sampleType) == offsetof(WGPUTextureBindingLayout, sampleType),
  781. "offsetof mismatch for TextureBindingLayout::sampleType");
  782. static_assert(offsetof(TextureBindingLayout, viewDimension) == offsetof(WGPUTextureBindingLayout, viewDimension),
  783. "offsetof mismatch for TextureBindingLayout::viewDimension");
  784. static_assert(offsetof(TextureBindingLayout, multisampled) == offsetof(WGPUTextureBindingLayout, multisampled),
  785. "offsetof mismatch for TextureBindingLayout::multisampled");
  786. // TextureDataLayout
  787. static_assert(sizeof(TextureDataLayout) == sizeof(WGPUTextureDataLayout), "sizeof mismatch for TextureDataLayout");
  788. static_assert(alignof(TextureDataLayout) == alignof(WGPUTextureDataLayout), "alignof mismatch for TextureDataLayout");
  789. static_assert(offsetof(TextureDataLayout, nextInChain) == offsetof(WGPUTextureDataLayout, nextInChain),
  790. "offsetof mismatch for TextureDataLayout::nextInChain");
  791. static_assert(offsetof(TextureDataLayout, offset) == offsetof(WGPUTextureDataLayout, offset),
  792. "offsetof mismatch for TextureDataLayout::offset");
  793. static_assert(offsetof(TextureDataLayout, bytesPerRow) == offsetof(WGPUTextureDataLayout, bytesPerRow),
  794. "offsetof mismatch for TextureDataLayout::bytesPerRow");
  795. static_assert(offsetof(TextureDataLayout, rowsPerImage) == offsetof(WGPUTextureDataLayout, rowsPerImage),
  796. "offsetof mismatch for TextureDataLayout::rowsPerImage");
  797. // TextureViewDescriptor
  798. static_assert(sizeof(TextureViewDescriptor) == sizeof(WGPUTextureViewDescriptor), "sizeof mismatch for TextureViewDescriptor");
  799. static_assert(alignof(TextureViewDescriptor) == alignof(WGPUTextureViewDescriptor), "alignof mismatch for TextureViewDescriptor");
  800. static_assert(offsetof(TextureViewDescriptor, nextInChain) == offsetof(WGPUTextureViewDescriptor, nextInChain),
  801. "offsetof mismatch for TextureViewDescriptor::nextInChain");
  802. static_assert(offsetof(TextureViewDescriptor, label) == offsetof(WGPUTextureViewDescriptor, label),
  803. "offsetof mismatch for TextureViewDescriptor::label");
  804. static_assert(offsetof(TextureViewDescriptor, format) == offsetof(WGPUTextureViewDescriptor, format),
  805. "offsetof mismatch for TextureViewDescriptor::format");
  806. static_assert(offsetof(TextureViewDescriptor, dimension) == offsetof(WGPUTextureViewDescriptor, dimension),
  807. "offsetof mismatch for TextureViewDescriptor::dimension");
  808. static_assert(offsetof(TextureViewDescriptor, baseMipLevel) == offsetof(WGPUTextureViewDescriptor, baseMipLevel),
  809. "offsetof mismatch for TextureViewDescriptor::baseMipLevel");
  810. static_assert(offsetof(TextureViewDescriptor, mipLevelCount) == offsetof(WGPUTextureViewDescriptor, mipLevelCount),
  811. "offsetof mismatch for TextureViewDescriptor::mipLevelCount");
  812. static_assert(offsetof(TextureViewDescriptor, baseArrayLayer) == offsetof(WGPUTextureViewDescriptor, baseArrayLayer),
  813. "offsetof mismatch for TextureViewDescriptor::baseArrayLayer");
  814. static_assert(offsetof(TextureViewDescriptor, arrayLayerCount) == offsetof(WGPUTextureViewDescriptor, arrayLayerCount),
  815. "offsetof mismatch for TextureViewDescriptor::arrayLayerCount");
  816. static_assert(offsetof(TextureViewDescriptor, aspect) == offsetof(WGPUTextureViewDescriptor, aspect),
  817. "offsetof mismatch for TextureViewDescriptor::aspect");
  818. // VertexAttributeDescriptor
  819. static_assert(sizeof(VertexAttributeDescriptor) == sizeof(WGPUVertexAttributeDescriptor), "sizeof mismatch for VertexAttributeDescriptor");
  820. static_assert(alignof(VertexAttributeDescriptor) == alignof(WGPUVertexAttributeDescriptor), "alignof mismatch for VertexAttributeDescriptor");
  821. static_assert(offsetof(VertexAttributeDescriptor, format) == offsetof(WGPUVertexAttributeDescriptor, format),
  822. "offsetof mismatch for VertexAttributeDescriptor::format");
  823. static_assert(offsetof(VertexAttributeDescriptor, offset) == offsetof(WGPUVertexAttributeDescriptor, offset),
  824. "offsetof mismatch for VertexAttributeDescriptor::offset");
  825. static_assert(offsetof(VertexAttributeDescriptor, shaderLocation) == offsetof(WGPUVertexAttributeDescriptor, shaderLocation),
  826. "offsetof mismatch for VertexAttributeDescriptor::shaderLocation");
  827. // BindGroupDescriptor
  828. static_assert(sizeof(BindGroupDescriptor) == sizeof(WGPUBindGroupDescriptor), "sizeof mismatch for BindGroupDescriptor");
  829. static_assert(alignof(BindGroupDescriptor) == alignof(WGPUBindGroupDescriptor), "alignof mismatch for BindGroupDescriptor");
  830. static_assert(offsetof(BindGroupDescriptor, nextInChain) == offsetof(WGPUBindGroupDescriptor, nextInChain),
  831. "offsetof mismatch for BindGroupDescriptor::nextInChain");
  832. static_assert(offsetof(BindGroupDescriptor, label) == offsetof(WGPUBindGroupDescriptor, label),
  833. "offsetof mismatch for BindGroupDescriptor::label");
  834. static_assert(offsetof(BindGroupDescriptor, layout) == offsetof(WGPUBindGroupDescriptor, layout),
  835. "offsetof mismatch for BindGroupDescriptor::layout");
  836. static_assert(offsetof(BindGroupDescriptor, entryCount) == offsetof(WGPUBindGroupDescriptor, entryCount),
  837. "offsetof mismatch for BindGroupDescriptor::entryCount");
  838. static_assert(offsetof(BindGroupDescriptor, entries) == offsetof(WGPUBindGroupDescriptor, entries),
  839. "offsetof mismatch for BindGroupDescriptor::entries");
  840. // BindGroupLayoutEntry
  841. static_assert(sizeof(BindGroupLayoutEntry) == sizeof(WGPUBindGroupLayoutEntry), "sizeof mismatch for BindGroupLayoutEntry");
  842. static_assert(alignof(BindGroupLayoutEntry) == alignof(WGPUBindGroupLayoutEntry), "alignof mismatch for BindGroupLayoutEntry");
  843. static_assert(offsetof(BindGroupLayoutEntry, binding) == offsetof(WGPUBindGroupLayoutEntry, binding),
  844. "offsetof mismatch for BindGroupLayoutEntry::binding");
  845. static_assert(offsetof(BindGroupLayoutEntry, visibility) == offsetof(WGPUBindGroupLayoutEntry, visibility),
  846. "offsetof mismatch for BindGroupLayoutEntry::visibility");
  847. static_assert(offsetof(BindGroupLayoutEntry, type) == offsetof(WGPUBindGroupLayoutEntry, type),
  848. "offsetof mismatch for BindGroupLayoutEntry::type");
  849. static_assert(offsetof(BindGroupLayoutEntry, hasDynamicOffset) == offsetof(WGPUBindGroupLayoutEntry, hasDynamicOffset),
  850. "offsetof mismatch for BindGroupLayoutEntry::hasDynamicOffset");
  851. static_assert(offsetof(BindGroupLayoutEntry, minBufferBindingSize) == offsetof(WGPUBindGroupLayoutEntry, minBufferBindingSize),
  852. "offsetof mismatch for BindGroupLayoutEntry::minBufferBindingSize");
  853. static_assert(offsetof(BindGroupLayoutEntry, viewDimension) == offsetof(WGPUBindGroupLayoutEntry, viewDimension),
  854. "offsetof mismatch for BindGroupLayoutEntry::viewDimension");
  855. static_assert(offsetof(BindGroupLayoutEntry, textureComponentType) == offsetof(WGPUBindGroupLayoutEntry, textureComponentType),
  856. "offsetof mismatch for BindGroupLayoutEntry::textureComponentType");
  857. static_assert(offsetof(BindGroupLayoutEntry, storageTextureFormat) == offsetof(WGPUBindGroupLayoutEntry, storageTextureFormat),
  858. "offsetof mismatch for BindGroupLayoutEntry::storageTextureFormat");
  859. static_assert(offsetof(BindGroupLayoutEntry, buffer) == offsetof(WGPUBindGroupLayoutEntry, buffer),
  860. "offsetof mismatch for BindGroupLayoutEntry::buffer");
  861. static_assert(offsetof(BindGroupLayoutEntry, sampler) == offsetof(WGPUBindGroupLayoutEntry, sampler),
  862. "offsetof mismatch for BindGroupLayoutEntry::sampler");
  863. static_assert(offsetof(BindGroupLayoutEntry, texture) == offsetof(WGPUBindGroupLayoutEntry, texture),
  864. "offsetof mismatch for BindGroupLayoutEntry::texture");
  865. static_assert(offsetof(BindGroupLayoutEntry, storageTexture) == offsetof(WGPUBindGroupLayoutEntry, storageTexture),
  866. "offsetof mismatch for BindGroupLayoutEntry::storageTexture");
  867. // BufferCopyView
  868. static_assert(sizeof(BufferCopyView) == sizeof(WGPUBufferCopyView), "sizeof mismatch for BufferCopyView");
  869. static_assert(alignof(BufferCopyView) == alignof(WGPUBufferCopyView), "alignof mismatch for BufferCopyView");
  870. static_assert(offsetof(BufferCopyView, nextInChain) == offsetof(WGPUBufferCopyView, nextInChain),
  871. "offsetof mismatch for BufferCopyView::nextInChain");
  872. static_assert(offsetof(BufferCopyView, layout) == offsetof(WGPUBufferCopyView, layout),
  873. "offsetof mismatch for BufferCopyView::layout");
  874. static_assert(offsetof(BufferCopyView, buffer) == offsetof(WGPUBufferCopyView, buffer),
  875. "offsetof mismatch for BufferCopyView::buffer");
  876. // ColorStateDescriptor
  877. static_assert(sizeof(ColorStateDescriptor) == sizeof(WGPUColorStateDescriptor), "sizeof mismatch for ColorStateDescriptor");
  878. static_assert(alignof(ColorStateDescriptor) == alignof(WGPUColorStateDescriptor), "alignof mismatch for ColorStateDescriptor");
  879. static_assert(offsetof(ColorStateDescriptor, nextInChain) == offsetof(WGPUColorStateDescriptor, nextInChain),
  880. "offsetof mismatch for ColorStateDescriptor::nextInChain");
  881. static_assert(offsetof(ColorStateDescriptor, format) == offsetof(WGPUColorStateDescriptor, format),
  882. "offsetof mismatch for ColorStateDescriptor::format");
  883. static_assert(offsetof(ColorStateDescriptor, alphaBlend) == offsetof(WGPUColorStateDescriptor, alphaBlend),
  884. "offsetof mismatch for ColorStateDescriptor::alphaBlend");
  885. static_assert(offsetof(ColorStateDescriptor, colorBlend) == offsetof(WGPUColorStateDescriptor, colorBlend),
  886. "offsetof mismatch for ColorStateDescriptor::colorBlend");
  887. static_assert(offsetof(ColorStateDescriptor, writeMask) == offsetof(WGPUColorStateDescriptor, writeMask),
  888. "offsetof mismatch for ColorStateDescriptor::writeMask");
  889. // ComputePipelineDescriptor
  890. static_assert(sizeof(ComputePipelineDescriptor) == sizeof(WGPUComputePipelineDescriptor), "sizeof mismatch for ComputePipelineDescriptor");
  891. static_assert(alignof(ComputePipelineDescriptor) == alignof(WGPUComputePipelineDescriptor), "alignof mismatch for ComputePipelineDescriptor");
  892. static_assert(offsetof(ComputePipelineDescriptor, nextInChain) == offsetof(WGPUComputePipelineDescriptor, nextInChain),
  893. "offsetof mismatch for ComputePipelineDescriptor::nextInChain");
  894. static_assert(offsetof(ComputePipelineDescriptor, label) == offsetof(WGPUComputePipelineDescriptor, label),
  895. "offsetof mismatch for ComputePipelineDescriptor::label");
  896. static_assert(offsetof(ComputePipelineDescriptor, layout) == offsetof(WGPUComputePipelineDescriptor, layout),
  897. "offsetof mismatch for ComputePipelineDescriptor::layout");
  898. static_assert(offsetof(ComputePipelineDescriptor, computeStage) == offsetof(WGPUComputePipelineDescriptor, computeStage),
  899. "offsetof mismatch for ComputePipelineDescriptor::computeStage");
  900. // DepthStencilStateDescriptor
  901. static_assert(sizeof(DepthStencilStateDescriptor) == sizeof(WGPUDepthStencilStateDescriptor), "sizeof mismatch for DepthStencilStateDescriptor");
  902. static_assert(alignof(DepthStencilStateDescriptor) == alignof(WGPUDepthStencilStateDescriptor), "alignof mismatch for DepthStencilStateDescriptor");
  903. static_assert(offsetof(DepthStencilStateDescriptor, nextInChain) == offsetof(WGPUDepthStencilStateDescriptor, nextInChain),
  904. "offsetof mismatch for DepthStencilStateDescriptor::nextInChain");
  905. static_assert(offsetof(DepthStencilStateDescriptor, format) == offsetof(WGPUDepthStencilStateDescriptor, format),
  906. "offsetof mismatch for DepthStencilStateDescriptor::format");
  907. static_assert(offsetof(DepthStencilStateDescriptor, depthWriteEnabled) == offsetof(WGPUDepthStencilStateDescriptor, depthWriteEnabled),
  908. "offsetof mismatch for DepthStencilStateDescriptor::depthWriteEnabled");
  909. static_assert(offsetof(DepthStencilStateDescriptor, depthCompare) == offsetof(WGPUDepthStencilStateDescriptor, depthCompare),
  910. "offsetof mismatch for DepthStencilStateDescriptor::depthCompare");
  911. static_assert(offsetof(DepthStencilStateDescriptor, stencilFront) == offsetof(WGPUDepthStencilStateDescriptor, stencilFront),
  912. "offsetof mismatch for DepthStencilStateDescriptor::stencilFront");
  913. static_assert(offsetof(DepthStencilStateDescriptor, stencilBack) == offsetof(WGPUDepthStencilStateDescriptor, stencilBack),
  914. "offsetof mismatch for DepthStencilStateDescriptor::stencilBack");
  915. static_assert(offsetof(DepthStencilStateDescriptor, stencilReadMask) == offsetof(WGPUDepthStencilStateDescriptor, stencilReadMask),
  916. "offsetof mismatch for DepthStencilStateDescriptor::stencilReadMask");
  917. static_assert(offsetof(DepthStencilStateDescriptor, stencilWriteMask) == offsetof(WGPUDepthStencilStateDescriptor, stencilWriteMask),
  918. "offsetof mismatch for DepthStencilStateDescriptor::stencilWriteMask");
  919. // RenderPassColorAttachmentDescriptor
  920. static_assert(sizeof(RenderPassColorAttachmentDescriptor) == sizeof(WGPURenderPassColorAttachmentDescriptor), "sizeof mismatch for RenderPassColorAttachmentDescriptor");
  921. static_assert(alignof(RenderPassColorAttachmentDescriptor) == alignof(WGPURenderPassColorAttachmentDescriptor), "alignof mismatch for RenderPassColorAttachmentDescriptor");
  922. static_assert(offsetof(RenderPassColorAttachmentDescriptor, attachment) == offsetof(WGPURenderPassColorAttachmentDescriptor, attachment),
  923. "offsetof mismatch for RenderPassColorAttachmentDescriptor::attachment");
  924. static_assert(offsetof(RenderPassColorAttachmentDescriptor, resolveTarget) == offsetof(WGPURenderPassColorAttachmentDescriptor, resolveTarget),
  925. "offsetof mismatch for RenderPassColorAttachmentDescriptor::resolveTarget");
  926. static_assert(offsetof(RenderPassColorAttachmentDescriptor, loadOp) == offsetof(WGPURenderPassColorAttachmentDescriptor, loadOp),
  927. "offsetof mismatch for RenderPassColorAttachmentDescriptor::loadOp");
  928. static_assert(offsetof(RenderPassColorAttachmentDescriptor, storeOp) == offsetof(WGPURenderPassColorAttachmentDescriptor, storeOp),
  929. "offsetof mismatch for RenderPassColorAttachmentDescriptor::storeOp");
  930. static_assert(offsetof(RenderPassColorAttachmentDescriptor, clearColor) == offsetof(WGPURenderPassColorAttachmentDescriptor, clearColor),
  931. "offsetof mismatch for RenderPassColorAttachmentDescriptor::clearColor");
  932. // RenderPipelineDescriptorDummyExtension
  933. static_assert(sizeof(RenderPipelineDescriptorDummyExtension) == sizeof(WGPURenderPipelineDescriptorDummyExtension), "sizeof mismatch for RenderPipelineDescriptorDummyExtension");
  934. static_assert(alignof(RenderPipelineDescriptorDummyExtension) == alignof(WGPURenderPipelineDescriptorDummyExtension), "alignof mismatch for RenderPipelineDescriptorDummyExtension");
  935. static_assert(offsetof(RenderPipelineDescriptorDummyExtension, dummyStage) == offsetof(WGPURenderPipelineDescriptorDummyExtension, dummyStage),
  936. "offsetof mismatch for RenderPipelineDescriptorDummyExtension::dummyStage");
  937. // TextureCopyView
  938. static_assert(sizeof(TextureCopyView) == sizeof(WGPUTextureCopyView), "sizeof mismatch for TextureCopyView");
  939. static_assert(alignof(TextureCopyView) == alignof(WGPUTextureCopyView), "alignof mismatch for TextureCopyView");
  940. static_assert(offsetof(TextureCopyView, nextInChain) == offsetof(WGPUTextureCopyView, nextInChain),
  941. "offsetof mismatch for TextureCopyView::nextInChain");
  942. static_assert(offsetof(TextureCopyView, texture) == offsetof(WGPUTextureCopyView, texture),
  943. "offsetof mismatch for TextureCopyView::texture");
  944. static_assert(offsetof(TextureCopyView, mipLevel) == offsetof(WGPUTextureCopyView, mipLevel),
  945. "offsetof mismatch for TextureCopyView::mipLevel");
  946. static_assert(offsetof(TextureCopyView, origin) == offsetof(WGPUTextureCopyView, origin),
  947. "offsetof mismatch for TextureCopyView::origin");
  948. static_assert(offsetof(TextureCopyView, aspect) == offsetof(WGPUTextureCopyView, aspect),
  949. "offsetof mismatch for TextureCopyView::aspect");
  950. // TextureDescriptor
  951. static_assert(sizeof(TextureDescriptor) == sizeof(WGPUTextureDescriptor), "sizeof mismatch for TextureDescriptor");
  952. static_assert(alignof(TextureDescriptor) == alignof(WGPUTextureDescriptor), "alignof mismatch for TextureDescriptor");
  953. static_assert(offsetof(TextureDescriptor, nextInChain) == offsetof(WGPUTextureDescriptor, nextInChain),
  954. "offsetof mismatch for TextureDescriptor::nextInChain");
  955. static_assert(offsetof(TextureDescriptor, label) == offsetof(WGPUTextureDescriptor, label),
  956. "offsetof mismatch for TextureDescriptor::label");
  957. static_assert(offsetof(TextureDescriptor, usage) == offsetof(WGPUTextureDescriptor, usage),
  958. "offsetof mismatch for TextureDescriptor::usage");
  959. static_assert(offsetof(TextureDescriptor, dimension) == offsetof(WGPUTextureDescriptor, dimension),
  960. "offsetof mismatch for TextureDescriptor::dimension");
  961. static_assert(offsetof(TextureDescriptor, size) == offsetof(WGPUTextureDescriptor, size),
  962. "offsetof mismatch for TextureDescriptor::size");
  963. static_assert(offsetof(TextureDescriptor, format) == offsetof(WGPUTextureDescriptor, format),
  964. "offsetof mismatch for TextureDescriptor::format");
  965. static_assert(offsetof(TextureDescriptor, mipLevelCount) == offsetof(WGPUTextureDescriptor, mipLevelCount),
  966. "offsetof mismatch for TextureDescriptor::mipLevelCount");
  967. static_assert(offsetof(TextureDescriptor, sampleCount) == offsetof(WGPUTextureDescriptor, sampleCount),
  968. "offsetof mismatch for TextureDescriptor::sampleCount");
  969. // VertexBufferLayoutDescriptor
  970. static_assert(sizeof(VertexBufferLayoutDescriptor) == sizeof(WGPUVertexBufferLayoutDescriptor), "sizeof mismatch for VertexBufferLayoutDescriptor");
  971. static_assert(alignof(VertexBufferLayoutDescriptor) == alignof(WGPUVertexBufferLayoutDescriptor), "alignof mismatch for VertexBufferLayoutDescriptor");
  972. static_assert(offsetof(VertexBufferLayoutDescriptor, arrayStride) == offsetof(WGPUVertexBufferLayoutDescriptor, arrayStride),
  973. "offsetof mismatch for VertexBufferLayoutDescriptor::arrayStride");
  974. static_assert(offsetof(VertexBufferLayoutDescriptor, stepMode) == offsetof(WGPUVertexBufferLayoutDescriptor, stepMode),
  975. "offsetof mismatch for VertexBufferLayoutDescriptor::stepMode");
  976. static_assert(offsetof(VertexBufferLayoutDescriptor, attributeCount) == offsetof(WGPUVertexBufferLayoutDescriptor, attributeCount),
  977. "offsetof mismatch for VertexBufferLayoutDescriptor::attributeCount");
  978. static_assert(offsetof(VertexBufferLayoutDescriptor, attributes) == offsetof(WGPUVertexBufferLayoutDescriptor, attributes),
  979. "offsetof mismatch for VertexBufferLayoutDescriptor::attributes");
  980. // BindGroupLayoutDescriptor
  981. static_assert(sizeof(BindGroupLayoutDescriptor) == sizeof(WGPUBindGroupLayoutDescriptor), "sizeof mismatch for BindGroupLayoutDescriptor");
  982. static_assert(alignof(BindGroupLayoutDescriptor) == alignof(WGPUBindGroupLayoutDescriptor), "alignof mismatch for BindGroupLayoutDescriptor");
  983. static_assert(offsetof(BindGroupLayoutDescriptor, nextInChain) == offsetof(WGPUBindGroupLayoutDescriptor, nextInChain),
  984. "offsetof mismatch for BindGroupLayoutDescriptor::nextInChain");
  985. static_assert(offsetof(BindGroupLayoutDescriptor, label) == offsetof(WGPUBindGroupLayoutDescriptor, label),
  986. "offsetof mismatch for BindGroupLayoutDescriptor::label");
  987. static_assert(offsetof(BindGroupLayoutDescriptor, entryCount) == offsetof(WGPUBindGroupLayoutDescriptor, entryCount),
  988. "offsetof mismatch for BindGroupLayoutDescriptor::entryCount");
  989. static_assert(offsetof(BindGroupLayoutDescriptor, entries) == offsetof(WGPUBindGroupLayoutDescriptor, entries),
  990. "offsetof mismatch for BindGroupLayoutDescriptor::entries");
  991. // RenderPassDescriptor
  992. static_assert(sizeof(RenderPassDescriptor) == sizeof(WGPURenderPassDescriptor), "sizeof mismatch for RenderPassDescriptor");
  993. static_assert(alignof(RenderPassDescriptor) == alignof(WGPURenderPassDescriptor), "alignof mismatch for RenderPassDescriptor");
  994. static_assert(offsetof(RenderPassDescriptor, nextInChain) == offsetof(WGPURenderPassDescriptor, nextInChain),
  995. "offsetof mismatch for RenderPassDescriptor::nextInChain");
  996. static_assert(offsetof(RenderPassDescriptor, label) == offsetof(WGPURenderPassDescriptor, label),
  997. "offsetof mismatch for RenderPassDescriptor::label");
  998. static_assert(offsetof(RenderPassDescriptor, colorAttachmentCount) == offsetof(WGPURenderPassDescriptor, colorAttachmentCount),
  999. "offsetof mismatch for RenderPassDescriptor::colorAttachmentCount");
  1000. static_assert(offsetof(RenderPassDescriptor, colorAttachments) == offsetof(WGPURenderPassDescriptor, colorAttachments),
  1001. "offsetof mismatch for RenderPassDescriptor::colorAttachments");
  1002. static_assert(offsetof(RenderPassDescriptor, depthStencilAttachment) == offsetof(WGPURenderPassDescriptor, depthStencilAttachment),
  1003. "offsetof mismatch for RenderPassDescriptor::depthStencilAttachment");
  1004. static_assert(offsetof(RenderPassDescriptor, occlusionQuerySet) == offsetof(WGPURenderPassDescriptor, occlusionQuerySet),
  1005. "offsetof mismatch for RenderPassDescriptor::occlusionQuerySet");
  1006. // VertexStateDescriptor
  1007. static_assert(sizeof(VertexStateDescriptor) == sizeof(WGPUVertexStateDescriptor), "sizeof mismatch for VertexStateDescriptor");
  1008. static_assert(alignof(VertexStateDescriptor) == alignof(WGPUVertexStateDescriptor), "alignof mismatch for VertexStateDescriptor");
  1009. static_assert(offsetof(VertexStateDescriptor, nextInChain) == offsetof(WGPUVertexStateDescriptor, nextInChain),
  1010. "offsetof mismatch for VertexStateDescriptor::nextInChain");
  1011. static_assert(offsetof(VertexStateDescriptor, indexFormat) == offsetof(WGPUVertexStateDescriptor, indexFormat),
  1012. "offsetof mismatch for VertexStateDescriptor::indexFormat");
  1013. static_assert(offsetof(VertexStateDescriptor, vertexBufferCount) == offsetof(WGPUVertexStateDescriptor, vertexBufferCount),
  1014. "offsetof mismatch for VertexStateDescriptor::vertexBufferCount");
  1015. static_assert(offsetof(VertexStateDescriptor, vertexBuffers) == offsetof(WGPUVertexStateDescriptor, vertexBuffers),
  1016. "offsetof mismatch for VertexStateDescriptor::vertexBuffers");
  1017. // RenderPipelineDescriptor
  1018. static_assert(sizeof(RenderPipelineDescriptor) == sizeof(WGPURenderPipelineDescriptor), "sizeof mismatch for RenderPipelineDescriptor");
  1019. static_assert(alignof(RenderPipelineDescriptor) == alignof(WGPURenderPipelineDescriptor), "alignof mismatch for RenderPipelineDescriptor");
  1020. static_assert(offsetof(RenderPipelineDescriptor, nextInChain) == offsetof(WGPURenderPipelineDescriptor, nextInChain),
  1021. "offsetof mismatch for RenderPipelineDescriptor::nextInChain");
  1022. static_assert(offsetof(RenderPipelineDescriptor, label) == offsetof(WGPURenderPipelineDescriptor, label),
  1023. "offsetof mismatch for RenderPipelineDescriptor::label");
  1024. static_assert(offsetof(RenderPipelineDescriptor, layout) == offsetof(WGPURenderPipelineDescriptor, layout),
  1025. "offsetof mismatch for RenderPipelineDescriptor::layout");
  1026. static_assert(offsetof(RenderPipelineDescriptor, vertexStage) == offsetof(WGPURenderPipelineDescriptor, vertexStage),
  1027. "offsetof mismatch for RenderPipelineDescriptor::vertexStage");
  1028. static_assert(offsetof(RenderPipelineDescriptor, fragmentStage) == offsetof(WGPURenderPipelineDescriptor, fragmentStage),
  1029. "offsetof mismatch for RenderPipelineDescriptor::fragmentStage");
  1030. static_assert(offsetof(RenderPipelineDescriptor, vertexState) == offsetof(WGPURenderPipelineDescriptor, vertexState),
  1031. "offsetof mismatch for RenderPipelineDescriptor::vertexState");
  1032. static_assert(offsetof(RenderPipelineDescriptor, primitiveTopology) == offsetof(WGPURenderPipelineDescriptor, primitiveTopology),
  1033. "offsetof mismatch for RenderPipelineDescriptor::primitiveTopology");
  1034. static_assert(offsetof(RenderPipelineDescriptor, rasterizationState) == offsetof(WGPURenderPipelineDescriptor, rasterizationState),
  1035. "offsetof mismatch for RenderPipelineDescriptor::rasterizationState");
  1036. static_assert(offsetof(RenderPipelineDescriptor, sampleCount) == offsetof(WGPURenderPipelineDescriptor, sampleCount),
  1037. "offsetof mismatch for RenderPipelineDescriptor::sampleCount");
  1038. static_assert(offsetof(RenderPipelineDescriptor, depthStencilState) == offsetof(WGPURenderPipelineDescriptor, depthStencilState),
  1039. "offsetof mismatch for RenderPipelineDescriptor::depthStencilState");
  1040. static_assert(offsetof(RenderPipelineDescriptor, colorStateCount) == offsetof(WGPURenderPipelineDescriptor, colorStateCount),
  1041. "offsetof mismatch for RenderPipelineDescriptor::colorStateCount");
  1042. static_assert(offsetof(RenderPipelineDescriptor, colorStates) == offsetof(WGPURenderPipelineDescriptor, colorStates),
  1043. "offsetof mismatch for RenderPipelineDescriptor::colorStates");
  1044. static_assert(offsetof(RenderPipelineDescriptor, sampleMask) == offsetof(WGPURenderPipelineDescriptor, sampleMask),
  1045. "offsetof mismatch for RenderPipelineDescriptor::sampleMask");
  1046. static_assert(offsetof(RenderPipelineDescriptor, alphaToCoverageEnabled) == offsetof(WGPURenderPipelineDescriptor, alphaToCoverageEnabled),
  1047. "offsetof mismatch for RenderPipelineDescriptor::alphaToCoverageEnabled");
  1048. // BindGroup
  1049. static_assert(sizeof(BindGroup) == sizeof(WGPUBindGroup), "sizeof mismatch for BindGroup");
  1050. static_assert(alignof(BindGroup) == alignof(WGPUBindGroup), "alignof mismatch for BindGroup");
  1051. void BindGroup::WGPUReference(WGPUBindGroup handle) {
  1052. if (handle != nullptr) {
  1053. wgpuBindGroupReference(handle);
  1054. }
  1055. }
  1056. void BindGroup::WGPURelease(WGPUBindGroup handle) {
  1057. if (handle != nullptr) {
  1058. wgpuBindGroupRelease(handle);
  1059. }
  1060. }
  1061. // BindGroupLayout
  1062. static_assert(sizeof(BindGroupLayout) == sizeof(WGPUBindGroupLayout), "sizeof mismatch for BindGroupLayout");
  1063. static_assert(alignof(BindGroupLayout) == alignof(WGPUBindGroupLayout), "alignof mismatch for BindGroupLayout");
  1064. void BindGroupLayout::WGPUReference(WGPUBindGroupLayout handle) {
  1065. if (handle != nullptr) {
  1066. wgpuBindGroupLayoutReference(handle);
  1067. }
  1068. }
  1069. void BindGroupLayout::WGPURelease(WGPUBindGroupLayout handle) {
  1070. if (handle != nullptr) {
  1071. wgpuBindGroupLayoutRelease(handle);
  1072. }
  1073. }
  1074. // Buffer
  1075. static_assert(sizeof(Buffer) == sizeof(WGPUBuffer), "sizeof mismatch for Buffer");
  1076. static_assert(alignof(Buffer) == alignof(WGPUBuffer), "alignof mismatch for Buffer");
  1077. void Buffer::Destroy() const {
  1078. wgpuBufferDestroy(Get());
  1079. }
  1080. void const * Buffer::GetConstMappedRange(size_t offset, size_t size) const {
  1081. auto result = wgpuBufferGetConstMappedRange(Get(), offset, size);
  1082. return result;
  1083. }
  1084. void * Buffer::GetMappedRange(size_t offset, size_t size) const {
  1085. auto result = wgpuBufferGetMappedRange(Get(), offset, size);
  1086. return result;
  1087. }
  1088. void Buffer::MapAsync(MapMode mode, size_t offset, size_t size, BufferMapCallback callback, void * userdata) const {
  1089. wgpuBufferMapAsync(Get(), static_cast<WGPUMapMode>(mode), offset, size, callback, reinterpret_cast<void * >(userdata));
  1090. }
  1091. void Buffer::Unmap() const {
  1092. wgpuBufferUnmap(Get());
  1093. }
  1094. void Buffer::WGPUReference(WGPUBuffer handle) {
  1095. if (handle != nullptr) {
  1096. wgpuBufferReference(handle);
  1097. }
  1098. }
  1099. void Buffer::WGPURelease(WGPUBuffer handle) {
  1100. if (handle != nullptr) {
  1101. wgpuBufferRelease(handle);
  1102. }
  1103. }
  1104. // CommandBuffer
  1105. static_assert(sizeof(CommandBuffer) == sizeof(WGPUCommandBuffer), "sizeof mismatch for CommandBuffer");
  1106. static_assert(alignof(CommandBuffer) == alignof(WGPUCommandBuffer), "alignof mismatch for CommandBuffer");
  1107. void CommandBuffer::WGPUReference(WGPUCommandBuffer handle) {
  1108. if (handle != nullptr) {
  1109. wgpuCommandBufferReference(handle);
  1110. }
  1111. }
  1112. void CommandBuffer::WGPURelease(WGPUCommandBuffer handle) {
  1113. if (handle != nullptr) {
  1114. wgpuCommandBufferRelease(handle);
  1115. }
  1116. }
  1117. // CommandEncoder
  1118. static_assert(sizeof(CommandEncoder) == sizeof(WGPUCommandEncoder), "sizeof mismatch for CommandEncoder");
  1119. static_assert(alignof(CommandEncoder) == alignof(WGPUCommandEncoder), "alignof mismatch for CommandEncoder");
  1120. ComputePassEncoder CommandEncoder::BeginComputePass(ComputePassDescriptor const * descriptor) const {
  1121. auto result = wgpuCommandEncoderBeginComputePass(Get(), reinterpret_cast<WGPUComputePassDescriptor const * >(descriptor));
  1122. return ComputePassEncoder::Acquire(result);
  1123. }
  1124. RenderPassEncoder CommandEncoder::BeginRenderPass(RenderPassDescriptor const * descriptor) const {
  1125. auto result = wgpuCommandEncoderBeginRenderPass(Get(), reinterpret_cast<WGPURenderPassDescriptor const * >(descriptor));
  1126. return RenderPassEncoder::Acquire(result);
  1127. }
  1128. void CommandEncoder::CopyBufferToBuffer(Buffer const& source, uint64_t sourceOffset, Buffer const& destination, uint64_t destinationOffset, uint64_t size) const {
  1129. wgpuCommandEncoderCopyBufferToBuffer(Get(), source.Get(), sourceOffset, destination.Get(), destinationOffset, size);
  1130. }
  1131. void CommandEncoder::CopyBufferToTexture(BufferCopyView const * source, TextureCopyView const * destination, Extent3D const * copySize) const {
  1132. wgpuCommandEncoderCopyBufferToTexture(Get(), reinterpret_cast<WGPUBufferCopyView const * >(source), reinterpret_cast<WGPUTextureCopyView const * >(destination), reinterpret_cast<WGPUExtent3D const * >(copySize));
  1133. }
  1134. void CommandEncoder::CopyTextureToBuffer(TextureCopyView const * source, BufferCopyView const * destination, Extent3D const * copySize) const {
  1135. wgpuCommandEncoderCopyTextureToBuffer(Get(), reinterpret_cast<WGPUTextureCopyView const * >(source), reinterpret_cast<WGPUBufferCopyView const * >(destination), reinterpret_cast<WGPUExtent3D const * >(copySize));
  1136. }
  1137. void CommandEncoder::CopyTextureToTexture(TextureCopyView const * source, TextureCopyView const * destination, Extent3D const * copySize) const {
  1138. wgpuCommandEncoderCopyTextureToTexture(Get(), reinterpret_cast<WGPUTextureCopyView const * >(source), reinterpret_cast<WGPUTextureCopyView const * >(destination), reinterpret_cast<WGPUExtent3D const * >(copySize));
  1139. }
  1140. CommandBuffer CommandEncoder::Finish(CommandBufferDescriptor const * descriptor) const {
  1141. auto result = wgpuCommandEncoderFinish(Get(), reinterpret_cast<WGPUCommandBufferDescriptor const * >(descriptor));
  1142. return CommandBuffer::Acquire(result);
  1143. }
  1144. void CommandEncoder::InjectValidationError(char const * message) const {
  1145. wgpuCommandEncoderInjectValidationError(Get(), reinterpret_cast<char const * >(message));
  1146. }
  1147. void CommandEncoder::InsertDebugMarker(char const * markerLabel) const {
  1148. wgpuCommandEncoderInsertDebugMarker(Get(), reinterpret_cast<char const * >(markerLabel));
  1149. }
  1150. void CommandEncoder::PopDebugGroup() const {
  1151. wgpuCommandEncoderPopDebugGroup(Get());
  1152. }
  1153. void CommandEncoder::PushDebugGroup(char const * groupLabel) const {
  1154. wgpuCommandEncoderPushDebugGroup(Get(), reinterpret_cast<char const * >(groupLabel));
  1155. }
  1156. void CommandEncoder::ResolveQuerySet(QuerySet const& querySet, uint32_t firstQuery, uint32_t queryCount, Buffer const& destination, uint64_t destinationOffset) const {
  1157. wgpuCommandEncoderResolveQuerySet(Get(), querySet.Get(), firstQuery, queryCount, destination.Get(), destinationOffset);
  1158. }
  1159. void CommandEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const {
  1160. wgpuCommandEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex);
  1161. }
  1162. void CommandEncoder::WGPUReference(WGPUCommandEncoder handle) {
  1163. if (handle != nullptr) {
  1164. wgpuCommandEncoderReference(handle);
  1165. }
  1166. }
  1167. void CommandEncoder::WGPURelease(WGPUCommandEncoder handle) {
  1168. if (handle != nullptr) {
  1169. wgpuCommandEncoderRelease(handle);
  1170. }
  1171. }
  1172. // ComputePassEncoder
  1173. static_assert(sizeof(ComputePassEncoder) == sizeof(WGPUComputePassEncoder), "sizeof mismatch for ComputePassEncoder");
  1174. static_assert(alignof(ComputePassEncoder) == alignof(WGPUComputePassEncoder), "alignof mismatch for ComputePassEncoder");
  1175. void ComputePassEncoder::Dispatch(uint32_t x, uint32_t y, uint32_t z) const {
  1176. wgpuComputePassEncoderDispatch(Get(), x, y, z);
  1177. }
  1178. void ComputePassEncoder::DispatchIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const {
  1179. wgpuComputePassEncoderDispatchIndirect(Get(), indirectBuffer.Get(), indirectOffset);
  1180. }
  1181. void ComputePassEncoder::EndPass() const {
  1182. wgpuComputePassEncoderEndPass(Get());
  1183. }
  1184. void ComputePassEncoder::InsertDebugMarker(char const * markerLabel) const {
  1185. wgpuComputePassEncoderInsertDebugMarker(Get(), reinterpret_cast<char const * >(markerLabel));
  1186. }
  1187. void ComputePassEncoder::PopDebugGroup() const {
  1188. wgpuComputePassEncoderPopDebugGroup(Get());
  1189. }
  1190. void ComputePassEncoder::PushDebugGroup(char const * groupLabel) const {
  1191. wgpuComputePassEncoderPushDebugGroup(Get(), reinterpret_cast<char const * >(groupLabel));
  1192. }
  1193. void ComputePassEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const {
  1194. wgpuComputePassEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast<uint32_t const * >(dynamicOffsets));
  1195. }
  1196. void ComputePassEncoder::SetPipeline(ComputePipeline const& pipeline) const {
  1197. wgpuComputePassEncoderSetPipeline(Get(), pipeline.Get());
  1198. }
  1199. void ComputePassEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const {
  1200. wgpuComputePassEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex);
  1201. }
  1202. void ComputePassEncoder::WGPUReference(WGPUComputePassEncoder handle) {
  1203. if (handle != nullptr) {
  1204. wgpuComputePassEncoderReference(handle);
  1205. }
  1206. }
  1207. void ComputePassEncoder::WGPURelease(WGPUComputePassEncoder handle) {
  1208. if (handle != nullptr) {
  1209. wgpuComputePassEncoderRelease(handle);
  1210. }
  1211. }
  1212. // ComputePipeline
  1213. static_assert(sizeof(ComputePipeline) == sizeof(WGPUComputePipeline), "sizeof mismatch for ComputePipeline");
  1214. static_assert(alignof(ComputePipeline) == alignof(WGPUComputePipeline), "alignof mismatch for ComputePipeline");
  1215. BindGroupLayout ComputePipeline::GetBindGroupLayout(uint32_t groupIndex) const {
  1216. auto result = wgpuComputePipelineGetBindGroupLayout(Get(), groupIndex);
  1217. return BindGroupLayout::Acquire(result);
  1218. }
  1219. void ComputePipeline::WGPUReference(WGPUComputePipeline handle) {
  1220. if (handle != nullptr) {
  1221. wgpuComputePipelineReference(handle);
  1222. }
  1223. }
  1224. void ComputePipeline::WGPURelease(WGPUComputePipeline handle) {
  1225. if (handle != nullptr) {
  1226. wgpuComputePipelineRelease(handle);
  1227. }
  1228. }
  1229. // Device
  1230. static_assert(sizeof(Device) == sizeof(WGPUDevice), "sizeof mismatch for Device");
  1231. static_assert(alignof(Device) == alignof(WGPUDevice), "alignof mismatch for Device");
  1232. BindGroup Device::CreateBindGroup(BindGroupDescriptor const * descriptor) const {
  1233. auto result = wgpuDeviceCreateBindGroup(Get(), reinterpret_cast<WGPUBindGroupDescriptor const * >(descriptor));
  1234. return BindGroup::Acquire(result);
  1235. }
  1236. BindGroupLayout Device::CreateBindGroupLayout(BindGroupLayoutDescriptor const * descriptor) const {
  1237. auto result = wgpuDeviceCreateBindGroupLayout(Get(), reinterpret_cast<WGPUBindGroupLayoutDescriptor const * >(descriptor));
  1238. return BindGroupLayout::Acquire(result);
  1239. }
  1240. Buffer Device::CreateBuffer(BufferDescriptor const * descriptor) const {
  1241. auto result = wgpuDeviceCreateBuffer(Get(), reinterpret_cast<WGPUBufferDescriptor const * >(descriptor));
  1242. return Buffer::Acquire(result);
  1243. }
  1244. CommandEncoder Device::CreateCommandEncoder(CommandEncoderDescriptor const * descriptor) const {
  1245. auto result = wgpuDeviceCreateCommandEncoder(Get(), reinterpret_cast<WGPUCommandEncoderDescriptor const * >(descriptor));
  1246. return CommandEncoder::Acquire(result);
  1247. }
  1248. ComputePipeline Device::CreateComputePipeline(ComputePipelineDescriptor const * descriptor) const {
  1249. auto result = wgpuDeviceCreateComputePipeline(Get(), reinterpret_cast<WGPUComputePipelineDescriptor const * >(descriptor));
  1250. return ComputePipeline::Acquire(result);
  1251. }
  1252. Buffer Device::CreateErrorBuffer() const {
  1253. auto result = wgpuDeviceCreateErrorBuffer(Get());
  1254. return Buffer::Acquire(result);
  1255. }
  1256. PipelineLayout Device::CreatePipelineLayout(PipelineLayoutDescriptor const * descriptor) const {
  1257. auto result = wgpuDeviceCreatePipelineLayout(Get(), reinterpret_cast<WGPUPipelineLayoutDescriptor const * >(descriptor));
  1258. return PipelineLayout::Acquire(result);
  1259. }
  1260. QuerySet Device::CreateQuerySet(QuerySetDescriptor const * descriptor) const {
  1261. auto result = wgpuDeviceCreateQuerySet(Get(), reinterpret_cast<WGPUQuerySetDescriptor const * >(descriptor));
  1262. return QuerySet::Acquire(result);
  1263. }
  1264. void Device::CreateReadyComputePipeline(ComputePipelineDescriptor const * descriptor, CreateReadyComputePipelineCallback callback, void * userdata) const {
  1265. wgpuDeviceCreateReadyComputePipeline(Get(), reinterpret_cast<WGPUComputePipelineDescriptor const * >(descriptor), callback, reinterpret_cast<void * >(userdata));
  1266. }
  1267. void Device::CreateReadyRenderPipeline(RenderPipelineDescriptor const * descriptor, CreateReadyRenderPipelineCallback callback, void * userdata) const {
  1268. wgpuDeviceCreateReadyRenderPipeline(Get(), reinterpret_cast<WGPURenderPipelineDescriptor const * >(descriptor), callback, reinterpret_cast<void * >(userdata));
  1269. }
  1270. RenderBundleEncoder Device::CreateRenderBundleEncoder(RenderBundleEncoderDescriptor const * descriptor) const {
  1271. auto result = wgpuDeviceCreateRenderBundleEncoder(Get(), reinterpret_cast<WGPURenderBundleEncoderDescriptor const * >(descriptor));
  1272. return RenderBundleEncoder::Acquire(result);
  1273. }
  1274. RenderPipeline Device::CreateRenderPipeline(RenderPipelineDescriptor const * descriptor) const {
  1275. auto result = wgpuDeviceCreateRenderPipeline(Get(), reinterpret_cast<WGPURenderPipelineDescriptor const * >(descriptor));
  1276. return RenderPipeline::Acquire(result);
  1277. }
  1278. Sampler Device::CreateSampler(SamplerDescriptor const * descriptor) const {
  1279. auto result = wgpuDeviceCreateSampler(Get(), reinterpret_cast<WGPUSamplerDescriptor const * >(descriptor));
  1280. return Sampler::Acquire(result);
  1281. }
  1282. ShaderModule Device::CreateShaderModule(ShaderModuleDescriptor const * descriptor) const {
  1283. auto result = wgpuDeviceCreateShaderModule(Get(), reinterpret_cast<WGPUShaderModuleDescriptor const * >(descriptor));
  1284. return ShaderModule::Acquire(result);
  1285. }
  1286. SwapChain Device::CreateSwapChain(Surface const& surface, SwapChainDescriptor const * descriptor) const {
  1287. auto result = wgpuDeviceCreateSwapChain(Get(), surface.Get(), reinterpret_cast<WGPUSwapChainDescriptor const * >(descriptor));
  1288. return SwapChain::Acquire(result);
  1289. }
  1290. Texture Device::CreateTexture(TextureDescriptor const * descriptor) const {
  1291. auto result = wgpuDeviceCreateTexture(Get(), reinterpret_cast<WGPUTextureDescriptor const * >(descriptor));
  1292. return Texture::Acquire(result);
  1293. }
  1294. Queue Device::GetDefaultQueue() const {
  1295. auto result = wgpuDeviceGetDefaultQueue(Get());
  1296. return Queue::Acquire(result);
  1297. }
  1298. void Device::InjectError(ErrorType type, char const * message) const {
  1299. wgpuDeviceInjectError(Get(), static_cast<WGPUErrorType>(type), reinterpret_cast<char const * >(message));
  1300. }
  1301. void Device::LoseForTesting() const {
  1302. wgpuDeviceLoseForTesting(Get());
  1303. }
  1304. bool Device::PopErrorScope(ErrorCallback callback, void * userdata) const {
  1305. auto result = wgpuDevicePopErrorScope(Get(), callback, reinterpret_cast<void * >(userdata));
  1306. return result;
  1307. }
  1308. void Device::PushErrorScope(ErrorFilter filter) const {
  1309. wgpuDevicePushErrorScope(Get(), static_cast<WGPUErrorFilter>(filter));
  1310. }
  1311. void Device::SetDeviceLostCallback(DeviceLostCallback callback, void * userdata) const {
  1312. wgpuDeviceSetDeviceLostCallback(Get(), callback, reinterpret_cast<void * >(userdata));
  1313. }
  1314. void Device::SetUncapturedErrorCallback(ErrorCallback callback, void * userdata) const {
  1315. wgpuDeviceSetUncapturedErrorCallback(Get(), callback, reinterpret_cast<void * >(userdata));
  1316. }
  1317. void Device::Tick() const {
  1318. wgpuDeviceTick(Get());
  1319. }
  1320. void Device::WGPUReference(WGPUDevice handle) {
  1321. if (handle != nullptr) {
  1322. wgpuDeviceReference(handle);
  1323. }
  1324. }
  1325. void Device::WGPURelease(WGPUDevice handle) {
  1326. if (handle != nullptr) {
  1327. wgpuDeviceRelease(handle);
  1328. }
  1329. }
  1330. // Fence
  1331. static_assert(sizeof(Fence) == sizeof(WGPUFence), "sizeof mismatch for Fence");
  1332. static_assert(alignof(Fence) == alignof(WGPUFence), "alignof mismatch for Fence");
  1333. uint64_t Fence::GetCompletedValue() const {
  1334. auto result = wgpuFenceGetCompletedValue(Get());
  1335. return result;
  1336. }
  1337. void Fence::OnCompletion(uint64_t value, FenceOnCompletionCallback callback, void * userdata) const {
  1338. wgpuFenceOnCompletion(Get(), value, callback, reinterpret_cast<void * >(userdata));
  1339. }
  1340. void Fence::WGPUReference(WGPUFence handle) {
  1341. if (handle != nullptr) {
  1342. wgpuFenceReference(handle);
  1343. }
  1344. }
  1345. void Fence::WGPURelease(WGPUFence handle) {
  1346. if (handle != nullptr) {
  1347. wgpuFenceRelease(handle);
  1348. }
  1349. }
  1350. // Instance
  1351. static_assert(sizeof(Instance) == sizeof(WGPUInstance), "sizeof mismatch for Instance");
  1352. static_assert(alignof(Instance) == alignof(WGPUInstance), "alignof mismatch for Instance");
  1353. Surface Instance::CreateSurface(SurfaceDescriptor const * descriptor) const {
  1354. auto result = wgpuInstanceCreateSurface(Get(), reinterpret_cast<WGPUSurfaceDescriptor const * >(descriptor));
  1355. return Surface::Acquire(result);
  1356. }
  1357. void Instance::WGPUReference(WGPUInstance handle) {
  1358. if (handle != nullptr) {
  1359. wgpuInstanceReference(handle);
  1360. }
  1361. }
  1362. void Instance::WGPURelease(WGPUInstance handle) {
  1363. if (handle != nullptr) {
  1364. wgpuInstanceRelease(handle);
  1365. }
  1366. }
  1367. // PipelineLayout
  1368. static_assert(sizeof(PipelineLayout) == sizeof(WGPUPipelineLayout), "sizeof mismatch for PipelineLayout");
  1369. static_assert(alignof(PipelineLayout) == alignof(WGPUPipelineLayout), "alignof mismatch for PipelineLayout");
  1370. void PipelineLayout::WGPUReference(WGPUPipelineLayout handle) {
  1371. if (handle != nullptr) {
  1372. wgpuPipelineLayoutReference(handle);
  1373. }
  1374. }
  1375. void PipelineLayout::WGPURelease(WGPUPipelineLayout handle) {
  1376. if (handle != nullptr) {
  1377. wgpuPipelineLayoutRelease(handle);
  1378. }
  1379. }
  1380. // QuerySet
  1381. static_assert(sizeof(QuerySet) == sizeof(WGPUQuerySet), "sizeof mismatch for QuerySet");
  1382. static_assert(alignof(QuerySet) == alignof(WGPUQuerySet), "alignof mismatch for QuerySet");
  1383. void QuerySet::Destroy() const {
  1384. wgpuQuerySetDestroy(Get());
  1385. }
  1386. void QuerySet::WGPUReference(WGPUQuerySet handle) {
  1387. if (handle != nullptr) {
  1388. wgpuQuerySetReference(handle);
  1389. }
  1390. }
  1391. void QuerySet::WGPURelease(WGPUQuerySet handle) {
  1392. if (handle != nullptr) {
  1393. wgpuQuerySetRelease(handle);
  1394. }
  1395. }
  1396. // Queue
  1397. static_assert(sizeof(Queue) == sizeof(WGPUQueue), "sizeof mismatch for Queue");
  1398. static_assert(alignof(Queue) == alignof(WGPUQueue), "alignof mismatch for Queue");
  1399. void Queue::CopyTextureForBrowser(TextureCopyView const * source, TextureCopyView const * destination, Extent3D const * copySize, CopyTextureForBrowserOptions const * options) const {
  1400. wgpuQueueCopyTextureForBrowser(Get(), reinterpret_cast<WGPUTextureCopyView const * >(source), reinterpret_cast<WGPUTextureCopyView const * >(destination), reinterpret_cast<WGPUExtent3D const * >(copySize), reinterpret_cast<WGPUCopyTextureForBrowserOptions const * >(options));
  1401. }
  1402. Fence Queue::CreateFence(FenceDescriptor const * descriptor) const {
  1403. auto result = wgpuQueueCreateFence(Get(), reinterpret_cast<WGPUFenceDescriptor const * >(descriptor));
  1404. return Fence::Acquire(result);
  1405. }
  1406. void Queue::Signal(Fence const& fence, uint64_t signalValue) const {
  1407. wgpuQueueSignal(Get(), fence.Get(), signalValue);
  1408. }
  1409. void Queue::Submit(uint32_t commandCount, CommandBuffer const * commands) const {
  1410. wgpuQueueSubmit(Get(), commandCount, reinterpret_cast<WGPUCommandBuffer const * >(commands));
  1411. }
  1412. void Queue::WriteBuffer(Buffer const& buffer, uint64_t bufferOffset, void const * data, size_t size) const {
  1413. wgpuQueueWriteBuffer(Get(), buffer.Get(), bufferOffset, reinterpret_cast<void const * >(data), size);
  1414. }
  1415. void Queue::WriteTexture(TextureCopyView const * destination, void const * data, size_t dataSize, TextureDataLayout const * dataLayout, Extent3D const * writeSize) const {
  1416. wgpuQueueWriteTexture(Get(), reinterpret_cast<WGPUTextureCopyView const * >(destination), reinterpret_cast<void const * >(data), dataSize, reinterpret_cast<WGPUTextureDataLayout const * >(dataLayout), reinterpret_cast<WGPUExtent3D const * >(writeSize));
  1417. }
  1418. void Queue::WGPUReference(WGPUQueue handle) {
  1419. if (handle != nullptr) {
  1420. wgpuQueueReference(handle);
  1421. }
  1422. }
  1423. void Queue::WGPURelease(WGPUQueue handle) {
  1424. if (handle != nullptr) {
  1425. wgpuQueueRelease(handle);
  1426. }
  1427. }
  1428. // RenderBundle
  1429. static_assert(sizeof(RenderBundle) == sizeof(WGPURenderBundle), "sizeof mismatch for RenderBundle");
  1430. static_assert(alignof(RenderBundle) == alignof(WGPURenderBundle), "alignof mismatch for RenderBundle");
  1431. void RenderBundle::WGPUReference(WGPURenderBundle handle) {
  1432. if (handle != nullptr) {
  1433. wgpuRenderBundleReference(handle);
  1434. }
  1435. }
  1436. void RenderBundle::WGPURelease(WGPURenderBundle handle) {
  1437. if (handle != nullptr) {
  1438. wgpuRenderBundleRelease(handle);
  1439. }
  1440. }
  1441. // RenderBundleEncoder
  1442. static_assert(sizeof(RenderBundleEncoder) == sizeof(WGPURenderBundleEncoder), "sizeof mismatch for RenderBundleEncoder");
  1443. static_assert(alignof(RenderBundleEncoder) == alignof(WGPURenderBundleEncoder), "alignof mismatch for RenderBundleEncoder");
  1444. void RenderBundleEncoder::Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) const {
  1445. wgpuRenderBundleEncoderDraw(Get(), vertexCount, instanceCount, firstVertex, firstInstance);
  1446. }
  1447. void RenderBundleEncoder::DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) const {
  1448. wgpuRenderBundleEncoderDrawIndexed(Get(), indexCount, instanceCount, firstIndex, baseVertex, firstInstance);
  1449. }
  1450. void RenderBundleEncoder::DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const {
  1451. wgpuRenderBundleEncoderDrawIndexedIndirect(Get(), indirectBuffer.Get(), indirectOffset);
  1452. }
  1453. void RenderBundleEncoder::DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const {
  1454. wgpuRenderBundleEncoderDrawIndirect(Get(), indirectBuffer.Get(), indirectOffset);
  1455. }
  1456. RenderBundle RenderBundleEncoder::Finish(RenderBundleDescriptor const * descriptor) const {
  1457. auto result = wgpuRenderBundleEncoderFinish(Get(), reinterpret_cast<WGPURenderBundleDescriptor const * >(descriptor));
  1458. return RenderBundle::Acquire(result);
  1459. }
  1460. void RenderBundleEncoder::InsertDebugMarker(char const * markerLabel) const {
  1461. wgpuRenderBundleEncoderInsertDebugMarker(Get(), reinterpret_cast<char const * >(markerLabel));
  1462. }
  1463. void RenderBundleEncoder::PopDebugGroup() const {
  1464. wgpuRenderBundleEncoderPopDebugGroup(Get());
  1465. }
  1466. void RenderBundleEncoder::PushDebugGroup(char const * groupLabel) const {
  1467. wgpuRenderBundleEncoderPushDebugGroup(Get(), reinterpret_cast<char const * >(groupLabel));
  1468. }
  1469. void RenderBundleEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const {
  1470. wgpuRenderBundleEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast<uint32_t const * >(dynamicOffsets));
  1471. }
  1472. void RenderBundleEncoder::SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset, uint64_t size) const {
  1473. wgpuRenderBundleEncoderSetIndexBuffer(Get(), buffer.Get(), static_cast<WGPUIndexFormat>(format), offset, size);
  1474. }
  1475. void RenderBundleEncoder::SetIndexBufferWithFormat(Buffer const& buffer, IndexFormat format, uint64_t offset, uint64_t size) const {
  1476. wgpuRenderBundleEncoderSetIndexBufferWithFormat(Get(), buffer.Get(), static_cast<WGPUIndexFormat>(format), offset, size);
  1477. }
  1478. void RenderBundleEncoder::SetPipeline(RenderPipeline const& pipeline) const {
  1479. wgpuRenderBundleEncoderSetPipeline(Get(), pipeline.Get());
  1480. }
  1481. void RenderBundleEncoder::SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset, uint64_t size) const {
  1482. wgpuRenderBundleEncoderSetVertexBuffer(Get(), slot, buffer.Get(), offset, size);
  1483. }
  1484. void RenderBundleEncoder::WGPUReference(WGPURenderBundleEncoder handle) {
  1485. if (handle != nullptr) {
  1486. wgpuRenderBundleEncoderReference(handle);
  1487. }
  1488. }
  1489. void RenderBundleEncoder::WGPURelease(WGPURenderBundleEncoder handle) {
  1490. if (handle != nullptr) {
  1491. wgpuRenderBundleEncoderRelease(handle);
  1492. }
  1493. }
  1494. // RenderPassEncoder
  1495. static_assert(sizeof(RenderPassEncoder) == sizeof(WGPURenderPassEncoder), "sizeof mismatch for RenderPassEncoder");
  1496. static_assert(alignof(RenderPassEncoder) == alignof(WGPURenderPassEncoder), "alignof mismatch for RenderPassEncoder");
  1497. void RenderPassEncoder::BeginOcclusionQuery(uint32_t queryIndex) const {
  1498. wgpuRenderPassEncoderBeginOcclusionQuery(Get(), queryIndex);
  1499. }
  1500. void RenderPassEncoder::Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) const {
  1501. wgpuRenderPassEncoderDraw(Get(), vertexCount, instanceCount, firstVertex, firstInstance);
  1502. }
  1503. void RenderPassEncoder::DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) const {
  1504. wgpuRenderPassEncoderDrawIndexed(Get(), indexCount, instanceCount, firstIndex, baseVertex, firstInstance);
  1505. }
  1506. void RenderPassEncoder::DrawIndexedIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const {
  1507. wgpuRenderPassEncoderDrawIndexedIndirect(Get(), indirectBuffer.Get(), indirectOffset);
  1508. }
  1509. void RenderPassEncoder::DrawIndirect(Buffer const& indirectBuffer, uint64_t indirectOffset) const {
  1510. wgpuRenderPassEncoderDrawIndirect(Get(), indirectBuffer.Get(), indirectOffset);
  1511. }
  1512. void RenderPassEncoder::EndOcclusionQuery() const {
  1513. wgpuRenderPassEncoderEndOcclusionQuery(Get());
  1514. }
  1515. void RenderPassEncoder::EndPass() const {
  1516. wgpuRenderPassEncoderEndPass(Get());
  1517. }
  1518. void RenderPassEncoder::ExecuteBundles(uint32_t bundlesCount, RenderBundle const * bundles) const {
  1519. wgpuRenderPassEncoderExecuteBundles(Get(), bundlesCount, reinterpret_cast<WGPURenderBundle const * >(bundles));
  1520. }
  1521. void RenderPassEncoder::InsertDebugMarker(char const * markerLabel) const {
  1522. wgpuRenderPassEncoderInsertDebugMarker(Get(), reinterpret_cast<char const * >(markerLabel));
  1523. }
  1524. void RenderPassEncoder::PopDebugGroup() const {
  1525. wgpuRenderPassEncoderPopDebugGroup(Get());
  1526. }
  1527. void RenderPassEncoder::PushDebugGroup(char const * groupLabel) const {
  1528. wgpuRenderPassEncoderPushDebugGroup(Get(), reinterpret_cast<char const * >(groupLabel));
  1529. }
  1530. void RenderPassEncoder::SetBindGroup(uint32_t groupIndex, BindGroup const& group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets) const {
  1531. wgpuRenderPassEncoderSetBindGroup(Get(), groupIndex, group.Get(), dynamicOffsetCount, reinterpret_cast<uint32_t const * >(dynamicOffsets));
  1532. }
  1533. void RenderPassEncoder::SetBlendColor(Color const * color) const {
  1534. wgpuRenderPassEncoderSetBlendColor(Get(), reinterpret_cast<WGPUColor const * >(color));
  1535. }
  1536. void RenderPassEncoder::SetIndexBuffer(Buffer const& buffer, IndexFormat format, uint64_t offset, uint64_t size) const {
  1537. wgpuRenderPassEncoderSetIndexBuffer(Get(), buffer.Get(), static_cast<WGPUIndexFormat>(format), offset, size);
  1538. }
  1539. void RenderPassEncoder::SetIndexBufferWithFormat(Buffer const& buffer, IndexFormat format, uint64_t offset, uint64_t size) const {
  1540. wgpuRenderPassEncoderSetIndexBufferWithFormat(Get(), buffer.Get(), static_cast<WGPUIndexFormat>(format), offset, size);
  1541. }
  1542. void RenderPassEncoder::SetPipeline(RenderPipeline const& pipeline) const {
  1543. wgpuRenderPassEncoderSetPipeline(Get(), pipeline.Get());
  1544. }
  1545. void RenderPassEncoder::SetScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height) const {
  1546. wgpuRenderPassEncoderSetScissorRect(Get(), x, y, width, height);
  1547. }
  1548. void RenderPassEncoder::SetStencilReference(uint32_t reference) const {
  1549. wgpuRenderPassEncoderSetStencilReference(Get(), reference);
  1550. }
  1551. void RenderPassEncoder::SetVertexBuffer(uint32_t slot, Buffer const& buffer, uint64_t offset, uint64_t size) const {
  1552. wgpuRenderPassEncoderSetVertexBuffer(Get(), slot, buffer.Get(), offset, size);
  1553. }
  1554. void RenderPassEncoder::SetViewport(float x, float y, float width, float height, float minDepth, float maxDepth) const {
  1555. wgpuRenderPassEncoderSetViewport(Get(), x, y, width, height, minDepth, maxDepth);
  1556. }
  1557. void RenderPassEncoder::WriteTimestamp(QuerySet const& querySet, uint32_t queryIndex) const {
  1558. wgpuRenderPassEncoderWriteTimestamp(Get(), querySet.Get(), queryIndex);
  1559. }
  1560. void RenderPassEncoder::WGPUReference(WGPURenderPassEncoder handle) {
  1561. if (handle != nullptr) {
  1562. wgpuRenderPassEncoderReference(handle);
  1563. }
  1564. }
  1565. void RenderPassEncoder::WGPURelease(WGPURenderPassEncoder handle) {
  1566. if (handle != nullptr) {
  1567. wgpuRenderPassEncoderRelease(handle);
  1568. }
  1569. }
  1570. // RenderPipeline
  1571. static_assert(sizeof(RenderPipeline) == sizeof(WGPURenderPipeline), "sizeof mismatch for RenderPipeline");
  1572. static_assert(alignof(RenderPipeline) == alignof(WGPURenderPipeline), "alignof mismatch for RenderPipeline");
  1573. BindGroupLayout RenderPipeline::GetBindGroupLayout(uint32_t groupIndex) const {
  1574. auto result = wgpuRenderPipelineGetBindGroupLayout(Get(), groupIndex);
  1575. return BindGroupLayout::Acquire(result);
  1576. }
  1577. void RenderPipeline::WGPUReference(WGPURenderPipeline handle) {
  1578. if (handle != nullptr) {
  1579. wgpuRenderPipelineReference(handle);
  1580. }
  1581. }
  1582. void RenderPipeline::WGPURelease(WGPURenderPipeline handle) {
  1583. if (handle != nullptr) {
  1584. wgpuRenderPipelineRelease(handle);
  1585. }
  1586. }
  1587. // Sampler
  1588. static_assert(sizeof(Sampler) == sizeof(WGPUSampler), "sizeof mismatch for Sampler");
  1589. static_assert(alignof(Sampler) == alignof(WGPUSampler), "alignof mismatch for Sampler");
  1590. void Sampler::WGPUReference(WGPUSampler handle) {
  1591. if (handle != nullptr) {
  1592. wgpuSamplerReference(handle);
  1593. }
  1594. }
  1595. void Sampler::WGPURelease(WGPUSampler handle) {
  1596. if (handle != nullptr) {
  1597. wgpuSamplerRelease(handle);
  1598. }
  1599. }
  1600. // ShaderModule
  1601. static_assert(sizeof(ShaderModule) == sizeof(WGPUShaderModule), "sizeof mismatch for ShaderModule");
  1602. static_assert(alignof(ShaderModule) == alignof(WGPUShaderModule), "alignof mismatch for ShaderModule");
  1603. void ShaderModule::WGPUReference(WGPUShaderModule handle) {
  1604. if (handle != nullptr) {
  1605. wgpuShaderModuleReference(handle);
  1606. }
  1607. }
  1608. void ShaderModule::WGPURelease(WGPUShaderModule handle) {
  1609. if (handle != nullptr) {
  1610. wgpuShaderModuleRelease(handle);
  1611. }
  1612. }
  1613. // Surface
  1614. static_assert(sizeof(Surface) == sizeof(WGPUSurface), "sizeof mismatch for Surface");
  1615. static_assert(alignof(Surface) == alignof(WGPUSurface), "alignof mismatch for Surface");
  1616. void Surface::WGPUReference(WGPUSurface handle) {
  1617. if (handle != nullptr) {
  1618. wgpuSurfaceReference(handle);
  1619. }
  1620. }
  1621. void Surface::WGPURelease(WGPUSurface handle) {
  1622. if (handle != nullptr) {
  1623. wgpuSurfaceRelease(handle);
  1624. }
  1625. }
  1626. // SwapChain
  1627. static_assert(sizeof(SwapChain) == sizeof(WGPUSwapChain), "sizeof mismatch for SwapChain");
  1628. static_assert(alignof(SwapChain) == alignof(WGPUSwapChain), "alignof mismatch for SwapChain");
  1629. void SwapChain::Configure(TextureFormat format, TextureUsage allowedUsage, uint32_t width, uint32_t height) const {
  1630. wgpuSwapChainConfigure(Get(), static_cast<WGPUTextureFormat>(format), static_cast<WGPUTextureUsage>(allowedUsage), width, height);
  1631. }
  1632. TextureView SwapChain::GetCurrentTextureView() const {
  1633. auto result = wgpuSwapChainGetCurrentTextureView(Get());
  1634. return TextureView::Acquire(result);
  1635. }
  1636. void SwapChain::Present() const {
  1637. wgpuSwapChainPresent(Get());
  1638. }
  1639. void SwapChain::WGPUReference(WGPUSwapChain handle) {
  1640. if (handle != nullptr) {
  1641. wgpuSwapChainReference(handle);
  1642. }
  1643. }
  1644. void SwapChain::WGPURelease(WGPUSwapChain handle) {
  1645. if (handle != nullptr) {
  1646. wgpuSwapChainRelease(handle);
  1647. }
  1648. }
  1649. // Texture
  1650. static_assert(sizeof(Texture) == sizeof(WGPUTexture), "sizeof mismatch for Texture");
  1651. static_assert(alignof(Texture) == alignof(WGPUTexture), "alignof mismatch for Texture");
  1652. TextureView Texture::CreateView(TextureViewDescriptor const * descriptor) const {
  1653. auto result = wgpuTextureCreateView(Get(), reinterpret_cast<WGPUTextureViewDescriptor const * >(descriptor));
  1654. return TextureView::Acquire(result);
  1655. }
  1656. void Texture::Destroy() const {
  1657. wgpuTextureDestroy(Get());
  1658. }
  1659. void Texture::WGPUReference(WGPUTexture handle) {
  1660. if (handle != nullptr) {
  1661. wgpuTextureReference(handle);
  1662. }
  1663. }
  1664. void Texture::WGPURelease(WGPUTexture handle) {
  1665. if (handle != nullptr) {
  1666. wgpuTextureRelease(handle);
  1667. }
  1668. }
  1669. // TextureView
  1670. static_assert(sizeof(TextureView) == sizeof(WGPUTextureView), "sizeof mismatch for TextureView");
  1671. static_assert(alignof(TextureView) == alignof(WGPUTextureView), "alignof mismatch for TextureView");
  1672. void TextureView::WGPUReference(WGPUTextureView handle) {
  1673. if (handle != nullptr) {
  1674. wgpuTextureViewReference(handle);
  1675. }
  1676. }
  1677. void TextureView::WGPURelease(WGPUTextureView handle) {
  1678. if (handle != nullptr) {
  1679. wgpuTextureViewRelease(handle);
  1680. }
  1681. }
  1682. // Instance
  1683. Instance CreateInstance(const InstanceDescriptor* descriptor) {
  1684. const WGPUInstanceDescriptor* cDescriptor =
  1685. reinterpret_cast<const WGPUInstanceDescriptor*>(descriptor);
  1686. return Instance::Acquire(wgpuCreateInstance(cDescriptor));
  1687. }
  1688. Proc GetProcAddress(Device const& device, const char* procName) {
  1689. return reinterpret_cast<Proc>(wgpuGetProcAddress(device.Get(), procName));
  1690. }
  1691. }