Example #1
0
 public void SetTexture(int slot, IPlatformTexture2D texture)
 {
     if (textures[slot] != texture)
     {
         textures[slot]     = (PlatformTexture2D)texture;
         texturesDirtyMask |= 1 << slot;
     }
 }
Example #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));
     }
 }
Example #3
0
 public override void Dispose()
 {
     MemoryUsed = 0;
     if (platformTexture != null)
     {
         var platformTextureCopy = platformTexture;
         Window.Current.InvokeOnRendering(() => {
             platformTextureCopy.Dispose();
         });
         platformTexture = null;
     }
     base.Dispose();
 }
Example #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);
     }
 }
Example #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);
 }
Example #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);
 }
Example #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));
 }
Example #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);
 }
Example #9
0
 public static void SetData <T>(
     this IPlatformTexture2D texture, int level, T[] data) where T : unmanaged
 {
     SetData(texture, level, data, 0);
 }
Example #10
0
 public static void SetData <T>(
     this IPlatformTexture2D texture, int level, T data) where T : unmanaged
 {
     SetData(texture, level, new IntPtr(&data));
 }