protected override void OnRender(IRenderContext context, DeviceContextProxy deviceContext) { if (resolutionChanged) { RemoveAndDispose(ref viewResource); viewResource = Collect(new ShaderResourceViewProxy(Device, ShadowMapTextureDesc)); viewResource.CreateView(DepthStencilViewDesc); viewResource.CreateView(ShaderResourceViewDesc); resolutionChanged = false; } deviceContext.DeviceContext.ClearDepthStencilView(viewResource, DepthStencilClearFlags.Depth, 1.0f, 0); context.IsShadowPass = true; var orgFrustum = context.BoundingFrustum; context.BoundingFrustum = new BoundingFrustum(LightViewProjectMatrix); #if !TEST deviceContext.DeviceContext.Rasterizer.SetViewport(0, 0, Width, Height); deviceContext.DeviceContext.OutputMerger.SetTargets(viewResource.DepthStencilView, new RenderTargetView[0]); for (int i = 0; i < context.RenderHost.PerFrameGeneralRenderCores.Count; ++i) { var core = context.RenderHost.PerFrameGeneralRenderCores[i]; if (core.IsThrowingShadow && core.RenderType == RenderType.Opaque) { core.Render(context, deviceContext); } } context.IsShadowPass = false; context.BoundingFrustum = orgFrustum; context.RenderHost.SetDefaultRenderTargets(false); context.SharedResource.ShadowView = viewResource.TextureView; #endif }
public override void Render(RenderContext context, DeviceContextProxy deviceContext) { if (!NeedRender) { modelStruct.HasShadowMap = 0; modelCB.Upload(deviceContext, ref modelStruct); return; } OnUpdateLightSource?.Invoke(this, new UpdateLightSourceEventArgs(context)); ++currentFrame; currentFrame %= Math.Max(1, UpdateFrequency); if (!FoundLightSource || currentFrame != 0) { return; } if (resolutionChanged) { RemoveAndDispose(ref viewResource); viewResource = new ShaderResourceViewProxy(Device, ShadowMapTextureDesc); viewResource.CreateView(DepthStencilViewDesc); viewResource.CreateView(ShaderResourceViewDesc); resolutionChanged = false; } deviceContext.ClearDepthStencilView(viewResource, DepthStencilClearFlags.Depth, 1.0f, 0); var orgFrustum = context.BoundingFrustum; var frustum = new BoundingFrustum(LightView * LightProjection); context.BoundingFrustum = frustum; #if !TEST deviceContext.SetViewport(0, 0, Width, Height); deviceContext.SetDepthStencil(viewResource.DepthStencilView); modelStruct.HasShadowMap = context.RenderHost.IsShadowMapEnabled ? 1 : 0; modelCB.Upload(deviceContext, ref modelStruct); for (var i = 0; i < context.RenderHost.PerFrameOpaqueNodes.Count; ++i) { //Only support opaque object for throwing shadows. var core = context.RenderHost.PerFrameOpaqueNodes[i]; if (core.RenderCore.IsThrowingShadow && core.TestViewFrustum(ref frustum)) { core.RenderShadow(context, deviceContext); } } context.BoundingFrustum = orgFrustum; context.RenderHost.SetDefaultRenderTargets(false); context.SharedResource.ShadowView = viewResource; #endif }
/// <summary> /// Registers the specified material unique identifier. /// </summary> /// <param name="textureModel">The texture model.</param> /// <param name="enableAutoGenMipMap">Enable generate mipmaps automatically</param> /// <returns></returns> public ShaderResourceViewProxy Register(TextureModel textureModel, bool enableAutoGenMipMap) { if (textureModel == null) { return(null); } var targetDict = enableAutoGenMipMap ? resourceDictionaryMipMaps : resourceDictionaryNoMipMaps; lock (targetDict) { if (targetDict.TryGetValue(textureModel.Guid, out var view)) { Debug.WriteLine("Re-using existing texture resource"); view.IncRef(); return(view); } else { Debug.WriteLine("Creating new texture resource"); var proxy = new ShaderResourceViewProxy(device); proxy.CreateView(textureModel, true, enableAutoGenMipMap); proxy.Guid = textureModel.Guid; proxy.Disposed += (s, e) => { lock (targetDict) { targetDict.Remove(proxy.Guid); } }; targetDict.Add(textureModel.Guid, proxy); return(proxy); } } }
/// <summary> /// Registers the specified material unique identifier. /// </summary> /// <param name="textureStream">The texture steam.</param> /// <param name="disableAutoGenMipMap">Disable generate mipmaps automatically</param> /// <returns></returns> public ShaderResourceViewProxy Register(Stream textureStream, bool disableAutoGenMipMap) { if (textureStream == null) { return(null); } var targetDict = disableAutoGenMipMap ? resourceDictionaryNoMipMaps : resourceDictionaryMipMaps; lock (targetDict) { if (targetDict.TryGetValue(textureStream, out ShaderResourceViewProxy view)) { view.IncRef(); return(view); } else { var proxy = new ShaderResourceViewProxy(device); proxy.CreateView(textureStream, disableAutoGenMipMap); proxy.Disposed += (s, e) => { lock (targetDict) { targetDict.Remove(textureStream); } }; targetDict.Add(textureStream, proxy); return(proxy); } } }
/// <summary> /// Registers the specified material unique identifier. /// </summary> /// <param name="textureModel">The texture model.</param> /// <param name="enableAutoGenMipMap">Enable generate mipmaps automatically</param> /// <returns></returns> public ShaderResourceViewProxy Register(TextureModel textureModel, bool enableAutoGenMipMap) { if (textureModel == null || textureModel.GetKey() == null) { return(null); } var targetDict = enableAutoGenMipMap ? resourceDictionaryMipMaps : resourceDictionaryNoMipMaps; lock (targetDict) { if (targetDict.TryGetValue(textureModel.GetKey(), out ShaderResourceViewProxy view)) { view.IncRef(); return(view); } else { var proxy = new ShaderResourceViewProxy(device); proxy.CreateView(textureModel, true, enableAutoGenMipMap); proxy.Disposed += (s, e) => { lock (targetDict) { targetDict.Remove(textureModel.GetKey()); } }; targetDict.Add(textureModel.GetKey(), proxy); return(proxy); } } }
protected override void OnAttached() { previousTime = TimeSpan.Zero; IntPtr context = ImGui.CreateContext(); ImGui.SetCurrentContext(context); ImGui.GetIO().Fonts.AddFontDefault(); bufferModel = new ImGui2DBufferModel(); (RenderCore as ImGuiRenderCore).Buffer = bufferModel; var io = ImGui.GetIO(); unsafe { io.Fonts.GetTexDataAsRGBA32(out IntPtr textureData, out var width, out var height); var textureView = new ShaderResourceViewProxy(EffectsManager.Device); textureView.CreateView(textureData, width, height, Format.R8G8B8A8_UNorm); io.Fonts.SetTexID(fontAtlasID); io.Fonts.ClearTexData(); (RenderCore as ImGuiRenderCore).TextureView = textureView; } ImGui.NewFrame(); newFrame = true; base.OnAttached(); }
/// <summary> /// Creates ShaderResourceViewProxy from common file formats such as Jpg, Bmp, DDS, Png, etc /// </summary> /// <param name="device">The device.</param> /// <param name="texture">The texture.</param> /// <param name="createSRV">if set to <c>true</c> [create SRV].</param> /// <returns></returns> public static ShaderResourceViewProxy CreateView(Device device, System.IO.Stream texture, bool createSRV = true, bool generateMipMaps = true) { var proxy = new ShaderResourceViewProxy(device); proxy.CreateView(texture, createSRV, generateMipMaps); return(proxy); }
/// <summary> /// Creates the 2D texture view from raw pixel byte array /// </summary> /// <param name="device">The device.</param> /// <param name="dataPtr">The data PTR.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="format">The format.</param> /// <param name="createSRV">if set to <c>true</c> [create SRV].</param> /// <param name="generateMipMaps"></param> /// <returns></returns> public unsafe static ShaderResourceViewProxy CreateView(Device device, IntPtr dataPtr, int width, int height, global::SharpDX.DXGI.Format format, bool createSRV = true, bool generateMipMaps = true) { var proxy = new ShaderResourceViewProxy(device); proxy.CreateView(dataPtr, width, height, format, createSRV, generateMipMaps); return(proxy); }
/// <summary> /// Creates the 2D texture view from data array /// </summary> /// <typeparam name="T"></typeparam> /// <param name="device">The device.</param> /// <param name="array">The array.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="format">The format.</param> /// <param name="createSRV">if set to <c>true</c> [create SRV].</param> /// <param name="generateMipMaps"></param> /// <returns></returns> public static ShaderResourceViewProxy CreateView <T>(Device device, T[] array, int width, int height, global::SharpDX.DXGI.Format format, bool createSRV = true, bool generateMipMaps = true) where T : struct { var proxy = new ShaderResourceViewProxy(device); proxy.CreateView(array, width, height, format, createSRV, generateMipMaps); return(proxy); }
/// <summary> /// Creates the view from pixel data. /// </summary> /// <param name="device">The device.</param> /// <param name="pixels">The pixels.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="format">The format.</param> /// <param name="createSRV">if set to <c>true</c> [create SRV].</param> /// <param name="generateMipMaps">if set to <c>true</c> [generate mip maps].</param> /// <returns></returns> public static ShaderResourceViewProxy CreateViewFromPixelData(Device device, Half4[] pixels, int width, int height, int depth, global::SharpDX.DXGI.Format format, bool createSRV = true, bool generateMipMaps = true) { var proxy = new ShaderResourceViewProxy(device); proxy.CreateView(pixels, width, height, depth, format, createSRV, generateMipMaps); return(proxy); }
private bool CreateCubeMapResources() { if(textureDesc.Width == faceSize && cubeMap != null && !cubeMap.IsDisposed) { return false; } textureDesc.Width = textureDesc.Height = dsvTextureDesc.Width = dsvTextureDesc.Height = FaceSize; RemoveAndDispose(ref cubeMap); cubeMap = Collect(new ShaderResourceViewProxy(Device, textureDesc)); var srvDesc = new ShaderResourceViewDescription() { Format = textureDesc.Format, Dimension = global::SharpDX.Direct3D.ShaderResourceViewDimension.TextureCube, TextureCube = new ShaderResourceViewDescription.TextureCubeResource() { MostDetailedMip = 0, MipLevels = -1 } }; cubeMap.CreateView(srvDesc); var rtsDesc = new RenderTargetViewDescription() { Format = textureDesc.Format, Dimension = RenderTargetViewDimension.Texture2DArray, Texture2DArray = new RenderTargetViewDescription.Texture2DArrayResource() { MipSlice = 0, FirstArraySlice = 0, ArraySize = 1 } }; for (int i = 0; i < 6; ++i) { RemoveAndDispose(ref cubeRTVs[i]); rtsDesc.Texture2DArray.FirstArraySlice = i; cubeRTVs[i] = Collect(new RenderTargetView(Device, CubeMap.Resource, rtsDesc)); } RemoveAndDispose(ref cubeDSV); cubeDSV = Collect(new ShaderResourceViewProxy(Device, dsvTextureDesc)); var dsvDesc = new DepthStencilViewDescription() { Format = dsvTextureDesc.Format, Dimension = DepthStencilViewDimension.Texture2DArray, Flags = DepthStencilViewFlags.None, Texture2DArray = new DepthStencilViewDescription.Texture2DArrayResource() { MipSlice = 0, FirstArraySlice = 0, ArraySize = 1 } }; for (int i = 0; i < 6; ++i) { RemoveAndDispose(ref cubeDSVs[i]); dsvDesc.Texture2DArray.FirstArraySlice = i; cubeDSVs[i] = Collect(new DepthStencilView(Device, cubeDSV.Resource, dsvDesc)); } viewport = new Viewport(0, 0, FaceSize, FaceSize); return true; }
private void UpdateTexture() { MipMapLevels = 0; RemoveAndDispose(ref cubeTextureRes); if (CubeTexture != null) { cubeTextureRes = new ShaderResourceViewProxy(Device); cubeTextureRes.CreateView(cubeTexture); if (cubeTextureRes.TextureView != null && cubeTextureRes.TextureView.Description.Dimension == ShaderResourceViewDimension.TextureCube) { MipMapLevels = cubeTextureRes.TextureView.Description.TextureCube.MipLevels; } } }
protected override void OnAttachBuffers(DeviceContext context, ref int vertStartSlot) { base.OnAttachBuffers(context, ref vertStartSlot); if (colorChanged) { RemoveAndDispose(ref colorGradientResource); if (ColorGradients != null) { colorGradientResource = new ShaderResourceViewProxy(Device); colorGradientResource.CreateView(colorGradients.ToArray(), global::SharpDX.Toolkit.Graphics.PixelFormat.R32G32B32A32.Float); } colorChanged = false; } }
protected override void OnRender(RenderContext context, DeviceContextProxy deviceContext) { if (resolutionChanged) { RemoveAndDispose(ref viewResource); viewResource = Collect(new ShaderResourceViewProxy(Device, ShadowMapTextureDesc)); viewResource.CreateView(DepthStencilViewDesc); viewResource.CreateView(ShaderResourceViewDesc); resolutionChanged = false; } deviceContext.ClearDepthStencilView(viewResource, DepthStencilClearFlags.Depth, 1.0f, 0); context.IsShadowPass = true; var orgFrustum = context.BoundingFrustum; var frustum = new BoundingFrustum(LightViewProjectMatrix); context.BoundingFrustum = frustum; #if !TEST deviceContext.SetViewport(0, 0, Width, Height); deviceContext.SetDepthStencilOnly(viewResource.DepthStencilView); for (int i = 0; i < context.RenderHost.PerFrameOpaqueNodes.Count; ++i) { //Only support opaque object for throwing shadows. var core = context.RenderHost.PerFrameOpaqueNodes[i]; if (core.RenderCore.IsThrowingShadow && core.TestViewFrustum(ref frustum)) { core.Render(context, deviceContext); } } context.IsShadowPass = false; context.BoundingFrustum = orgFrustum; context.RenderHost.SetDefaultRenderTargets(false); context.SharedResource.ShadowView = viewResource; #endif }
private void UpdateTexture() { MipMapLevels = 0; if (cubeTexture != null) { cubeTextureRes.CreateView(cubeTexture); if (cubeTextureRes.TextureView != null && cubeTextureRes.TextureView.Description.Dimension == ShaderResourceViewDimension.TextureCube) { MipMapLevels = cubeTextureRes.TextureView.Description.TextureCube.MipLevels; } } else { cubeTextureRes.DisposeAndClear(); } }
/// <summary> /// Called when [attach]. /// </summary> /// <param name="technique">The technique.</param> /// <returns></returns> protected override bool OnAttach(IRenderTechnique technique) { if (base.OnAttach(technique)) { var buffer = Collect(new SkyDomeBufferModel()); buffer.Geometry = SphereMesh; GeometryBuffer = buffer; cubeTextureRes = Collect(new ShaderResourceViewProxy(Device)); if (cubeTexture != null) { cubeTextureRes.CreateView(cubeTexture, true); } textureSampler = Collect(technique.EffectsManager.StateManager.Register(SamplerDescription)); return(true); } else { return(false); } }
private void InitialParameters() { ssaoParam.Radius = radius; var rnd = new Random((int)Stopwatch.GetTimestamp()); var thres = Math.Cos(Math.PI / 2 - Math.PI / 12); for (var i = 0; i < 32; ++i) { while (true) { var x = rnd.NextFloat(-1, 1); var y = rnd.NextFloat(-1, 1); var z = rnd.NextFloat(1e-3f, 1); var v = Vector3.Normalize(new Vector3(x, y, z)); var angle = Vector3.Dot(v, Vector3.UnitZ); if (Vector3.Dot(v, Vector3.UnitZ) < thres) { continue; } var scale = i / 32f; scale = 0.1f + 0.9f * scale; v *= scale; kernels[i] = new Vector4(v.X, v.Y, v.Z, 0); break; } } var noise = new Vector3[4 * 4]; for (var i = 0; i < 16; ++i) { var x = rnd.NextFloat(-1, 1); var y = rnd.NextFloat(-1, 1); noise[i] = Vector3.Normalize(new Vector3(x, y, 0)); } ssaoNoiseView = ShaderResourceViewProxy .CreateView(Device, noise, 4, 4, global::SharpDX.DXGI.Format.R32G32B32_Float, true, false); }
/// <summary> /// Called when [attach]. /// </summary> /// <param name="technique">The technique.</param> /// <returns></returns> protected override bool OnAttach(IRenderTechnique technique) { if (base.OnAttach(technique)) { var buffer = Collect(new SkyBoxBufferModel()); buffer.Geometry = new PointGeometry3D() { Positions = BoxPositions }; buffer.Topology = PrimitiveTopology.TriangleList; GeometryBuffer = buffer; cubeTextureRes = Collect(new ShaderResourceViewProxy(Device)); if (cubeTexture != null) { cubeTextureRes.CreateView(cubeTexture, true); } textureSampler = Collect(technique.EffectsManager.StateManager.Register(SamplerDescription)); return(true); } else { return(false); } }
protected override void OnRender(RenderContext context, DeviceContextProxy deviceContext) { #region Initialize textures if (renderTargetFull == null || renderTargetDesc.Width != (int)(context.ActualWidth) || renderTargetDesc.Height != (int)(context.ActualHeight)) { depthdesc.Width = renderTargetDesc.Width = (int)(context.ActualWidth); depthdesc.Height = renderTargetDesc.Height = (int)(context.ActualHeight); RemoveAndDispose(ref renderTargetFull); RemoveAndDispose(ref depthStencilBuffer); renderTargetFull = Collect(new ShaderResourceViewProxy(deviceContext.DeviceContext.Device, renderTargetDesc)); renderTargetFull.CreateView(renderTargetViewDesc); renderTargetFull.CreateView(targetResourceViewDesc); depthStencilBuffer = Collect(new ShaderResourceViewProxy(deviceContext.DeviceContext.Device, depthdesc)); depthStencilBuffer.CreateView(depthStencilViewDesc); blurCore.Resize(deviceContext.DeviceContext.Device, renderTargetDesc.Width / downSamplingScale, renderTargetDesc.Height / downSamplingScale); //Skip this frame to avoid performance hit due to texture creation InvalidateRenderer(); return; } #endregion #region Render objects onto offscreen texture deviceContext.DeviceContext.ClearDepthStencilView(depthStencilBuffer, DepthStencilClearFlags.Stencil, 0, 0); BindTarget(depthStencilBuffer, renderTargetFull, deviceContext, renderTargetDesc.Width, renderTargetDesc.Height); context.IsCustomPass = true; bool hasMesh = false; for (int i = 0; i < context.RenderHost.PerFrameNodesWithPostEffect.Count; ++i) { IEffectAttributes effect; var mesh = context.RenderHost.PerFrameNodesWithPostEffect[i]; if (mesh.TryGetPostEffect(EffectName, out effect)) { object attribute; var color = Color; if (effect.TryGetAttribute(EffectAttributeNames.ColorAttributeName, out attribute) && attribute is string colorStr) { color = colorStr.ToColor4(); } if (modelStruct.Color != color) { modelStruct.Color = color; OnUploadPerModelConstantBuffers(deviceContext); } context.CustomPassName = DefaultPassNames.EffectOutlineP1; var pass = mesh.EffectTechnique[DefaultPassNames.EffectOutlineP1]; if (pass.IsNULL) { continue; } pass.BindShader(deviceContext); pass.BindStates(deviceContext, StateType.BlendState); deviceContext.SetDepthStencilState(pass.DepthStencilState, 1); mesh.Render(context, deviceContext); hasMesh = true; } } context.IsCustomPass = false; #endregion if (hasMesh) { deviceContext.DeviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleStrip; deviceContext.DeviceContext.PixelShader.SetSampler(samplerSlot, sampler); #region Do Blur Pass BindTarget(null, blurCore.CurrentRTV, deviceContext, blurCore.Width, blurCore.Height, true); blurPassVertical.GetShader(ShaderStage.Pixel).BindTexture(deviceContext, textureSlot, renderTargetFull); blurPassVertical.BindShader(deviceContext); blurPassVertical.BindStates(deviceContext, StateType.BlendState | StateType.RasterState | StateType.DepthStencilState); deviceContext.DeviceContext.Draw(4, 0); blurCore.Run(deviceContext, NumberOfBlurPass, 1, 0);//Already blur once on vertical, pass 1 as initial index. #endregion #region Draw back with stencil test BindTarget(depthStencilBuffer, renderTargetFull, deviceContext, renderTargetDesc.Width, renderTargetDesc.Height); screenQuadPass.GetShader(ShaderStage.Pixel).BindTexture(deviceContext, textureSlot, blurCore.CurrentSRV); screenQuadPass.BindShader(deviceContext); deviceContext.SetDepthStencilState(screenQuadPass.DepthStencilState, 0); screenQuadPass.BindStates(deviceContext, StateType.BlendState | StateType.RasterState); deviceContext.DeviceContext.Draw(4, 0); #endregion #region Draw outline onto original target context.RenderHost.SetDefaultRenderTargets(false); screenOutlinePass.GetShader(ShaderStage.Pixel).BindTexture(deviceContext, textureSlot, renderTargetFull); screenOutlinePass.BindShader(deviceContext); screenOutlinePass.BindStates(deviceContext, StateType.BlendState | StateType.RasterState | StateType.DepthStencilState); deviceContext.DeviceContext.Draw(4, 0); screenOutlinePass.GetShader(ShaderStage.Pixel).BindTexture(deviceContext, textureSlot, null); #endregion } else { context.RenderHost.SetDefaultRenderTargets(false); } }
private void CreateTextureView(System.IO.Stream stream, ShaderResourceViewProxy proxy) { proxy.CreateView(stream); }
public bool ProcessCursor(ref PointerInfo pointer, DeviceContextProxy context, out Vector4 rect) { var width = 0; var height = 0; var left = pointer.Position.X; var top = pointer.Position.Y; switch (pointer.ShapeInfo.Type) { case (int)OutputDuplicatePointerShapeType.Color: width = pointer.ShapeInfo.Width; height = pointer.ShapeInfo.Height; break; case (int)OutputDuplicatePointerShapeType.Monochrome: ProcessMonoMask(context, true, ref pointer, out width, out height, out left, out top); break; case (int)OutputDuplicatePointerShapeType.MaskedColor: ProcessMonoMask(context, false, ref pointer, out width, out height, out left, out top); break; default: rect = Vector4.Zero; //Invalid cursor type return(false); } rect = new Vector4(pointer.Position.X, pointer.Position.Y, width, height); var rowPitch = pointer.ShapeInfo.Type == (int)OutputDuplicatePointerShapeType.Color ? pointer.ShapeInfo.Pitch : width * BPP; var slicePitch = 0; if (pointerResource == null || currentType != pointer.ShapeInfo.Type || pointerTexDesc.Width != width || pointerTexDesc.Height != height) { RemoveAndDispose(ref pointerResource); pointerTexDesc.Width = width; pointerTexDesc.Height = height; currentType = pointer.ShapeInfo.Type; global::SharpDX.Utilities.Pin(pointer.ShapeInfo.Type == (int)OutputDuplicatePointerShapeType.Color ? pointer.PtrShapeBuffer : initBuffer, ptr => { pointerResource = new ShaderResourceViewProxy(context, new Texture2D(context, pointerTexDesc, new[] { new DataBox(ptr, rowPitch, slicePitch) })); }); pointerResource.CreateView(pointerSRVDesc); #if OUTPUTDETAIL Console.WriteLine("Create new cursor texture. Type = " + pointer.ShapeInfo.Type); #endif } else { var dataBox = context.MapSubresource(pointerResource.Resource, 0, global::SharpDX.Direct3D11.MapMode.WriteDiscard, global::SharpDX.Direct3D11.MapFlags.None); if (pointer.ShapeInfo.Type == (int)OutputDuplicatePointerShapeType.Color) { #if OUTPUTDETAIL Console.WriteLine("Reuse existing cursor texture for Color."); #endif unsafe { var row = pointer.ShapeInfo.Height; var sourceCounter = 0; var target32 = (byte *)dataBox.DataPointer; for (var i = 0; i < row; ++i) { var targetCounter = i * dataBox.RowPitch; for (var j = 0; j < pointer.ShapeInfo.Pitch; ++j) { target32[targetCounter++] = pointer.PtrShapeBuffer[sourceCounter++]; } } } } else { #if OUTPUTDETAIL Console.WriteLine("Reuse existing cursor texture for Mono and Mask."); #endif unsafe // Call unmanaged code { var target32 = (byte *)dataBox.DataPointer; for (var i = 0; i < initBuffer.Length; ++i) { target32[i] = initBuffer[i]; } } } context.UnmapSubresource(pointerResource.Resource, 0); } return(true); }
/// <summary> /// Initializes a new instance of the <see cref="SharedTextureResourceProxy"/> class. /// </summary> /// <param name="device">The device.</param> /// <param name="stream">The stream.</param> public SharedTextureResourceProxy(Device device, Stream stream) { resource = Collect(new ShaderResourceViewProxy(device)); resource.CreateView(stream); }