VTK  9.7.20260823
vtkAnariDevice.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
15
16#ifndef vtkAnariDevice_h
17#define vtkAnariDevice_h
18
19#include "vtkObject.h"
20#include "vtkRenderingAnariModule.h" // For export macro
21
22#include <anari/anari_cpp.hpp> // for ANARI handles
23
24#include <functional> // for std::function
25
26VTK_ABI_NAMESPACE_BEGIN
27
28class vtkAnariDeviceInternals;
29
30class VTKRENDERINGANARI_EXPORT vtkAnariDevice : public vtkObject
31{
32public:
33 using OnNewDeviceCallback = std::function<void()>;
34
36 vtkTypeMacro(vtkAnariDevice, vtkObject);
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
44 void SetAnariDebugConfig(const char* traceDir, const char* traceMode);
45
53 const char* libraryName, const char* deviceName, bool enableDebugLayer = false);
54
58 bool AnariInitialized() const;
59
63 anari::Device GetHandle() const;
64
68 const anari::Extensions& GetAnariDeviceExtensions() const;
69
73 const char* const* GetAnariDeviceExtensionStrings() const;
74
79
81
88 void SetParameterc(const char* param, char*);
89 void SetParameterb(const char* param, bool);
90 void SetParameteri(const char* param, int);
91 void SetParameter2i(const char* param, int, int);
92 void SetParameter3i(const char* param, int, int, int);
93 void SetParameter4i(const char* param, int, int, int, int);
94 void SetParameterf(const char* param, float);
95 void SetParameter2f(const char* param, float, float);
96 void SetParameter3f(const char* param, float, float, float);
97 void SetParameter4f(const char* param, float, float, float, float);
98 void SetParameterd(const char* param, double);
101
105 std::string& GetAnariLibraryName() const;
106
110 std::string& GetAnariDeviceName() const;
111
115 std::vector<std::string> GetAnariRendererSubTypes() const;
116
117protected:
122
126 ~vtkAnariDevice() override;
127
128private:
129 vtkAnariDevice(const vtkAnariDevice&) = delete;
130 void operator=(const vtkAnariDevice&) = delete;
131
132 vtkAnariDeviceInternals* Internal{ nullptr };
133};
134
135VTK_ABI_NAMESPACE_END
136#endif
anari::Device GetHandle() const
Get the current ANARI device, which will be NULL if not yet setup.
void SetParameterb(const char *param, bool)
void CommitParameters()
bool SetupAnariDeviceFromLibrary(const char *libraryName, const char *deviceName, bool enableDebugLayer=false)
Initialize this vtkAnariDevice from the name of an anari::Library and anari::Device to be loaded.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkAnariDevice * New()
vtkAnariDevice()
Default constructor.
void SetParameter4f(const char *param, float, float, float, float)
bool AnariInitialized() const
Check if ANARI has been initialized with SetupAnariDeviceFromLibrary.
void SetParameter3f(const char *param, float, float, float)
void SetParameterf(const char *param, float)
void SetParameter2f(const char *param, float, float)
std::string & GetAnariDeviceName() const
Get the anari device name.
void SetParameterd(const char *param, double)
void SetParameter4i(const char *param, int, int, int, int)
void SetAnariDebugConfig(const char *traceDir, const char *traceMode)
Setup the trace directory and trace mode strings for the debug device for when SetupAnariDeviceFromLi...
std::function< void()> OnNewDeviceCallback
~vtkAnariDevice() override
Destructor.
void SetParameter3i(const char *param, int, int, int)
const anari::Extensions & GetAnariDeviceExtensions() const
Get the current ANARI device extensions, which will be empty if not yet setup.
std::vector< std::string > GetAnariRendererSubTypes() const
Get all the available renderer subtypes.
const char *const * GetAnariDeviceExtensionStrings() const
Get the current ANARI device extensions as list of strings.
void SetOnNewDeviceCallback(OnNewDeviceCallback &&cb)
Set a callback that gets called whenever a new device has been created.
std::string & GetAnariLibraryName() const
Get the anari library name.
void SetParameterc(const char *param, char *)
Methods to set/commit generic parameteters on the underlying anari::Renderer object.
void SetParameteri(const char *param, int)
void SetParameter2i(const char *param, int, int)
a simple class to control print indentation
Definition vtkIndent.h:108