Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ByteEXT and UShortEXT and enable as texture and RT formats #509

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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