VTK
9.4.20250130
|
Create a webgpu device for use in rendering and compute pipelines. More...
#include <vtkWebGPUConfiguration.h>
Public Types | |
enum class | PowerPreferenceType { Undefined , LowPower , HighPerformance } |
These enums have a one-one correspondence with the webgpu enums. More... | |
enum class | BackendType { Undefined , Null , WebGPU , D3D11 , D3D12 , Metal , Vulkan , OpenGL , OpenGLES } |
enum | { AdapterRequestCompletedEvent = vtkCommand::UserEvent , DeviceRequestCompletedEvent } |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual vtkTypeBool | IsA (const char *type) |
Return 1 if this class is the same type of (or a subclass of) the named class. | |
vtkWebGPUConfiguration * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) override |
Methods invoked by print to print information about the object including superclasses. | |
BackendType | GetBackendInUse () |
Get the backend in use. | |
std::string | GetBackendInUseAsString () |
Convenient function returns a string representation of the currently used backend. | |
bool | Initialize () |
Initializes the class. | |
void | Finalize () |
Finalizes the class. | |
void | ProcessEvents () |
Process events on the WGPUInstance . | |
std::string | ReportCapabilities () |
Print information of webgpu adapter and device to the output string. | |
std::uint32_t | GetAdapterVendorID () |
Get the PCI vendor ID of the adapter and the system PCI ID of the device. | |
std::uint32_t | GetAdapterDeviceID () |
void | WriteBuffer (const wgpu::Buffer &buffer, unsigned long offset, const void *data, unsigned long sizeBytes, const char *description=nullptr) |
Convenient method used to write data into an existing buffer. | |
wgpu::TextureView | CreateView (wgpu::Texture texture, wgpu::TextureViewDimension dimension, wgpu::TextureAspect aspect, wgpu::TextureFormat format, int baseMipLevel, int mipLevelCount, const char *label=nullptr) |
Creates a texture view of a texture. | |
wgpu::TextureView | CreateView (wgpu::Texture texture, const wgpu::TextureViewDescriptor &viewDescriptor) |
void | WriteTexture (wgpu::Texture texture, uint32_t bytesPerRow, uint32_t byteSize, const void *data, const char *description=nullptr) |
Upload byteSize of data from the data pointer to the given texture, assuming bytesPerRow bytes of data per row in the texture. | |
void | DumpMemoryStatistics () |
This method prints the information corresponding to all active wgpu::Buffer and wgpu::Texture objects to the log with verbosity specified by GetGPUMemoryLogVerbosity(). | |
vtkSetEnumMacro (PowerPreference, PowerPreferenceType) | |
Set/Get the power preference of the graphics adapter. | |
vtkGetEnumMacro (PowerPreference, PowerPreferenceType) | |
Set/Get the power preference of the graphics adapter. | |
vtkSetEnumMacro (Backend, BackendType) | |
Set/Get the graphics backend to use from the graphics adapter. | |
vtkGetEnumMacro (Backend, BackendType) | |
Set/Get the graphics backend to use from the graphics adapter. | |
virtual void | SetTimeout (double) |
Set/Get the timeout. | |
virtual double | GetTimeout () |
Set/Get the timeout. | |
wgpu::Adapter | GetAdapter () |
Get handles of the WGPU adapter/device/instance. | |
wgpu::Device | GetDevice () |
Get handles of the WGPU adapter/device/instance. | |
wgpu::Instance | GetInstance () |
Get handles of the WGPU adapter/device/instance. | |
bool | IsAMDGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
bool | IsAppleGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
bool | IsARMGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
bool | IsBroadcomGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
bool | IsIntelGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
bool | IsMesaGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
bool | IsMicrosoftGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
bool | IsNVIDIAGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
bool | IsSamsungGPUInUse () |
Checks whether a particular vendor's GPU is in use. | |
wgpu::Buffer | CreateBuffer (unsigned long sizeBytes, wgpu::BufferUsage usage, bool mappedAtCreation=false, const char *label=nullptr) |
Convenient methods used to create webgpu buffers. | |
wgpu::Buffer | CreateBuffer (const wgpu::BufferDescriptor &bufferDescriptor) |
Convenient methods used to create webgpu buffers. | |
wgpu::Texture | CreateTexture (wgpu::Extent3D extents, wgpu::TextureDimension dimension, wgpu::TextureFormat format, wgpu::TextureUsage usage, int mipLevelCount=1, const char *label=nullptr) |
Creates a WebGPU texture with the given device and returns it. | |
wgpu::Texture | CreateTexture (const wgpu::TextureDescriptor &textureDescriptor) |
Creates a WebGPU texture with the given device and returns it. | |
void | SetGPUMemoryLogVerbosity (vtkLogger::Verbosity verbosity) |
Set/Get the log verbosity of messages that are emitted when data is uploaded to GPU memory. | |
vtkLogger::Verbosity | GetGPUMemoryLogVerbosity () |
Set/Get the log verbosity of messages that are emitted when data is uploaded to GPU memory. | |
Public Member Functions inherited from vtkObject | |
vtkBaseTypeMacro (vtkObject, vtkObjectBase) | |
virtual void | DebugOn () |
Turn debugging output on. | |
virtual void | DebugOff () |
Turn debugging output off. | |
bool | GetDebug () |
Get the value of the debug flag. | |
void | SetDebug (bool debugFlag) |
Set the value of the debug flag. | |
virtual void | Modified () |
Update the modification time for this object. | |
virtual vtkMTimeType | GetMTime () |
Return this object's modified time. | |
void | PrintSelf (ostream &os, vtkIndent indent) override |
Methods invoked by print to print information about the object including superclasses. | |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
vtkTypeBool | HasObserver (unsigned long event) |
vtkTypeBool | HasObserver (const char *event) |
vtkTypeBool | InvokeEvent (unsigned long event) |
vtkTypeBool | InvokeEvent (const char *event) |
std::string | GetObjectDescription () const override |
The object description printed in messages and PrintSelf output. | |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkCommand * | GetCommand (unsigned long tag) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObserver (vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObservers (unsigned long event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObservers (const char *event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkTypeBool | HasObserver (unsigned long event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkTypeBool | HasObserver (const char *event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
Overloads to AddObserver that allow developers to add class member functions as callbacks for events. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
Overloads to AddObserver that allow developers to add class member functions as callbacks for events. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
Allow user to set the AbortFlagOn() with the return value of the callback method. | |
vtkTypeBool | InvokeEvent (unsigned long event, void *callData) |
This method invokes an event and return whether the event was aborted or not. | |
vtkTypeBool | InvokeEvent (const char *event, void *callData) |
This method invokes an event and return whether the event was aborted or not. | |
virtual void | SetObjectName (const std::string &objectName) |
Set/get the name of this object for reporting purposes. | |
virtual std::string | GetObjectName () const |
Set/get the name of this object for reporting purposes. | |
Public Member Functions inherited from vtkObjectBase | |
const char * | GetClassName () const |
Return the class name as a string. | |
virtual std::string | GetObjectDescription () const |
The object description printed in messages and PrintSelf output. | |
virtual vtkTypeBool | IsA (const char *name) |
Return 1 if this class is the same type of (or a subclass of) the named class. | |
virtual vtkIdType | GetNumberOfGenerationsFromBase (const char *name) |
Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). | |
virtual void | Delete () |
Delete a VTK object. | |
virtual void | FastDelete () |
Delete a reference to this object. | |
void | InitializeObjectBase () |
void | Print (ostream &os) |
Print an object to an ostream. | |
void | Register (vtkObjectBase *o) |
Increase the reference count (mark as used by another object). | |
virtual void | UnRegister (vtkObjectBase *o) |
Decrease the reference count (release by another object). | |
int | GetReferenceCount () |
Return the current reference count of this object. | |
void | SetReferenceCount (int) |
Sets the reference count. | |
bool | GetIsInMemkind () const |
A local state flag that remembers whether this object lives in the normal or extended memory space. | |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
Methods invoked by print to print information about the object including superclasses. | |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
Methods invoked by print to print information about the object including superclasses. | |
virtual bool | UsesGarbageCollector () const |
Indicate whether the class uses vtkGarbageCollector or not. | |
Static Public Member Functions | |
static vtkWebGPUConfiguration * | New () |
static vtkTypeBool | IsTypeOf (const char *type) |
static vtkWebGPUConfiguration * | SafeDownCast (vtkObjectBase *o) |
static void | SetDefaultTimeout (double) |
Use this method to customize the default value for Timeout. | |
static std::size_t | Align (std::size_t value, std::size_t alignment) |
Adjusts a given value to the nearest multiple of the specified alignment. | |
static std::string | DeviceNotReadyMessage () |
Static Public Member Functions inherited from vtkObject | |
static vtkObject * | New () |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on. | |
static void | BreakOnError () |
This method is called when vtkErrorMacro executes. | |
static void | SetGlobalWarningDisplay (vtkTypeBool val) |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static void | GlobalWarningDisplayOn () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static void | GlobalWarningDisplayOff () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static vtkTypeBool | GetGlobalWarningDisplay () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
Static Public Member Functions inherited from vtkObjectBase | |
static vtkTypeBool | IsTypeOf (const char *name) |
Return 1 if this class type is the same type of (or a subclass of) the named class. | |
static vtkIdType | GetNumberOfGenerationsFromBaseType (const char *name) |
Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). | |
static vtkObjectBase * | New () |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on. | |
static void | SetMemkindDirectory (const char *directoryname) |
The name of a directory, ideally mounted -o dax, to memory map an extended memory space within. | |
static bool | GetUsingMemkind () |
A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space. | |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkWebGPUConfiguration () | |
~vtkWebGPUConfiguration () override | |
void | AcquireAdapter (vtkObject *caller, unsigned long event, void *calldata) |
void | AcquireDevice (vtkObject *caller, unsigned long event, void *calldata) |
Protected Member Functions inherited from vtkObject | |
vtkObject () | |
~vtkObject () override | |
void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) override |
void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr) |
These methods allow a command to exclusively grab all events. | |
void | InternalReleaseFocus () |
These methods allow a command to exclusively grab all events. | |
Protected Member Functions inherited from vtkObjectBase | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) |
virtual void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) |
virtual void | ReportReferences (vtkGarbageCollector *) |
virtual void | ObjectFinalize () |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Protected Attributes | |
PowerPreferenceType | PowerPreference = PowerPreferenceType::HighPerformance |
BackendType | Backend |
double | Timeout |
vtkLogger::Verbosity | GPUMemoryLogVerbosity = vtkLogger::VERBOSITY_INVALID |
Protected Attributes inherited from vtkObject | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
std::string | ObjectName |
Protected Attributes inherited from vtkObjectBase | |
std::atomic< int32_t > | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
Friends | |
class | vtkWebGPUConfigurationInternals |
Additional Inherited Members | |
Static Protected Member Functions inherited from vtkObjectBase | |
static vtkMallocingFunction | GetCurrentMallocFunction () |
static vtkReallocingFunction | GetCurrentReallocFunction () |
static vtkFreeingFunction | GetCurrentFreeFunction () |
static vtkFreeingFunction | GetAlternateFreeFunction () |
Create a webgpu device for use in rendering and compute pipelines.
This class creates and maintains a single WGPUInstance object. The adapter and device are created off the WGPUInstance object. It also allows selection of the graphics backend and the power preference of the graphics adapter.
Definition at line 36 of file vtkWebGPUConfiguration.h.
Definition at line 40 of file vtkWebGPUConfiguration.h.
|
strong |
These enums have a one-one correspondence with the webgpu enums.
They are here so that wrapped languages can make use of them.
Enumerator | |
---|---|
Undefined | |
LowPower | |
HighPerformance |
Definition at line 47 of file vtkWebGPUConfiguration.h.
|
strong |
Enumerator | |
---|---|
Undefined | |
Null | |
WebGPU | |
D3D11 | |
D3D12 | |
Metal | |
Vulkan | |
OpenGL | |
OpenGLES |
Definition at line 54 of file vtkWebGPUConfiguration.h.
anonymous enum |
Enumerator | |
---|---|
AdapterRequestCompletedEvent | |
DeviceRequestCompletedEvent |
Definition at line 181 of file vtkWebGPUConfiguration.h.
|
protected |
|
overrideprotected |
|
static |
|
static |
|
virtual |
Return 1 if this class is the same type of (or a subclass of) the named class.
Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObjectBase.
|
static |
|
protectedvirtual |
vtkWebGPUConfiguration * vtkWebGPUConfiguration::NewInstance | ( | ) | const |
|
overridevirtual |
vtkWebGPUConfiguration::vtkSetEnumMacro | ( | PowerPreference | , |
PowerPreferenceType | |||
) |
Set/Get the power preference of the graphics adapter.
Available options are:
Undefined
LowPower
HighPerformance
. The default value is HighPerformance
. vtkWebGPUConfiguration::vtkGetEnumMacro | ( | PowerPreference | , |
PowerPreferenceType | |||
) |
Set/Get the power preference of the graphics adapter.
Available options are:
Undefined
LowPower
HighPerformance
. The default value is HighPerformance
. vtkWebGPUConfiguration::vtkSetEnumMacro | ( | Backend | , |
BackendType | |||
) |
Set/Get the graphics backend to use from the graphics adapter.
Available options are:
Undefined
Null
WebGPU
D3D11
D3D12
Metal
Vulkan
OpenGL
OpenGLES
The default value is determined at runtime based on the operating system. vtkWebGPUConfiguration::vtkGetEnumMacro | ( | Backend | , |
BackendType | |||
) |
Set/Get the graphics backend to use from the graphics adapter.
Available options are:
Undefined
Null
WebGPU
D3D11
D3D12
Metal
Vulkan
OpenGL
OpenGLES
The default value is determined at runtime based on the operating system.
|
virtual |
Set/Get the timeout.
It represents the number of milliseconds to wait for device initialization. Due to the asynchronous nature of WebGPU adapter and device requests, the Initialize()
method repeatedly processes pending events in the WebGPU instance until the device is ready. Use this timeout to prevent hangs because of the infinite loop.
|
virtual |
Set/Get the timeout.
It represents the number of milliseconds to wait for device initialization. Due to the asynchronous nature of WebGPU adapter and device requests, the Initialize()
method repeatedly processes pending events in the WebGPU instance until the device is ready. Use this timeout to prevent hangs because of the infinite loop.
|
static |
Use this method to customize the default value for Timeout.
BackendType vtkWebGPUConfiguration::GetBackendInUse | ( | ) |
Get the backend in use.
This is useful to know when the Backend
is set to Undefined
. When the Backend
is set to Undefined
, the webgpu implementation library (ex: dawn, wgpu-native) automatically select the best supported graphics backend. Usually, this is Metal on Apple hardware, Vulkan on Linux/Android and D3D12 on Windows.
std::string vtkWebGPUConfiguration::GetBackendInUseAsString | ( | ) |
Convenient function returns a string representation of the currently used backend.
wgpu::Adapter vtkWebGPUConfiguration::GetAdapter | ( | ) |
Get handles of the WGPU adapter/device/instance.
wgpu::Device vtkWebGPUConfiguration::GetDevice | ( | ) |
Get handles of the WGPU adapter/device/instance.
wgpu::Instance vtkWebGPUConfiguration::GetInstance | ( | ) |
Get handles of the WGPU adapter/device/instance.
bool vtkWebGPUConfiguration::Initialize | ( | ) |
Initializes the class.
WGPUInstance
. If a WGPUInstance
was already created by a previous call to Initialize
without a Finalize
from another instance of vtkWebGPUConfiguration
then this method adds a reference to the existing WGPUInstance
.WGPUInstance
is available, it requests a WGPUAdapter
with the specified Backend
and PowerPreference
.WGPUDevice
from the WGPUAdapter
.NOTE: This method blocks until a device is ready. Due to the asynchronous nature of the WebGPU API, we must block by processing webgpu events until the device is ready because VTK right now does not have a concept of an event loop. You can specify a timeout in milliseconds by calling SetTimeout().
void vtkWebGPUConfiguration::Finalize | ( | ) |
Finalizes the class.
This method destroys the device, adapter and releases the reference to WGPUInstance
if not already done.
void vtkWebGPUConfiguration::ProcessEvents | ( | ) |
Process events on the WGPUInstance
.
NOTE: In WebAssembly, this method needs the application to be compiled with -sASYNCIFY=1
or -sJSPI=1
for emscripten_sleep
to yield to the browsers run loop for processing webgpu callbacks.
|
static |
Adjusts a given value to the nearest multiple of the specified alignment.
It is useful for ensuring that memory addresses or other data sizes adhere to alignment requirements in webgpu, which can be critical for performance and correctness of shaders.
std::string vtkWebGPUConfiguration::ReportCapabilities | ( | ) |
Print information of webgpu adapter and device to the output string.
|
static |
std::uint32_t vtkWebGPUConfiguration::GetAdapterVendorID | ( | ) |
Get the PCI vendor ID of the adapter and the system PCI ID of the device.
The Vendor ID can be looked up in https://pcisig.com/membership/member-companies The Device ID will match output of lspci
or the hardware Ids property of the GPU in Windows device manager
std::uint32_t vtkWebGPUConfiguration::GetAdapterDeviceID | ( | ) |
bool vtkWebGPUConfiguration::IsAMDGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
bool vtkWebGPUConfiguration::IsAppleGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
bool vtkWebGPUConfiguration::IsARMGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
bool vtkWebGPUConfiguration::IsBroadcomGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
bool vtkWebGPUConfiguration::IsIntelGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
bool vtkWebGPUConfiguration::IsMesaGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
bool vtkWebGPUConfiguration::IsMicrosoftGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
bool vtkWebGPUConfiguration::IsNVIDIAGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
bool vtkWebGPUConfiguration::IsSamsungGPUInUse | ( | ) |
Checks whether a particular vendor's GPU is in use.
These methods are useful if you want to detect the GPU platform and skip running a test or warn the user that the GPU may not be supported that well by your application. Internally, these methods look at the VendorID. A more robust detection mechanism can be built to parse it from an external json file like https://dawn.googlesource.com/dawn/+/refs/heads/main/src/dawn/gpu_info.json
wgpu::Buffer vtkWebGPUConfiguration::CreateBuffer | ( | unsigned long | sizeBytes, |
wgpu::BufferUsage | usage, | ||
bool | mappedAtCreation = false , |
||
const char * | label = nullptr |
||
) |
Convenient methods used to create webgpu buffers.
This method also logs memory information which is useful to audit GPU memory usage. It avoids creating buffers larger than supported by the device.
wgpu::Buffer vtkWebGPUConfiguration::CreateBuffer | ( | const wgpu::BufferDescriptor & | bufferDescriptor | ) |
Convenient methods used to create webgpu buffers.
This method also logs memory information which is useful to audit GPU memory usage. It avoids creating buffers larger than supported by the device.
void vtkWebGPUConfiguration::WriteBuffer | ( | const wgpu::Buffer & | buffer, |
unsigned long | offset, | ||
const void * | data, | ||
unsigned long | sizeBytes, | ||
const char * | description = nullptr |
||
) |
Convenient method used to write data into an existing buffer.
This method also logs memory information which is useful to audit GPU memory usage.
wgpu::Texture vtkWebGPUConfiguration::CreateTexture | ( | wgpu::Extent3D | extents, |
wgpu::TextureDimension | dimension, | ||
wgpu::TextureFormat | format, | ||
wgpu::TextureUsage | usage, | ||
int | mipLevelCount = 1 , |
||
const char * | label = nullptr |
||
) |
Creates a WebGPU texture with the given device and returns it.
wgpu::Texture vtkWebGPUConfiguration::CreateTexture | ( | const wgpu::TextureDescriptor & | textureDescriptor | ) |
Creates a WebGPU texture with the given device and returns it.
wgpu::TextureView vtkWebGPUConfiguration::CreateView | ( | wgpu::Texture | texture, |
wgpu::TextureViewDimension | dimension, | ||
wgpu::TextureAspect | aspect, | ||
wgpu::TextureFormat | format, | ||
int | baseMipLevel, | ||
int | mipLevelCount, | ||
const char * | label = nullptr |
||
) |
Creates a texture view of a texture.
wgpu::TextureView vtkWebGPUConfiguration::CreateView | ( | wgpu::Texture | texture, |
const wgpu::TextureViewDescriptor & | viewDescriptor | ||
) |
void vtkWebGPUConfiguration::WriteTexture | ( | wgpu::Texture | texture, |
uint32_t | bytesPerRow, | ||
uint32_t | byteSize, | ||
const void * | data, | ||
const char * | description = nullptr |
||
) |
Upload byteSize of data from the data pointer to the given texture, assuming bytesPerRow
bytes of data per row in the texture.
void vtkWebGPUConfiguration::SetGPUMemoryLogVerbosity | ( | vtkLogger::Verbosity | verbosity | ) |
Set/Get the log verbosity of messages that are emitted when data is uploaded to GPU memory.
The GetGPUMemoryLogVerbosity looks up system environment for VTK_WEBGPU_MEMORY_LOG_VERBOSITY
that shall be used to set initial logger verbosity. The default value is TRACE.
Accepted string values are OFF, ERROR, WARNING, INFO, TRACE, MAX, INVALID or ASCII representation for an integer in the range [-9,9].
vtkLogger::Verbosity vtkWebGPUConfiguration::GetGPUMemoryLogVerbosity | ( | ) |
Set/Get the log verbosity of messages that are emitted when data is uploaded to GPU memory.
The GetGPUMemoryLogVerbosity looks up system environment for VTK_WEBGPU_MEMORY_LOG_VERBOSITY
that shall be used to set initial logger verbosity. The default value is TRACE.
Accepted string values are OFF, ERROR, WARNING, INFO, TRACE, MAX, INVALID or ASCII representation for an integer in the range [-9,9].
void vtkWebGPUConfiguration::DumpMemoryStatistics | ( | ) |
This method prints the information corresponding to all active wgpu::Buffer and wgpu::Texture objects to the log with verbosity specified by GetGPUMemoryLogVerbosity().
With Dawn, this interfaces directly into Dawn's memory statistics API for accurate information about active objects.
|
protected |
|
protected |
|
friend |
Definition at line 310 of file vtkWebGPUConfiguration.h.
|
protected |
Definition at line 294 of file vtkWebGPUConfiguration.h.
|
protected |
Definition at line 296 of file vtkWebGPUConfiguration.h.
|
protected |
Definition at line 298 of file vtkWebGPUConfiguration.h.
|
protected |
Definition at line 300 of file vtkWebGPUConfiguration.h.