VTK  9.7.20260913
vtkWebGPUImplExtensions.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
19
20#ifndef vtkWebGPUImplExtensions_h
21#define vtkWebGPUImplExtensions_h
22
23#include "vtk_wgpu.h" // for the WebGPU C API
24
25#ifdef __EMSCRIPTEN__
26// Selects the HTML canvas a surface renders into. Provided by emdawnwebgpu.
27#define VTK_WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector ((WGPUSType)0x00040000)
28
29typedef struct VTKWGPUEmscriptenSurfaceSourceCanvasHTMLSelector
30{
31 WGPUChainedStruct chain;
32 WGPUStringView selector;
33} VTKWGPUEmscriptenSurfaceSourceCanvasHTMLSelector;
34
35#define VTK_WGPU_EMSCRIPTEN_SURFACE_SOURCE_CANVAS_HTML_SELECTOR_INIT \
36 VTKWGPUEmscriptenSurfaceSourceCanvasHTMLSelector \
37 { \
38 /*.chain=*/{ /*.next=*/nullptr, \
39 /*.sType=*/VTK_WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector }, \
40 /*.selector=*/WGPUStringView \
41 { \
42 nullptr, WGPU_STRLEN \
43 } \
44 }
45#endif // __EMSCRIPTEN__
46
47#if VTK_USE_DAWN_WEBGPU
48// Reports the adapter's power preference. Chained onto WGPUAdapterInfo by Dawn.
49#define VTK_WGPUSType_DawnAdapterPropertiesPowerPreference ((WGPUSType)0x00050008)
50
51typedef struct VTKWGPUDawnAdapterPropertiesPowerPreference
52{
53 WGPUChainedStruct chain;
54 WGPUPowerPreference powerPreference;
55} VTKWGPUDawnAdapterPropertiesPowerPreference;
56
57#define VTK_WGPU_DAWN_ADAPTER_PROPERTIES_POWER_PREFERENCE_INIT \
58 VTKWGPUDawnAdapterPropertiesPowerPreference \
59 { \
60 /*.chain=*/{ /*.next=*/nullptr, \
61 /*.sType=*/VTK_WGPUSType_DawnAdapterPropertiesPowerPreference }, \
62 /*.powerPreference=*/WGPUPowerPreference_Undefined \
63 }
64#endif // VTK_USE_DAWN_WEBGPU
65
66#endif
67// VTK-HeaderTest-Exclude: vtkWebGPUImplExtensions.h