VertexBuffer, VertexLayout and GeometryBinding improvements

- VertexBuffer: Added constructor that takes stride instead of type
- VertexLayout: Added Refcounting to VertexLayout and ownership parameters for VertexElements
- Fixed: GeometryBinding using stride and offset from buffer instead of buffer binding
This commit is contained in:
Simon Lübeß
2021-08-05 18:32:21 +02:00
parent e04d058381
commit 5c0ee3bae0
7 changed files with 65 additions and 32 deletions
@@ -40,6 +40,21 @@ namespace GlitchyEngine.Renderer
_defaultBinding = .(this, (.)_vertexType.Stride, 0);
}
public this(GraphicsContext context, uint32 vertexStride, uint32 vertexCount, Usage usage = .Default, CPUAccessFlags cpuAccess = .None) : base(context)
{
_vertexType = null;
_description = .(){
Size = (vertexStride * vertexCount),
Usage = usage,
CPUAccess = cpuAccess,
BindFlags = .Vertex,
MiscFlags = .None
};
_defaultBinding = .(this, vertexStride, 0);
}
[Inline]
public static implicit operator VertexBufferBinding(Self buffer) => buffer._defaultBinding;
}