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