示例#1
0
        public CShaderSamplers GetSamplerBinder_PickedEditor(CRenderContext RHICtx, CShaderProgram shader)
        {
            if (shader == null)
            {
                return(null);
            }

            if (mSamplerBinder_PickedEditor == null)
            {
                mSamplerBinder_PickedEditor = new CShaderSamplers();
                using (var it = MtlInst.Material.GetSamplerStateDescs().GetEnumerator())
                {
                    while (it.MoveNext())
                    {
                        var name              = it.Current.Key;
                        var samplerDesc       = it.Current.Value;
                        CSamplerBindInfo info = new CSamplerBindInfo();
                        if (shader.FindSamplerBindInfoByShaderName(MtlInst, name, ref info))
                        {
                            CSamplerState SamplerState = CEngine.Instance.SamplerStateManager.GetSamplerState(RHICtx, samplerDesc);
                            mSamplerBinder_PickedEditor.PSBindSampler(info.PSBindPoint, SamplerState);
                        }
                        else
                        {
                            var defaultSamplerDesc = new CSamplerStateDesc();
                            defaultSamplerDesc.SetDefault();
                            CSamplerState SamplerState = CEngine.Instance.SamplerStateManager.GetSamplerState(RHICtx, defaultSamplerDesc);
                            mSamplerBinder_PickedEditor.PSBindSampler(info.PSBindPoint, SamplerState);
                        }
                    }
                }
            }
            return(mSamplerBinder_PickedEditor);
        }
示例#2
0
        protected override void OnCreated()
        {
            AddSRV("gEnvMap");

            var SamplerStatDesc = new CSamplerStateDesc();

            SamplerStatDesc.SetDefault();
            SamplerStatDesc.Filter = ESamplerFilter.SPF_MIN_MAG_MIP_LINEAR;
            SamplerStat            = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, SamplerStatDesc);
        }
示例#3
0
 protected override void OnCreated()
 {
     //AddSRV("gBaseSceneView");
     //AddSRV("gBloomTex");
     //mobile ao sampler state;
     {
         var SamplerDesc_MobileAo = new CSamplerStateDesc();
         SamplerDesc_MobileAo.SetDefault();
         SamplerDesc_MobileAo.Filter   = ESamplerFilter.SPF_MIN_MAG_LINEAR_MIP_POINT;
         SamplerDesc_MobileAo.AddressU = EAddressMode.ADM_CLAMP;
         SamplerDesc_MobileAo.AddressV = EAddressMode.ADM_CLAMP;
         SamplerDesc_MobileAo.AddressW = EAddressMode.ADM_CLAMP;
         mSampStat_MobileAo            = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, SamplerDesc_MobileAo);
     }
 }
示例#4
0
        public override void BindResources(Graphics.Mesh.CGfxMesh mesh, CPass pass)
        //, CConstantBuffer cbPerInstance, CShaderResources TexBinder, CShaderSamplers SamplerBinder, CShaderProgram Shader)
        {
            var TexBinder     = pass.ShaderResources;
            var SamplerBinder = pass.ShaderSamplerBinder;
            var Shader        = pass.GpuProgram;
            //up
            {
                if (Shader.FindTextureBindInfo(null, "gSrcTexUp", ref mTexBindInfo_SrcTexUp))
                {
                    TexBinder.PSBindTexture(mTexBindInfo_SrcTexUp.PSBindPoint, mSrcTexUp);
                }

                if (Shader.FindSamplerBindInfo(null, "Samp_gSrcTexUp", ref mSamplerBindInfo_SrcTexUp) == true)
                {
                    mSamplerStateDesc_SrcTexUp.SetDefault();
                    mSamplerStateDesc_SrcTexUp.Filter   = ESamplerFilter.SPF_MIN_MAG_MIP_LINEAR;
                    mSamplerStateDesc_SrcTexUp.AddressU = EAddressMode.ADM_CLAMP;
                    mSamplerStateDesc_SrcTexUp.AddressV = EAddressMode.ADM_CLAMP;

                    var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSamplerStateDesc_SrcTexUp);

                    SamplerBinder.PSBindSampler(mSamplerBindInfo_SrcTexUp.PSBindPoint, SamplerStat);
                }
            }

            //down
            {
                if (Shader.FindTextureBindInfo(null, "gSrcTexDown", ref mTexBindInfo_SrcTexDown))
                {
                    TexBinder.PSBindTexture(mTexBindInfo_SrcTexDown.PSBindPoint, mSrcTexDown);
                }

                if (Shader.FindSamplerBindInfo(null, "Samp_gSrcTexDown", ref mSamplerBindInfo_SrcTexDown) == true)
                {
                    mSamplerStateDesc_SrcTexDown.SetDefault();
                    mSamplerStateDesc_SrcTexDown.Filter   = ESamplerFilter.SPF_MIN_MAG_MIP_LINEAR;
                    mSamplerStateDesc_SrcTexDown.AddressU = EAddressMode.ADM_CLAMP;
                    mSamplerStateDesc_SrcTexDown.AddressV = EAddressMode.ADM_CLAMP;

                    var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSamplerStateDesc_SrcTexDown);

                    SamplerBinder.PSBindSampler(mSamplerBindInfo_SrcTexDown.PSBindPoint, SamplerStat);
                }
            }
        }
