public void ActivateBind(int index) { Activate(); BufferRangeTarget target = (BufferRangeTarget)BufferTarget; GL.BindBufferBase(target, index, _bufferId); }
/// <summary> /// Activates the bind. /// </summary> /// <param name="index">The index.</param> public void ActivateBind(int index) //todo: more than one bound buffer is not working, but have different indices; test: glUniformBlockBinding { Activate(); BufferRangeTarget target = (BufferRangeTarget)BufferTarget; GL.BindBufferBase(target, index, bufferID); }
private void SetBuffer(int index, ShaderStage stage, BufferRange buffer, bool isStorage) { int bindingPoint = isStorage ? _program.GetStorageBufferBindingPoint(stage, index) : _program.GetUniformBufferBindingPoint(stage, index); if (bindingPoint == -1) { return; } BufferRangeTarget target = isStorage ? BufferRangeTarget.ShaderStorageBuffer : BufferRangeTarget.UniformBuffer; if (buffer.Buffer == null) { GL.BindBufferRange(target, bindingPoint, 0, IntPtr.Zero, 0); return; } int bufferHandle = ((Buffer)buffer.Buffer).Handle; IntPtr bufferOffset = (IntPtr)buffer.Offset; GL.BindBufferRange(target, bindingPoint, bufferHandle, bufferOffset, buffer.Size); }
public void bindBuffer(int index, string name, int uboIndex, BufferRangeTarget Target) { int uniformBlockIndex = GL.GetUniformBlockIndex(_program, name); GL.BindBufferBase(Target, index, uboIndex); GL.UniformBlockBinding(_program, uniformBlockIndex, index); }
/// <summary> /// Binds <see cref="GLObject.Id"/> to an indexed buffer target. /// </summary> /// <param name="target">The target for the bind</param> /// <param name="index">The index of the binding point</param> public void BindBase(BufferRangeTarget target, int index) { if (index != -1) { GL.BindBufferBase(target, index, Id); } }
public void BindBufferBase(BufferRangeTarget target, int index, int buffer) { AddCommand(new GLCommand { Command = CommandEnum.BindBufferBase, Arguments = ValueTuple.Create(target, index, buffer) }); }
/// <summary> /// Binds a range of this buffers data to an indexed buffer target. /// </summary> /// <param name="target">The target for the bind</param> /// <param name="index">The index of the binding point</param> /// <param name="offsetInBytes"></param> /// <param name="sizeInBytes"></param> public void BindRange(BufferRangeTarget target, int index, int offsetInBytes, int sizeInBytes) { // TODO: Check for out of bounds data ranges. if (index != -1) { GL.BindBufferRange(target, index, Id, new IntPtr(offsetInBytes), sizeInBytes); } }
public void BindBufferRange(BufferRangeTarget target, int bindingPoint, int buffer, IntPtr offset, IntPtr size) { if (!_bufferBindings.ContainsKey(target)) { _bufferBindings[target] = new BufferBinding[BufferBindingPoints]; } var binding = new BufferBinding(buffer, offset, size); if (IsBindingDifferent(target, bindingPoint, binding)) { GL.BindBufferRange(target, bindingPoint, buffer, offset, size); _bufferBindings[target][bindingPoint] = binding; } }
public void SetTransformFeedbackBuffer(int index, BufferRange buffer) { const BufferRangeTarget target = BufferRangeTarget.TransformFeedbackBuffer; if (_tfEnabled) { GL.PauseTransformFeedback(); GL.BindBufferRange(target, index, buffer.Handle.ToInt32(), (IntPtr)buffer.Offset, buffer.Size); GL.ResumeTransformFeedback(); } else { GL.BindBufferRange(target, index, buffer.Handle.ToInt32(), (IntPtr)buffer.Offset, buffer.Size); } }
private void SetBuffer(int bindingPoint, BufferRange buffer, bool isStorage) { BufferRangeTarget target = isStorage ? BufferRangeTarget.ShaderStorageBuffer : BufferRangeTarget.UniformBuffer; if (buffer.Buffer == null) { GL.BindBufferRange(target, bindingPoint, 0, IntPtr.Zero, 0); return; } int bufferHandle = ((Buffer)buffer.Buffer).Handle; IntPtr bufferOffset = (IntPtr)buffer.Offset; GL.BindBufferRange(target, bindingPoint, bufferHandle, bufferOffset, buffer.Size); }
bool IsBindingDifferent(BufferRangeTarget target, int bindingPoint, BufferBinding binding) { if (_bufferBindings[target][bindingPoint] == null) { return(true); } var old = _bufferBindings[target][bindingPoint]; if (old.Buffer != binding.Buffer) { return(true); } if (old.Offset != binding.Offset) { return(true); } if (old.Size != binding.Size) { return(true); } return(false); }
public static void glBindBufferRange( BufferRangeTarget target, uint index, uint buffer, IntPtr offset, UIntPtr size) => p_glBindBufferRange(target, index, buffer, offset, size);
/// <summary> /// Binds a buffer to a binding point. Equivalent to glBindBufferBase with a check for redundant state changes. /// </summary> public void BindBufferBase(BufferRangeTarget target, int bindingPoint, int buffer) { _bufferBindingManager.BindBufferBase(target, bindingPoint, buffer); }
/// <summary> /// Binds a buffer range to a binding point. Equivalent to glBindBufferRange with a check for redundant state changes. /// </summary> public void BindBufferRange(BufferRangeTarget target, int bindingPoint, int buffer, IntPtr offset, IntPtr size) { _bufferBindingManager.BindBufferRange(target, bindingPoint, buffer, offset, size); }
/// <summary> Construct and bind to binding index on target</summary> public GLDataBlock(int bindingindex, bool std430, BufferRangeTarget tgr) : base(std430) { BindingIndex = bindingindex; Bind(BindingIndex, tgr); }
///<summary> Bing to buffer range target at this binding index</summary> public void Bind(int bindingindex, BufferRangeTarget tgr) { System.Diagnostics.Debug.Assert(context == GLStatics.GetContext(), "Context incorrect"); // safety GL.BindBufferBase(tgr, bindingindex, Id); // binding point set to tgr }
public unsafe static void BindBuffersRange(BufferRangeTarget target, uint first, int count, ref uint buffers, ref int offsets, ref int sizes) => glBindBuffersRange(target, first, count, ref buffers, ref offsets, ref sizes);
internal BufferBinding(BufferRangeTarget bindingTarget, ProgramInterface programInterface) { BindingTarget = bindingTarget; _programInterface = programInterface; }
public unsafe static void BindBufferBase(BufferRangeTarget target, uint index, uint buffer) => glBindBufferBase(target, index, buffer);
public void BindBase(BufferRangeTarget target, int index) { GL.BindBufferBase(target, index, _id); }
public void BindBufferBase(BufferRangeTarget target, int index, int buffer) { device.BindBufferBase(target, index, buffer); }
public unsafe static void BindBufferRange(BufferRangeTarget target, uint index, uint buffer, int offset, int size) => glBindBufferRange(target, index, buffer, offset, size);
public unsafe static void BindBuffersBase(BufferRangeTarget target, uint first, int count, ref uint buffers) => glBindBuffersBase(target, first, count, ref buffers);