public Texture2D( GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat format ) { if (graphicsDevice == null) { throw new ArgumentNullException("graphicsDevice"); } GraphicsDevice = graphicsDevice; Width = width; Height = height; LevelCount = mipMap ? CalculateMipLevels(width, height) : 1; // TODO: Use QueryRenderTargetFormat! if (this is IRenderTarget) { if (format == SurfaceFormat.ColorSrgbEXT) { if (FNA3D.FNA3D_SupportsSRGBRenderTargets(GraphicsDevice.GLDevice) == 0) { // Renderable but not on this device Format = SurfaceFormat.Color; } else { Format = format; } } else if (format != SurfaceFormat.Color && format != SurfaceFormat.Rgba1010102 && format != SurfaceFormat.Rg32 && format != SurfaceFormat.Rgba64 && format != SurfaceFormat.Single && format != SurfaceFormat.Vector2 && format != SurfaceFormat.Vector4 && format != SurfaceFormat.HalfSingle && format != SurfaceFormat.HalfVector2 && format != SurfaceFormat.HalfVector4 && format != SurfaceFormat.HdrBlendable) { // Not a renderable format period Format = SurfaceFormat.Color; } else { Format = format; } } else { Format = format; } texture = FNA3D.FNA3D_CreateTexture2D( GraphicsDevice.GLDevice, Format, Width, Height, LevelCount, (byte)((this is IRenderTarget) ? 1 : 0) ); }