* VertexBuffer.invariant() - check that buffer position is zero and limit is non zero
* Remove unneeded null check when binding uniforms to uniform bindings * Added Uniform.deleteNativeBuffers() to delete any buffers the uniform might be using (currently independent of Shader disposal) git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10770 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
d048d5d6c1
commit
228a8e2ebd
@ -222,9 +222,7 @@ public class Technique /* implements Savable */ {
|
|||||||
for (UniformBinding binding : def.getWorldBindings()) {
|
for (UniformBinding binding : def.getWorldBindings()) {
|
||||||
Uniform uniform = shader.getUniform("g_" + binding.name());
|
Uniform uniform = shader.getUniform("g_" + binding.name());
|
||||||
uniform.setBinding(binding);
|
uniform.setBinding(binding);
|
||||||
if (uniform != null) {
|
worldBindUniforms.add(uniform);
|
||||||
worldBindUniforms.add(uniform);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
needReload = false;
|
needReload = false;
|
||||||
|
@ -351,6 +351,14 @@ public class VertexBuffer extends NativeObject implements Savable, Cloneable {
|
|||||||
if (data == null) {
|
if (data == null) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
// Position must be 0.
|
||||||
|
if (data.position() != 0) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
// Is the size of the VB == 0?
|
||||||
|
if (data.limit() == 0) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
// Does offset exceed buffer limit or negative?
|
// Does offset exceed buffer limit or negative?
|
||||||
if (offset > data.limit() || offset < 0) {
|
if (offset > data.limit() || offset < 0) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
|
@ -33,6 +33,7 @@ package com.jme3.shader;
|
|||||||
|
|
||||||
import com.jme3.math.*;
|
import com.jme3.math.*;
|
||||||
import com.jme3.util.BufferUtils;
|
import com.jme3.util.BufferUtils;
|
||||||
|
import java.nio.Buffer;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
@ -347,4 +348,10 @@ public class Uniform extends ShaderVariable {
|
|||||||
updateNeeded = true;
|
updateNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteNativeBuffers() {
|
||||||
|
if (value instanceof Buffer) {
|
||||||
|
BufferUtils.destroyDirectBuffer((Buffer)value);
|
||||||
|
value = null; // ????
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user