示例#5
0
        public CShaderSamplers GetSamplerBinder_Shadow(CRenderContext RHICtx, CShaderProgram shader)
        {
            if (shader == null)
            {
                return(null);
            }

            if (mSamplerBinder_Shadow == null)
            {
                mSamplerBinder_Shadow = new CShaderSamplers();
                //var SamplerDesc = new CSamplerStateDesc();
                //SamplerDesc.SetDefault();
                //for (UInt32 i = 0; i < shader.SamplerNumber; i++)
                //{
                //    CSamplerBindInfo info = new CSamplerBindInfo();
                //    shader.GetSamplerBindInfo(i, ref info);
                //    MtlInst.GetSamplerStateDesc(i, ref SamplerDesc);
                //    CSamplerState SamplerState = CEngine.Instance.SamplerStateManager.GetSamplerState(RHICtx, SamplerDesc);
                //    mSamplerBinder_Shadow.PSBindSampler(info.PSBindPoint, SamplerState);
                //}
                using (var it = MtlInst.Material.GetSamplerStateDescs().GetEnumerator())
                {
                    while (it.MoveNext())
                    {
                        var name              = it.Current.Key;
                        var samplerDesc       = it.Current.Value;
                        CSamplerBindInfo info = new CSamplerBindInfo();
                        if (shader.FindSamplerBindInfoByShaderName(MtlInst, name, ref info))
                        {
                            CSamplerState SamplerState = CEngine.Instance.SamplerStateManager.GetSamplerState(RHICtx, samplerDesc);
                            mSamplerBinder_Shadow.PSBindSampler(info.PSBindPoint, SamplerState);
                        }
                        else
                        {
                            var defaultSamplerDesc = new CSamplerStateDesc();
                            defaultSamplerDesc.SetDefault();
                            CSamplerState SamplerState = CEngine.Instance.SamplerStateManager.GetSamplerState(RHICtx, defaultSamplerDesc);
                            mSamplerBinder_Shadow.PSBindSampler(info.PSBindPoint, SamplerState);
                        }
                    }
                }
            }

            return(mSamplerBinder_Shadow);
        }
        protected override void OnCreated()
        {
            AddSRV("gEnvMap");
            AddSRV("gShadowMap");

            var SamplerStatDesc = new CSamplerStateDesc();

            SamplerStatDesc.SetDefault();
            SamplerStatDesc.Filter = ESamplerFilter.SPF_MIN_MAG_MIP_LINEAR;
            SamplerStat            = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, SamplerStatDesc);

            var SamplerDesc_ShadowMap = new CSamplerStateDesc();

            SamplerDesc_ShadowMap.SetDefault();
            SamplerDesc_ShadowMap.AddressU    = EAddressMode.ADM_BORDER;
            SamplerDesc_ShadowMap.AddressV    = EAddressMode.ADM_BORDER;
            SamplerDesc_ShadowMap.BorderColor = new Color4(1.0f, 1.0f, 1.0f, 1.0f);
            mSampler_ShadowMap = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, SamplerDesc_ShadowMap);
        }
