public void ApplyFullTriGray(RenderContext context, IDxTexture2D texture) { this.FullScreenTriangle.Bind(context, null); context.Context.VertexShader.Set(this.VSTri); context.Context.PixelShader.Set(this.PSGray); context.Context.PixelShader.SetShaderResource(0, texture == null ? null : texture.ShaderView); context.Context.PixelShader.SetSampler(0, this.LinearSampler); }
public void ApplyFullTriAlpha(RenderContext context, IDxTexture2D texture, float alpha) { this.cbLuma.Update(context, ref alpha); this.FullScreenTriangle.Bind(context, null); context.Context.VertexShader.Set(this.VSTri); context.Context.PixelShader.Set(this.PSAlpha); context.Context.PixelShader.SetShaderResource(0, texture == null ? null : texture.ShaderView); context.Context.PixelShader.SetSampler(0, this.LinearSampler); }
public static void SaveToMemory(RenderDevice device, RenderContext context, IDxTexture2D texture, eImageFormat format, out IntPtr data, out int size, out IntPtr blob) { long retcode = NativeMethods.SaveTextureToMemory(device.Device.NativePointer, context.Context.NativePointer, texture.Texture.NativePointer, (int)format, out data, out size, out blob); if (retcode < 0) { throw new Exception("Failed to Save Texture"); } }
public static void SaveToFile(DxDevice device, RenderContext context, IDxTexture2D texture, string path) { eImageFormat format = GetCodec(path); long retcode = NativeMethods.SaveTextureToFile(device.Device.NativePointer, context.Context.NativePointer, texture.Texture.NativePointer, path, (int)format); if (retcode != 0) { throw new Exception("Failed to Save Texture"); } }
public void Dispose() { if (this.blacktex != null) { this.blacktex.Dispose(); this.blacktex = null; } if (this.whitetex != null) { this.whitetex.Dispose(); this.whitetex = null; } }
public static DX11Texture2D CreateStaging(DxDevice device, IDxTexture2D source) { var desc = source.Texture.Description; desc.BindFlags = BindFlags.None; desc.CpuAccessFlags = CpuAccessFlags.Read; desc.Usage = ResourceUsage.Staging; desc.OptionFlags = ResourceOptionFlags.None; DX11Texture2D texture = new DX11Texture2D(); texture.Texture = new Texture2D(device.Device, desc); texture.description = texture.Texture.Description; return(texture); }
public DX11SliceDepthStencil(DxDevice device, IDxTexture2D texture, int sliceindex, eDepthFormat depthformat) { this.device = device; this.parent = texture; DepthStencilViewDescription dsvd = new DepthStencilViewDescription() { Format = depthformat.GetDepthFormat(), Dimension = DepthStencilViewDimension.Texture2DArray, Texture2DArray = new DepthStencilViewDescription.Texture2DArrayResource() { ArraySize = 1, FirstArraySlice = sliceindex, MipSlice = 0 } }; this.DepthView = new DepthStencilView(device, this.parent.Texture, dsvd); }
public DxMipSliceRenderTarget(DxDevice device, IDxTexture2D texture, int mipindex, int w, int h) { this.device = device; this.Width = w; this.Height = h; this.Depth = 1; RenderTargetViewDescription rtd = new RenderTargetViewDescription() { Dimension = RenderTargetViewDimension.Texture2D, Format = texture.Format, Texture2D = new RenderTargetViewDescription.Texture2DResource() { MipSlice = mipindex } }; ShaderResourceViewDescription srvd = new ShaderResourceViewDescription() { Dimension = ShaderResourceViewDimension.Texture2D, Format = texture.Format, Texture2D = new ShaderResourceViewDescription.Texture2DResource() { MipLevels = 1, MostDetailedMip = mipindex } }; UnorderedAccessViewDescription uavd = new UnorderedAccessViewDescription() { Dimension = UnorderedAccessViewDimension.Texture3D, Format = texture.Format, Texture2D = new UnorderedAccessViewDescription.Texture2DResource() { MipSlice = mipindex } }; this.RenderView = new RenderTargetView(device, texture.Texture, rtd); this.ShaderView = new ShaderResourceView(device, texture.Texture, srvd); this.UnorderedView = new UnorderedAccessView(device, texture.Texture, uavd); }
public DX11SliceRenderTarget(DxDevice device, IDxTexture2D texture, int sliceindex) { this.device = device; this.parent = texture; RenderTargetViewDescription rtd = new RenderTargetViewDescription() { Dimension = RenderTargetViewDimension.Texture2DArray, Format = texture.Format, Texture2DArray = new RenderTargetViewDescription.Texture2DArrayResource() { ArraySize = 1, MipSlice = 0, FirstArraySlice = sliceindex } }; this.RenderView = new RenderTargetView(device.Device, this.parent.Texture, rtd); }
public static IDxTexture2D LoadFromFile(RenderDevice device, string path, CancellationToken ct, IProgress <bool> started = null) { if (ct.IsCancellationRequested) { throw new OperationCanceledException(); } if (started != null) { started.Report(true); } //Thread.Sleep(4000); IDxTexture2D texture = TextureLoader.LoadFromFile(device, path); if (ct.IsCancellationRequested) { texture.Dispose(); throw new OperationCanceledException(); } return(texture); }
public static void SaveToMemoryCompressedNoHeader(RenderDevice device, RenderContext context, IDxTexture2D texture, DdsBlockType blockType, out IntPtr data, out int size, out IntPtr blob) { long retcode = NativeMethods.SaveCompressedTextureToMemoryNoHeader(device.Device.NativePointer, context.Context.NativePointer, texture.Texture.NativePointer, (int)blockType, out data, out size, out blob); if (retcode < 0) { throw new Exception("Failed to Save Texture"); } }
public static void SaveToFileCompressed(DxDevice device, RenderContext context, IDxTexture2D texture, string path, DdsBlockType blockType) { long retcode = NativeMethods.SaveCompressedTextureToFile(device.Device.NativePointer, context.Context.NativePointer, texture.Texture.NativePointer, path, (int)blockType); if (retcode < 0) { throw new Exception("Failed to Save Texture"); } }