Check cached buffer results in OpenGL functions for matching capacity
This commit is contained in:
parent
69e52d3361
commit
17d7df3f19
|
@ -89,7 +89,8 @@ static inline jobject safeNewBuffer(JNIEnv *env, void *p, int size) {
|
|||
static inline jobject safeNewBufferCached(JNIEnv *env, void *p, int size, jobject old_buffer) {
|
||||
if (old_buffer != NULL) {
|
||||
void *old_buffer_address = (*env)->GetDirectBufferAddress(env, old_buffer);
|
||||
if (old_buffer_address == p)
|
||||
jlong capacity = (*env)->GetDirectBufferCapacity(env, old_buffer);
|
||||
if (old_buffer_address == p && capacity == size)
|
||||
return old_buffer;
|
||||
}
|
||||
return safeNewBuffer(env, p, size);
|
||||
|
|
|
@ -110,7 +110,7 @@ public interface ARB_buffer_object {
|
|||
* ByteBuffer mapped_buffer; mapped_buffer = glMapBufferARB(..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferARB(..., ..., ..., mapped_buffer);
|
||||
*
|
||||
* @param result_size The size of the buffer area.
|
||||
* @param old_buffer A ByteBuffer. If this argument points to the same address as the new mapping, it will be returned and no new buffer will be created. In that case, size is ignored.
|
||||
* @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created.
|
||||
*
|
||||
* @return A ByteBuffer representing the mapped buffer memory.
|
||||
*/
|
||||
|
|
|
@ -44,9 +44,8 @@ public interface ATI_map_object_buffer {
|
|||
* new ByteBuffer is created.
|
||||
*
|
||||
* @param result_size The size of the buffer area.
|
||||
* @param old_buffer A ByteBuffer. If this argument points to the same address as the new mapping,
|
||||
* it will be returned and no new buffer will be created. In that case, size is
|
||||
* ignored.
|
||||
* @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping,
|
||||
* it will be returned and no new buffer will be created.
|
||||
*
|
||||
* @return A ByteBuffer representing the mapped object buffer memory.
|
||||
*/
|
||||
|
|
|
@ -116,8 +116,8 @@ public interface GL15 {
|
|||
* mapped_buffer = glMapBuffer(..., ..., ..., mapped_buffer);
|
||||
*
|
||||
* @param result_size The size of the buffer area.
|
||||
* @param old_buffer A ByteBuffer. If this argument points to the same address as the new mapping, it will be returned and no
|
||||
* new buffer will be created. In that case, size is ignored.
|
||||
* @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no
|
||||
* new buffer will be created.
|
||||
*
|
||||
* @return A ByteBuffer representing the mapped buffer memory.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue