/// <summary> /// The InitAsConstantBuffer /// </summary> /// <param name="register">The <see cref="int"/></param> /// <param name="visibility">The <see cref="ShaderVisibility"/></param> public void InitAsConstantBuffer(int register, ShaderVisibility visibility = ShaderVisibility.All) { var cbuffer = new RootDescriptor1 { RegisterSpace = 0, ShaderRegister = register, Flags = RootDescriptorFlags.None }; Parameter = new RootParameter1(visibility, cbuffer, RootParameterType.ConstantBufferView); }
/// <summary> /// The InitAsBufferUAV /// </summary> /// <param name="register">The <see cref="int"/></param> /// <param name="visibility">The <see cref="ShaderVisibility"/></param> public void InitAsBufferUAV(int register, ShaderVisibility visibility = ShaderVisibility.All) { var buffer = new RootDescriptor1 { RegisterSpace = 0, ShaderRegister = register, Flags = RootDescriptorFlags.None }; Parameter = new RootParameter1(visibility, buffer, RootParameterType.UnorderedAccessView); }
/// <summary> /// Initializes a new instance of the <see cref="RootParameter"/> struct. /// </summary> /// <param name="rootDescriptor">The root descriptor.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <exception cref="System.ArgumentException">type</exception> public RootParameter1(ShaderVisibility visibility, RootDescriptor1 rootDescriptor, RootParameterType type) : this() { if(type == RootParameterType.Constant32Bits || type == RootParameterType.DescriptorTable) { throw new ArgumentException(string.Format("Cannot this type [{0}] for a RootDescriptor", type), "type"); } native.ParameterType = type; Descriptor = rootDescriptor; ShaderVisibility = visibility; }
/// <summary> /// Initializes a new instance of the <see cref="RootParameter"/> struct. /// </summary> /// <param name="rootDescriptor">The root descriptor.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <exception cref="System.ArgumentException">type</exception> public RootParameter1(ShaderVisibility visibility, RootDescriptor1 rootDescriptor, RootParameterType type) : this() { if (type == RootParameterType.Constant32Bits || type == RootParameterType.DescriptorTable) { throw new ArgumentException(string.Format("Cannot this type [{0}] for a RootDescriptor", type), "type"); } native.ParameterType = type; Descriptor = rootDescriptor; ShaderVisibility = visibility; }