private void UpdateTexture(EvaluationContext context) { Size2 size = Size.GetValue(context); if (size.Height <= 0 || size.Width <= 0) { Log.Warning($"Requested invalid texture resolution: {size}"); return; } var texDesc = new Texture2DDescription { Width = size.Width, Height = size.Height, MipLevels = MipLevels.GetValue(context), ArraySize = ArraySize.GetValue(context), Format = Format.GetValue(context), //SampleDescription = SampleDescription.GetValue(context), SampleDescription = new SampleDescription(1, 0), Usage = ResourceUsage.GetValue(context), BindFlags = BindFlags.GetValue(context), CpuAccessFlags = CpuAccessFlags.GetValue(context), OptionFlags = ResourceOptionFlags.GetValue(context) }; try { ResourceManager.Instance().CreateTexture2d(texDesc, "Texture2D", ref _textureResId, ref Texture.Value); } catch (Exception e) { Log.Error($"Failed to create Texture2D: {e.Message}", SymbolChildId); } //ResourceManager.Instance().id .TestId = _textureResId; }
private void UpdateTexture(EvaluationContext context) { Int3 size = Size.GetValue(context); if (size.X < 1 || size.Y < 1 || size.Z < 1) { Log.Warning($"Requested invalid texture resolution: {size}"); return; } var texDesc = new Texture3DDescription { Width = size.X, Height = size.Y, Depth = size.Z, MipLevels = MipLevels.GetValue(context), Format = Format.GetValue(context), Usage = ResourceUsage.GetValue(context), BindFlags = BindFlags.GetValue(context), CpuAccessFlags = CpuAccessFlags.GetValue(context), OptionFlags = ResourceOptionFlags.GetValue(context) }; var rm = ResourceManager.Instance(); rm.CreateTexture3d(texDesc, "Texture3D", ref _textureResId, ref OutputTexture.Value.Texture); if ((BindFlags.Value & SharpDX.Direct3D11.BindFlags.ShaderResource) > 0) rm.CreateShaderResourceView(_textureResId, "", ref OutputTexture.Value.Srv); if ((BindFlags.Value & SharpDX.Direct3D11.BindFlags.RenderTarget) > 0) rm.CreateRenderTargetView(_textureResId, "", ref OutputTexture.Value.Rtv); if ((BindFlags.Value & SharpDX.Direct3D11.BindFlags.UnorderedAccess) > 0) rm.CreateUnorderedAccessView(_textureResId, "", ref OutputTexture.Value.Uav); }