From: <eli...@us...> - 2006-12-20 17:55:12
|
Revision: 2696 http://svn.sourceforge.net/java-game-lib/?rev=2696&view=rev Author: elias_naur Date: 2006-12-20 09:55:10 -0800 (Wed, 20 Dec 2006) Log Message: ----------- Check cached buffer results in OpenGL functions for matching capacity Modified Paths: -------------- trunk/LWJGL/src/native/common/common_tools.h trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java Modified: trunk/LWJGL/src/native/common/common_tools.h =================================================================== --- trunk/LWJGL/src/native/common/common_tools.h 2006-12-18 18:27:15 UTC (rev 2695) +++ trunk/LWJGL/src/native/common/common_tools.h 2006-12-20 17:55:10 UTC (rev 2696) @@ -89,7 +89,8 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2006-12-18 18:27:15 UTC (rev 2695) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2006-12-20 17:55:10 UTC (rev 2696) @@ -110,7 +110,7 @@ * 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. */ Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java 2006-12-18 18:27:15 UTC (rev 2695) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java 2006-12-20 17:55:10 UTC (rev 2696) @@ -44,9 +44,8 @@ * 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. */ Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2006-12-18 18:27:15 UTC (rev 2695) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2006-12-20 17:55:10 UTC (rev 2696) @@ -116,8 +116,8 @@ * 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. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |