Welcome, Guest! Log In | Create Account

Changeset 1908

Show
Ignore:
Timestamp:
11/18/09 22:13:16 (3 months ago)
Author:
borrillis
Message:

- UnifiedHighLevelGpuProgram?

  • lots wrong here, works now.

- CellShading? demo

  • Now uses Unified programs to delegate to HLSL or CG + Added CellShading? HLSL program
  • demo now runs under all three renderers
Location:
trunk
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/Media/Materials/CelShading.material

    r448 r1908  
    1 vertex_program Ogre/CelShadingVP cg 
     1vertex_program Ogre/CelShadingCG_vp cg 
    22{ 
    33        source Example_CelShading.cg 
    44        entry_point main_vp 
    55        profiles vs_1_1 arbvp1 
     6} 
    67 
     8fragment_program Ogre/CelShadingCG_fp cg 
     9{ 
     10        source Example_CelShading.cg 
     11        entry_point main_fp 
     12        profiles ps_1_1 arbfp1 fp20 
     13} 
     14 
     15vertex_program Ogre/CelShadingHLSL_vp hlsl 
     16{ 
     17        source Example_CelShading.hlsl 
     18        entry_point main_vp 
     19        target vs_1_1 arbvp1 
     20} 
     21 
     22fragment_program Ogre/CelShadingHLSL_fp hlsl 
     23{ 
     24        source Example_CelShading.hlsl 
     25        entry_point main_fp 
     26        target ps_2_0 
     27} 
     28 
     29vertex_program Ogre/CelShadingVP unified 
     30{ 
     31        delegate Ogre/CelShadingHLSL_vp 
     32        delegate Ogre/CelShadingCG_vp 
    733        default_params 
    834        { 
     
    1137                param_named_auto worldViewProj worldviewproj_matrix 
    1238                param_named shininess float 10  
    13         } 
     39        }        
    1440} 
    1541 
    16 fragment_program Ogre/CelShadingFP cg 
     42fragment_program Ogre/CelShadingFP unified 
    1743{ 
    18         source Example_CelShading.cg 
    19         entry_point main_fp 
    20         profiles ps_1_1 arbfp1 fp20 
     44        delegate Ogre/CelShadingHLSL_fp 
     45        delegate Ogre/CelShadingCG_fp 
    2146} 
    22  
    2347 
    2448material Examples/CelShading 
     
    6185                        } 
    6286                } 
     87 
    6388        } 
    6489         
  • trunk/Projects/Axiom/Engine/Graphics/UnifiedHighLevelGpuProgram.cs

    r1663 r1908  
    7272                private List<String> _delegateNames = new List<string>(); 
    7373 
    74                 private HighLevelGpuProgram _chosenDelgate; 
     74                private HighLevelGpuProgram _chosenDelegate; 
    7575                public HighLevelGpuProgram Delegate 
    7676                { 
    7777                        get 
    7878                        { 
    79                                 if ( _chosenDelgate == null ) 
     79                                if ( _chosenDelegate == null ) 
    8080                                        chooseDelegate(); 
    81                                 return _chosenDelgate; 
     81                                return _chosenDelegate; 
    8282                        } 
    8383                } 
     
    104104                protected virtual void chooseDelegate() 
    105105                { 
    106                         _chosenDelgate = null; 
     106                        _chosenDelegate = null; 
    107107                        foreach ( string delegateName in _delegateNames ) 
    108108                        { 
    109                                 HighLevelGpuProgram program = HighLevelGpuProgramManager.Instance[ delegateName ]; 
    110                                 if ( program != null && program.IsSupported ) 
    111                                 { 
    112                                         _chosenDelgate = program; 
    113                                         break; 
    114                                 } 
     109                HighLevelGpuProgram program = HighLevelGpuProgramManager.Instance[ delegateName ]; 
     110                if ( program != null && program.IsSupported ) 
     111                { 
     112                    _chosenDelegate = program; 
     113                    break; 
     114                } 
    115115                        } 
    116116                } 
     
    131131                        _delegateNames.Add( delegateName ); 
    132132                        // Invalidate current selection 
    133                         _chosenDelgate = null; 
     133                        _chosenDelegate = null; 
    134134                } 
    135135 
     
    141141                        _delegateNames.Clear(); 
    142142                        // Invalidate current selection 
    143                         _chosenDelgate = null; 
     143                        _chosenDelegate = null; 
    144144                } 
    145145 
     
    152152                        get 
    153153                        { 
    154                                 if ( _chosenDelgate != null ) 
    155                                 { 
    156                                         return _chosenDelgate.BindingDelegate; 
     154                                if ( Delegate != null ) 
     155                                { 
     156                                        return Delegate.BindingDelegate; 
    157157                                } 
    158158 
     
    165165                        get 
    166166                        { 
    167                                 if ( _chosenDelgate != null ) 
    168                                 { 
    169                                         return _chosenDelgate.IsMorphAnimationIncluded; 
     167                                if ( Delegate != null ) 
     168                                { 
     169                                        return Delegate.IsMorphAnimationIncluded; 
    170170                                } 
    171171 
     
    174174                        set 
    175175                        { 
    176                                 if ( _chosenDelgate != null ) 
    177                                         _chosenDelgate.IsMorphAnimationIncluded = value; 
     176                                if ( Delegate != null ) 
     177                                        Delegate.IsMorphAnimationIncluded = value; 
    178178                        } 
    179179                } 
     
    183183                        get 
    184184                        { 
    185                                 if ( _chosenDelgate != null ) 
    186                                 { 
    187                                         return _chosenDelgate.IsSkeletalAnimationIncluded; 
     185                                if ( Delegate != null ) 
     186                                { 
     187                                        return Delegate.IsSkeletalAnimationIncluded; 
    188188                                } 
    189189                                return false; 
     
    191191                        set 
    192192                        { 
    193                                 if ( _chosenDelgate != null ) 
    194                                         _chosenDelgate.IsSkeletalAnimationIncluded = value; 
     193                                if ( Delegate != null ) 
     194                                        Delegate.IsSkeletalAnimationIncluded = value; 
    195195                        } 
    196196                } 
     
    200200                        get 
    201201                        { 
    202                                 if ( _chosenDelgate != null ) 
    203                                 { 
    204                                         return _chosenDelgate.PoseAnimationCount; 
     202                                if ( Delegate != null ) 
     203                                { 
     204                                        return Delegate.PoseAnimationCount; 
    205205                                } 
    206206                                return 0; 
     
    208208                        set 
    209209                        { 
    210                                 if ( _chosenDelgate != null ) 
    211                                         _chosenDelgate.PoseAnimationCount = value; 
     210                                if ( Delegate != null ) 
     211                                        Delegate.PoseAnimationCount = value; 
    212212                        } 
    213213                } 
     
    217217                        get 
    218218                        { 
    219                                 return _chosenDelgate != null; 
     219                                return Delegate != null; 
    220220                        } 
    221221                } 
     
    225225                        get 
    226226                        { 
    227                                 if ( _chosenDelgate != null ) 
    228                                 { 
    229                                         return _chosenDelgate.PassSurfaceAndLightStates; 
     227                                if ( Delegate != null ) 
     228                                { 
     229                                        return Delegate.PassSurfaceAndLightStates; 
    230230                                } 
    231231                                return false; 
     
    233233                        set 
    234234                        { 
    235                                 if ( _chosenDelgate != null ) 
    236                                         _chosenDelgate.PassSurfaceAndLightStates = value; 
    237                         } 
    238                 } 
     235                                if ( Delegate != null ) 
     236                                        Delegate.PassSurfaceAndLightStates = value; 
     237                        } 
     238                } 
     239 
     240        public override bool HasDefaultParameters 
     241        { 
     242            get 
     243            { 
     244                if ( Delegate != null ) 
     245                { 
     246                    return Delegate.HasDefaultParameters; 
     247                } 
     248                return false; 
     249            } 
     250        } 
     251 
     252        public override GpuProgramParameters DefaultParameters 
     253        { 
     254            get 
     255            { 
     256                if ( Delegate != null ) 
     257                { 
     258                    return Delegate.DefaultParameters; 
     259                } 
     260                return null; 
     261            } 
     262        } 
    239263 
    240264                public override GpuProgramParameters CreateParameters() 
     
    253277                } 
    254278 
    255                 protected override void CreateLowLevelImpl() 
     279        public override bool SetParam( string name, string val ) 
     280        { 
     281            switch ( name ) 
     282            { 
     283                case "delegate": 
     284                    AddDelegateProgram( val ); 
     285                    return true; 
     286                    break; 
     287            } 
     288            return false; 
     289        } 
     290 
     291        public override void Load( bool background ) 
     292        { 
     293            if ( Delegate != null ) 
     294                Delegate.Load( background ); 
     295        } 
     296 
     297        protected override void CreateLowLevelImpl() 
    256298                { 
    257299                        throw new Exception( "The method or operation is not implemented." ); 
     
    268310                } 
    269311 
    270                 public override bool SetParam( string name, string val ) 
    271                 { 
    272                         switch ( name ) 
    273                         { 
    274                                 case "delegate": 
    275                                         AddDelegateProgram( val ); 
    276                                         return true; 
    277                                         break; 
    278                         } 
    279                         return false; 
    280                 } 
    281  
    282312                protected override void LoadFromSource() 
    283313                { 
     
    289319                        get 
    290320                        { 
    291                                 if ( _chosenDelgate != null ) 
    292                                 { 
    293                                         return _chosenDelgate.SamplerCount; 
     321                                if ( Delegate != null ) 
     322                                { 
     323                                        return Delegate.SamplerCount; 
    294324                                } 
    295325                                return 0; 
  • trunk/Projects/AxiomDemos/Source/Browser/WinForm/Axiom.Demos.Browser.WinForm.csproj

    r1895 r1908  
    105105      <SubType>Code</SubType> 
    106106    </Compile> 
     107    <None Include="..\..\..\..\..\Media\GpuPrograms\Example_CelShading.hlsl"> 
     108      <Link>Media\GpuPrograms\Example_CelShading.hlsl</Link> 
     109      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     110    </None> 
    107111    <None Include="..\..\..\..\..\Media\Materials\Example.particle"> 
    108112      <Link>Media\Materials\Example.particle</Link> 
     
    602606    <None Include="..\..\..\..\..\Media\Materials\Glass.material"> 
    603607      <Link>Media\Materials\Glass.material</Link> 
    604       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
    605     </None> 
    606     <None Include="..\..\..\..\..\Media\Materials\hdr.material"> 
    607       <Link>Media\Materials\hdr.material</Link> 
    608608      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
    609609    </None>