-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a8bbec
commit 7719a06
Showing
33 changed files
with
879 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
HexaEngine.Core/Graphics/Shaders/Reflection/ArrayTraits.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public struct ArrayTraits | ||
{ | ||
public uint DimsCount; | ||
|
||
public unsafe fixed uint Dims[32]; | ||
|
||
public unsafe fixed uint SpecConstantOpIds[32]; | ||
|
||
public uint Stride; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
HexaEngine.Core/Graphics/Shaders/Reflection/ConstantBufferMemberInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public unsafe struct ConstantBufferMemberInfo | ||
{ | ||
public string Name; | ||
|
||
public uint Offset; | ||
public uint AbsoluteOffset; | ||
public uint Size; | ||
public uint PaddedSize; | ||
public TypeInfo* Type; | ||
|
||
public void Release() | ||
{ | ||
if (Type != null) | ||
{ | ||
Type->Release(); | ||
|
||
Free(Type); | ||
Type = null; | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
HexaEngine.Core/Graphics/Shaders/Reflection/DecorationFlags.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
[Flags] | ||
public enum DecorationFlags | ||
{ | ||
None = 0, | ||
Block = 1, | ||
BufferBlock = 2, | ||
RowMajor = 4, | ||
ColumnMajor = 8, | ||
BuiltIn = 0x10, | ||
NoPerspective = 0x20, | ||
Flat = 0x40, | ||
NonWritable = 0x80, | ||
RelaxedPrecision = 0x100, | ||
NonReadable = 0x200, | ||
Patch = 0x400, | ||
PerVertex = 0x800, | ||
PerTask = 0x1000, | ||
WeightTexture = 0x2000, | ||
BlockMatchTexture = 0x4000 | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
HexaEngine.Core/Graphics/Shaders/Reflection/DescriptorBindingInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
using Silk.NET.SPIRV.Reflect; | ||
|
||
public struct DescriptorBindingInfo | ||
{ | ||
public string Name; | ||
public DescriptorType Type; | ||
public int BufferSize; | ||
public ConstantBufferMemberInfo[] Members; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public enum Dimension | ||
{ | ||
Texture1D = 0, | ||
Texture2D = 1, | ||
Texture3D = 2, | ||
TextureCube = 3, | ||
Rect = 4, | ||
Buffer = 5, | ||
SubpassData = 6, | ||
TileImageDataExt = 4173, | ||
Max = int.MaxValue | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
HexaEngine.Core/Graphics/Shaders/Reflection/ImageFormat.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public enum ImageFormat | ||
{ | ||
Unknown = 0, | ||
RGBA32F = 1, | ||
RGBA16F = 2, | ||
R32F = 3, | ||
RGBA8 = 4, | ||
RGBA8SNorm = 5, | ||
RG32F = 6, | ||
RG16F = 7, | ||
R11FG11FB10F = 8, | ||
R16F = 9, | ||
RGBA16 = 10, | ||
RGB10A2 = 11, | ||
RG16 = 12, | ||
RG8 = 13, | ||
R16 = 14, | ||
R8 = 15, | ||
RGBA16SNorm = 16, | ||
RG16SNorm = 17, | ||
RG8SNorm = 18, | ||
R16SNorm = 19, | ||
R8SNorm = 20, | ||
RGBA32I = 21, | ||
RGBA16I = 22, | ||
RGBA8I = 23, | ||
R32I = 24, | ||
RG32I = 25, | ||
RG16I = 26, | ||
RG8I = 27, | ||
R16I = 28, | ||
R8I = 29, | ||
RGBA32UI = 30, | ||
RGBA16UI = 31, | ||
RGBA8UI = 32, | ||
R32UI = 33, | ||
RGB10A2UI = 34, | ||
RG32UI = 35, | ||
RG16UI = 36, | ||
RG8UI = 37, | ||
R16UI = 38, | ||
R8UI = 39, | ||
R64UI = 40, | ||
R64I = 41, | ||
Max = int.MaxValue | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
HexaEngine.Core/Graphics/Shaders/Reflection/ImageTraits.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public struct ImageTraits | ||
{ | ||
public Dimension Dim; | ||
public uint Depth; | ||
public bool Arrayed; | ||
public bool Ms; | ||
public bool Sampled; | ||
public ImageFormat ImageFormat; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public struct Matrix | ||
{ | ||
public uint ColumnCount; | ||
public uint RowCount; | ||
public uint Stride; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public struct NumericTraits | ||
{ | ||
public Scalar Scalar; | ||
public Vector Vector; | ||
public Matrix Matrix; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public struct Scalar | ||
{ | ||
public uint Width; | ||
public bool Signed; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
HexaEngine.Core/Graphics/Shaders/Reflection/ShaderReflection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
namespace HexaEngine.Core.Graphics.Shaders.Reflection | ||
{ | ||
public struct ConstantBuffer | ||
{ | ||
public string? Name; | ||
public uint Slot; | ||
public uint Size; | ||
public uint PaddedSize; | ||
public ConstantBufferMemberInfo[] Members; | ||
|
||
public ConstantBuffer(string? name, uint slot, uint size, uint paddedSize, ConstantBufferMemberInfo[] members) | ||
{ | ||
Name = name; | ||
Slot = slot; | ||
Size = size; | ||
PaddedSize = paddedSize; | ||
Members = members; | ||
} | ||
|
||
public void Release() | ||
{ | ||
if (Members != null) | ||
{ | ||
for (int i = 0; i < Members.Length; i++) | ||
{ | ||
Members[i].Release(); | ||
} | ||
} | ||
|
||
this = default; | ||
} | ||
} | ||
|
||
public class ShaderReflection : IDisposable | ||
{ | ||
public readonly ConstantBuffer[] ConstantBuffers; | ||
|
||
private bool disposedValue; | ||
|
||
public ShaderReflection(ConstantBuffer[] constantBuffers) | ||
{ | ||
ConstantBuffers = constantBuffers; | ||
} | ||
|
||
protected virtual void Dispose(bool disposing) | ||
{ | ||
if (!disposedValue) | ||
{ | ||
if (disposing) | ||
{ | ||
for (var i = 0; i < ConstantBuffers.Length; i++) | ||
{ | ||
ConstantBuffers[i].Release(); | ||
} | ||
} | ||
|
||
disposedValue = true; | ||
} | ||
} | ||
|
||
~ShaderReflection() | ||
{ | ||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method | ||
Dispose(disposing: false); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method | ||
Dispose(disposing: true); | ||
GC.SuppressFinalize(this); | ||
} | ||
} | ||
} |
Oops, something went wrong.