OpenXR D3D12/Vulkan backend

This commit is contained in:
iChris4 committed 2026-08-30 21:48:59 +02:00
1 parent 0beb7d880c
commit e31932de0a
28 files changed
+33730 -44

No files matched your search

Binary file not shown.
@@ -0,0 +1,330 @@
#ifndef DAWN_DAWN_PROC_TABLE_H_
#define DAWN_DAWN_PROC_TABLE_H_
#include "dawn/webgpu.h"
// Note: Often allocated as a static global. Do not add a complex constructor.
typedef struct DawnProcTable {
uint8_t version[20];
WGPUProcCreateInstance createInstance;
WGPUProcGetInstanceFeatures getInstanceFeatures;
WGPUProcGetInstanceLimits getInstanceLimits;
WGPUProcHasInstanceFeature hasInstanceFeature;
WGPUProcGetProcAddress getProcAddress;
WGPUProcAdapterCreateDevice adapterCreateDevice;
WGPUProcAdapterGetFeatures adapterGetFeatures;
WGPUProcAdapterGetFormatCapabilities adapterGetFormatCapabilities;
WGPUProcAdapterGetInfo adapterGetInfo;
WGPUProcAdapterGetInstance adapterGetInstance;
WGPUProcAdapterGetLimits adapterGetLimits;
WGPUProcAdapterHasFeature adapterHasFeature;
WGPUProcAdapterRequestDevice adapterRequestDevice;
WGPUProcAdapterAddRef adapterAddRef;
WGPUProcAdapterRelease adapterRelease;
WGPUProcAdapterInfoFreeMembers adapterInfoFreeMembers;
WGPUProcAdapterPropertiesMemoryHeapsFreeMembers adapterPropertiesMemoryHeapsFreeMembers;
WGPUProcAdapterPropertiesSubgroupMatrixConfigsFreeMembers adapterPropertiesSubgroupMatrixConfigsFreeMembers;
WGPUProcBindGroupSetLabel bindGroupSetLabel;
WGPUProcBindGroupAddRef bindGroupAddRef;
WGPUProcBindGroupRelease bindGroupRelease;
WGPUProcBindGroupLayoutSetLabel bindGroupLayoutSetLabel;
WGPUProcBindGroupLayoutAddRef bindGroupLayoutAddRef;
WGPUProcBindGroupLayoutRelease bindGroupLayoutRelease;
WGPUProcBufferCreateTexelView bufferCreateTexelView;
WGPUProcBufferDestroy bufferDestroy;
WGPUProcBufferGetConstMappedRange bufferGetConstMappedRange;
WGPUProcBufferGetMappedRange bufferGetMappedRange;
WGPUProcBufferGetMapState bufferGetMapState;
WGPUProcBufferGetSize bufferGetSize;
WGPUProcBufferGetUsage bufferGetUsage;
WGPUProcBufferMapAsync bufferMapAsync;
WGPUProcBufferReadMappedRange bufferReadMappedRange;
WGPUProcBufferSetLabel bufferSetLabel;
WGPUProcBufferUnmap bufferUnmap;
WGPUProcBufferWriteMappedRange bufferWriteMappedRange;
WGPUProcBufferAddRef bufferAddRef;
WGPUProcBufferRelease bufferRelease;
WGPUProcCommandBufferSetLabel commandBufferSetLabel;
WGPUProcCommandBufferAddRef commandBufferAddRef;
WGPUProcCommandBufferRelease commandBufferRelease;
WGPUProcCommandEncoderBeginComputePass commandEncoderBeginComputePass;
WGPUProcCommandEncoderBeginRenderPass commandEncoderBeginRenderPass;
WGPUProcCommandEncoderClearBuffer commandEncoderClearBuffer;
WGPUProcCommandEncoderCopyBufferToBuffer commandEncoderCopyBufferToBuffer;
WGPUProcCommandEncoderCopyBufferToTexture commandEncoderCopyBufferToTexture;
WGPUProcCommandEncoderCopyTextureToBuffer commandEncoderCopyTextureToBuffer;
WGPUProcCommandEncoderCopyTextureToTexture commandEncoderCopyTextureToTexture;
WGPUProcCommandEncoderFinish commandEncoderFinish;
WGPUProcCommandEncoderInjectValidationError commandEncoderInjectValidationError;
WGPUProcCommandEncoderInsertDebugMarker commandEncoderInsertDebugMarker;
WGPUProcCommandEncoderPopDebugGroup commandEncoderPopDebugGroup;
WGPUProcCommandEncoderPushDebugGroup commandEncoderPushDebugGroup;
WGPUProcCommandEncoderResolveQuerySet commandEncoderResolveQuerySet;
WGPUProcCommandEncoderSetLabel commandEncoderSetLabel;
WGPUProcCommandEncoderWriteBuffer commandEncoderWriteBuffer;
WGPUProcCommandEncoderWriteTimestamp commandEncoderWriteTimestamp;
WGPUProcCommandEncoderAddRef commandEncoderAddRef;
WGPUProcCommandEncoderRelease commandEncoderRelease;
WGPUProcComputePassEncoderDispatchWorkgroups computePassEncoderDispatchWorkgroups;
WGPUProcComputePassEncoderDispatchWorkgroupsIndirect computePassEncoderDispatchWorkgroupsIndirect;
WGPUProcComputePassEncoderEnd computePassEncoderEnd;
WGPUProcComputePassEncoderInsertDebugMarker computePassEncoderInsertDebugMarker;
WGPUProcComputePassEncoderPopDebugGroup computePassEncoderPopDebugGroup;
WGPUProcComputePassEncoderPushDebugGroup computePassEncoderPushDebugGroup;
WGPUProcComputePassEncoderSetBindGroup computePassEncoderSetBindGroup;
WGPUProcComputePassEncoderSetImmediates computePassEncoderSetImmediates;
WGPUProcComputePassEncoderSetLabel computePassEncoderSetLabel;
WGPUProcComputePassEncoderSetPipeline computePassEncoderSetPipeline;
WGPUProcComputePassEncoderSetResourceTable computePassEncoderSetResourceTable;
WGPUProcComputePassEncoderWriteTimestamp computePassEncoderWriteTimestamp;
WGPUProcComputePassEncoderAddRef computePassEncoderAddRef;
WGPUProcComputePassEncoderRelease computePassEncoderRelease;
WGPUProcComputePipelineGetBindGroupLayout computePipelineGetBindGroupLayout;
WGPUProcComputePipelineSetLabel computePipelineSetLabel;
WGPUProcComputePipelineAddRef computePipelineAddRef;
WGPUProcComputePipelineRelease computePipelineRelease;
WGPUProcDawnDrmFormatCapabilitiesFreeMembers dawnDrmFormatCapabilitiesFreeMembers;
WGPUProcDeviceCreateBindGroup deviceCreateBindGroup;
WGPUProcDeviceCreateBindGroupLayout deviceCreateBindGroupLayout;
WGPUProcDeviceCreateBuffer deviceCreateBuffer;
WGPUProcDeviceCreateCommandEncoder deviceCreateCommandEncoder;
WGPUProcDeviceCreateComputePipeline deviceCreateComputePipeline;
WGPUProcDeviceCreateComputePipelineAsync deviceCreateComputePipelineAsync;
WGPUProcDeviceCreateErrorBuffer deviceCreateErrorBuffer;
WGPUProcDeviceCreateErrorExternalTexture deviceCreateErrorExternalTexture;
WGPUProcDeviceCreateErrorShaderModule deviceCreateErrorShaderModule;
WGPUProcDeviceCreateErrorTexture deviceCreateErrorTexture;
WGPUProcDeviceCreateExternalTexture deviceCreateExternalTexture;
WGPUProcDeviceCreatePipelineLayout deviceCreatePipelineLayout;
WGPUProcDeviceCreateQuerySet deviceCreateQuerySet;
WGPUProcDeviceCreateRenderBundleEncoder deviceCreateRenderBundleEncoder;
WGPUProcDeviceCreateRenderPipeline deviceCreateRenderPipeline;
WGPUProcDeviceCreateRenderPipelineAsync deviceCreateRenderPipelineAsync;
WGPUProcDeviceCreateResourceTable deviceCreateResourceTable;
WGPUProcDeviceCreateSampler deviceCreateSampler;
WGPUProcDeviceCreateShaderModule deviceCreateShaderModule;
WGPUProcDeviceCreateTexture deviceCreateTexture;
WGPUProcDeviceDestroy deviceDestroy;
WGPUProcDeviceForceLoss deviceForceLoss;
WGPUProcDeviceGetAdapter deviceGetAdapter;
WGPUProcDeviceGetAdapterInfo deviceGetAdapterInfo;
WGPUProcDeviceGetAHardwareBufferProperties deviceGetAHardwareBufferProperties;
WGPUProcDeviceGetFeatures deviceGetFeatures;
WGPUProcDeviceGetLimits deviceGetLimits;
WGPUProcDeviceGetLostFuture deviceGetLostFuture;
WGPUProcDeviceGetQueue deviceGetQueue;
WGPUProcDeviceHasFeature deviceHasFeature;
WGPUProcDeviceImportSharedBufferMemory deviceImportSharedBufferMemory;
WGPUProcDeviceImportSharedFence deviceImportSharedFence;
WGPUProcDeviceImportSharedTextureMemory deviceImportSharedTextureMemory;
WGPUProcDeviceInjectError deviceInjectError;
WGPUProcDevicePopErrorScope devicePopErrorScope;
WGPUProcDevicePushErrorScope devicePushErrorScope;
WGPUProcDeviceSetLabel deviceSetLabel;
WGPUProcDeviceSetLoggingCallback deviceSetLoggingCallback;
WGPUProcDeviceTick deviceTick;
WGPUProcDeviceValidateTextureDescriptor deviceValidateTextureDescriptor;
WGPUProcDeviceAddRef deviceAddRef;
WGPUProcDeviceRelease deviceRelease;
WGPUProcExternalTextureDestroy externalTextureDestroy;
WGPUProcExternalTextureExpire externalTextureExpire;
WGPUProcExternalTextureRefresh externalTextureRefresh;
WGPUProcExternalTextureSetLabel externalTextureSetLabel;
WGPUProcExternalTextureAddRef externalTextureAddRef;
WGPUProcExternalTextureRelease externalTextureRelease;
WGPUProcInstanceCreateSurface instanceCreateSurface;
WGPUProcInstanceGetWGSLLanguageFeatures instanceGetWGSLLanguageFeatures;
WGPUProcInstanceHasWGSLLanguageFeature instanceHasWGSLLanguageFeature;
WGPUProcInstanceProcessEvents instanceProcessEvents;
WGPUProcInstanceRequestAdapter instanceRequestAdapter;
WGPUProcInstanceWaitAny instanceWaitAny;
WGPUProcInstanceAddRef instanceAddRef;
WGPUProcInstanceRelease instanceRelease;
WGPUProcPipelineLayoutSetLabel pipelineLayoutSetLabel;
WGPUProcPipelineLayoutAddRef pipelineLayoutAddRef;
WGPUProcPipelineLayoutRelease pipelineLayoutRelease;
WGPUProcQuerySetDestroy querySetDestroy;
WGPUProcQuerySetGetCount querySetGetCount;
WGPUProcQuerySetGetType querySetGetType;
WGPUProcQuerySetSetLabel querySetSetLabel;
WGPUProcQuerySetAddRef querySetAddRef;
WGPUProcQuerySetRelease querySetRelease;
WGPUProcQueueCopyExternalTextureForBrowser queueCopyExternalTextureForBrowser;
WGPUProcQueueCopyTextureForBrowser queueCopyTextureForBrowser;
WGPUProcQueueOnSubmittedWorkDone queueOnSubmittedWorkDone;
WGPUProcQueueSetLabel queueSetLabel;
WGPUProcQueueSubmit queueSubmit;
WGPUProcQueueWriteBuffer queueWriteBuffer;
WGPUProcQueueWriteTexture queueWriteTexture;
WGPUProcQueueAddRef queueAddRef;
WGPUProcQueueRelease queueRelease;
WGPUProcRenderBundleSetLabel renderBundleSetLabel;
WGPUProcRenderBundleAddRef renderBundleAddRef;
WGPUProcRenderBundleRelease renderBundleRelease;
WGPUProcRenderBundleEncoderDraw renderBundleEncoderDraw;
WGPUProcRenderBundleEncoderDrawIndexed renderBundleEncoderDrawIndexed;
WGPUProcRenderBundleEncoderDrawIndexedIndirect renderBundleEncoderDrawIndexedIndirect;
WGPUProcRenderBundleEncoderDrawIndirect renderBundleEncoderDrawIndirect;
WGPUProcRenderBundleEncoderFinish renderBundleEncoderFinish;
WGPUProcRenderBundleEncoderInsertDebugMarker renderBundleEncoderInsertDebugMarker;
WGPUProcRenderBundleEncoderPopDebugGroup renderBundleEncoderPopDebugGroup;
WGPUProcRenderBundleEncoderPushDebugGroup renderBundleEncoderPushDebugGroup;
WGPUProcRenderBundleEncoderSetBindGroup renderBundleEncoderSetBindGroup;
WGPUProcRenderBundleEncoderSetImmediates renderBundleEncoderSetImmediates;
WGPUProcRenderBundleEncoderSetIndexBuffer renderBundleEncoderSetIndexBuffer;
WGPUProcRenderBundleEncoderSetLabel renderBundleEncoderSetLabel;
WGPUProcRenderBundleEncoderSetPipeline renderBundleEncoderSetPipeline;
WGPUProcRenderBundleEncoderSetResourceTable renderBundleEncoderSetResourceTable;
WGPUProcRenderBundleEncoderSetVertexBuffer renderBundleEncoderSetVertexBuffer;
WGPUProcRenderBundleEncoderAddRef renderBundleEncoderAddRef;
WGPUProcRenderBundleEncoderRelease renderBundleEncoderRelease;
WGPUProcRenderPassEncoderBeginOcclusionQuery renderPassEncoderBeginOcclusionQuery;
WGPUProcRenderPassEncoderDraw renderPassEncoderDraw;
WGPUProcRenderPassEncoderDrawIndexed renderPassEncoderDrawIndexed;
WGPUProcRenderPassEncoderDrawIndexedIndirect renderPassEncoderDrawIndexedIndirect;
WGPUProcRenderPassEncoderDrawIndirect renderPassEncoderDrawIndirect;
WGPUProcRenderPassEncoderEnd renderPassEncoderEnd;
WGPUProcRenderPassEncoderEndOcclusionQuery renderPassEncoderEndOcclusionQuery;
WGPUProcRenderPassEncoderExecuteBundles renderPassEncoderExecuteBundles;
WGPUProcRenderPassEncoderInsertDebugMarker renderPassEncoderInsertDebugMarker;
WGPUProcRenderPassEncoderMultiDrawIndexedIndirect renderPassEncoderMultiDrawIndexedIndirect;
WGPUProcRenderPassEncoderMultiDrawIndirect renderPassEncoderMultiDrawIndirect;
WGPUProcRenderPassEncoderPixelLocalStorageBarrier renderPassEncoderPixelLocalStorageBarrier;
WGPUProcRenderPassEncoderPopDebugGroup renderPassEncoderPopDebugGroup;
WGPUProcRenderPassEncoderPushDebugGroup renderPassEncoderPushDebugGroup;
WGPUProcRenderPassEncoderSetBindGroup renderPassEncoderSetBindGroup;
WGPUProcRenderPassEncoderSetBlendConstant renderPassEncoderSetBlendConstant;
WGPUProcRenderPassEncoderSetImmediates renderPassEncoderSetImmediates;
WGPUProcRenderPassEncoderSetIndexBuffer renderPassEncoderSetIndexBuffer;
WGPUProcRenderPassEncoderSetLabel renderPassEncoderSetLabel;
WGPUProcRenderPassEncoderSetPipeline renderPassEncoderSetPipeline;
WGPUProcRenderPassEncoderSetResourceTable renderPassEncoderSetResourceTable;
WGPUProcRenderPassEncoderSetScissorRect renderPassEncoderSetScissorRect;
WGPUProcRenderPassEncoderSetStencilReference renderPassEncoderSetStencilReference;
WGPUProcRenderPassEncoderSetVertexBuffer renderPassEncoderSetVertexBuffer;
WGPUProcRenderPassEncoderSetViewport renderPassEncoderSetViewport;
WGPUProcRenderPassEncoderWriteTimestamp renderPassEncoderWriteTimestamp;
WGPUProcRenderPassEncoderAddRef renderPassEncoderAddRef;
WGPUProcRenderPassEncoderRelease renderPassEncoderRelease;
WGPUProcRenderPipelineGetBindGroupLayout renderPipelineGetBindGroupLayout;
WGPUProcRenderPipelineSetLabel renderPipelineSetLabel;
WGPUProcRenderPipelineAddRef renderPipelineAddRef;
WGPUProcRenderPipelineRelease renderPipelineRelease;
WGPUProcResourceTableDestroy resourceTableDestroy;
WGPUProcResourceTableGetSize resourceTableGetSize;
WGPUProcResourceTableInsertBinding resourceTableInsertBinding;
WGPUProcResourceTableRemoveBinding resourceTableRemoveBinding;
WGPUProcResourceTableSetLabel resourceTableSetLabel;
WGPUProcResourceTableUpdate resourceTableUpdate;
WGPUProcResourceTableAddRef resourceTableAddRef;
WGPUProcResourceTableRelease resourceTableRelease;
WGPUProcSamplerSetLabel samplerSetLabel;
WGPUProcSamplerAddRef samplerAddRef;
WGPUProcSamplerRelease samplerRelease;
WGPUProcShaderModuleGetCompilationInfo shaderModuleGetCompilationInfo;
WGPUProcShaderModuleSetLabel shaderModuleSetLabel;
WGPUProcShaderModuleAddRef shaderModuleAddRef;
WGPUProcShaderModuleRelease shaderModuleRelease;
WGPUProcSharedBufferMemoryBeginAccess sharedBufferMemoryBeginAccess;
WGPUProcSharedBufferMemoryCreateBuffer sharedBufferMemoryCreateBuffer;
WGPUProcSharedBufferMemoryEndAccess sharedBufferMemoryEndAccess;
WGPUProcSharedBufferMemoryGetProperties sharedBufferMemoryGetProperties;
WGPUProcSharedBufferMemoryIsDeviceLost sharedBufferMemoryIsDeviceLost;
WGPUProcSharedBufferMemorySetLabel sharedBufferMemorySetLabel;
WGPUProcSharedBufferMemoryAddRef sharedBufferMemoryAddRef;
WGPUProcSharedBufferMemoryRelease sharedBufferMemoryRelease;
WGPUProcSharedBufferMemoryEndAccessStateFreeMembers sharedBufferMemoryEndAccessStateFreeMembers;
WGPUProcSharedFenceExportInfo sharedFenceExportInfo;
WGPUProcSharedFenceSetLabel sharedFenceSetLabel;
WGPUProcSharedFenceAddRef sharedFenceAddRef;
WGPUProcSharedFenceRelease sharedFenceRelease;
WGPUProcSharedTextureMemoryBeginAccess sharedTextureMemoryBeginAccess;
WGPUProcSharedTextureMemoryCreateTexture sharedTextureMemoryCreateTexture;
WGPUProcSharedTextureMemoryEndAccess sharedTextureMemoryEndAccess;
WGPUProcSharedTextureMemoryGetProperties sharedTextureMemoryGetProperties;
WGPUProcSharedTextureMemoryIsDeviceLost sharedTextureMemoryIsDeviceLost;
WGPUProcSharedTextureMemorySetLabel sharedTextureMemorySetLabel;
WGPUProcSharedTextureMemoryAddRef sharedTextureMemoryAddRef;
WGPUProcSharedTextureMemoryRelease sharedTextureMemoryRelease;
WGPUProcSharedTextureMemoryEndAccessStateFreeMembers sharedTextureMemoryEndAccessStateFreeMembers;
WGPUProcSupportedFeaturesFreeMembers supportedFeaturesFreeMembers;
WGPUProcSupportedInstanceFeaturesFreeMembers supportedInstanceFeaturesFreeMembers;
WGPUProcSupportedWGSLLanguageFeaturesFreeMembers supportedWGSLLanguageFeaturesFreeMembers;
WGPUProcSurfaceConfigure surfaceConfigure;
WGPUProcSurfaceGetCapabilities surfaceGetCapabilities;
WGPUProcSurfaceGetCurrentTexture surfaceGetCurrentTexture;
WGPUProcSurfacePresent surfacePresent;
WGPUProcSurfaceSetLabel surfaceSetLabel;
WGPUProcSurfaceUnconfigure surfaceUnconfigure;
WGPUProcSurfaceAddRef surfaceAddRef;
WGPUProcSurfaceRelease surfaceRelease;
WGPUProcSurfaceCapabilitiesFreeMembers surfaceCapabilitiesFreeMembers;
WGPUProcTexelBufferViewSetLabel texelBufferViewSetLabel;
WGPUProcTexelBufferViewAddRef texelBufferViewAddRef;
WGPUProcTexelBufferViewRelease texelBufferViewRelease;
WGPUProcTextureCreateErrorView textureCreateErrorView;
WGPUProcTextureCreateView textureCreateView;
WGPUProcTextureDestroy textureDestroy;
WGPUProcTextureGetDepthOrArrayLayers textureGetDepthOrArrayLayers;
WGPUProcTextureGetDimension textureGetDimension;
WGPUProcTextureGetFormat textureGetFormat;
WGPUProcTextureGetHeight textureGetHeight;
WGPUProcTextureGetMipLevelCount textureGetMipLevelCount;
WGPUProcTextureGetSampleCount textureGetSampleCount;
WGPUProcTextureGetTextureBindingViewDimension textureGetTextureBindingViewDimension;
WGPUProcTextureGetUsage textureGetUsage;
WGPUProcTextureGetWidth textureGetWidth;
WGPUProcTexturePin texturePin;
WGPUProcTextureSetLabel textureSetLabel;
WGPUProcTextureSetOwnershipForMemoryDump textureSetOwnershipForMemoryDump;
WGPUProcTextureUnpin textureUnpin;
WGPUProcTextureAddRef textureAddRef;
WGPUProcTextureRelease textureRelease;
WGPUProcTextureViewSetLabel textureViewSetLabel;
WGPUProcTextureViewAddRef textureViewAddRef;
WGPUProcTextureViewRelease textureViewRelease;
} DawnProcTable;
#endif // DAWN_DAWN_PROC_TABLE_H_
@@ -0,0 +1,65 @@
// Copyright 2023 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_
#define INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_
#include <d3d11_1.h>
#include <wrl/client.h>
#include <memory>
#include <optional>
#include "dawn/native/D3DBackend.h"
namespace dawn::native::d3d11 {
DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr<ID3D11Device> GetD3D11Device(WGPUDevice device);
// May be chained on RequestAdapterOptions
struct DAWN_NATIVE_EXPORT RequestAdapterOptionsD3D11Device : wgpu::ChainedStruct {
RequestAdapterOptionsD3D11Device() {
sType = static_cast<wgpu::SType>(WGPUSType_RequestAdapterOptionsD3D11Device);
}
Microsoft::WRL::ComPtr<ID3D11Device> device;
};
// May be chained on SharedTextureMemoryDescriptor
struct DAWN_NATIVE_EXPORT SharedTextureMemoryD3D11Texture2DDescriptor : wgpu::ChainedStruct {
SharedTextureMemoryD3D11Texture2DDescriptor() {
sType = static_cast<wgpu::SType>(WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor);
}
// This ID3D11Texture2D object must be created from the same ID3D11Device used in the
// WGPUDevice.
Microsoft::WRL::ComPtr<ID3D11Texture2D> texture;
};
} // namespace dawn::native::d3d11
#endif // INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_
@@ -0,0 +1,86 @@
// Copyright 2018 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_DAWN_NATIVE_D3D12BACKEND_H_
#define INCLUDE_DAWN_NATIVE_D3D12BACKEND_H_
#include <d3d11on12.h>
#include <d3d12.h>
#include <dxgi1_4.h>
#include <wrl/client.h>
#include "dawn/native/D3DBackend.h"
struct ID3D12Device;
struct ID3D12Resource;
namespace dawn::native::d3d12 {
class Device;
enum MemorySegment {
Local,
NonLocal,
};
DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr<ID3D12Device> GetD3D12Device(WGPUDevice device);
DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr<ID3D11On12Device> GetOrCreateD3D11On12Device(
WGPUDevice device);
DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr<ID3D12CommandQueue> GetD3D12CommandQueue(
WGPUDevice device);
DAWN_NATIVE_EXPORT uint64_t SetExternalMemoryReservation(WGPUDevice device,
uint64_t requestedReservationSize,
MemorySegment memorySegment);
// May be chained on SharedBufferMemoryDescriptor
struct DAWN_NATIVE_EXPORT SharedBufferMemoryD3D12ResourceDescriptor : wgpu::ChainedStruct {
SharedBufferMemoryD3D12ResourceDescriptor() {
sType = static_cast<wgpu::SType>(WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor);
}
// This ID3D12Resource object must be created from the same ID3D12Device used in the
// WGPUDevice.
Microsoft::WRL::ComPtr<ID3D12Resource> resource;
};
// May be chained on SharedTextureMemoryDescriptor.
struct DAWN_NATIVE_EXPORT SharedTextureMemoryD3D12ResourceDescriptor : wgpu::ChainedStruct {
SharedTextureMemoryD3D12ResourceDescriptor() {
sType = static_cast<wgpu::SType>(WGPUSType_SharedTextureMemoryD3D12ResourceDescriptor);
}
// This ID3D12Resource object must be created from the same ID3D12Device used in the
// WGPUDevice.
Microsoft::WRL::ComPtr<ID3D12Resource> resource;
};
} // namespace dawn::native::d3d12
#endif // INCLUDE_DAWN_NATIVE_D3D12BACKEND_H_
@@ -0,0 +1,56 @@
// Copyright 2023 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_DAWN_NATIVE_D3DBACKEND_H_
#define INCLUDE_DAWN_NATIVE_D3DBACKEND_H_
#include <dxgi1_4.h>
#include <webgpu/webgpu_cpp_chained_struct.h>
#include <wrl/client.h>
#include <memory>
#include <vector>
#include "dawn/native/DawnNative.h"
namespace dawn::native::d3d {
DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr<IDXGIAdapter> GetDXGIAdapter(WGPUAdapter adapter);
// Can be chained in WGPURequestAdapterOptions
struct DAWN_NATIVE_EXPORT RequestAdapterOptionsLUID : wgpu::ChainedStruct {
RequestAdapterOptionsLUID();
::LUID adapterLUID;
};
// Chrome uses 0 as acquire key.
static constexpr uint64_t kDXGIKeyedMutexAcquireKey = 0;
} // namespace dawn::native::d3d
#endif // INCLUDE_DAWN_NATIVE_D3DBACKEND_H_
@@ -0,0 +1,369 @@
// Copyright 2018 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_DAWN_NATIVE_DAWNNATIVE_H_
#define INCLUDE_DAWN_NATIVE_DAWNNATIVE_H_
#include <webgpu/webgpu_cpp.h>
#include <string>
#include <string_view>
#include <vector>
#include "dawn/dawn_proc_table.h"
#include "dawn/native/dawn_native_export.h"
namespace dawn::platform {
class Platform;
} // namespace dawn::platform
namespace dawn::native {
class InstanceBase;
class AdapterBase;
// Each toggle is assigned with a TogglesStage, indicating the validation and earliest usage
// time of the toggle.
enum class ToggleStage { Instance, Adapter, Device };
// A struct to record the information of a toggle. A toggle is a code path in Dawn device that
// can be manually configured to run or not outside Dawn, including workarounds, special
// features and optimizations.
struct ToggleInfo {
const char* name;
const char* description;
const char* url;
ToggleStage stage;
};
// A struct to record the information of a feature. A feature is a GPU feature that is not
// required to be supported by all Dawn backends and can only be used when it is enabled on the
// creation of device.
struct FeatureInfo {
const char* name;
const char* description;
const char* url;
// The enum of feature state, could be stable or experimental. Using an experimental feature
// requires the AllowUnsafeAPIs toggle to be enabled.
enum class FeatureState { Stable = 0, Experimental };
FeatureState featureState;
};
// An adapter is an object that represent on possibility of creating devices in the system.
// Most of the time it will represent a combination of a physical GPU and an API. Not that the
// same GPU can be represented by multiple adapters but on different APIs.
//
// The underlying Dawn adapter is owned by the Dawn instance so this class is not RAII but just
// a reference to an underlying adapter.
class DAWN_NATIVE_EXPORT Adapter {
public:
Adapter();
// NOLINTNEXTLINE(runtime/explicit)
Adapter(AdapterBase* impl);
~Adapter();
Adapter(const Adapter& other);
Adapter& operator=(const Adapter& other);
void SetUseTieredLimits(bool useTieredLimits);
// Check that the Adapter is able to support importing external images. This is necessary
// to implement the swapchain and interop APIs in Chromium.
bool SupportsExternalImages() const;
explicit operator bool() const;
// Create a device on this adapter. On an error, nullptr is returned.
WGPUDevice CreateDevice(const wgpu::DeviceDescriptor* deviceDescriptor);
WGPUDevice CreateDevice(const WGPUDeviceDescriptor* deviceDescriptor = nullptr);
// Returns the underlying WGPUAdapter object.
WGPUAdapter Get() const;
// Reset the backend device object for testing purposes.
void ResetInternalDeviceForTesting();
private:
AdapterBase* mImpl = nullptr;
};
enum BackendValidationLevel { Full, Partial, Disabled };
// Can be chained in InstanceDescriptor
struct DAWN_NATIVE_EXPORT DawnInstanceDescriptor : wgpu::ChainedStruct {
DawnInstanceDescriptor();
uint32_t additionalRuntimeSearchPathsCount = 0;
const char* const* additionalRuntimeSearchPaths = nullptr;
dawn::platform::Platform* platform = nullptr;
BackendValidationLevel backendValidationLevel = BackendValidationLevel::Disabled;
bool beginCaptureOnStartup = false;
WGPULoggingCallbackInfo loggingCallbackInfo = WGPU_LOGGING_CALLBACK_INFO_INIT;
template <typename F,
typename T,
typename Cb = wgpu::LoggingCallback<T>,
typename = std::enable_if_t<std::is_convertible_v<F, Cb*>>>
void SetLoggingCallback(F callback, T userdata) {
assert(loggingCallbackInfo.callback == nullptr);
loggingCallbackInfo.callback = [](WGPULoggingType type, struct WGPUStringView message,
void* callback_param, void* userdata_param) {
auto cb = reinterpret_cast<Cb*>(callback_param);
(*cb)(static_cast<wgpu::LoggingType>(type), message, static_cast<T>(userdata_param));
};
loggingCallbackInfo.userdata1 = reinterpret_cast<void*>(+callback);
loggingCallbackInfo.userdata2 = reinterpret_cast<void*>(userdata);
}
template <typename L,
typename Cb = wgpu::LoggingCallback<>,
typename = std::enable_if_t<std::is_convertible_v<L, Cb>>>
void SetLoggingCallback(L callback) {
assert(loggingCallbackInfo.callback == nullptr);
using F = wgpu::LoggingCallback<void>;
static_assert(std::is_convertible_v<L, F*>, "Logging callback cannot be a binding lambda");
loggingCallbackInfo.callback = [](WGPULoggingType type, struct WGPUStringView message,
void* callback_param, void*) {
auto cb = reinterpret_cast<F*>(callback_param);
(*cb)(static_cast<wgpu::LoggingType>(type), message);
};
loggingCallbackInfo.userdata1 = reinterpret_cast<void*>(+callback);
loggingCallbackInfo.userdata2 = nullptr;
}
// Equality operators, mostly for testing. Note that this tests
// strict pointer-pointer equality if the struct contains member pointers.
bool operator==(const DawnInstanceDescriptor& rhs) const;
};
// Represents a connection to dawn_native and is used for dependency injection, discovering
// system adapters and injecting custom adapters (like a Swiftshader Vulkan adapter).
//
// This is an RAII class for Dawn instances and also controls the lifetime of all adapters
// for this instance.
class DAWN_NATIVE_EXPORT Instance {
public:
explicit Instance(const WGPUInstanceDescriptor* desc = nullptr);
explicit Instance(const wgpu::InstanceDescriptor* desc);
explicit Instance(InstanceBase* impl);
~Instance();
Instance(const Instance& other) = delete;
Instance& operator=(const Instance& other) = delete;
// Discovers and returns a vector of adapters.
// All systems adapters that can be found are returned if no options are passed.
// Otherwise, returns adapters based on the `options`. Adapter toggles descriptor can chained
// after options.
std::vector<Adapter> EnumerateAdapters(const WGPURequestAdapterOptions* options) const;
std::vector<Adapter> EnumerateAdapters(
const wgpu::RequestAdapterOptions* options = nullptr) const;
const ToggleInfo* GetToggleInfo(const char* toggleName);
// Enables backend validation layers
void SetBackendValidationLevel(BackendValidationLevel validationLevel);
uint64_t GetDeviceCountForTesting() const;
// Backdoor to get the number of deprecation warnings for testing
uint64_t GetDeprecationWarningCountForTesting() const;
// Returns the underlying WGPUInstance object.
WGPUInstance Get() const;
// Make mImpl->mPlatform point to an object inside Dawn in case it becomes a dangling pointer
void DisconnectDawnPlatform();
// Used by DawnTest, NOT thread-safe.
void SetPlatformForTesting(dawn::platform::Platform* platform);
private:
InstanceBase* mImpl = nullptr;
};
// Backend-agnostic API for dawn_native
DAWN_NATIVE_EXPORT const DawnProcTable& GetProcs();
// Query the names of all the toggles that are enabled in adapter
DAWN_NATIVE_EXPORT std::vector<const char*> GetTogglesUsed(const wgpu::Adapter& adapter);
// Query the names of all the toggles that are enabled in device
DAWN_NATIVE_EXPORT std::vector<const char*> GetTogglesUsed(WGPUDevice device);
// Backdoor to get the number of lazy clears for testing
DAWN_NATIVE_EXPORT size_t GetLazyClearCountForTesting(WGPUDevice device);
// Query if texture has been initialized
DAWN_NATIVE_EXPORT bool IsTextureSubresourceInitialized(
WGPUTexture texture,
uint32_t baseMipLevel,
uint32_t levelCount,
uint32_t baseArrayLayer,
uint32_t layerCount,
WGPUTextureAspect aspect = WGPUTextureAspect_All);
// Backdoor to get the order of the ProcMap for testing
DAWN_NATIVE_EXPORT std::vector<std::string_view> GetProcMapNamesForTesting();
DAWN_NATIVE_EXPORT bool DeviceTick(WGPUDevice device);
DAWN_NATIVE_EXPORT bool InstanceProcessEvents(WGPUInstance instance);
// ErrorInjector functions used for testing only. Defined in dawn_native/ErrorInjector.cpp
DAWN_NATIVE_EXPORT void EnableErrorInjector();
DAWN_NATIVE_EXPORT void DisableErrorInjector();
DAWN_NATIVE_EXPORT void ClearErrorInjector();
DAWN_NATIVE_EXPORT uint64_t AcquireErrorInjectorCallCount();
DAWN_NATIVE_EXPORT void InjectErrorAt(uint64_t index);
// The different types of external images
enum ExternalImageType : uint16_t {
OpaqueFD,
DmaBuf,
IOSurface,
EGLImage,
GLTexture,
AHardwareBuffer,
Last = AHardwareBuffer,
};
// Common properties of external images
struct DAWN_NATIVE_EXPORT ExternalImageDescriptor {
public:
const WGPUTextureDescriptor* cTextureDescriptor = nullptr; // Must match image creation params
bool isInitialized = false; // Whether the texture is initialized on import
ExternalImageType GetType() const;
protected:
explicit ExternalImageDescriptor(ExternalImageType type);
private:
ExternalImageType mType;
};
struct DAWN_NATIVE_EXPORT ExternalImageExportInfo {
public:
bool isInitialized = false; // Whether the texture is initialized after export
ExternalImageType GetType() const;
protected:
explicit ExternalImageExportInfo(ExternalImageType type);
private:
ExternalImageType mType;
};
DAWN_NATIVE_EXPORT bool CheckIsErrorForTesting(void* objectHandle);
DAWN_NATIVE_EXPORT std::string GetObjectLabelForTesting(void* objectHandle);
DAWN_NATIVE_EXPORT uint64_t GetAllocatedSizeForTesting(WGPUBuffer buffer);
DAWN_NATIVE_EXPORT std::vector<const ToggleInfo*> AllToggleInfos();
// Used to query the details of an feature. Return nullptr if featureName is not a valid
// name of an feature supported in Dawn.
DAWN_NATIVE_EXPORT const FeatureInfo* GetFeatureInfo(wgpu::FeatureName feature);
class DAWN_NATIVE_EXPORT MemoryDump {
public:
// Standard attribute |name|s for the AddScalar() and AddString() methods.
// These match the expected names in Chromium memory-infra instrumentation.
static const char kNameSize[]; // To represent allocated space.
static const char kNameObjectCount[]; // To represent number of objects.
// Standard attribute |unit|s for the AddScalar() and AddString() methods.
// These match the expected names in Chromium memory-infra instrumentation.
static const char kUnitsBytes[]; // Unit name to represent bytes.
static const char kUnitsObjects[]; // Unit name to represent #objects.
MemoryDump() = default;
virtual void AddScalar(const char* name,
const char* key,
const char* units,
uint64_t value) = 0;
virtual void AddString(const char* name, const char* key, const std::string& value) = 0;
virtual void AddOwnerGUID(const char* name, uint64_t ownerGUID);
MemoryDump(const MemoryDump&) = delete;
MemoryDump& operator=(const MemoryDump&) = delete;
protected:
virtual ~MemoryDump() = default;
};
DAWN_NATIVE_EXPORT void DumpMemoryStatistics(WGPUDevice device, MemoryDump* dump);
// Intended for background tracing for UMA that returns the estimated memory usage.
struct DAWN_NATIVE_EXPORT MemoryUsageInfo {
// Total memory usage.
uint64_t totalUsage;
// Total depth stencil textures' memory.
uint64_t depthStencilTexturesUsage;
// Total MSAA textures' memory.
uint64_t msaaTexturesUsage;
// Number of MSAA textures.
uint64_t msaaTexturesCount;
// Largest MSAA texture's memory.
uint64_t largestMsaaTextureUsage;
// Total textures' memory.
uint64_t texturesUsage;
// Total buffers' memory.
uint64_t buffersUsage;
};
DAWN_NATIVE_EXPORT MemoryUsageInfo ComputeEstimatedMemoryUsageInfo(WGPUDevice device);
// Memory information gathered from backend specific allocators.
// - memory allocated by clients for objects such as buffers, textures.
// - heap memory used by the allocator for allocations.
struct DAWN_NATIVE_EXPORT AllocatorMemoryInfo {
uint64_t totalUsedMemory = 0;
uint64_t totalAllocatedMemory = 0;
uint64_t totalLazyAllocatedMemory = 0;
uint64_t totalLazyUsedMemory = 0;
};
DAWN_NATIVE_EXPORT AllocatorMemoryInfo GetAllocatorMemoryInfo(WGPUDevice device);
// Free any unused GPU memory like staging buffers, cached resources, etc. Returns true if there are
// still objects to delete and ReduceMemoryUsage() should be run again after a short delay to allow
// submitted work to complete.
DAWN_NATIVE_EXPORT bool ReduceMemoryUsage(WGPUDevice device);
// Perform tasks that are appropriate to do when idle like serializing pipeline
// caches, etc.
DAWN_NATIVE_EXPORT void PerformIdleTasks(const wgpu::Device& device);
DAWN_NATIVE_EXPORT bool IsDeviceLost(WGPUDevice device);
} // namespace dawn::native
#endif // INCLUDE_DAWN_NATIVE_DAWNNATIVE_H_
@@ -0,0 +1,39 @@
// Copyright 2018 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_DAWN_NATIVE_NULLBACKEND_H_
#define INCLUDE_DAWN_NATIVE_NULLBACKEND_H_
#include "dawn/native/DawnNative.h"
namespace dawn::native::null {
// Nothing for now \o/
} // namespace dawn::native::null
#endif // INCLUDE_DAWN_NATIVE_NULLBACKEND_H_
@@ -0,0 +1,183 @@
// Copyright 2018 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_DAWN_NATIVE_VULKANBACKEND_H_
#define INCLUDE_DAWN_NATIVE_VULKANBACKEND_H_
#include <vulkan/vulkan.h>
#include <array>
#include <vector>
#include "dawn/native/DawnNative.h"
namespace dawn::native::vulkan {
DAWN_NATIVE_EXPORT VkInstance GetInstance(WGPUDevice device);
DAWN_NATIVE_EXPORT PFN_vkVoidFunction GetInstanceProcAddr(WGPUDevice device, const char* pName);
enum class NeedsDedicatedAllocation {
Yes,
No,
// Use Vulkan reflection to detect whether a dedicated allocation is needed.
Detect,
};
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorVk : ExternalImageDescriptor {
public:
// The following members may be ignored if |ExternalImageDescriptor::isInitialized| is false
// since the import does not need to preserve texture contents.
// See https://www.khronos.org/registry/vulkan/specs/1.1/html/chap7.html. The acquire
// operation old/new layouts must match exactly the layouts in the release operation. So
// we may need to issue two barriers releasedOldLayout -> releasedNewLayout ->
// cTextureDescriptor.usage if the new layout is not compatible with the desired usage.
// The first barrier is the queue transfer, the second is the layout transition to our
// desired usage.
VkImageLayout releasedOldLayout = VK_IMAGE_LAYOUT_GENERAL;
VkImageLayout releasedNewLayout = VK_IMAGE_LAYOUT_GENERAL;
// Try to detect the need to use a dedicated allocation for imported images by default but let
// the application override this as drivers have bugs and forget to require a dedicated
// allocation.
NeedsDedicatedAllocation dedicatedAllocation = NeedsDedicatedAllocation::Detect;
protected:
using ExternalImageDescriptor::ExternalImageDescriptor;
};
struct ExternalImageExportInfoVk : ExternalImageExportInfo {
public:
// See comments in |ExternalImageDescriptorVk|
// Contains the old/new layouts used in the queue release operation.
VkImageLayout releasedOldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
VkImageLayout releasedNewLayout = VK_IMAGE_LAYOUT_UNDEFINED;
protected:
using ExternalImageExportInfo::ExternalImageExportInfo;
};
// Can't use DAWN_PLATFORM_IS(LINUX) since header included in both Dawn and Chrome
#if defined(__linux__) || defined(__Fuchsia__)
// Common properties of external images represented by FDs. On successful import the file
// descriptor's ownership is transferred to the Dawn implementation and they shouldn't be
// used outside of Dawn again. TODO(enga): Also transfer ownership in the error case so the
// caller can assume the FD is always consumed.
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorFD : ExternalImageDescriptorVk {
public:
int memoryFD = -1; // A file descriptor from an export of the memory of the image
std::vector<int> waitFDs; // File descriptors of semaphores which will be waited on
protected:
using ExternalImageDescriptorVk::ExternalImageDescriptorVk;
};
// Descriptor for opaque file descriptor image import
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorOpaqueFD : ExternalImageDescriptorFD {
ExternalImageDescriptorOpaqueFD();
VkDeviceSize allocationSize = 0; // Must match VkMemoryAllocateInfo from image creation
uint32_t memoryTypeIndex = 0; // Must match VkMemoryAllocateInfo from image creation
};
// The plane-wise offset and stride.
struct DAWN_NATIVE_EXPORT PlaneLayout {
uint64_t offset = 0;
uint32_t stride = 0;
};
// Descriptor for dma-buf file descriptor image import
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorDmaBuf : ExternalImageDescriptorFD {
ExternalImageDescriptorDmaBuf();
static constexpr uint32_t kMaxPlanes = 3;
std::array<PlaneLayout, kMaxPlanes> planeLayouts = {};
uint64_t drmModifier = 0; // DRM modifier of the buffer
};
// Info struct that is written to in |ExportVulkanImage|.
struct DAWN_NATIVE_EXPORT ExternalImageExportInfoFD : ExternalImageExportInfoVk {
public:
// Contains the exported semaphore handles.
std::vector<int> semaphoreHandles;
protected:
using ExternalImageExportInfoVk::ExternalImageExportInfoVk;
};
struct DAWN_NATIVE_EXPORT ExternalImageExportInfoOpaqueFD : ExternalImageExportInfoFD {
ExternalImageExportInfoOpaqueFD();
};
struct DAWN_NATIVE_EXPORT ExternalImageExportInfoDmaBuf : ExternalImageExportInfoFD {
ExternalImageExportInfoDmaBuf();
};
#ifdef __ANDROID__
// Descriptor for AHardwareBuffer image import
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorAHardwareBuffer : ExternalImageDescriptorVk {
public:
ExternalImageDescriptorAHardwareBuffer();
struct AHardwareBuffer* handle; // The AHardwareBuffer which contains the memory of the image
std::vector<int> waitFDs; // File descriptors of semaphores which will be waited on
protected:
using ExternalImageDescriptorVk::ExternalImageDescriptorVk;
};
struct DAWN_NATIVE_EXPORT ExternalImageExportInfoAHardwareBuffer : ExternalImageExportInfoFD {
ExternalImageExportInfoAHardwareBuffer();
};
#endif // __ANDROID__
#endif // defined(__linux__) || defined(__Fuchsia__)
// Imports external memory into a Vulkan image. Internally, this uses external memory /
// semaphore extensions to import the image and wait on the provided synchronizaton
// primitives before the texture can be used.
// On failure, returns a nullptr.
DAWN_NATIVE_EXPORT WGPUTexture WrapVulkanImage(WGPUDevice device,
const ExternalImageDescriptorVk* descriptor);
// Exports external memory from a Vulkan image. This must be called on wrapped textures
// before they are destroyed. It writes the semaphore to wait on and the old/new image
// layouts to |info|. Pass VK_IMAGE_LAYOUT_UNDEFINED as |desiredLayout| if you don't want to
// perform a layout transition.
DAWN_NATIVE_EXPORT bool ExportVulkanImage(WGPUTexture texture,
VkImageLayout desiredLayout,
ExternalImageExportInfoVk* info);
// |ExportVulkanImage| with default desiredLayout of VK_IMAGE_LAYOUT_UNDEFINED.
DAWN_NATIVE_EXPORT bool ExportVulkanImage(WGPUTexture texture, ExternalImageExportInfoVk* info);
} // namespace dawn::native::vulkan
#endif // INCLUDE_DAWN_NATIVE_VULKANBACKEND_H_
@@ -0,0 +1,49 @@
// Copyright 2018 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_DAWN_NATIVE_DAWN_NATIVE_EXPORT_H_
#define INCLUDE_DAWN_NATIVE_DAWN_NATIVE_EXPORT_H_
#if defined(DAWN_NATIVE_SHARED_LIBRARY)
#if defined(_WIN32)
#if defined(DAWN_NATIVE_IMPLEMENTATION)
#define DAWN_NATIVE_EXPORT __declspec(dllexport)
#else
#define DAWN_NATIVE_EXPORT __declspec(dllimport)
#endif
#else // defined(_WIN32)
#if defined(DAWN_NATIVE_IMPLEMENTATION)
#define DAWN_NATIVE_EXPORT __attribute__((visibility("default")))
#else
#define DAWN_NATIVE_EXPORT
#endif
#endif // defined(_WIN32)
#else // defined(DAWN_NATIVE_SHARED_LIBRARY)
#define DAWN_NATIVE_EXPORT
#endif // defined(DAWN_NATIVE_SHARED_LIBRARY)
#endif // INCLUDE_DAWN_NATIVE_DAWN_NATIVE_EXPORT_H_
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,370 @@
#ifndef DAWN_WIRE_CLIENT_WEBGPU_H_
#define DAWN_WIRE_CLIENT_WEBGPU_H_
#include "webgpu/webgpu.h"
#include "dawn/wire/dawn_wire_export.h"
#ifdef __cplusplus
extern "C" {
#endif
DAWN_WIRE_EXPORT WGPUInstance wgpuDawnWireClientCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientGetInstanceFeatures(WGPUSupportedInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientGetInstanceLimits(WGPUInstanceLimits * limits) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBool wgpuDawnWireClientHasInstanceFeature(WGPUInstanceFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUProc wgpuDawnWireClientGetProcAddress(WGPUStringView procName) WGPU_FUNCTION_ATTRIBUTE;
// Methods of Adapter
DAWN_WIRE_EXPORT WGPUDevice wgpuDawnWireClientAdapterCreateDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientAdapterGetFeatures(WGPUAdapter adapter, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientAdapterGetFormatCapabilities(WGPUAdapter adapter, WGPUTextureFormat format, WGPUDawnFormatCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientAdapterGetInfo(WGPUAdapter adapter, WGPUAdapterInfo * info) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUInstance wgpuDawnWireClientAdapterGetInstance(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientAdapterGetLimits(WGPUAdapter adapter, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBool wgpuDawnWireClientAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientAdapterRequestDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientAdapterAddRef(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientAdapterRelease(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE;
// Methods of AdapterInfo
DAWN_WIRE_EXPORT void wgpuDawnWireClientAdapterInfoFreeMembers(WGPUAdapterInfo adapterInfo) WGPU_FUNCTION_ATTRIBUTE;
// Methods of AdapterPropertiesMemoryHeaps
DAWN_WIRE_EXPORT void wgpuDawnWireClientAdapterPropertiesMemoryHeapsFreeMembers(WGPUAdapterPropertiesMemoryHeaps adapterPropertiesMemoryHeaps) WGPU_FUNCTION_ATTRIBUTE;
// Methods of AdapterPropertiesSubgroupMatrixConfigs
DAWN_WIRE_EXPORT void wgpuDawnWireClientAdapterPropertiesSubgroupMatrixConfigsFreeMembers(WGPUAdapterPropertiesSubgroupMatrixConfigs adapterPropertiesSubgroupMatrixConfigs) WGPU_FUNCTION_ATTRIBUTE;
// Methods of BindGroup
DAWN_WIRE_EXPORT void wgpuDawnWireClientBindGroupSetLabel(WGPUBindGroup bindGroup, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBindGroupAddRef(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBindGroupRelease(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE;
// Methods of BindGroupLayout
DAWN_WIRE_EXPORT void wgpuDawnWireClientBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBindGroupLayoutAddRef(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE;
// Methods of Buffer
DAWN_WIRE_EXPORT WGPUTexelBufferView wgpuDawnWireClientBufferCreateTexelView(WGPUBuffer buffer, WGPUTexelBufferViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBufferDestroy(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void const * wgpuDawnWireClientBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void * wgpuDawnWireClientBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBufferMapState wgpuDawnWireClientBufferGetMapState(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint64_t wgpuDawnWireClientBufferGetSize(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBufferUsage wgpuDawnWireClientBufferGetUsage(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientBufferMapAsync(WGPUBuffer buffer, WGPUMapMode mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientBufferReadMappedRange(WGPUBuffer buffer, size_t offset, void * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBufferSetLabel(WGPUBuffer buffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBufferUnmap(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientBufferWriteMappedRange(WGPUBuffer buffer, size_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBufferAddRef(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientBufferRelease(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
// Methods of CommandBuffer
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandBufferAddRef(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandBufferRelease(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE;
// Methods of CommandEncoder
DAWN_WIRE_EXPORT WGPUComputePassEncoder wgpuDawnWireClientCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPURenderPassEncoder wgpuDawnWireClientCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, WGPUTexelCopyBufferInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyBufferInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUCommandBuffer wgpuDawnWireClientCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderInjectValidationError(WGPUCommandEncoder commandEncoder, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderWriteBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, uint8_t const * data, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderAddRef(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientCommandEncoderRelease(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
// Methods of ComputePassEncoder
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderSetImmediates(WGPUComputePassEncoder computePassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderSetResourceTable(WGPUComputePassEncoder computePassEncoder, WGPU_NULLABLE WGPUResourceTable table) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderAddRef(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
// Methods of ComputePipeline
DAWN_WIRE_EXPORT WGPUBindGroupLayout wgpuDawnWireClientComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePipelineSetLabel(WGPUComputePipeline computePipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePipelineAddRef(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientComputePipelineRelease(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE;
// Methods of DawnDrmFormatCapabilities
DAWN_WIRE_EXPORT void wgpuDawnWireClientDawnDrmFormatCapabilitiesFreeMembers(WGPUDawnDrmFormatCapabilities dawnDrmFormatCapabilities) WGPU_FUNCTION_ATTRIBUTE;
// Methods of Device
DAWN_WIRE_EXPORT WGPUBindGroup wgpuDawnWireClientDeviceCreateBindGroup(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBindGroupLayout wgpuDawnWireClientDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPU_NULLABLE WGPUBuffer wgpuDawnWireClientDeviceCreateBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUCommandEncoder wgpuDawnWireClientDeviceCreateCommandEncoder(WGPUDevice device, WGPU_NULLABLE WGPUCommandEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUComputePipeline wgpuDawnWireClientDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientDeviceCreateComputePipelineAsync(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBuffer wgpuDawnWireClientDeviceCreateErrorBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUExternalTexture wgpuDawnWireClientDeviceCreateErrorExternalTexture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUShaderModule wgpuDawnWireClientDeviceCreateErrorShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor, WGPUStringView errorMessage) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUTexture wgpuDawnWireClientDeviceCreateErrorTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUExternalTexture wgpuDawnWireClientDeviceCreateExternalTexture(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUPipelineLayout wgpuDawnWireClientDeviceCreatePipelineLayout(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUQuerySet wgpuDawnWireClientDeviceCreateQuerySet(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPURenderBundleEncoder wgpuDawnWireClientDeviceCreateRenderBundleEncoder(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPURenderPipeline wgpuDawnWireClientDeviceCreateRenderPipeline(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientDeviceCreateRenderPipelineAsync(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUResourceTable wgpuDawnWireClientDeviceCreateResourceTable(WGPUDevice device, WGPUResourceTableDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUSampler wgpuDawnWireClientDeviceCreateSampler(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUShaderModule wgpuDawnWireClientDeviceCreateShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUTexture wgpuDawnWireClientDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceDestroy(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceForceLoss(WGPUDevice device, WGPUDeviceLostReason type, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUAdapter wgpuDawnWireClientDeviceGetAdapter(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientDeviceGetAdapterInfo(WGPUDevice device, WGPUAdapterInfo * adapterInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientDeviceGetAHardwareBufferProperties(WGPUDevice device, void * handle, WGPUAHardwareBufferProperties * properties) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceGetFeatures(WGPUDevice device, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientDeviceGetLimits(WGPUDevice device, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientDeviceGetLostFuture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUQueue wgpuDawnWireClientDeviceGetQueue(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBool wgpuDawnWireClientDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUSharedBufferMemory wgpuDawnWireClientDeviceImportSharedBufferMemory(WGPUDevice device, WGPUSharedBufferMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUSharedFence wgpuDawnWireClientDeviceImportSharedFence(WGPUDevice device, WGPUSharedFenceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUSharedTextureMemory wgpuDawnWireClientDeviceImportSharedTextureMemory(WGPUDevice device, WGPUSharedTextureMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceInjectError(WGPUDevice device, WGPUErrorType type, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientDevicePopErrorScope(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceSetLabel(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceTick(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceValidateTextureDescriptor(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceAddRef(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientDeviceRelease(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
// Methods of ExternalTexture
DAWN_WIRE_EXPORT void wgpuDawnWireClientExternalTextureDestroy(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientExternalTextureExpire(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientExternalTextureRefresh(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientExternalTextureSetLabel(WGPUExternalTexture externalTexture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientExternalTextureAddRef(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientExternalTextureRelease(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
// Methods of Instance
DAWN_WIRE_EXPORT WGPUSurface wgpuDawnWireClientInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientInstanceGetWGSLLanguageFeatures(WGPUInstance instance, WGPUSupportedWGSLLanguageFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBool wgpuDawnWireClientInstanceHasWGSLLanguageFeature(WGPUInstance instance, WGPUWGSLLanguageFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientInstanceProcessEvents(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientInstanceRequestAdapter(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUWaitStatus wgpuDawnWireClientInstanceWaitAny(WGPUInstance instance, size_t futureCount, WGPU_NULLABLE WGPUFutureWaitInfo * futures, uint64_t timeoutNS) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientInstanceAddRef(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientInstanceRelease(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
// Methods of PipelineLayout
DAWN_WIRE_EXPORT void wgpuDawnWireClientPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientPipelineLayoutAddRef(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE;
// Methods of QuerySet
DAWN_WIRE_EXPORT void wgpuDawnWireClientQuerySetDestroy(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint32_t wgpuDawnWireClientQuerySetGetCount(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUQueryType wgpuDawnWireClientQuerySetGetType(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQuerySetSetLabel(WGPUQuerySet querySet, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQuerySetAddRef(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQuerySetRelease(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
// Methods of Queue
DAWN_WIRE_EXPORT void wgpuDawnWireClientQueueCopyExternalTextureForBrowser(WGPUQueue queue, WGPUImageCopyExternalTexture const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQueueCopyTextureForBrowser(WGPUQueue queue, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQueueSetLabel(WGPUQueue queue, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQueueSubmit(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQueueWriteTexture(WGPUQueue queue, WGPUTexelCopyTextureInfo const * destination, void const * data, size_t dataSize, WGPUTexelCopyBufferLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQueueAddRef(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientQueueRelease(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE;
// Methods of RenderBundle
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleSetLabel(WGPURenderBundle renderBundle, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleAddRef(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleRelease(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE;
// Methods of RenderBundleEncoder
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPURenderBundle wgpuDawnWireClientRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderSetImmediates(WGPURenderBundleEncoder renderBundleEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderSetResourceTable(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPUResourceTable table) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderAddRef(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
// Methods of RenderPassEncoder
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderPixelLocalStorageBarrier(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetImmediates(WGPURenderPassEncoder renderPassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetResourceTable(WGPURenderPassEncoder renderPassEncoder, WGPU_NULLABLE WGPUResourceTable table) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderWriteTimestamp(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderAddRef(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
// Methods of RenderPipeline
DAWN_WIRE_EXPORT WGPUBindGroupLayout wgpuDawnWireClientRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPipelineAddRef(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientRenderPipelineRelease(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE;
// Methods of ResourceTable
DAWN_WIRE_EXPORT void wgpuDawnWireClientResourceTableDestroy(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint32_t wgpuDawnWireClientResourceTableGetSize(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint32_t wgpuDawnWireClientResourceTableInsertBinding(WGPUResourceTable resourceTable, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientResourceTableRemoveBinding(WGPUResourceTable resourceTable, uint32_t slot) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientResourceTableSetLabel(WGPUResourceTable resourceTable, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientResourceTableUpdate(WGPUResourceTable resourceTable, uint32_t slot, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientResourceTableAddRef(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientResourceTableRelease(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
// Methods of Sampler
DAWN_WIRE_EXPORT void wgpuDawnWireClientSamplerSetLabel(WGPUSampler sampler, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSamplerAddRef(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSamplerRelease(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE;
// Methods of ShaderModule
DAWN_WIRE_EXPORT WGPUFuture wgpuDawnWireClientShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientShaderModuleSetLabel(WGPUShaderModule shaderModule, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientShaderModuleAddRef(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientShaderModuleRelease(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SharedBufferMemory
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientSharedBufferMemoryBeginAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBuffer wgpuDawnWireClientSharedBufferMemoryCreateBuffer(WGPUSharedBufferMemory sharedBufferMemory, WGPU_NULLABLE WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientSharedBufferMemoryEndAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientSharedBufferMemoryGetProperties(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBool wgpuDawnWireClientSharedBufferMemoryIsDeviceLost(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedBufferMemorySetLabel(WGPUSharedBufferMemory sharedBufferMemory, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedBufferMemoryAddRef(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedBufferMemoryRelease(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SharedBufferMemoryEndAccessState
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedBufferMemoryEndAccessStateFreeMembers(WGPUSharedBufferMemoryEndAccessState sharedBufferMemoryEndAccessState) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SharedFence
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedFenceExportInfo(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo * info) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedFenceSetLabel(WGPUSharedFence sharedFence, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedFenceAddRef(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedFenceRelease(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SharedTextureMemory
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientSharedTextureMemoryBeginAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUTexture wgpuDawnWireClientSharedTextureMemoryCreateTexture(WGPUSharedTextureMemory sharedTextureMemory, WGPU_NULLABLE WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientSharedTextureMemoryEndAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientSharedTextureMemoryGetProperties(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUBool wgpuDawnWireClientSharedTextureMemoryIsDeviceLost(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedTextureMemorySetLabel(WGPUSharedTextureMemory sharedTextureMemory, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedTextureMemoryAddRef(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedTextureMemoryRelease(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SharedTextureMemoryEndAccessState
DAWN_WIRE_EXPORT void wgpuDawnWireClientSharedTextureMemoryEndAccessStateFreeMembers(WGPUSharedTextureMemoryEndAccessState sharedTextureMemoryEndAccessState) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SupportedFeatures
DAWN_WIRE_EXPORT void wgpuDawnWireClientSupportedFeaturesFreeMembers(WGPUSupportedFeatures supportedFeatures) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SupportedInstanceFeatures
DAWN_WIRE_EXPORT void wgpuDawnWireClientSupportedInstanceFeaturesFreeMembers(WGPUSupportedInstanceFeatures supportedInstanceFeatures) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SupportedWGSLLanguageFeatures
DAWN_WIRE_EXPORT void wgpuDawnWireClientSupportedWGSLLanguageFeaturesFreeMembers(WGPUSupportedWGSLLanguageFeatures supportedWGSLLanguageFeatures) WGPU_FUNCTION_ATTRIBUTE;
// Methods of Surface
DAWN_WIRE_EXPORT void wgpuDawnWireClientSurfaceConfigure(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUStatus wgpuDawnWireClientSurfacePresent(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSurfaceSetLabel(WGPUSurface surface, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSurfaceUnconfigure(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSurfaceAddRef(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
// Methods of SurfaceCapabilities
DAWN_WIRE_EXPORT void wgpuDawnWireClientSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities surfaceCapabilities) WGPU_FUNCTION_ATTRIBUTE;
// Methods of TexelBufferView
DAWN_WIRE_EXPORT void wgpuDawnWireClientTexelBufferViewSetLabel(WGPUTexelBufferView texelBufferView, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTexelBufferViewAddRef(WGPUTexelBufferView texelBufferView) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTexelBufferViewRelease(WGPUTexelBufferView texelBufferView) WGPU_FUNCTION_ATTRIBUTE;
// Methods of Texture
DAWN_WIRE_EXPORT WGPUTextureView wgpuDawnWireClientTextureCreateErrorView(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUTextureView wgpuDawnWireClientTextureCreateView(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureDestroy(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint32_t wgpuDawnWireClientTextureGetDepthOrArrayLayers(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUTextureDimension wgpuDawnWireClientTextureGetDimension(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUTextureFormat wgpuDawnWireClientTextureGetFormat(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint32_t wgpuDawnWireClientTextureGetHeight(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint32_t wgpuDawnWireClientTextureGetMipLevelCount(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint32_t wgpuDawnWireClientTextureGetSampleCount(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUTextureViewDimension wgpuDawnWireClientTextureGetTextureBindingViewDimension(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT WGPUTextureUsage wgpuDawnWireClientTextureGetUsage(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT uint32_t wgpuDawnWireClientTextureGetWidth(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTexturePin(WGPUTexture texture, WGPUTextureUsage usage) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureSetLabel(WGPUTexture texture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureSetOwnershipForMemoryDump(WGPUTexture texture, uint64_t ownerGuid) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureUnpin(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureAddRef(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureRelease(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
// Methods of TextureView
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureViewSetLabel(WGPUTextureView textureView, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureViewAddRef(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE;
DAWN_WIRE_EXPORT void wgpuDawnWireClientTextureViewRelease(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE;
#ifdef __cplusplus
} // extern "C"
#endif
#endif // DAWN_WIRE_CLIENT_WEBGPU_H_
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,33 @@
// Copyright 2022 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_WEBGPU_WEBGPU_H_
#define INCLUDE_WEBGPU_WEBGPU_H_
#include "dawn/webgpu.h"
#endif // INCLUDE_WEBGPU_WEBGPU_H_
@@ -0,0 +1,33 @@
// Copyright 2022 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_WEBGPU_WEBGPU_CPP_H_
#define INCLUDE_WEBGPU_WEBGPU_CPP_H_
#include "dawn/webgpu_cpp.h"
#endif // INCLUDE_WEBGPU_WEBGPU_CPP_H_
@@ -0,0 +1,57 @@
// Copyright 2023 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __EMSCRIPTEN__
#error "Do not include this header. Emscripten already provides headers needed for WebGPU."
#endif
#ifndef WEBGPU_CPP_CHAINED_STRUCT_H_
#define WEBGPU_CPP_CHAINED_STRUCT_H_
#include <cstddef>
#include <cstdint>
// This header file declares the ChainedStruct structures separately from the WebGPU
// headers so that dependencies can directly extend structures without including the larger header
// which exposes capabilities that may require correctly set proc tables.
namespace wgpu {
enum class SType : uint32_t;
struct ChainedStruct {
ChainedStruct const * nextInChain = nullptr;
SType sType = SType(0u);
};
struct ChainedStructOut {
ChainedStructOut * nextInChain = nullptr;
SType sType = SType(0u);
};
} // namespace wgpu}
#endif // WEBGPU_CPP_CHAINED_STRUCT_H_
@@ -0,0 +1,33 @@
// Copyright 2025 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_WEBGPU_WEBGPU_CPP_PRINT_H_
#define INCLUDE_WEBGPU_WEBGPU_CPP_PRINT_H_
#include "dawn/webgpu_cpp_print.h"
#endif // INCLUDE_WEBGPU_WEBGPU_CPP_PRINT_H_
@@ -0,0 +1,161 @@
// Copyright 2017 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef WEBGPU_ENUM_CLASS_BITMASKS_H_
#define WEBGPU_ENUM_CLASS_BITMASKS_H_
#include <type_traits>
// The operators in wgpu:: namespace need be introduced into other namespaces with
// using-declarations for C++ Argument Dependent Lookup to work.
#define WGPU_IMPORT_BITMASK_OPERATORS \
using wgpu::operator|; \
using wgpu::operator&; \
using wgpu::operator^; \
using wgpu::operator~; \
using wgpu::operator&=; \
using wgpu::operator|=; \
using wgpu::operator^=; \
using wgpu::HasZeroOrOneBits;
namespace wgpu {
template <typename T>
struct IsWGPUBitmask {
static constexpr bool enable = false;
};
template <typename T, typename Enable = void>
struct LowerBitmask {
static constexpr bool enable = false;
};
template <typename T>
struct LowerBitmask<T, typename std::enable_if<IsWGPUBitmask<T>::enable>::type> {
static constexpr bool enable = true;
using type = T;
constexpr static T Lower(T t) { return t; }
};
template <typename T>
struct BoolConvertible {
using Integral = typename std::underlying_type<T>::type;
// NOLINTNEXTLINE(runtime/explicit)
explicit constexpr BoolConvertible(Integral value) : value(value) {}
constexpr operator bool() const { return value != 0; }
constexpr operator T() const { return static_cast<T>(value); }
Integral value;
};
template <typename T>
struct LowerBitmask<BoolConvertible<T>> {
static constexpr bool enable = true;
using type = T;
static constexpr type Lower(BoolConvertible<T> t) { return t; }
};
template <
typename T1,
typename T2,
typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator|(T1 left, T2 right) {
using T = typename LowerBitmask<T1>::type;
using Integral = typename std::underlying_type<T>::type;
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) |
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
}
template <
typename T1,
typename T2,
typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator&(T1 left, T2 right) {
using T = typename LowerBitmask<T1>::type;
using Integral = typename std::underlying_type<T>::type;
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) &
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
}
template <
typename T1,
typename T2,
typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator^(T1 left, T2 right) {
using T = typename LowerBitmask<T1>::type;
using Integral = typename std::underlying_type<T>::type;
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) ^
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
}
template <typename T1>
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator~(T1 t) {
using T = typename LowerBitmask<T1>::type;
using Integral = typename std::underlying_type<T>::type;
return BoolConvertible<T>(~static_cast<Integral>(LowerBitmask<T1>::Lower(t)));
}
template <
typename T,
typename T2,
typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
constexpr T& operator&=(T& l, T2 right) {
T r = LowerBitmask<T2>::Lower(right);
l = l & r;
return l;
}
template <
typename T,
typename T2,
typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
constexpr T& operator|=(T& l, T2 right) {
T r = LowerBitmask<T2>::Lower(right);
l = l | r;
return l;
}
template <
typename T,
typename T2,
typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
constexpr T& operator^=(T& l, T2 right) {
T r = LowerBitmask<T2>::Lower(right);
l = l ^ r;
return l;
}
template <typename T>
constexpr bool HasZeroOrOneBits(T value) {
using Integral = typename std::underlying_type<T>::type;
return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
}
} // namespace wgpu
#endif // WEBGPU_ENUM_CLASS_BITMASKS_H_
@@ -0,0 +1,58 @@
# Copyright 2024 The Dawn & Tint Authors
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This allows CMake find_package() to find all the dawn targets that were exported.
# For a helpful explanation on this subject, please walk through the steps in the CMake tutorial.
# 1. https://cmake.org/cmake/help/latest/guide/tutorial/Installing%20and%20Testing.html
# 2. https://cmake.org/cmake/help/latest/guide/tutorial/Adding%20Export%20Configuration.html
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was DawnConfig.cmake.in ########
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
####################################################################################
include ("${CMAKE_CURRENT_LIST_DIR}/DawnTargets.cmake")
@@ -0,0 +1,43 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "0.0.0")
if (PACKAGE_FIND_VERSION_RANGE)
# Package version must be in the requested version range
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
endif()
else()
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
@@ -0,0 +1,19 @@
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "dawn::webgpu_dawn" for configuration "Release"
set_property(TARGET dawn::webgpu_dawn APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(dawn::webgpu_dawn PROPERTIES
IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/webgpu_dawn.lib"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/webgpu_dawn.dll"
)
list(APPEND _cmake_import_check_targets dawn::webgpu_dawn )
list(APPEND _cmake_import_check_files_for_dawn::webgpu_dawn "${_IMPORT_PREFIX}/lib/webgpu_dawn.lib" "${_IMPORT_PREFIX}/bin/webgpu_dawn.dll" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
@@ -0,0 +1,113 @@
# Generated by CMake
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
message(FATAL_ERROR "CMake >= 3.0.0 required")
endif()
if(CMAKE_VERSION VERSION_LESS "3.0.0")
message(FATAL_ERROR "CMake >= 3.0.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 3.0.0...4.0)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_cmake_targets_defined "")
set(_cmake_targets_not_defined "")
set(_cmake_expected_targets "")
foreach(_cmake_expected_target IN ITEMS dawn::dawn_public_config dawn::webgpu_dawn)
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
if(TARGET "${_cmake_expected_target}")
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
else()
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
endif()
endforeach()
unset(_cmake_expected_target)
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
unset(_cmake_targets_defined)
unset(_cmake_targets_not_defined)
unset(_cmake_expected_targets)
unset(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT _cmake_targets_defined STREQUAL "")
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
endif()
unset(_cmake_targets_defined)
unset(_cmake_targets_not_defined)
unset(_cmake_expected_targets)
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
# Create imported target dawn::dawn_public_config
add_library(dawn::dawn_public_config INTERFACE IMPORTED)
set_target_properties(dawn::dawn_public_config PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
# Create imported target dawn::webgpu_dawn
add_library(dawn::webgpu_dawn SHARED IMPORTED)
set_target_properties(dawn::webgpu_dawn PROPERTIES
INTERFACE_LINK_LIBRARIES "dawn::dawn_public_config"
)
# Load information for each installed configuration.
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/DawnTargets-*.cmake")
foreach(_cmake_config_file IN LISTS _cmake_config_files)
include("${_cmake_config_file}")
endforeach()
unset(_cmake_config_file)
unset(_cmake_config_files)
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
if(CMAKE_VERSION VERSION_LESS "3.28"
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
if(NOT EXISTS "${_cmake_file}")
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
\"${_cmake_file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
endif()
unset(_cmake_file)
unset("_cmake_import_check_files_for_${_cmake_target}")
endforeach()
unset(_cmake_target)
unset(_cmake_import_check_targets)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
+144
View File
@@ -6,6 +6,7 @@
#include "gx/fifo.hpp"
#include "gx/shader_info.hpp"
#include "imgui.hpp"
#include "stereo.hpp"
#include "webgpu/gpu.hpp"
#include <webgpu/webgpu_cpp.h>
#endif
@@ -67,6 +68,22 @@ Module Log("aurora");
std::atomic<uint32_t> g_captureFrame{UINT32_MAX};
std::string g_captureOutputPath;
struct StereoProviderRegistration {
AuroraStereoFrameProvider callback = nullptr;
void* userdata = nullptr;
};
#ifdef AURORA_ENABLE_GX
struct StereoSinkRegistration {
stereo::SinkCallback callback = nullptr;
void* userdata = nullptr;
};
#endif
std::mutex g_stereoRegistrationMutex;
StereoProviderRegistration g_stereoProvider;
#ifdef AURORA_ENABLE_GX
StereoSinkRegistration g_stereoSink;
#endif
using PresentClock = std::chrono::steady_clock;
struct PresentTimingSample {
@@ -475,6 +492,133 @@ std::mutex g_surfaceMutex;
std::atomic<bool> g_surfaceReconfigurePending{false};
std::atomic<bool> g_surfaceRecreatePending{false};
struct StereoEyeTarget {
webgpu::TextureWithSampler color;
webgpu::TextureWithSampler resolvedColor;
webgpu::TextureWithSampler depth;
const webgpu::TextureWithSampler& output() const noexcept {
return resolvedColor.texture ? resolvedColor : color;
}
};
std::array<StereoEyeTarget, AURORA_STEREO_EYE_COUNT> g_stereoEyeTargets;
void ensure_stereo_eye_target(uint32_t eyeIndex, uint32_t width, uint32_t height) {
auto& target = g_stereoEyeTargets[eyeIndex];
const uint32_t samples = webgpu::g_graphicsConfig.msaaSamples;
if (target.color.texture && target.color.size.width == width && target.color.size.height == height &&
((samples > 1 && target.resolvedColor.texture) || (samples == 1 && !target.resolvedColor.texture))) {
return;
}
target = {};
target.color = webgpu::create_render_texture(width, height, samples > 1);
if (samples > 1) {
target.resolvedColor =
webgpu::create_render_texture(target.color.size.width, target.color.size.height, false);
}
const wgpu::TextureDescriptor depthDescriptor{
.label = eyeIndex == 0 ? "Stereo left eye depth" : "Stereo right eye depth",
.usage = wgpu::TextureUsage::RenderAttachment,
.dimension = wgpu::TextureDimension::e2D,
.size = target.color.size,
.format = webgpu::g_graphicsConfig.depthFormat,
.mipLevelCount = 1,
.sampleCount = samples,
};
target.depth.texture = g_device.CreateTexture(&depthDescriptor);
target.depth.view = target.depth.texture.CreateView();
target.depth.size = target.color.size;
target.depth.format = webgpu::g_graphicsConfig.depthFormat;
}
std::optional<AuroraStereoFrame> request_stereo_frame(uint32_t logicalFrame) noexcept {
StereoProviderRegistration registration;
{
std::lock_guard lock(g_stereoRegistrationMutex);
registration = g_stereoProvider;
}
if (registration.callback == nullptr) {
return std::nullopt;
}
AuroraStereoFrame frame{};
bool provided = false;
try {
provided = registration.callback(logicalFrame, &frame, registration.userdata);
} catch (...) {
Log.error("Stereo frame provider threw an exception; rendering frame {} in mono", logicalFrame);
return std::nullopt;
}
if (!provided) {
return std::nullopt;
}
const auto finite = [](const float* values, size_t count) {
return std::all_of(values, values + count, [](float value) { return std::isfinite(value); });
};
for (uint32_t eye = 0; eye < AURORA_STEREO_EYE_COUNT; ++eye) {
const auto& input = frame.eyes[eye];
if (input.width == 0 || input.height == 0 || !finite(input.projection, 16) ||
!finite(input.viewFromCenter, 12)) {
Log.warn("Stereo frame {} has invalid eye {} dimensions or transforms; rendering in mono",
logicalFrame, eye);
return std::nullopt;
}
}
return frame;
}
gfx::StereoReplayFrame make_stereo_replay_frame(const AuroraStereoFrame& input) {
gfx::StereoReplayFrame replay{};
for (uint32_t eye = 0; eye < AURORA_STEREO_EYE_COUNT; ++eye) {
ensure_stereo_eye_target(eye, input.eyes[eye].width, input.eyes[eye].height);
const auto& owned = g_stereoEyeTargets[eye];
const auto& output = owned.output();
auto& view = replay.eyes[eye];
view.target = {
.colorView = owned.color.view,
.resolveView = owned.resolvedColor.view,
.depthView = owned.depth.view,
.copySourceTexture = output.texture,
.copySourceView = output.view,
.copySourceDepthView = owned.depth.view,
.size = owned.color.size,
.msaaSamples = webgpu::g_graphicsConfig.msaaSamples,
};
std::memcpy(&view.projection, input.eyes[eye].projection, sizeof(view.projection));
std::memcpy(&view.viewFromCenter, input.eyes[eye].viewFromCenter, sizeof(view.viewFromCenter));
}
return replay;
}
void run_stereo_sink(wgpu::CommandEncoder& encoder, uint64_t frameToken, uint32_t logicalFrame) noexcept {
StereoSinkRegistration registration;
{
std::lock_guard lock(g_stereoRegistrationMutex);
registration = g_stereoSink;
}
if (registration.callback == nullptr) {
return;
}
stereo::SinkFrame frame{
.frameToken = frameToken,
.logicalFrame = logicalFrame,
};
for (uint32_t eye = 0; eye < AURORA_STEREO_EYE_COUNT; ++eye) {
const auto& output = g_stereoEyeTargets[eye].output();
frame.eyes[eye] = {
.texture = &output.texture,
.view = &output.view,
.size = output.size,
.format = output.format,
};
}
registration.callback(encoder, frame, registration.userdata);
}
void request_surface_reconfigure() noexcept {
g_surfaceReconfigurePending.store(true, std::memory_order_release);
}
+200 -36
View File
@@ -8,6 +8,7 @@
#include "../webgpu/gpu.hpp"
#include "../gx/pipeline.hpp"
#include "pipeline_cache.hpp"
#include "stereo_replay.hpp"
#include "tex_copy_conv.hpp"
#include "tex_palette_conv.hpp"
#include "texture_replacement.hpp"
@@ -182,6 +183,7 @@ struct RenderPass {
bool resolveNeedsShaderSampling = false;
bool resolveLinearSampling = false;
bool snapshotColorResolveSource = false;
bool efbTarget = false;
std::vector<tex_palette_conv::ConvRequest> paletteConvs;
};
static std::vector<RenderPass> g_renderPasses;
@@ -392,6 +394,7 @@ static void set_efb_targets(RenderPass& pass) {
pass.copySourceDepthView = webgpu::g_depthBuffer.view;
pass.targetSize = webgpu::g_frameBuffer.size;
pass.msaaSamples = webgpu::g_graphicsConfig.msaaSamples;
pass.efbTarget = true;
}
struct OffscreenCacheKey {
@@ -1099,7 +1102,95 @@ void abort_frame() noexcept {
end_pipeline_frame();
}
static void end_batch_impl(const wgpu::CommandEncoder& cmd, bool advanceFrame) {
static bool prepare_stereo_replay_uniforms(const StereoReplayFrame& stereoFrame) noexcept {
size_t requiredBytes = 0;
for (const auto& pass : g_renderPasses) {
if (!pass.efbTarget) {
continue;
}
for (const auto& command : pass.commands) {
if (command.type != CommandType::Draw || command.data.draw.type != ShaderType::GX ||
!command.data.draw.gx.uniformReplayLayout.perspective) {
continue;
}
const auto& draw = command.data.draw.gx;
const auto& layout = draw.uniformReplayLayout;
const size_t projectionEnd = static_cast<size_t>(layout.projectionOffset) + sizeof(Mat4x4<float>);
const size_t positionEnd = static_cast<size_t>(layout.positionOffset) +
static_cast<size_t>(layout.positionMatrixCount) * sizeof(Mat3x4<float>);
const size_t normalEnd = static_cast<size_t>(layout.normalOffset) +
static_cast<size_t>(layout.normalMatrixCount) * sizeof(Mat3x4<float>);
if (std::max({projectionEnd, positionEnd, normalEnd}) > draw.uniformRange.size) {
Log.error("Stereo replay rejected an invalid GX uniform layout (range={}, projection={}, position={}, normal={})",
draw.uniformRange.size, projectionEnd, positionEnd, normalEnd);
return false;
}
requiredBytes += static_cast<size_t>(draw.uniformRange.size) * AURORA_STEREO_EYE_COUNT;
}
}
// end_batch_impl appends MaxUniformSize bytes after this for safe dynamic-offset reads.
if (requiredBytes > UniformBufferSize ||
g_uniforms.size() > UniformBufferSize - requiredBytes ||
g_uniforms.size() + requiredBytes > UniformBufferSize - gx::MaxUniformSize) {
Log.warn("Skipping stereo replay: GX uniform buffer needs {} additional bytes ({} of {} already used)",
requiredBytes, g_uniforms.size(), UniformBufferSize);
return false;
}
for (auto& pass : g_renderPasses) {
if (!pass.efbTarget) {
continue;
}
for (auto& command : pass.commands) {
if (command.type != CommandType::Draw || command.data.draw.type != ShaderType::GX ||
!command.data.draw.gx.uniformReplayLayout.perspective) {
continue;
}
auto& draw = command.data.draw.gx;
const auto& layout = draw.uniformReplayLayout;
for (uint32_t eyeIndex = 0; eyeIndex < AURORA_STEREO_EYE_COUNT; ++eyeIndex) {
auto [uniform, range] = copy_uniform(draw.uniformRange);
draw.stereoUniformRanges[eyeIndex] = range;
const auto& eye = stereoFrame.eyes[eyeIndex];
std::memcpy(uniform.data() + layout.projectionOffset, &eye.projection, sizeof(eye.projection));
for (uint32_t matrix = 0; matrix < layout.positionMatrixCount; ++matrix) {
if ((layout.positionMatrixMask & (1u << matrix)) == 0) {
continue;
}
const size_t offset = layout.positionOffset + matrix * sizeof(Mat3x4<float>);
Mat3x4<float> source;
std::memcpy(&source, uniform.data() + offset, sizeof(source));
const auto transformed = stereo_replay::compose_affine(eye.viewFromCenter, source);
std::memcpy(uniform.data() + offset, &transformed, sizeof(transformed));
}
for (uint32_t matrix = 0; matrix < layout.normalMatrixCount; ++matrix) {
const size_t offset = layout.normalOffset + matrix * sizeof(Mat3x4<float>);
Mat3x4<float> source;
std::memcpy(&source, uniform.data() + offset, sizeof(source));
const auto transformed = stereo_replay::compose_normal(eye.viewFromCenter, source);
std::memcpy(uniform.data() + offset, &transformed, sizeof(transformed));
}
if (pass.targetSize.width != 0 && pass.targetSize.height != 0) {
float renderSize[2];
std::memcpy(renderSize, uniform.data() + 8, sizeof(renderSize));
renderSize[0] *= static_cast<float>(eye.target.size.width) /
static_cast<float>(pass.targetSize.width);
renderSize[1] *= static_cast<float>(eye.target.size.height) /
static_cast<float>(pass.targetSize.height);
std::memcpy(uniform.data() + 8, renderSize, sizeof(renderSize));
}
}
}
}
return true;
}
static bool end_batch_impl(const wgpu::CommandEncoder& cmd, bool advanceFrame,
const StereoReplayFrame* stereoFrame = nullptr) {
ZoneScoped;
ASSERT(!g_inOffscreen, "end_frame called while offscreen rendering is active");
if (advanceFrame) {
@@ -1109,6 +1200,7 @@ static void end_batch_impl(const wgpu::CommandEncoder& cmd, bool advanceFrame) {
// interpolation tasks pointing into it would dangle. Tie the clear to the rotation itself.
gx::drop_pending_frame_interpolation_uniforms();
}
const bool stereoPrepared = stereoFrame == nullptr || prepare_stereo_replay_uniforms(*stereoFrame);
g_uniforms.append_zeroes(gx::MaxUniformSize); // Pad the end of the buffer
uint64_t bufferOffset = 0;
const auto writeBuffer = [&](ByteBuffer& buf, wgpu::Buffer& out, uint64_t size, std::string_view label) {
@@ -1158,11 +1250,16 @@ static void end_batch_impl(const wgpu::CommandEncoder& cmd, bool advanceFrame) {
if (advanceFrame) {
++g_frameIndex;
}
return stereoPrepared;
}
void end_frame(const wgpu::CommandEncoder& cmd) { end_batch_impl(cmd, true); }
void end_frame(const wgpu::CommandEncoder& cmd) { (void)end_batch_impl(cmd, true); }
void end_batch(const wgpu::CommandEncoder& cmd) { end_batch_impl(cmd, false); }
bool end_frame(const wgpu::CommandEncoder& cmd, const StereoReplayFrame& stereoFrame) {
return end_batch_impl(cmd, true, &stereoFrame);
}
void end_batch(const wgpu::CommandEncoder& cmd) { (void)end_batch_impl(cmd, false); }
uint32_t current_frame() noexcept { return g_frameIndex; }
@@ -1195,18 +1292,31 @@ static const char* render_pass_label(u32 index) noexcept {
return index < kRenderPassLabels.size() ? kRenderPassLabels[index] : "Render pass";
}
static void render_pass_impl(const wgpu::RenderPassEncoder& pass, const std::vector<RenderPass>& passes, u32 idx,
int32_t interpolatedFrame);
struct RenderInvocation {
int32_t interpolatedFrame = -1;
uint32_t stereoEye = UINT32_MAX;
const ReplayTarget* target = nullptr;
bool finalize = true;
bool replayOnlyEfb = false;
bool encodeTextureBakes = true;
bool encodeResolves = true;
bool captureDepth = true;
};
static void render_impl(std::vector<RenderPass>& renderPasses, wgpu::CommandEncoder& cmd, int32_t interpolatedFrame,
bool finalize) {
static void render_pass_impl(const wgpu::RenderPassEncoder& pass, const std::vector<RenderPass>& passes, u32 idx,
const RenderInvocation& invocation);
static void render_impl(std::vector<RenderPass>& renderPasses, wgpu::CommandEncoder& cmd,
const RenderInvocation& invocation) {
ZoneScoped;
// Palette conversions, MSAA resolves and EFB copies depend on sealed frame state, not on the
// interpolation weight, so encode them on the native render and let replay slots sample them.
const bool encodeTextureBakes = interpolatedFrame < 0;
for (u32 i = 0; i < renderPasses.size(); ++i) {
const auto& passInfo = renderPasses[i];
if (encodeTextureBakes) {
if (invocation.replayOnlyEfb && !passInfo.efbTarget) {
continue;
}
if (invocation.encodeTextureBakes) {
for (const auto& conv : passInfo.paletteConvs) {
tex_palette_conv::run(cmd, conv);
}
@@ -1214,16 +1324,20 @@ static void render_impl(std::vector<RenderPass>& renderPasses, wgpu::CommandEnco
const bool hasRenderWork = passInfo.clearColor || passInfo.clearDepth || !passInfo.commands.empty();
if (i == renderPasses.size() - 1) {
ASSERT(!passInfo.resolveTarget, "Final render pass must not have resolve target");
} else if (!(passInfo.resolveTarget && encodeTextureBakes) && !hasRenderWork) {
} else if (!(passInfo.resolveTarget && invocation.encodeResolves) && !hasRenderWork) {
// Skip only empty intermediate passes: offscreen and scratch passes with resolves still have to
// run for later samplers, and on a replay slot a resolve-only pass has nothing to encode.
continue;
}
const bool overrideTarget = invocation.target != nullptr && passInfo.efbTarget;
const auto colorView = overrideTarget ? invocation.target->colorView : passInfo.colorView;
const auto resolveView = overrideTarget ? invocation.target->resolveView : passInfo.resolveView;
const auto depthView = overrideTarget ? invocation.target->depthView : passInfo.depthView;
const std::array attachments{
wgpu::RenderPassColorAttachment{
.view = passInfo.colorView,
.resolveTarget = passInfo.resolveView,
.view = colorView,
.resolveTarget = resolveView,
.loadOp = passInfo.clearColor ? wgpu::LoadOp::Clear : wgpu::LoadOp::Load,
.storeOp = wgpu::StoreOp::Store,
.clearValue =
@@ -1236,7 +1350,7 @@ static void render_impl(std::vector<RenderPass>& renderPasses, wgpu::CommandEnco
},
};
const wgpu::RenderPassDepthStencilAttachment depthStencilAttachment{
.view = passInfo.depthView,
.view = depthView,
.depthLoadOp = passInfo.clearDepth ? wgpu::LoadOp::Clear : wgpu::LoadOp::Load,
.depthStoreOp = wgpu::StoreOp::Store,
.depthClearValue = passInfo.clearDepthValue,
@@ -1249,14 +1363,14 @@ static void render_impl(std::vector<RenderPass>& renderPasses, wgpu::CommandEnco
};
auto pass = cmd.BeginRenderPass(&renderPassDescriptor);
render_pass_impl(pass, renderPasses, i, interpolatedFrame);
render_pass_impl(pass, renderPasses, i, invocation);
pass.End();
if (finalize && i == renderPasses.size() - 1) {
if (invocation.finalize && invocation.captureDepth && i == renderPasses.size() - 1) {
depth_peek::encode_frame_snapshot(cmd, passInfo.copySourceDepthView, passInfo.targetSize, passInfo.msaaSamples);
}
if (passInfo.resolveTarget) {
if (passInfo.resolveTarget && invocation.encodeResolves) {
const bool isDepth = gx::is_depth_format(passInfo.resolveFormat);
wgpu::Texture resolveSourceTexture = passInfo.copySourceTexture;
wgpu::TextureView resolveSourceView = isDepth ? passInfo.copySourceDepthView : passInfo.copySourceView;
@@ -1322,19 +1436,19 @@ static void render_impl(std::vector<RenderPass>& renderPasses, wgpu::CommandEnco
}
}
}
if (finalize) {
if (invocation.finalize) {
recycle_render_passes(renderPasses);
}
#if defined(AURORA_GFX_DEBUG_GROUPS)
if (finalize && !g_debugGroupStack.empty()) {
if (invocation.finalize && !g_debugGroupStack.empty()) {
for (auto& it : std::ranges::reverse_view(g_debugGroupStack)) {
Log.warn("Debug group was not popped at end of frame: {}", it);
}
g_debugGroupStack.clear();
}
if (finalize && g_debugMarkers.size() > 0) {
if (invocation.finalize && g_debugMarkers.size() > 0) {
g_debugMarkers.clear();
}
#endif
@@ -1354,11 +1468,36 @@ void seal_frame(SealedFrame& out) noexcept {
}
void render(SealedFrame& frame, wgpu::CommandEncoder& cmd, int32_t interpolatedFrame, bool finalize) {
render_impl(frame.data().passes, cmd, interpolatedFrame, finalize);
render_impl(frame.data().passes, cmd,
RenderInvocation{
.interpolatedFrame = interpolatedFrame,
.finalize = finalize,
.encodeTextureBakes = interpolatedFrame < 0,
});
}
void render_stereo_eye(SealedFrame& frame, wgpu::CommandEncoder& cmd,
const StereoReplayFrame& stereoFrame, uint32_t eye, bool finalize) {
CHECK(eye < AURORA_STEREO_EYE_COUNT, "invalid stereo eye {}", eye);
render_impl(frame.data().passes, cmd,
RenderInvocation{
.stereoEye = eye,
.target = &stereoFrame.eyes[eye].target,
.finalize = finalize,
.replayOnlyEfb = true,
.encodeTextureBakes = false,
.encodeResolves = false,
.captureDepth = false,
});
}
void render(wgpu::CommandEncoder& cmd, int32_t interpolatedFrame, bool finalize) {
render_impl(g_renderPasses, cmd, interpolatedFrame, finalize);
render_impl(g_renderPasses, cmd,
RenderInvocation{
.interpolatedFrame = interpolatedFrame,
.finalize = finalize,
.encodeTextureBakes = interpolatedFrame < 0,
});
if (finalize) {
g_currentRenderPass = UINT32_MAX;
expire_bind_group_cache();
@@ -1376,7 +1515,7 @@ void after_submit() noexcept {
}
static void render_pass_impl(const wgpu::RenderPassEncoder& pass, const std::vector<RenderPass>& renderPasses, u32 idx,
int32_t interpolatedFrame) {
const RenderInvocation& invocation) {
// Per-invocation, not per-process: two encoders can be recording at once.
gx::DrawEncodeState encodeState{};
encodeState.boundTextureBindGroup = gx::g_emptyTextureBindGroup.Get();
@@ -1388,6 +1527,16 @@ static void render_pass_impl(const wgpu::RenderPassEncoder& pass, const std::vec
pass.SetBindGroup(0, g_staticBindGroup);
pass.SetBindGroup(2, gx::g_emptyTextureBindGroup);
const auto& sourceSize = renderPasses[idx].targetSize;
const bool overrideTarget = invocation.target != nullptr && renderPasses[idx].efbTarget;
const auto targetSize = overrideTarget ? invocation.target->size : sourceSize;
const float scaleX = overrideTarget && sourceSize.width != 0
? static_cast<float>(targetSize.width) / static_cast<float>(sourceSize.width)
: 1.0f;
const float scaleY = overrideTarget && sourceSize.height != 0
? static_cast<float>(targetSize.height) / static_cast<float>(sourceSize.height)
: 1.0f;
for (const auto& cmd : renderPasses[idx].commands) {
#ifdef AURORA_GFX_DEBUG_GROUPS
{
@@ -1414,29 +1563,44 @@ static void render_pass_impl(const wgpu::RenderPassEncoder& pass, const std::vec
// reproduced in clip space. Passing the raw swapped pair diverged per backend in release builds.
const float minDepth = std::clamp(std::min(vp.znear, vp.zfar), 0.0f, 1.0f);
const float maxDepth = std::clamp(std::max(vp.znear, vp.zfar), 0.0f, 1.0f);
pass.SetViewport(vp.left, vp.top, vp.width, vp.height, minDepth, maxDepth);
pass.SetViewport(vp.left * scaleX, vp.top * scaleY, vp.width * scaleX, vp.height * scaleY,
minDepth, maxDepth);
} break;
case CommandType::SetScissor: {
const auto& sc = cmd.data.setScissor;
const auto& size = renderPasses[idx].targetSize;
const auto left = std::clamp(sc.x, 0, static_cast<int32_t>(size.width));
const auto top = std::clamp(sc.y, 0, static_cast<int32_t>(size.height));
const auto right =
std::clamp(sc.x + sc.width, left, static_cast<int32_t>(size.width));
const auto bottom =
std::clamp(sc.y + sc.height, top, static_cast<int32_t>(size.height));
pass.SetScissorRect(static_cast<uint32_t>(left), static_cast<uint32_t>(top),
static_cast<uint32_t>(right - left), static_cast<uint32_t>(bottom - top));
const auto sourceLeft = std::clamp(sc.x, 0, static_cast<int32_t>(sourceSize.width));
const auto sourceTop = std::clamp(sc.y, 0, static_cast<int32_t>(sourceSize.height));
const auto sourceRight =
std::clamp(sc.x + sc.width, sourceLeft, static_cast<int32_t>(sourceSize.width));
const auto sourceBottom =
std::clamp(sc.y + sc.height, sourceTop, static_cast<int32_t>(sourceSize.height));
const auto left = static_cast<uint32_t>(std::clamp(
static_cast<int32_t>(std::floor(static_cast<float>(sourceLeft) * scaleX)), 0,
static_cast<int32_t>(targetSize.width)));
const auto top = static_cast<uint32_t>(std::clamp(
static_cast<int32_t>(std::floor(static_cast<float>(sourceTop) * scaleY)), 0,
static_cast<int32_t>(targetSize.height)));
const auto right = static_cast<uint32_t>(std::clamp(
static_cast<int32_t>(std::ceil(static_cast<float>(sourceRight) * scaleX)),
static_cast<int32_t>(left), static_cast<int32_t>(targetSize.width)));
const auto bottom = static_cast<uint32_t>(std::clamp(
static_cast<int32_t>(std::ceil(static_cast<float>(sourceBottom) * scaleY)),
static_cast<int32_t>(top), static_cast<int32_t>(targetSize.height)));
pass.SetScissorRect(left, top, right - left, bottom - top);
} break;
case CommandType::Draw: {
const auto& draw = cmd.data.draw;
switch (draw.type) {
case ShaderType::GX: {
const gfx::Range* uniformOverride = nullptr;
if (interpolatedFrame >= 0 &&
static_cast<size_t>(interpolatedFrame) < draw.gx.interpolatedUniformRanges.size() &&
draw.gx.interpolatedUniformRanges[interpolatedFrame].size != 0) {
uniformOverride = &draw.gx.interpolatedUniformRanges[interpolatedFrame];
if (invocation.stereoEye < draw.gx.stereoUniformRanges.size() &&
draw.gx.stereoUniformRanges[invocation.stereoEye].size != 0) {
uniformOverride = &draw.gx.stereoUniformRanges[invocation.stereoEye];
} else if (invocation.interpolatedFrame >= 0 &&
static_cast<size_t>(invocation.interpolatedFrame) <
draw.gx.interpolatedUniformRanges.size() &&
draw.gx.interpolatedUniformRanges[invocation.interpolatedFrame].size != 0) {
uniformOverride = &draw.gx.interpolatedUniformRanges[invocation.interpolatedFrame];
}
gx::render(draw.gx, pass, encodeState, renderPasses[idx].requireReadyPipelines, uniformOverride);
} break;
+22 -7
View File
@@ -3,7 +3,7 @@
#include "vr/mkw_vr_policy.h"
#include <algorithm>
#include <cmath>
#include <cstring>
#include <mutex>
namespace mkw::vr {
@@ -22,19 +22,34 @@ struct PolicyState {
std::mutex g_policy_mutex;
PolicyState g_policy;
bool IsFinitePositive(float value) noexcept {
return std::isfinite(value) && value > 0.0f;
uint32_t FloatBits(const float* value) noexcept {
uint32_t bits = 0;
std::memcpy(&bits, value, sizeof(bits));
return bits;
}
bool IsFiniteFloat(const float* value) noexcept {
// mkw_runtime_common is built with -ffast-math, which permits the compiler
// to fold std::isfinite to true. Inspecting the object representation keeps
// this validation effective under the target's real compile flags.
return (FloatBits(value) & 0x7F800000u) != 0x7F800000u;
}
bool IsFinitePositive(const float* value) noexcept {
const uint32_t bits = FloatBits(value);
return (bits & 0x80000000u) == 0 && (bits & 0x7FFFFFFFu) != 0 &&
(bits & 0x7F800000u) != 0x7F800000u;
}
MkwVRPolicyConfig SanitizeConfig(const MkwVRPolicyConfig& config) noexcept {
MkwVRPolicyConfig sanitized = config;
if (!IsFinitePositive(sanitized.world_units_per_meter)) {
if (!IsFinitePositive(&sanitized.world_units_per_meter)) {
sanitized.world_units_per_meter = kDefaultConfig.world_units_per_meter;
}
if (!IsFinitePositive(sanitized.hud_distance_meters)) {
if (!IsFinitePositive(&sanitized.hud_distance_meters)) {
sanitized.hud_distance_meters = kDefaultConfig.hud_distance_meters;
}
if (!IsFinitePositive(sanitized.hud_scale)) {
if (!IsFinitePositive(&sanitized.hud_scale)) {
sanitized.hud_scale = kDefaultConfig.hud_scale;
}
return sanitized;
@@ -43,7 +58,7 @@ MkwVRPolicyConfig SanitizeConfig(const MkwVRPolicyConfig& config) noexcept {
bool IsFiniteCamera(const MkwVRCameraObservation& camera) noexcept {
return camera.valid &&
std::all_of(camera.view_from_world.begin(), camera.view_from_world.end(),
[](float value) { return std::isfinite(value); });
[](const float& value) { return IsFiniteFloat(&value); });
}
VRPresentationMode SelectPresentation(const PolicyState& state) noexcept {
+11 -1
View File
@@ -1,5 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// The runtime source tree is globbed even in explicitly non-VR builds. Keep
// this translation unit dependency-free in that configuration; callers that
// include the public OpenXR headers must use the same feature guard.
#if defined(MKW_ENABLE_OPENXR)
#include "vr/openxr_runtime.h"
#include <algorithm>
@@ -333,6 +338,10 @@ bool OpenXRRuntime::CreateSession(const void* graphics_binding) {
return Fail(XR_ERROR_CALL_ORDER_INVALID, "CreateSession",
"Initialize must succeed first");
}
if (m_instance_loss_pending) {
return Fail(XR_ERROR_INSTANCE_LOST, "CreateSession",
"the OpenXR instance is loss-pending");
}
if (HasSession()) {
return Fail(XR_ERROR_CALL_ORDER_INVALID, "CreateSession",
"a session already exists");
@@ -361,7 +370,6 @@ bool OpenXRRuntime::CreateSession(const void* graphics_binding) {
m_session_state = XR_SESSION_STATE_UNKNOWN;
m_exit_requested = false;
m_instance_loss_pending = false;
Log(OpenXRLogLevel::Info,
"OpenXR session created; waiting for the runtime READY event");
return true;
@@ -887,3 +895,5 @@ std::string OpenXRRuntime::ResultString(XrResult result) const {
}
} // namespace mkw::vr
#endif // MKW_ENABLE_OPENXR