From: <eli...@us...> - 2006-07-31 22:38:06
|
Revision: 2538 Author: elias_naur Date: 2006-07-31 15:37:31 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2538&view=rev Log Message: ----------- ReferencesStack now clears references when popping to avoid keeping buffer references around too long Modified Paths: -------------- trunk/LWJGL/src/generated/org/lwjgl/opengl/References.java trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/References.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/References.java 2006-07-31 01:22:33 UTC (rev 2537) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/References.java 2006-07-31 22:37:31 UTC (rev 2538) @@ -42,4 +42,24 @@ this.GL20_glVertexAttribPointer_buffer = references.GL20_glVertexAttribPointer_buffer; this.NV_vertex_program_glVertexAttribPointerNV_buffer = references.NV_vertex_program_glVertexAttribPointerNV_buffer; } + void clear() { + this.ARB_matrix_palette_glMatrixIndexPointerARB_pPointer = null; + this.ARB_vertex_blend_glWeightPointerARB_pPointer = null; + this.ARB_vertex_program_glVertexAttribPointerARB_buffer = null; + this.ARB_vertex_shader_glVertexAttribPointerARB_buffer = null; + this.ATI_element_array_glElementPointerATI_pPointer = null; + this.EXT_fog_coord_glFogCoordPointerEXT_data = null; + this.EXT_secondary_color_glSecondaryColorPointerEXT_pPointer = null; + this.EXT_vertex_shader_glVariantPointerEXT_pAddr = null; + this.EXT_vertex_weighting_glVertexWeightPointerEXT_pPointer = null; + this.GL11_glColorPointer_pointer = null; + this.GL11_glEdgeFlagPointer_pointer = null; + this.GL11_glNormalPointer_pointer = null; + this.GL11_glSelectBuffer_buffer = null; + this.GL11_glVertexPointer_pointer = null; + this.GL11_glTexCoordPointer_pointer = null; + this.GL14_glFogCoordPointer_data = null; + this.GL20_glVertexAttribPointer_buffer = null; + this.NV_vertex_program_glVertexAttribPointerNV_buffer = null; + } } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java 2006-07-31 01:22:33 UTC (rev 2537) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/ReferencesStack.java 2006-07-31 22:37:31 UTC (rev 2538) @@ -46,6 +46,7 @@ public References popState() { References result = references_stack[stack_pos]; + references_stack[stack_pos].clear(); stack_pos--; return result; } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java 2006-07-31 01:22:33 UTC (rev 2537) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ReferencesGeneratorProcessorFactory.java 2006-07-31 22:37:31 UTC (rev 2538) @@ -105,6 +105,17 @@ } } + private static void generateClearsFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { + for (ParameterDeclaration param : method.getParameters()) { + CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); + if (cached_reference_annotation != null) { + Class nio_type = Utils.getNIOBufferType(param.getType()); + String reference_name = Utils.getReferenceName(interface_decl, method, param); + writer.println("\t\tthis." + reference_name + " = null;"); + } + } + } + private static void generateCopiesFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); @@ -117,6 +128,12 @@ } } + private static void generateClearsFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) { + for (MethodDeclaration method : interface_decl.getMethods()) { + generateClearsFromParameters(writer, interface_decl, method); + } + } + private static void generateCopiesFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) { for (MethodDeclaration method : interface_decl.getMethods()) { generateCopiesFromParameters(writer, interface_decl, method); @@ -163,6 +180,12 @@ generateCopiesFromMethods(writer, interface_decl); } writer.println("\t}"); + writer.println("\tvoid clear() {"); + for (TypeDeclaration typedecl : interface_decls) { + InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; + generateClearsFromMethods(writer, interface_decl); + } + writer.println("\t}"); writer.println("}"); writer.close(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |