Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        /// <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;
        }
Esempio n. 4
0
        /// <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;
        }