Esempio n. 1
0
        protected override bool ResolveParameters(ProgramSet programSet)
        {
            //resolve parameter for normal texturing procedures
            bool isSuccess = base.ResolveParameters(programSet);

            if (isSuccess)
            {
                //resolve source modification parameters
                Program psProgram = programSet.CpuFragmentProgram;

                for (int i = this.textureBlends.Count - 1; i >= 0; i--)
                {
                    TextureBlend texBlend = this.textureBlends[i];
                    if ((texBlend.SourceModifier != SourceModifier.Invalid) &&
                        (texBlend.SourceModifier != SourceModifier.None))
                    {
                        texBlend.ModControlParam =
                            psProgram.ResolveAutoParameterInt(Graphics.GpuProgramParameters.AutoConstantType.Custom,
                                                              texBlend.CustomNum);
                        if (texBlend.ModControlParam == null)
                        {
                            isSuccess = false;
                            break;
                        }
                    }
                }
            }

            return(isSuccess);
        }
Esempio n. 2
0
        protected override bool ResolveParameters(ProgramSet programSet)
        {
            if (this.fogMode == FogMode.None)
            {
                return(true);
            }

            Program  vsProgram = programSet.CpuVertexProgram;
            Program  psProgram = programSet.CpuFragmentProgram;
            Function vsMain    = vsProgram.EntryPointFunction;
            Function psMain    = psProgram.EntryPointFunction;

            //Resolve world view matrix.
            this.worldViewProjMatrix =
                vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.WorldViewProjMatrix, 0);
            if (this.worldViewProjMatrix == null)
            {
                return(false);
            }

            //Resolve vertex shader input position
            this.vsInPos = vsMain.ResolveInputParameter(Parameter.SemanticType.Position, 0,
                                                        Parameter.ContentType.PositionObjectSpace,
                                                        GpuProgramParameters.GpuConstantType.Float4);
            if (this.vsInPos == null)
            {
                return(false);
            }

            //Resolve fog color
            this.fogColor = psProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                       GpuProgramParameters.GpuParamVariability.Global, "gFogColor");
            if (this.fogColor == null)
            {
                return(false);
            }

            //Resolve pixel shader output diffuse color
            this.psOutDiffuse = psMain.ResolveOutputParameter(Parameter.SemanticType.Color, 0,
                                                              Parameter.ContentType.ColorDiffuse,
                                                              GpuProgramParameters.GpuConstantType.Float4);
            if (this.psOutDiffuse == null)
            {
                return(false);
            }

            //Per pixel fog
            if (this.calcMode == CalcMode.PerPixel)
            {
                //Resolve fog params
                this.fogParams = psProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                            GpuProgramParameters.GpuParamVariability.Global, "gFogParams");
                if (this.fogParams == null)
                {
                    return(false);
                }

                //Resolve vertex shader output depth
                this.vsOutDepth = vsMain.ResolveOutputParameter(Parameter.SemanticType.TextureCoordinates, -1,
                                                                Parameter.ContentType.DepthViewSpace,
                                                                GpuProgramParameters.GpuConstantType.Float1);
                if (this.vsOutDepth == null)
                {
                    return(false);
                }

                //Resolve pixel shader input depth.
                this.psInDepth = psMain.ResolveInputParameter(Parameter.SemanticType.TextureCoordinates, this.vsOutDepth.Index,
                                                              this.vsOutDepth.Content,
                                                              GpuProgramParameters.GpuConstantType.Float1);
                if (this.psInDepth == null)
                {
                    return(false);
                }
            }
            //per vertex fog
            else
            {
                this.fogParams = vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                            GpuProgramParameters.GpuParamVariability.Global, "gFogParams");
                if (this.fogParams == null)
                {
                    return(false);
                }

                //Resolve vertex shader output fog factor
                this.vsOutFogFactor = vsMain.ResolveOutputParameter(Parameter.SemanticType.TextureCoordinates, -1,
                                                                    Parameter.ContentType.Unknown,
                                                                    GpuProgramParameters.GpuConstantType.Float1);
                if (this.vsOutFogFactor == null)
                {
                    return(false);
                }

                //Resolve pixel shader input fog factor
                this.psInFogFactor = psMain.ResolveInputParameter(Parameter.SemanticType.TextureCoordinates,
                                                                  this.vsOutFogFactor.Index, this.vsOutFogFactor.Content,
                                                                  GpuProgramParameters.GpuConstantType.Float1);
                if (this.psInFogFactor == null)
                {
                    return(false);
                }
            }


            return(true);
        }
