Skip to content

Commit

Permalink
Add ByteEXT and UShortEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
kg committed Dec 25, 2024
1 parent ebadfa6 commit 1753f30
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Graphics/SurfaceFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,13 @@ public enum SurfaceFormat
/// BC7 block texture format where the R/G/B values are non-linear sRGB.
/// </summary>
Bc7SrgbEXT,
/// <summary>
/// Unsigned 8-bit R pixel format.
/// </summary>
ByteEXT,
/// <summary>
/// Unsigned 16-bit R pixel format.
/// </summary>
UShortEXT,
}
}
4 changes: 4 additions & 0 deletions src/Graphics/Texture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public static int GetBlockSizeSquaredEXT(SurfaceFormat format)
case SurfaceFormat.Vector2:
case SurfaceFormat.HdrBlendable:
case SurfaceFormat.Vector4:
case SurfaceFormat.ByteEXT:
case SurfaceFormat.UShortEXT:
return 1;
default:
throw new ArgumentException("Should be a value defined in SurfaceFormat", "Format");
Expand All @@ -149,12 +151,14 @@ public static int GetFormatSizeEXT(SurfaceFormat format)
case SurfaceFormat.Bc7SrgbEXT:
return 16;
case SurfaceFormat.Alpha8:
case SurfaceFormat.ByteEXT:
return 1;
case SurfaceFormat.Bgr565:
case SurfaceFormat.Bgra4444:
case SurfaceFormat.Bgra5551:
case SurfaceFormat.HalfSingle:
case SurfaceFormat.NormalizedByte2:
case SurfaceFormat.UShortEXT:
return 2;
case SurfaceFormat.Color:
case SurfaceFormat.Single:
Expand Down
4 changes: 3 additions & 1 deletion src/Graphics/Texture2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ SurfaceFormat format
format != SurfaceFormat.HalfSingle &&
format != SurfaceFormat.HalfVector2 &&
format != SurfaceFormat.HalfVector4 &&
format != SurfaceFormat.HdrBlendable )
format != SurfaceFormat.HdrBlendable &&
format != SurfaceFormat.ByteEXT &&
format != SurfaceFormat.UShortEXT)
{
// Not a renderable format period
Format = SurfaceFormat.Color;
Expand Down

0 comments on commit 1753f30

Please sign in to comment.