示例#7
0
        public override void BindResources(Graphics.Mesh.CGfxMesh mesh, CPass pass)
        //, CConstantBuffer cbPerInstance, CShaderResources TexBinder, CShaderSamplers SamplerBinder, CShaderProgram Shader)
        {
            var TexBinder     = pass.ShaderResources;
            var SamplerBinder = pass.ShaderSamplerBinder;
            var Shader        = pass.GpuProgram;

            //base scene view;
            if (Shader.FindTextureBindInfo(null, "gBaseSceneView", ref mTexBindInfo_BaseSceneView))
            {
                TexBinder.PSBindTexture(mTexBindInfo_BaseSceneView.PSBindPoint, mBaseSceneView);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gBaseSceneView", ref mSamplerBindInfo_BaseSceneView) == true)
            {
                mSamplerStateDesc_BaseSceneView.SetDefault();
                mSamplerStateDesc_BaseSceneView.Filter   = ESamplerFilter.SPF_MIN_MAG_MIP_LINEAR;
                mSamplerStateDesc_BaseSceneView.AddressU = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_BaseSceneView.AddressV = EAddressMode.ADM_CLAMP;

                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSamplerStateDesc_BaseSceneView);

                SamplerBinder.PSBindSampler(mSamplerBindInfo_BaseSceneView.PSBindPoint, SamplerStat);
            }

            //bloom;
            if (Shader.FindTextureBindInfo(null, "gBloomTex", ref mTexBindInfo_BloomTex))
            {
                TexBinder.PSBindTexture(mTexBindInfo_BloomTex.PSBindPoint, mBloomTex);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gBloomTex", ref mSamplerBindInfo_BloomTex) == true)
            {
                mSamplerStateDesc_BloomTex.SetDefault();
                mSamplerStateDesc_BloomTex.Filter   = ESamplerFilter.SPF_MIN_MAG_MIP_LINEAR;
                mSamplerStateDesc_BloomTex.AddressU = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_BloomTex.AddressV = EAddressMode.ADM_CLAMP;

                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSamplerStateDesc_BloomTex);

                SamplerBinder.PSBindSampler(mSamplerBindInfo_BloomTex.PSBindPoint, SamplerStat);
            }
        }
示例#8
0
        public override void BindResources(Graphics.Mesh.CGfxMesh mesh, CPass pass)
        {
            var TexBinder     = pass.ShaderResources;
            var SamplerBinder = pass.ShaderSamplerBinder;
            var Shader        = pass.GpuProgram;

            if (Shader.FindTextureBindInfo(null, "gPickedSetUpTex", ref mTBI_PickedSetUp))
            {
                TexBinder.PSBindTexture(mTBI_PickedSetUp.PSBindPoint, mSRV_PickedSetUp);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gPickedSetUp", ref mSBI_PickedSetUp) == true)
            {
                mSSD_PickedSetUp.SetDefault();
                mSSD_PickedSetUp.Filter   = ESamplerFilter.SPF_MIN_MAG_MIP_POINT;
                mSSD_PickedSetUp.AddressU = EAddressMode.ADM_CLAMP;
                mSSD_PickedSetUp.AddressV = EAddressMode.ADM_CLAMP;

                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSSD_PickedSetUp);

                SamplerBinder.PSBindSampler(mSBI_PickedSetUp.PSBindPoint, SamplerStat);
            }

            //
            if (Shader.FindTextureBindInfo(null, "gPickedBlurTex", ref mTBI_PickedBlur))
            {
                TexBinder.PSBindTexture(mTBI_PickedBlur.PSBindPoint, mSRV_PickedBlur);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gPickedBlur", ref mSBI_PickedBlur) == true)
            {
                mSSD_PickedBlur.SetDefault();
                mSSD_PickedBlur.Filter   = ESamplerFilter.SPF_MIN_MAG_MIP_POINT;
                mSSD_PickedBlur.AddressU = EAddressMode.ADM_CLAMP;
                mSSD_PickedBlur.AddressV = EAddressMode.ADM_CLAMP;

                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSSD_PickedBlur);

                SamplerBinder.PSBindSampler(mSBI_PickedBlur.PSBindPoint, SamplerStat);
            }
        }
