Skip to content

Commit

Permalink
easier flag types
Browse files Browse the repository at this point in the history
  • Loading branch information
thatcosmonaut committed Jan 16, 2021
1 parent 3379b95 commit 2e3871a
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/Refresh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public enum DepthFormat
Depth32Stencil8
}

public enum TextureUsageFlagBits
[Flags]
public enum TextureUsageFlags : uint
{
SamplerBit = 1,
ColorTargetBit = 2
Expand All @@ -137,7 +138,8 @@ public enum CubeMapFace
NegativeZ
}

public enum BufferUsageFlagBits
[Flags]
public enum BufferUsageFlags : uint
{
Vertex = 1,
Index = 2,
Expand Down Expand Up @@ -263,12 +265,26 @@ public enum BlendFactor
OneMinusSourceOneAlpha
}

public enum ColorComponentFlagBits
[Flags]
public enum ColorComponentFlags : uint
{
R = 1,
G = 2,
B = 4,
A = 8
A = 8,

RG = R | G,
RB = R | B,
RA = R | A,
GB = G | B,
GA = G | A,
BA = B | A,

RGB = R | G | B,
RGA = R | G | A,
GBA = G | B | A,

RGBA = R | G | B | A
}

public enum ShaderStageType
Expand Down Expand Up @@ -439,7 +455,7 @@ public struct ColorTargetBlendState
public BlendFactor sourceAlphaBlendFactor;
public BlendFactor destinationAlphaBlendFactor;
public BlendOp alphaBlendOp;
public uint colorWriteMask;
public ColorComponentFlags colorWriteMask;
}

[StructLayout(LayoutKind.Sequential)]
Expand Down Expand Up @@ -500,7 +516,7 @@ public struct TextureCreateInfo
public SampleCount sampleCount;
public uint levelCount;
public ColorFormat format;
public uint usageFlags; /* Refresh_TextureUsageFlags */
public TextureUsageFlags usageFlags; /* Refresh_TextureUsageFlags */
}

[StructLayout(LayoutKind.Sequential)]
Expand All @@ -509,7 +525,7 @@ public struct ShaderStageState
public IntPtr shaderModule;
[MarshalAs(UnmanagedType.LPStr)]
public string entryPointName;
public UInt64 uniformBufferSize;
public ulong uniformBufferSize;
}

[StructLayout(LayoutKind.Sequential)]
Expand Down Expand Up @@ -742,7 +758,7 @@ DepthFormat format
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Refresh_CreateBuffer(
IntPtr device,
uint usageFlags, /* BufferUsageFlagBits */
BufferUsageFlags usageFlags,
uint sizeInBytes
);

Expand Down

0 comments on commit 2e3871a

Please sign in to comment.