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 static unsafe RenderCommand SetRenderTargets(DepthStencilViewHandle dsv, RenderTargetView rtv) { Assure.NotNull(rtv); Assure.False( rtv.ResourceOrViewDisposed, "One or more elements in the render target view array (or their resources) were disposed." ); RenderTargetViewHandle *rtvArrPtr = (RenderTargetViewHandle *)AllocAndZeroTemp((uint)(sizeof(RenderTargetViewHandle))); *rtvArrPtr = rtv.ResourceViewHandle; return(new RenderCommand( RenderCommandInstruction.SetRenderTargets, (IntPtr)rtvArrPtr, (IntPtr)(ResourceViewHandle)dsv, 1U )); }
internal static unsafe RenderCommand SetRenderTargets(DepthStencilViewHandle dsv, params RenderTargetViewHandle[] rtvArr) { Assure.NotNull(rtvArr); Assure.None(rtvArr, rtv => rtv == null, "One or more elements in the render target view array were null."); Assure.LessThanOrEqualTo(rtvArr.Length, MAX_RENDER_TARGETS, "Maximum of " + MAX_RENDER_TARGETS + " render targets permitted."); RenderTargetViewHandle *rtvArrPtr = (RenderTargetViewHandle *)AllocAndZeroTemp((uint)(rtvArr.Length * sizeof(RenderTargetViewHandle))); for (int i = 0; i < rtvArr.Length; i++) { rtvArrPtr[i] = rtvArr[i]; } return(new RenderCommand( RenderCommandInstruction.SetRenderTargets, (IntPtr)rtvArrPtr, (IntPtr)(ResourceViewHandle)dsv, (uint)rtvArr.Length )); }
internal DepthStencilView(DepthStencilViewHandle resourceViewHandle, ITexture2D resource, uint mipIndex) : base(resourceViewHandle, resource) { MipIndex = mipIndex; }