package speiger.src.coreengine.rendering.shader.uniform.base;

import org.lwjgl.opengl.GL41;

import speiger.src.coreengine.rendering.shader.uniform.Uniform;
import speiger.src.coreengine.rendering.utils.AllocationTracker;

public class IntUniform extends Uniform {
	int value;

	public IntUniform(String name, int value) {
		super(name);
		this.value = value;
	}
	
	public IntUniform set(int value) {
		if(this.value != value) {
			this.value = value;
			update();
		}
		return this;
	}
	
	@Override
	protected void processChanges(int programId, int location) {
		GL41.glProgramUniform1i(programId, location, value);
		AllocationTracker.INSTANCE.addGPUBytes(4L);
	}
}
