/// <summary> /// Sets the active <see cref="DeviceBuffer"/> for the given index. /// When drawing, the bound <see cref="DeviceBuffer"/> objects must be compatible with the bound <see cref="Pipeline"/>. /// The given buffer must be non-null. It is not necessary to un-bind vertex buffers for Pipelines which will not /// use them. All extra vertex buffers are simply ignored. /// </summary> /// <param name="index">The buffer slot.</param> /// <param name="buffer">The new <see cref="DeviceBuffer"/>.</param> public void SetVertexBuffer(uint index, DeviceBuffer buffer) { SetVertexBufferCore(index, buffer); }
// TODO: private protected /// <summary> /// </summary> /// <param name="index"></param> /// <param name="buffer"></param> protected abstract void SetVertexBufferCore(uint index, DeviceBuffer buffer);
// TODO: private protected /// <summary> /// </summary> /// <param name="indirectBuffer"></param> /// <param name="offset"></param> protected abstract void DispatchIndirectCore(DeviceBuffer indirectBuffer, uint offset);
/// <summary> /// Updates a <see cref="DeviceBuffer"/> region with new data. /// This function must be used with a blittable value type <typeparamref name="T"/>. /// </summary> /// <typeparam name="T">The type of data to upload.</typeparam> /// <param name="buffer">The resource to update.</param> /// <param name="bufferOffsetInBytes">An offset, in bytes, from the beginning of the <see cref="DeviceBuffer"/> storage, at /// which new data will be uploaded.</param> /// <param name="source">The value to upload.</param> public unsafe void UpdateBuffer <T>( DeviceBuffer buffer, uint bufferOffsetInBytes, T source) where T : struct { ref byte sourceByteRef = ref Unsafe.AsRef <byte>(Unsafe.AsPointer(ref source));
/// <summary> /// Issues an indirect compute dispatch command based on the information contained in the given indirect /// <see cref="DeviceBuffer"/>. The information stored in the indirect Buffer should conform to the structure of /// <see cref="IndirectDispatchArguments"/>. /// </summary> /// <param name="indirectBuffer">The indirect Buffer to read from. Must have been created with the /// <see cref="BufferUsage.IndirectBuffer"/> flag.</param> /// <param name="offset">An offset, in bytes, from the start of the indirect buffer from which the draw commands will be /// read. This value must be a multiple of 4.</param> public void DispatchIndirect(DeviceBuffer indirectBuffer, uint offset) { DispatchIndirectCore(indirectBuffer, offset); }
// TODO: private protected /// <summary> /// </summary> /// <param name="indirectBuffer"></param> /// <param name="offset"></param> /// <param name="drawCount"></param> /// <param name="stride"></param> protected abstract void DrawIndexedIndirectCore(DeviceBuffer indirectBuffer, uint offset, uint drawCount, uint stride);
/// <summary> /// Issues indirect, indexed draw commands based on the information contained in the given indirect <see cref="DeviceBuffer"/>. /// The information stored in the indirect Buffer should conform to the structure of /// <see cref="IndirectDrawIndexedArguments"/>. /// </summary> /// <param name="indirectBuffer">The indirect Buffer to read from. Must have been created with the /// <see cref="BufferUsage.IndirectBuffer"/> flag.</param> /// <param name="offset">An offset, in bytes, from the start of the indirect buffer from which the draw commands will be /// read. This value must be a multiple of 4.</param> /// <param name="drawCount">The number of draw commands to read and issue from the indirect Buffer.</param> /// <param name="stride">The stride, in bytes, between consecutive draw commands in the indirect Buffer. This value must /// be a multiple of four, and must be larger than the size of <see cref="IndirectDrawIndexedArguments"/>.</param> public void DrawIndexedIndirect(DeviceBuffer indirectBuffer, uint offset, uint drawCount, uint stride) { DrawIndexedIndirectCore(indirectBuffer, offset, drawCount, stride); }
// TODO: private protected /// <summary> /// </summary> /// <param name="buffer"></param> /// <param name="format"></param> protected abstract void SetIndexBufferCore(DeviceBuffer buffer, IndexFormat format);
/// <summary> /// Sets the active <see cref="DeviceBuffer"/>. /// When drawing, an <see cref="DeviceBuffer"/> must be bound. /// </summary> /// <param name="buffer">The new <see cref="DeviceBuffer"/>.</param> /// <param name="format">The format of data in the <see cref="DeviceBuffer"/>.</param> public void SetIndexBuffer(DeviceBuffer buffer, IndexFormat format) { SetIndexBufferCore(buffer, format); }