示例#9
0
        public override void BindResources(Graphics.Mesh.CGfxMesh mesh, CPass pass)
        {
            var TexBinder     = pass.ShaderResources;
            var SamplerBinder = pass.ShaderSamplerBinder;
            var Shader        = pass.GpuProgram;

            if (Shader.FindTextureBindInfo(null, "gSrcTex", ref mTexBindInfo_Src))
            {
                TexBinder.PSBindTexture(mTexBindInfo_Src.PSBindPoint, mSRV_Src);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gSrcTex", ref mSampBindInfo_Src) == true)
            {
                mSampStateDesc_Src.SetDefault();
                mSampStateDesc_Src.Filter   = ESamplerFilter.SPF_MIN_MAG_LINEAR_MIP_POINT;
                mSampStateDesc_Src.AddressU = EAddressMode.ADM_CLAMP;
                mSampStateDesc_Src.AddressV = EAddressMode.ADM_CLAMP;
                mSampStateDesc_Src.AddressW = EAddressMode.ADM_CLAMP;

                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSampStateDesc_Src);
                SamplerBinder.PSBindSampler(mSampBindInfo_Src.PSBindPoint, SamplerStat);
            }
        }
示例#10
0
        public unsafe void UpdateGpuBufferVTF(CRenderContext rc, EngineNS.CCommandList cmd, Graphics.CGfxCamera Camera)
        {
            CTexture2DDesc desc = new CTexture2DDesc();

            desc.Init();

            var spDesc = new CSamplerStateDesc();

            spDesc.SetDefault();
            spDesc.Filter = ESamplerFilter.SPF_MIN_MAG_MIP_POINT;
            mSamplerState = CEngine.Instance.SamplerStateManager.GetSamplerState(rc, spDesc);

            int vertStride = sizeof(Cluster.GpuSceneVertex);
            int size       = mAllVertices.Count * vertStride;
            int side       = (int)Math.Sqrt((float)size) + 1;

            desc.Width     = 512;
            desc.Height    = 512;
            desc.MipLevels = 1;
            desc.Format    = EPixelFormat.PXF_R32G32B32A32_FLOAT;
            mVertexTexture = rc.CreateTexture2D(desc);
            CShaderResourceViewDesc srvDesc = new CShaderResourceViewDesc();

            srvDesc.mFormat    = desc.Format;
            srvDesc.mTexture2D = mVertexTexture.CoreObject;
            mVertexTextureView = rc.CreateShaderResourceView(srvDesc);
            mVertexTextureView.ResourceState.StreamState = EStreamingState.SS_Valid;

            {
                var copyArray = mAllVertices.ToArray();
                fixed(Vector4 *p = &mVertexTexData[0])
                fixed(Cluster.GpuSceneVertex * v = &copyArray[0])
                {
                    CoreSDK.SDK_Memory_Copy(p, v, (uint)size);

                    mVertexTexture.UpdateMipData(cmd, 0, p, 512, 512, 512 * 4 * 4);
                }
            }

            int InstStride = sizeof(GpuMeshInstanceData);

            size                     = mGpuInstanceDatas.Count * InstStride;
            side                     = (int)Math.Sqrt((float)size) + 1;
            desc.Width               = 256;
            desc.Height              = 256;
            desc.MipLevels           = 1;
            desc.Format              = EPixelFormat.PXF_R32G32B32A32_FLOAT;
            mInstanceDataTexture     = rc.CreateTexture2D(desc);
            srvDesc.mFormat          = desc.Format;
            srvDesc.mTexture2D       = mInstanceDataTexture.CoreObject;
            mInstanceDataTextureView = rc.CreateShaderResourceView(srvDesc);
            mInstanceDataTextureView.ResourceState.StreamState = EStreamingState.SS_Valid;

            {
                var copyArray = mGpuInstanceDatas.ToArray();
                fixed(Vector4 *p = &mInstTexData[0])
                fixed(GpuMeshInstanceData * v = &copyArray[0])
                {
                    CoreSDK.SDK_Memory_Copy(p, v, (uint)size);
                    mInstanceDataTexture.UpdateMipData(cmd, 0, p, 256, 256, 256 * 4 * 4);
                }
            }
        }
