Exemplo n.º 1
0
 public void SetTexture(int slot, IPlatformTexture2D texture)
 {
     if (textures[slot] != texture)
     {
         textures[slot]     = (PlatformTexture2D)texture;
         texturesDirtyMask |= 1 << slot;
     }
 }
Exemplo n.º 2
0
 public static void SetData <T>(
     this IPlatformTexture2D texture, int level, int x, int y, int width, int height, T[] data, int startIndex) where T : unmanaged
 {
     fixed(T *p = &data[startIndex])
     {
         texture.SetData(level, x, y, width, height, new IntPtr(p));
     }
 }
Exemplo n.º 3
0
 public override void Dispose()
 {
     MemoryUsed = 0;
     if (platformTexture != null)
     {
         var platformTextureCopy = platformTexture;
         Window.Current.InvokeOnRendering(() => {
             platformTextureCopy.Dispose();
         });
         platformTexture = null;
     }
     base.Dispose();
 }
Exemplo n.º 4
0
 private void EnsurePlatformTexture(Format format, int width, int height, bool mipmaps)
 {
     if (platformTexture == null ||
         platformTexture.Format != format ||
         platformTexture.Width != width ||
         platformTexture.Height != height ||
         platformTexture.LevelCount > 1 != mipmaps
         )
     {
         if (platformTexture != null)
         {
             platformTexture.Dispose();
         }
         platformTexture = PlatformRenderer.Context.CreateTexture2D(format, width, height, mipmaps, textureParams);
         PlatformRenderer.RebindTexture(this);
     }
 }
Exemplo n.º 5
0
 public static void SetData(this IPlatformTexture2D texture, int level, IntPtr data)
 {
     GraphicsUtility.CalculateMipLevelSize(level, texture.Width, texture.Height, out var levelWidth, out var levelHeight);
     texture.SetData(level, 0, 0, levelWidth, levelHeight, data);
 }
Exemplo n.º 6
0
 public static void SetData <T>(
     this IPlatformTexture2D texture, int level, int x, int y, int width, int height, T[] data) where T : unmanaged
 {
     SetData(texture, level, x, y, width, height, data, 0);
 }
Exemplo n.º 7
0
 public static void SetData <T>(
     this IPlatformTexture2D texture, int level, int x, int y, int width, int height, T data) where T : unmanaged
 {
     texture.SetData(level, x, y, width, height, new IntPtr(&data));
 }
Exemplo n.º 8
0
 public static void SetData <T>(
     this IPlatformTexture2D texture, int level, T[] data, int startIndex) where T : unmanaged
 {
     GraphicsUtility.CalculateMipLevelSize(level, texture.Width, texture.Height, out var levelWidth, out var levelHeight);
     SetData(texture, level, 0, 0, levelWidth, levelHeight, data, startIndex);
 }
Exemplo n.º 9
0
 public static void SetData <T>(
     this IPlatformTexture2D texture, int level, T[] data) where T : unmanaged
 {
     SetData(texture, level, data, 0);
 }
Exemplo n.º 10
0
 public static void SetData <T>(
     this IPlatformTexture2D texture, int level, T data) where T : unmanaged
 {
     SetData(texture, level, new IntPtr(&data));
 }