(Breaking) Made VertexLayout initialization sexy

This commit is contained in:
Simon Lübeß
2021-01-02 16:32:08 +01:00
parent 3c58e20787
commit 523da5536b
3 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -91,9 +91,9 @@ namespace GlitchyEngine
// Create Input Layout
_vertexLayout = new VertexLayout(_window.Context, new .(
VertexElement("POSITION", 0, .R32G32B32_Float, 0),
VertexElement("COLOR", 0, .R8G8B8A8_UNorm, 0)
), _vertexShader.[Friend]nativeCode);
VertexElement(.R32G32B32_Float, "POSITION"),
VertexElement(.R8G8B8A8_UNorm, "COLOR"),
), _vertexShader);
//
// Load pixel shader
@@ -11,11 +11,11 @@ namespace GlitchyEngine.Renderer
{
internal ID3D11InputLayout* nativeLayout ~ _?.Release();
public ID3DBlob* nativeShaderCode;
public ID3DBlob* nativeShaderCode ~ _?.Release();
public this(GraphicsContext context, VertexElement[] ownElements, ID3DBlob* nativeShaderCode)
public this(GraphicsContext context, VertexElement[] ownElements, VertexShader vertexShader)
{
this.nativeShaderCode = nativeShaderCode;
nativeShaderCode = vertexShader.nativeCode..AddRef();
_context = context;
_elements = ownElements;
+3 -3
View File
@@ -56,11 +56,11 @@ namespace GlitchyEngine.Renderer
public this() => this = default;
public this(String semanticName, uint32 semanticIndex, Format format, uint32 inputSlot, uint32 offset = (.)-1, InputClassification slotClass = .PerVertexData, uint32 instanceStepRate = 0)
public this(Format format, String semanticName, uint32 semanticIndex = 0, uint32 inputSlot = 0, uint32 offset = (.)-1, InputClassification slotClass = .PerVertexData, uint32 instanceStepRate = 0)
{
Format = format;
SemanticName = semanticName;
SemanticIndex = semanticIndex;
Format = format;
InputSlot = inputSlot;
AlignedByteOffset = offset;
InputSlotClass = slotClass;
@@ -85,7 +85,7 @@ namespace GlitchyEngine.Renderer
// Todo: DirectX needs shader!
/// Takes ownership of ownElements!
public this(GraphicsContext context, VertexElement[] ownElements)
public this(GraphicsContext context, VertexElement[] ownElements, VertexShader vertexShader)
{
_context = context;
_elements = ownElements;