示例#1
0
 public CHullShader(ICDevice device, CShaderReflection reflection)
     : base(device, reflection)
 {
     domain = reflection.GetTesselationDomain();
     partitioning = reflection.GetTesselationPartitioning();
     outputTopology = reflection.GetTesselationOutputTopology();
     outputControlPoints = reflection.GetOutputControlPoints();
     maxTesselationFactor = reflection.GetMaxTesselationFactor();
 }
示例#2
0
        public CHullShader(ICDevice device, CShaderReflection reflection)
            : base(device, reflection)
        {
            Profile = ParseProfile(reflection.Profile);
            Domain = reflection.GetTesselationDomain();
            Partitioning = reflection.GetTesselationPartitioning();
            OutputTopology = reflection.GetTesselationOutputTopology();
            InputControlPoints = reflection.GetInputControlPoints();
            OutputControlPoints = reflection.GetOutputControlPoints();
            MaxTesselationFactor = reflection.GetMaxTesselationFactor();

            var text = GenerateText<CHullShader>(WriteIOAndCode);
            CompilationResult bytecode;
            try
            {
                bytecode = ShaderBytecode.Compile(text, "main", ProfileToString(Profile),
                    ShaderFlags.PackMatrixColumnMajor | ShaderFlags.OptimizationLevel3, EffectFlags.None, Name);
            }
            catch (Exception e)
            {
                throw new ArgumentException(string.Format("Failed to compile a hull shader '{0}'\r\n--- Code ---\r\n{1}\r\n--- Errors ---\r\n{2}", Name, text, e.Message), e);
            }
            D3DHullShader = new HullShader(device.D3DDevice, bytecode);
        }