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,8 +40,8 @@ namespace GlitchyEngine.Renderer
nativeBuffers[slot] = vertexBuffer.nativeBuffer..AddRef();
bufferStrides[slot] = vertexBuffer.Binding.Stride;
bufferOffsets[slot] = vertexBuffer.Binding.Offset;
bufferStrides[slot] = binding.Stride;
bufferOffsets[slot] = binding.Offset;
}
else
{
@@ -13,12 +13,13 @@ namespace GlitchyEngine.Renderer
public ID3DBlob* nativeShaderCode ~ _?.Release();
public this(GraphicsContext context, VertexElement[] elements, VertexShader vertexShader)
public this(GraphicsContext context, VertexElement[] elements, bool ownsElements, VertexShader vertexShader)
{
nativeShaderCode = vertexShader.nativeCode..AddRef();
_context = context..AddRef();
_elements = elements;
_ownsElements = ownsElements;
CreateNativeLayout();
}