Esempio n. 3
0
        protected override bool ResolveParameters(ProgramSet programSet)
        {
            Program  vsProgram = programSet.CpuVertexProgram;
            Function vsMain    = vsProgram.EntryPointFunction;

            //REsolve world view IT matrix
            this.worldViewITMatrix =
                vsProgram.ResolveAutoParameterInt(
                    GpuProgramParameters.AutoConstantType.InverseTransposeWorldViewMatrix, 0);
            if (this.worldViewITMatrix == null)
            {
                return(false);
            }

            //Get surface ambient color if need to
            if ((this.trackVertexColorType & TrackVertexColor.Ambient) == 0)
            {
                this.derivedAmbientLightColor =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.DerivedAmbientLightColor, 0);
                if (this.derivedAmbientLightColor == null)
                {
                    return(false);
                }
            }
            else
            {
                this.lightAmbientColor =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.AmbientLightColor, 0);
                if (this.lightAmbientColor == null)
                {
                    return(false);
                }

                this.surfaceAmbientColor =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.SurfaceAmbientColor, 0);
                if (this.surfaceAmbientColor == null)
                {
                    return(false);
                }
            }

            //Get surface diffuse color if need to.
            if ((this.trackVertexColorType & TrackVertexColor.Diffuse) == 0)
            {
                this.surfaceDiffuseColor =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.SurfaceDiffuseColor, 0);
                if (this.surfaceDiffuseColor == null)
                {
                    return(false);
                }
            }

            //Get surface specular color if need to
            if ((this.trackVertexColorType & TrackVertexColor.Specular) == 0)
            {
                this.surfaceSpecularColor =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.SurfaceSpecularColor, 0);
                if (this.surfaceSpecularColor == null)
                {
                    return(false);
                }
            }

            //Get surface emissive color if need to.
            if ((this.trackVertexColorType & TrackVertexColor.Emissive) == 0)
            {
                this.surfaceEmissiveCoilor =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.SurfaceEmissiveColor, 0);
                if (this.surfaceEmissiveCoilor == null)
                {
                    return(false);
                }
            }

            //Get derived scene color
            this.derivedSceneColor =
                vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.DerivedSceneColor, 0);
            if (this.derivedSceneColor == null)
            {
                return(false);
            }

            //get surface shininess
            this.surfaceShininess = vsProgram.ResolveAutoParameterInt(
                GpuProgramParameters.AutoConstantType.SurfaceShininess, 0);
            if (this.surfaceShininess == null)
            {
                return(false);
            }

            //Resolve input vertex shader normal
            this.vsInNormal = vsMain.ResolveInputParameter(Parameter.SemanticType.Normal, 0,
                                                           Parameter.ContentType.NormalObjectSpace,
                                                           GpuProgramParameters.GpuConstantType.Float3);
            if (this.vsInNormal == null)
            {
                return(false);
            }

            if (this.trackVertexColorType != 0)
            {
                this.vsDiffuse = vsMain.ResolveInputParameter(Parameter.SemanticType.Color, 0,
                                                              Parameter.ContentType.ColorDiffuse,
                                                              GpuProgramParameters.GpuConstantType.Float4);
                if (this.vsDiffuse == null)
                {
                    return(false);
                }
            }

            //Resolve output vertex shader diffuse color.
            this.vsOutDiffuse = vsMain.ResolveOutputParameter(Parameter.SemanticType.Color, 0,
                                                              Parameter.ContentType.ColorDiffuse,
                                                              GpuProgramParameters.GpuConstantType.Float4);
            if (this.vsOutDiffuse == null)
            {
                return(false);
            }

            //Resolve per light parameters
            for (int i = 0; i < this.lightParamsList.Count; i++)
            {
                switch (this.lightParamsList[i].Type)
                {
                case LightType.Directional:
                    this.lightParamsList[i].Direction =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                   GpuProgramParameters.GpuParamVariability.Lights,
                                                   "light_position_view_space");
                    if (this.lightParamsList[i].Direction == null)
                    {
                        return(false);
                    }
                    break;

                case LightType.Point:
                    this.worldViewMatrix =
                        vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.WorldViewMatrix, 0);
                    if (this.worldViewMatrix == null)
                    {
                        return(false);
                    }

                    this.vsInPosition = vsMain.ResolveInputParameter(Parameter.SemanticType.Position, 0,
                                                                     Parameter.ContentType.PositionObjectSpace,
                                                                     GpuProgramParameters.GpuConstantType.Float4);
                    if (this.vsInPosition == null)
                    {
                        return(false);
                    }

                    this.lightParamsList[i].Position =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                   GpuProgramParameters.GpuParamVariability.Lights,
                                                   "light_position_view_space");
                    if (this.lightParamsList[i].Position == null)
                    {
                        return(false);
                    }

                    this.lightParamsList[i].AttenuatParams =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                   GpuProgramParameters.GpuParamVariability.Lights,
                                                   "light_attenuation");
                    if (this.lightParamsList[i].AttenuatParams == null)
                    {
                        return(false);
                    }
                    break;

                case LightType.Spotlight:
                    this.worldViewMatrix =
                        vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.WorldViewMatrix, 0);
                    if (this.worldViewMatrix == null)
                    {
                        return(false);
                    }

                    this.vsInPosition = vsMain.ResolveInputParameter(Parameter.SemanticType.Position, 0,
                                                                     Parameter.ContentType.PositionObjectSpace,
                                                                     GpuProgramParameters.GpuConstantType.Float4);
                    if (this.vsInPosition == null)
                    {
                        return(false);
                    }

                    this.lightParamsList[i].Position =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                   GpuProgramParameters.GpuParamVariability.Lights,
                                                   "light_position_view_space");
                    if (this.lightParamsList[i].Position == null)
                    {
                        return(false);
                    }


                    this.lightParamsList[i].Direction =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                   GpuProgramParameters.GpuParamVariability.Lights,
                                                   "light_direction_view_space");
                    if (this.lightParamsList[i].Direction == null)
                    {
                        return(false);
                    }

                    this.lightParamsList[i].AttenuatParams =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                   GpuProgramParameters.GpuParamVariability.Lights,
                                                   "light_attenuation");
                    if (this.lightParamsList[i].AttenuatParams == null)
                    {
                        return(false);
                    }

                    this.lightParamsList[i].SpotParams =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float3, -1,
                                                   GpuProgramParameters.GpuParamVariability.Lights,
                                                   "spotlight_params");
                    if (this.lightParamsList[i].SpotParams == null)
                    {
                        return(false);
                    }

                    break;
                }

                //Resolve diffuse color
                if ((this.trackVertexColorType & TrackVertexColor.Diffuse) == 0)
                {
                    this.lightParamsList[i].DiffuseColor =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                   GpuProgramParameters.GpuParamVariability.Global |
                                                   GpuProgramParameters.GpuParamVariability.Lights,
                                                   "derived_light_diffuse");
                    if (this.lightParamsList[i].DiffuseColor == null)
                    {
                        return(false);
                    }
                }
                else
                {
                    this.lightParamsList[i].DiffuseColor =
                        vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                   GpuProgramParameters.GpuParamVariability.Lights, "light_diffuse");
                    if (this.lightParamsList[i].DiffuseColor == null)
                    {
                        return(false);
                    }
                }

                if (this.specularEnable)
                {
                    //Resolve specular color
                    if ((this.trackVertexColorType & TrackVertexColor.Specular) == 0)
                    {
                        this.lightParamsList[i].SpecularColor =
                            vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                       GpuProgramParameters.GpuParamVariability.Global |
                                                       GpuProgramParameters.GpuParamVariability.Lights,
                                                       "derived_light_specular");
                        if (this.lightParamsList[i].SpecularColor == null)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        this.lightParamsList[i].SpecularColor =
                            vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                       GpuProgramParameters.GpuParamVariability.Lights,
                                                       "light_specular");
                        if (this.lightParamsList[i].SpecularColor == null)
                        {
                            return(false);
                        }
                    }

                    if (this.vsOutSpecular == null)
                    {
                        this.vsOutSpecular = vsMain.ResolveOutputParameter(Parameter.SemanticType.Color, 1,
                                                                           Parameter.ContentType.ColorSpecular,
                                                                           GpuProgramParameters.GpuConstantType.Float4);
                        if (this.vsOutSpecular == null)
                        {
                            return(false);
                        }
                    }

                    if (this.vsInPosition == null)
                    {
                        this.vsInPosition = vsMain.ResolveInputParameter(Parameter.SemanticType.Position, 0,
                                                                         Parameter.ContentType.PositionObjectSpace,
                                                                         GpuProgramParameters.GpuConstantType.Float4);
                        if (this.vsInPosition == null)
                        {
                            return(false);
                        }
                    }

                    if (this.worldViewMatrix == null)
                    {
                        this.worldViewMatrix =
                            vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.WorldViewMatrix, 0);
                        if (this.worldViewMatrix == null)
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Esempio n. 4
0
        protected override bool ResolveParameters(ProgramSet programSet)
        {
            Program  vsProgram = programSet.CpuVertexProgram;
            Program  psProgram = programSet.CpuFragmentProgram;
            Function vsMain    = vsProgram.EntryPointFunction;
            Function psMain    = psProgram.EntryPointFunction;

            //Get input position parameter
            this.vsInPos = Function.GetParameterBySemantic(vsMain.InputParameters, Parameter.SemanticType.Position, 0);
            if (this.vsInPos == null)
            {
                return(false);
            }

            //Get output position parameter
            this.vsOutPos = Function.GetParameterBySemantic(vsMain.OutputParameters, Parameter.SemanticType.Position, 0);
            if (this.vsOutPos == null)
            {
                return(false);
            }

            //Resolve vertex shader output depth.
            this.vsOutDepth = vsMain.ResolveOutputParameter(Parameter.SemanticType.TextureCoordinates, -1,
                                                            Parameter.ContentType.DepthViewSpace,
                                                            GpuProgramParameters.GpuConstantType.Float1);
            if (this.vsOutDepth == null)
            {
                return(false);
            }

            //Resolve input depth parameter.
            this.psInDepth = psMain.ResolveInputParameter(Parameter.SemanticType.TextureCoordinates, this.vsOutDepth.Index,
                                                          this.vsOutDepth.Content, GpuProgramParameters.GpuConstantType.Float1);
            if (this.psInDepth == null)
            {
                return(false);
            }

            //Get in/local specular paramter
            this.psSpecular = Function.GetParameterBySemantic(psMain.InputParameters, Parameter.SemanticType.Color, 1);
            if (this.psSpecular == null)
            {
                this.psSpecular = Function.GetParameterBySemantic(psMain.LocalParameters, Parameter.SemanticType.Color, 1);
                if (this.psSpecular == null)
                {
                    return(false);
                }
            }
            //Resolve computed local shadow color parameter.
            this.psLocalShadowFactor = psMain.ResolveLocalParameter(Parameter.SemanticType.Unknown, 0, "lShadowFactor",
                                                                    GpuProgramParameters.GpuConstantType.Float1);
            if (this.psLocalShadowFactor == null)
            {
                return(false);
            }

            //Resolve computed local shadow color parameter
            this.psSplitPoints = psProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                            GpuProgramParameters.GpuParamVariability.Global,
                                                            "pssm_split_points");
            if (this.psSplitPoints == null)
            {
                return(false);
            }

            //Get derived scene color
            this.psDerivedSceneColor =
                psProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.DerivedSceneColor, 0);
            if (this.psDerivedSceneColor == null)
            {
                return(false);
            }

            int lightIndex = 0;

            foreach (var it in this.shadowTextureParamsList)
            {
                it.WorldViewProjMatrix = vsProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Matrix_4X4, -1,
                                                                    GpuProgramParameters.GpuParamVariability.PerObject,
                                                                    "world_texture_view_proj");
                if (it.WorldViewProjMatrix == null)
                {
                    return(false);
                }

                Parameter.ContentType lightSpace = Parameter.ContentType.PositionLightSpace0;

                switch (lightIndex)
                {
                case 1:
                    lightSpace = Parameter.ContentType.PositionLightSpace1;
                    break;

                case 2:
                    lightSpace = Parameter.ContentType.PositionLightSpace2;
                    break;

                case 3:
                    lightSpace = Parameter.ContentType.PositionLightSpace3;
                    break;

                case 4:
                    lightSpace = Parameter.ContentType.PositionLightSpace4;
                    break;

                case 5:
                    lightSpace = Parameter.ContentType.PositionLightSpace5;
                    break;

                case 6:
                    lightSpace = Parameter.ContentType.PositionLightSpace6;
                    break;

                case 7:
                    lightSpace = Parameter.ContentType.PositionLightSpace7;
                    break;
                }

                it.VSOutLightPosition = vsMain.ResolveOutputParameter(Parameter.SemanticType.TextureCoordinates, -1,
                                                                      lightSpace,
                                                                      GpuProgramParameters.GpuConstantType.Float4);
                if (it.VSOutLightPosition == null)
                {
                    return(false);
                }

                it.PSInLightPosition = psMain.ResolveInputParameter(Parameter.SemanticType.TextureCoordinates,
                                                                    it.VSOutLightPosition.Index,
                                                                    it.VSOutLightPosition.Content,
                                                                    GpuProgramParameters.GpuConstantType.Float4);
                if (it.PSInLightPosition == null)
                {
                    return(false);
                }

                it.TextureSampler = psProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Sampler2D,
                                                               it.TextureSamplerIndex,
                                                               GpuProgramParameters.GpuParamVariability.Global,
                                                               "shadow_map");
                if (it.TextureSampler == null)
                {
                    return(false);
                }

                it.InvTextureSize = psProgram.ResolveParameter(GpuProgramParameters.GpuConstantType.Float4, -1,
                                                               GpuProgramParameters.GpuParamVariability.Global,
                                                               "inv_shadow_texture_size");
                if (it.InvTextureSize == null)
                {
                    return(false);
                }

                lightIndex++;
            }

            return(true);
        }
