VTK  9.6.20260624
vtkOpenGLArrayTextureBufferCache.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
26
27#ifndef vtkOpenGLArrayTextureBufferCache_h
28#define vtkOpenGLArrayTextureBufferCache_h
29
30#include "vtkObject.h"
31#include "vtkOpenGLBufferObject.h" // for entry ivar
32#include "vtkRenderingOpenGL2Module.h" // For export macro
33#include "vtkSmartPointer.h" // for entry ivars
34#include "vtkTextureObject.h" // for entry ivar
35
36#include <cstddef> // for std::size_t
37#include <map> // for cache map
38#include <memory> // for shared_ptr
39#include <tuple> // for composite key
40
41VTK_ABI_NAMESPACE_BEGIN
42class vtkDataArray;
43class vtkWindow;
44
45class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLArrayTextureBufferCache : public vtkObject
46{
47public:
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
67
75 std::shared_ptr<Entry> GetTextureBuffer(
76 vtkDataArray* array, bool scalarComponents, bool integerTexture);
77
84 std::size_t GetNumberOfCachedTextureBuffers() const { return this->Cache.size(); }
85
91
92protected:
95
96 using Key = std::tuple<vtkDataArray*, bool, bool>;
97 std::map<Key, std::shared_ptr<Entry>> Cache;
98
99private:
101 void operator=(const vtkOpenGLArrayTextureBufferCache&) = delete;
102};
103
104VTK_ABI_NAMESPACE_END
105#endif
a simple class to control print indentation
Definition vtkIndent.h:108
std::tuple< vtkDataArray *, bool, bool > Key
std::size_t GetNumberOfCachedTextureBuffers() const
Return the number of distinct (array, role) texture buffers currently cached.
static vtkOpenGLArrayTextureBufferCache * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ReleaseGraphicsResources(vtkWindow *window)
Release the GL resources held by every cached entry and forget them.
std::shared_ptr< Entry > GetTextureBuffer(vtkDataArray *array, bool scalarComponents, bool integerTexture)
Return the shared entry for the given (array, scalarComponents, integerTexture), creating an empty en...
std::map< Key, std::shared_ptr< Entry > > Cache
Hold a reference to a vtkObjectBase instance.
window superclass for vtkRenderWindow
Definition vtkWindow.h:61
A cached texture buffer for one (array, role).
vtkSmartPointer< vtkOpenGLBufferObject > Buffer
#define vtkDataArray
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318