コード例 #1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            if (ConstantBuffers.Any())
            {
                sb.AppendLine("// Buffer Definitions: ");
                sb.AppendLine("//");

                foreach (var constantBuffer in ConstantBuffers)
                {
                    sb.Append(constantBuffer);
                }

                sb.AppendLine("//");
            }

            if (ResourceBindings.Any())
            {
                sb.AppendLine("// Resource Bindings:");
                sb.AppendLine("//");
                sb.AppendLine("// Name                                 Type  Format         Dim Slot Elements");
                sb.AppendLine("// ------------------------------ ---------- ------- ----------- ---- --------");

                foreach (var resourceBinding in ResourceBindings)
                {
                    sb.AppendLine(resourceBinding.ToString());
                }

                sb.AppendLine("//");
                sb.AppendLine("//");
            }

            return(sb.ToString());
        }
コード例 #2
0
        public VertexShader(string filename, params IShaderResourceBinding[] otherBindings)
            : base(ShaderType.Vertex, filename, otherBindings)
        {
            InstanceDataBinding = null;
            ViewProjMatBinding  = null;

            this.InputBindings = ResourceBindings.OfType <VertexInputBinding>().ToArray();
            if (InputBindings.Length > MAX_VS_INPUT_BINDINGS)
            {
                throw new ArgumentException("Can not specify more than " + MAX_VS_INPUT_BINDINGS + " vertex input bindings.", "otherBindings");
            }

            this.NumInputSlots = InputBindings.Any() ? InputBindings.Max(bind => bind.SlotIndex) + 1U : 0U;
            if (NumInputSlots > MAX_VS_INPUT_BINDINGS)
            {
                throw new ArgumentException("Can not set more than " + MAX_VS_INPUT_BINDINGS + " input slots.");
            }
        }
コード例 #3
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            if (ConstantBuffers.Any())
            {
                sb.AppendLine("// Buffer Definitions: ");
                sb.AppendLine("//");

                foreach (var constantBuffer in ConstantBuffers)
                {
                    sb.Append(constantBuffer);
                }

                sb.AppendLine("//");
            }

            if (ResourceBindings.Any())
            {
                sb.AppendLine("// Resource Bindings:");
                sb.AppendLine("//");
                if (!Target.IsSM51)
                {
                    sb.AppendLine("// Name                                 Type  Format         Dim      HLSL Bind  Count");
                    sb.AppendLine("// ------------------------------ ---------- ------- ----------- -------------- ------");
                }
                else
                {
                    sb.AppendLine("// Name                                 Type  Format         Dim      ID      HLSL Bind  Count");
                    sb.AppendLine("// ------------------------------ ---------- ------- ----------- ------- -------------- ------");
                }
                foreach (var resourceBinding in ResourceBindings)
                {
                    sb.AppendLine(resourceBinding.ToString());
                }

                sb.AppendLine("//");
                sb.AppendLine("//");
            }

            return(sb.ToString());
        }