internal bool GetWindowRTVAndDSV(out RenderTargetViewHandle rtv, out DepthStencilViewHandle dsv) { RenderTargetViewHandle outWindowRTV; DepthStencilViewHandle outWindowDSV; unsafe { char *failReason = stackalloc char[InteropUtils.MAX_INTEROP_FAIL_REASON_STRING_LENGTH + 1]; bool success = NativeMethods.WindowFactory_GetWindowBackBufferRTVAndDSV( (IntPtr)failReason, WindowHandle, (IntPtr)(&outWindowRTV), (IntPtr)(&outWindowDSV) ); if (!success) { throw new NativeOperationFailedException(Marshal.PtrToStringUni((IntPtr)failReason)); } } // If window was closed, rtv/dsv handles will be null if (outWindowRTV == RenderTargetViewHandle.NULL || outWindowDSV == DepthStencilViewHandle.NULL) { rtv = RenderTargetViewHandle.NULL; dsv = DepthStencilViewHandle.NULL; return(false); } rtv = outWindowRTV; dsv = outWindowDSV; return(true); }
internal static unsafe RenderCommand SetRenderTargets(DepthStencilViewHandle dsv, RenderTargetViewHandle rtv) { RenderTargetViewHandle *rtvPtr = (RenderTargetViewHandle *)AllocAndZeroTemp((uint)sizeof(RenderTargetViewHandle)); *rtvPtr = rtv; return(new RenderCommand( RenderCommandInstruction.SetRenderTargets, (IntPtr)rtvPtr, (IntPtr)(ResourceViewHandle)dsv, 1U )); }
internal static unsafe RenderCommand SetRenderTargets(DepthStencilViewHandle dsv, RenderTargetViewHandle rtv1, RenderTargetViewHandle rtv2) { RenderTargetViewHandle *rtvArrPtr = (RenderTargetViewHandle *)AllocAndZeroTemp(2U * (uint)sizeof(RenderTargetViewHandle)); rtvArrPtr[0] = rtv1; rtvArrPtr[1] = rtv2; return(new RenderCommand( RenderCommandInstruction.SetRenderTargets, (IntPtr)rtvArrPtr, (IntPtr)(ResourceViewHandle)dsv, 2U )); }
internal RenderTargetView(RenderTargetViewHandle resourceViewHandle, ITexture2D resource, uint mipIndex) : base(resourceViewHandle, resource) { MipIndex = mipIndex; }