@@ -38,7 +38,11 @@ ManagedBuffer<T>::ManagedBuffer(ManagedBufferRegistry* registry_, const std::str
3838}
3939
4040template <typename T>
41- ManagedBuffer<T>::~ManagedBuffer () {}
41+ ManagedBuffer<T>::~ManagedBuffer () {
42+ if (registry) {
43+ registry->removeManagedBuffer <T>(this );
44+ }
45+ }
4246
4347template <typename T>
4448void ManagedBuffer<T>::checkInvalidValues() {
@@ -47,15 +51,17 @@ void ManagedBuffer<T>::checkInvalidValues() {
4751
4852template <typename T>
4953void ManagedBuffer<T>::setTextureSize(uint32_t sizeX_) {
50- if (deviceBufferType != DeviceBufferType::Attribute) exception (" managed buffer can only be set as texture once" );
54+ if (deviceBufferType != DeviceBufferType::Attribute)
55+ exception (" managed buffer cannot be resized, texture size can only be set once" );
5156
5257 deviceBufferType = DeviceBufferType::Texture1d;
5358 sizeX = sizeX_;
5459}
5560
5661template <typename T>
5762void ManagedBuffer<T>::setTextureSize(uint32_t sizeX_, uint32_t sizeY_) {
58- if (deviceBufferType != DeviceBufferType::Attribute) exception (" managed buffer can only be set as texture once" );
63+ if (deviceBufferType != DeviceBufferType::Attribute)
64+ exception (" managed buffer cannot be resized, texture size can only be set once" );
5965
6066 deviceBufferType = DeviceBufferType::Texture2d;
6167 sizeX = sizeX_;
@@ -64,7 +70,8 @@ void ManagedBuffer<T>::setTextureSize(uint32_t sizeX_, uint32_t sizeY_) {
6470
6571template <typename T>
6672void ManagedBuffer<T>::setTextureSize(uint32_t sizeX_, uint32_t sizeY_, uint32_t sizeZ_) {
67- if (deviceBufferType != DeviceBufferType::Attribute) exception (" managed buffer can only be set as texture once" );
73+ if (deviceBufferType != DeviceBufferType::Attribute)
74+ exception (" managed buffer cannot be resized, texture size can only be set once" );
6875
6976 deviceBufferType = DeviceBufferType::Texture3d;
7077 sizeX = sizeX_;
0 commit comments