@@ -179,10 +179,11 @@ abstract class Buffer(
179179 }
180180
181181 /* *
182- * Grows the backing buffers
182+ * Allocates memory for each backing buffer using the specified size
183183 * This function handles the buffer binding
184184 *
185185 * @param size The size of the new buffer
186+ * @return An [IllegalArgumentException] if validation fails; null if the allocation succeeds
186187 */
187188 open fun allocate (size : Long ): Throwable ? {
188189 if (! bufferValid(target, access))
@@ -203,9 +204,11 @@ abstract class Buffer(
203204 }
204205
205206 /* *
206- * Create a new buffer storage
207+ * Allocates new storage for the OpenGL buffer using the provided data
207208 * This function cannot be called twice for the same buffer
208209 * This function handles the buffer binding
210+ *
211+ * @return [IllegalArgumentException] for an invalid target or usage; null if storage allocation is successful
209212 */
210213 open fun storage (data : ByteBuffer ): Throwable ? {
211214 if (! bufferValid(target, access))
@@ -226,11 +229,12 @@ abstract class Buffer(
226229 }
227230
228231 /* *
229- * Create a new buffer storage
232+ * Allocates storage for the buffer object
230233 * This function cannot be called twice for the same buffer
231234 * This function handles the buffer binding
232235 *
233236 * @param size The size of the storage buffer
237+ * @return [IllegalArgumentException] if the target or usage is invalid; null if storage allocation succeeds
234238 */
235239 open fun storage (size : Long ): Throwable ? {
236240 if (! bufferValid(target, access))
@@ -251,12 +255,12 @@ abstract class Buffer(
251255 }
252256
253257 /* *
254- * Maps all or part of a buffer object 's data store into the client's address space
258+ * Maps a specified region of the buffer's data store into client memory, processes it using the provided lambda, and then unmaps the buffer
255259 *
256260 * @param size Specifies the length of the range to be mapped.
257261 * @param offset Specifies the starting offset within the buffer of the range to be mapped.
258262 * @param block Lambda scope with the mapped buffer passed in
259- * @return Error encountered during the mapping process
263+ * @return [IllegalArgumentException] if there were errors during the validation, mapping or unmapping, null otherwise
260264 */
261265 open fun map (
262266 size : Long ,
@@ -311,7 +315,9 @@ abstract class Buffer(
311315 }
312316
313317 /* *
314- * Sets the given data into the client mapped memory and executes the provided processing function to manage data transfer.
318+ * Uploads the specified data to the buffer starting at the given offset
319+ *
320+ * This abstract function should be implemented to perform the actual data transfer into the buffer
315321 *
316322 * @param data Data to set in memory
317323 * @param offset The starting offset within the buffer of the range to be mapped
0 commit comments