示例#11
0
        public override void BindResources(Graphics.Mesh.CGfxMesh mesh, CPass pass)
        {
            var TexBinder     = pass.ShaderResources;
            var SamplerBinder = pass.ShaderSamplerBinder;
            var Shader        = pass.GpuProgram;

            //base scene view;
            if (Shader.FindTextureBindInfo(null, "gBaseSceneView", ref mTexBindInfo_BaseSceneView))
            {
                TexBinder.PSBindTexture(mTexBindInfo_BaseSceneView.PSBindPoint, mBaseSceneView);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gBaseSceneView", ref mSamplerBindInfo_BaseSceneView) == true)
            {
                mSamplerStateDesc_BaseSceneView.SetDefault();
                mSamplerStateDesc_BaseSceneView.Filter   = ESamplerFilter.SPF_MIN_MAG_LINEAR_MIP_POINT;
                mSamplerStateDesc_BaseSceneView.AddressU = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_BaseSceneView.AddressV = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_BaseSceneView.AddressW = EAddressMode.ADM_CLAMP;

                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSamplerStateDesc_BaseSceneView);
                SamplerBinder.PSBindSampler(mSamplerBindInfo_BaseSceneView.PSBindPoint, SamplerStat);
            }

            //bloom;
            if (Shader.FindTextureBindInfo(null, "gBloomTex", ref mTexBindInfo_BloomTex))
            {
                TexBinder.PSBindTexture(mTexBindInfo_BloomTex.PSBindPoint, mBloomTex);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gBloomTex", ref mSamplerBindInfo_BloomTex) == true)
            {
                mSamplerStateDesc_BloomTex.SetDefault();
                mSamplerStateDesc_BloomTex.Filter   = ESamplerFilter.SPF_MIN_MAG_LINEAR_MIP_POINT;
                mSamplerStateDesc_BloomTex.AddressU = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_BloomTex.AddressV = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_BloomTex.AddressW = EAddressMode.ADM_CLAMP;

                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSamplerStateDesc_BloomTex);
                SamplerBinder.PSBindSampler(mSamplerBindInfo_BloomTex.PSBindPoint, SamplerStat);
            }

            //vignette;
            if (Shader.FindTextureBindInfo(null, "gVignette", ref mTexBindInfo_Vignette))
            {
                TexBinder.PSBindTexture(mTexBindInfo_Vignette.PSBindPoint, mVignetteTex);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gVignette", ref mSamplerBindInfo_Vignette) == true)
            {
                mSamplerStateDesc_Vignette.SetDefault();
                mSamplerStateDesc_Vignette.Filter   = ESamplerFilter.SPF_MIN_MAG_LINEAR_MIP_POINT;
                mSamplerStateDesc_Vignette.AddressU = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_Vignette.AddressV = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_Vignette.AddressW = EAddressMode.ADM_CLAMP;
                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSamplerStateDesc_Vignette);
                SamplerBinder.PSBindSampler(mSamplerBindInfo_Vignette.PSBindPoint, SamplerStat);
            }

            //sun shaft;
            if (Shader.FindTextureBindInfo(null, "gSunShaft", ref mTexBindInfo_SunShaft))
            {
                TexBinder.PSBindTexture(mTexBindInfo_SunShaft.PSBindPoint, mSunShaftTex);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gSunShaft", ref mSamplerBindInfo_SunShaft) == true)
            {
                mSamplerStateDesc_SunShaft.SetDefault();
                mSamplerStateDesc_SunShaft.Filter   = ESamplerFilter.SPF_MIN_MAG_LINEAR_MIP_POINT;
                mSamplerStateDesc_SunShaft.AddressU = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_SunShaft.AddressV = EAddressMode.ADM_CLAMP;
                mSamplerStateDesc_SunShaft.AddressW = EAddressMode.ADM_CLAMP;
                var SamplerStat = CEngine.Instance.SamplerStateManager.GetSamplerState(CEngine.Instance.RenderContext, mSamplerStateDesc_SunShaft);
                SamplerBinder.PSBindSampler(mSamplerBindInfo_SunShaft.PSBindPoint, SamplerStat);
            }

            //mobile ao srv binding;
            if (Shader.FindTextureBindInfo(null, "gMobileAoTex", ref mTBI_MobileAo))
            {
                TexBinder.PSBindTexture(mTBI_MobileAo.PSBindPoint, mSRV_MobileAo);
            }

            if (Shader.FindSamplerBindInfo(null, "Samp_gMobileAoTex", ref mSBI_MobileAo) == true)
            {
                SamplerBinder.PSBindSampler(mSBI_MobileAo.PSBindPoint, mSampStat_MobileAo);
            }
        }
示例#12
0
        public void SetPassData(CRenderContext rc, CGfxMesh mesh, UInt32 index, CGfxSceneView vp, CPass pass)
        {
            //OnEffectRefresh(rc);
            if (pass.RenderPipeline == null)
            {
                var rplDesc = new CRenderPipelineDesc();
                pass.RenderPipeline = rc.CreateRenderPipeline(rplDesc);
            }
            pass.RenderPipeline.ShaderProgram     = mEffect.ShaderProgram;
            pass.RenderPipeline.RasterizerState   = mMaterial.RasterizerState;
            pass.RenderPipeline.DepthStencilState = mMaterial.DepthStencilState;
            pass.RenderPipeline.BlendState        = mMaterial.BlendState;

            pass.GeometryMesh = mesh.MeshPrimitives.GeometryMesh;

            pass.BindCBuffer(mEffect.ShaderProgram, mEffect.PerInstanceId, CBuffer);
            pass.BindCBuffer(mEffect.ShaderProgram, mEffect.PerFrameId, CEngine.Instance.PerFrameCBuffer);

            if (vp != null)
            {
                pass.ViewPort = vp.Viewport;
            }

            var textures = new CShaderResources();

            {
                Material.BindTextures(textures, mEffect.ShaderProgram);
                foreach (var i in Textures)
                {
                    textures.PSBindTexture(i.Key, i.Value);
                }
                mesh.ShadingEnv.BindResources(mesh, CBuffer, textures, mEffect.ShaderProgram);
            }
            pass.ShaderResources = textures;

            CShaderSamplers samplers = new CShaderSamplers();

            {
                CSamplerStateDesc sampDesc = new CSamplerStateDesc();
                sampDesc.SetDefault();
                sampDesc.Filter = ESamplerFilter.SPF_MIN_MAG_MIP_POINT;
                CSamplerState samp = CEngine.Instance.SamplerStateManager.GetSamplerState(rc, sampDesc);
                for (UInt32 i = 0; i < mEffect.ShaderProgram.SamplerNumber; i++)
                {
                    CSamplerBindInfo info = new CSamplerBindInfo();
                    mEffect.ShaderProgram.GetSamplerBindInfo(i, ref info);
                    samplers.PSBindSampler(info.PSBindPoint, samp);
                }
            }
            pass.ShaderSamplers = samplers;

            foreach (var i in mesh.MdfQueue.Modifiers)
            {
                i.OnSetPassData(pass);
            }

            CDrawPrimitiveDesc dpDesc = new CDrawPrimitiveDesc();

            mesh.MeshPrimitives.GetAtom(index, 0, ref dpDesc);
            pass.BindDrawPrimitive(ref dpDesc);
        }