2021-01-20 03:33:27 +00:00
|
|
|
|
using RefreshCS;
|
|
|
|
|
|
|
|
|
|
namespace MoonWorks.Graphics
|
|
|
|
|
{
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
2024-03-01 07:53:11 +00:00
|
|
|
|
/// A texture slice specifies a subresource of a texture.
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public struct TextureSlice
|
|
|
|
|
{
|
2024-02-23 08:06:04 +00:00
|
|
|
|
public Texture Texture;
|
|
|
|
|
public uint MipLevel;
|
2024-03-01 07:53:11 +00:00
|
|
|
|
public uint Layer;
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2024-03-01 07:53:11 +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
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public TextureSlice(Texture texture)
|
|
|
|
|
{
|
|
|
|
|
Texture = texture;
|
2024-02-23 08:06:04 +00:00
|
|
|
|
MipLevel = 0;
|
2024-03-01 07:53:11 +00:00
|
|
|
|
Layer = 0;
|
2022-02-23 05:14:32 +00:00
|
|
|
|
}
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public Refresh.TextureSlice ToRefreshTextureSlice()
|
|
|
|
|
{
|
2024-03-01 07:53:11 +00:00
|
|
|
|
return new Refresh.TextureSlice
|
2022-02-23 05:14:32 +00:00
|
|
|
|
{
|
|
|
|
|
texture = Texture.Handle,
|
2024-02-23 08:06:04 +00:00
|
|
|
|
mipLevel = MipLevel,
|
2024-03-01 07:53:11 +00:00
|
|
|
|
layer = Layer
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-20 03:33:27 +00:00
|
|
|
|
}
|