2024-06-05 19:34:24 +00:00
|
|
|
|
using RefreshCS;
|
2024-06-04 17:20:07 +00:00
|
|
|
|
namespace MoonWorks.Graphics;
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A texture slice specifies a subresource of a texture.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public struct TextureSlice
|
2021-01-20 03:33:27 +00:00
|
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
|
public Texture Texture;
|
|
|
|
|
public uint MipLevel;
|
|
|
|
|
public uint Layer;
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
|
public uint Size => (Texture.Width * Texture.Height * Texture.Depth * Texture.BytesPerPixel(Texture.Format) / Texture.BlockSizeSquared(Texture.Format)) >> (int) MipLevel;
|
2024-01-16 06:19:59 +00:00
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
|
public TextureSlice(Texture texture)
|
|
|
|
|
{
|
|
|
|
|
Texture = texture;
|
|
|
|
|
MipLevel = 0;
|
|
|
|
|
Layer = 0;
|
|
|
|
|
}
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
|
public Refresh.TextureSlice ToRefresh()
|
2024-06-04 17:20:07 +00:00
|
|
|
|
{
|
2024-06-05 19:34:24 +00:00
|
|
|
|
return new Refresh.TextureSlice
|
2022-02-23 05:14:32 +00:00
|
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
|
Texture = Texture.Handle,
|
|
|
|
|
MipLevel = MipLevel,
|
|
|
|
|
Layer = Layer
|
|
|
|
|
};
|
2022-02-23 05:14:32 +00:00
|
|
|
|
}
|
2021-01-20 03:33:27 +00:00
|
|
|
|
}
|