| 99 | } |
| 100 | |
| 101 | static void FreeBuffer(BufferContext* ctx, HBuffer hbuffer) |
| 102 | { |
| 103 | if (!IsBufferValid(hbuffer)) |
| 104 | { |
| 105 | dmLogError("Invalid buffer when freeing buffer"); |
| 106 | return; |
| 107 | } |
| 108 | |
| 109 | Buffer* b = ctx->Get(hbuffer); |
| 110 | if (b == 0x0) |
| 111 | { |
| 112 | dmLogError("Stale buffer handle when freeing buffer"); |
| 113 | return; |
| 114 | } |
| 115 | |
| 116 | ctx->Release(hbuffer); |
| 117 | |
| 118 | FreeMetadata(b); |
| 119 | b->m_MetaDataArray.~dmArray(); // b->m_MetaDataArray was initialized with "placement new" operator. We have to destroy it manually |
| 120 | |
| 121 | dmMemory::AlignedFree(b); |
| 122 | } |
| 123 | |
| 124 | ///////////////////////////////////////////////////////////////// |
| 125 | // Buffer instances |
no test coverage detected