Esempio n. 5
0
        internal override bool ResolveParameters(ProgramSet programSet)
        {
            Program  vsProgram = programSet.CpuVertexProgram;
            Function vsMain    = vsProgram.EntryPointFunction;

            //if needed mark this vertex program as hardware skinned
            if (DoBoneCalculations)
            {
                vsProgram.SkeletalAnimationIncluded = true;
            }

            //get the parameters we need whther we are doing bone calculations or not

            //note in order t be consistent we will always output position, normal,
            //tangent, and binormal in both object and world space. And output position
            //in projective space to cover the responsibility of the transform stage

            //input param
            paramInPosition = vsMain.ResolveInputParameter(Parameter.SemanticType.Position, 0,
                                                           Parameter.ContentType.PositionObjectSpace,
                                                           Graphics.GpuProgramParameters.GpuConstantType.Float4);
            paramInNormal = vsMain.ResolveInputParameter(Parameter.SemanticType.Normal, 0,
                                                         Parameter.ContentType.NormalObjectSpace,
                                                         Graphics.GpuProgramParameters.GpuConstantType.Float3);
            paramInBiNormal = vsMain.ResolveInputParameter(Parameter.SemanticType.Binormal, 0,
                                                           Parameter.ContentType.BinormalObjectSpace,
                                                           Graphics.GpuProgramParameters.GpuConstantType.Float3);
            paramInTangent = vsMain.ResolveInputParameter(Parameter.SemanticType.Tangent, 0,
                                                          Parameter.ContentType.TangentObjectSpace,
                                                          Graphics.GpuProgramParameters.GpuConstantType.Float3);

            //local param
            paramLocalPositionWorld = vsMain.ResolveLocalParameter(Parameter.SemanticType.Position, 0,
                                                                   Parameter.ContentType.PositionWorldSpace,
                                                                   Graphics.GpuProgramParameters.GpuConstantType.Float4);
            paramLocalNormalWorld = vsMain.ResolveLocalParameter(Parameter.SemanticType.Normal, 0,
                                                                 Parameter.ContentType.NormalWorldSpace,
                                                                 Graphics.GpuProgramParameters.GpuConstantType.Float3);
            paramLocalTangentWorld = vsMain.ResolveLocalParameter(Parameter.SemanticType.Tangent, 0,
                                                                  Parameter.ContentType.TangentWorldSpace,
                                                                  Graphics.GpuProgramParameters.GpuConstantType.Float3);
            paramLocalBiNormalWorld = vsMain.ResolveLocalParameter(Parameter.SemanticType.Binormal, 0,
                                                                   Parameter.ContentType.BinormalWorldSpace,
                                                                   Graphics.GpuProgramParameters.GpuConstantType.Float3);

            //output param
            paramOutPositionProj = vsMain.ResolveOutputParameter(Parameter.SemanticType.Position, 0,
                                                                 Parameter.ContentType.PositionProjectiveSpace,
                                                                 Graphics.GpuProgramParameters.GpuConstantType.Float4);

            //check if parameter retrieval went well
            bool isValid =
                (paramInPosition != null &&
                 paramInNormal != null &&
                 paramInBiNormal != null &&
                 paramInTangent != null &&
                 paramLocalPositionWorld != null &&
                 paramLocalNormalWorld != null &&
                 paramLocalTangentWorld != null &&
                 paramLocalBiNormalWorld != null &&
                 paramOutPositionProj != null);

            if (doBoneCalculations)
            {
                GpuProgramParameters.AutoConstantType worldMatrixType =
                    GpuProgramParameters.AutoConstantType.WorldMatrixArray3x4;

                if (ShaderGenerator.Instance.TargetLangauge == "hlsl")
                {
                    //given that hlsl shaders use column major matrices which are not compatible with the cg
                    //and glsl method of row major matrices, we will use a full matrix instead
                    worldMatrixType = GpuProgramParameters.AutoConstantType.WorldMatrixArray;
                }

                //input parameters
                paramInNormal = vsMain.ResolveInputParameter(Parameter.SemanticType.Normal, 0,
                                                             Parameter.ContentType.NormalObjectSpace,
                                                             GpuProgramParameters.GpuConstantType.Float3);
                paramInBiNormal = vsMain.ResolveInputParameter(Parameter.SemanticType.Binormal, 0,
                                                               Parameter.ContentType.BinormalObjectSpace,
                                                               GpuProgramParameters.GpuConstantType.Float3);
                paramInTangent = vsMain.ResolveInputParameter(Parameter.SemanticType.Tangent, 0,
                                                              Parameter.ContentType.TangentObjectSpace,
                                                              GpuProgramParameters.GpuConstantType.Float3);
                paramInIndices = vsMain.ResolveInputParameter(Parameter.SemanticType.BlendIndicies, 0,
                                                              Parameter.ContentType.Unknown,
                                                              GpuProgramParameters.GpuConstantType.Float4);
                paramInWeights = vsMain.ResolveInputParameter(Parameter.SemanticType.BlendWeights, 0,
                                                              Parameter.ContentType.Unknown,
                                                              GpuProgramParameters.GpuConstantType.Float4);
                paramInWorldMatrices  = vsProgram.ResolveAutoParameterInt(worldMatrixType, 0, boneCount);
                paramInInvWorldMatrix =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.InverseWorldMatrix, 0);
                paramInViewProjMatrix =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.ViewProjMatrix, 0);

                paramTempFloat4 = vsMain.ResolveLocalParameter(Parameter.SemanticType.Unknown, -1, "TempVal4",
                                                               GpuProgramParameters.GpuConstantType.Float3);
                paramTempFloat3 = vsMain.ResolveLocalParameter(Parameter.SemanticType.Unknown, -1, "TempVal3",
                                                               GpuProgramParameters.GpuConstantType.Float3);

                //check if parameter retrival went well
                isValid &=
                    (paramInIndices != null &&
                     paramInWeights != null &&
                     paramInWorldMatrices != null &&
                     paramInViewProjMatrix != null &&
                     paramInInvWorldMatrix != null &&
                     paramTempFloat4 != null &&
                     paramTempFloat3 != null);
            }
            else
            {
                paramInWorldMatrices =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.WorldMatrix, 0);
                paramInWorldViewProjMatrix =
                    vsProgram.ResolveAutoParameterInt(GpuProgramParameters.AutoConstantType.WorldViewProjMatrix, 0);

                //check if parameter retrieval went well
                isValid &=
                    (paramInWorldMatrix != null &&
                     paramInWorldViewProjMatrix != null);
            }

            return(isValid);
        }