Beispiel #1
0
        public Boolean InitStaticSampler(Int32 register, H1SamplerDescription samplerDesc, ShaderVisibility visibility)
        {
            if (m_NumInitializedStaticSamplers > m_NumSamplers)
            {
                return(false); // there are no available to initialize static samplers
            }
            StaticSamplerDescription staticSamplerDesc = m_SamplerArray[m_NumInitializedStaticSamplers];

            staticSamplerDesc                = new StaticSamplerDescription(visibility, register, 0); // initialize static sampler description
            staticSamplerDesc.Filter         = H1RHIDefinitionHelper.ConvertToFilter(samplerDesc.Filter);
            staticSamplerDesc.AddressU       = H1RHIDefinitionHelper.ConvertToTextureAddressMode(samplerDesc.AddressU);
            staticSamplerDesc.AddressV       = H1RHIDefinitionHelper.ConvertToTextureAddressMode(samplerDesc.AddressV);
            staticSamplerDesc.AddressW       = H1RHIDefinitionHelper.ConvertToTextureAddressMode(samplerDesc.AddressW);
            staticSamplerDesc.MipLODBias     = samplerDesc.MipLODBias;
            staticSamplerDesc.MaxAnisotropy  = samplerDesc.MaxAnisotropy;
            staticSamplerDesc.ComparisonFunc = H1RHIDefinitionHelper.ConvertToComparisonFunc(samplerDesc.ComparisonFunc);
            staticSamplerDesc.BorderColor    = StaticBorderColor.OpaqueWhite;
            staticSamplerDesc.MinLOD         = samplerDesc.MinLOD;
            staticSamplerDesc.MaxLOD         = samplerDesc.MaxLOD;

            if (staticSamplerDesc.AddressU == TextureAddressMode.Border ||
                staticSamplerDesc.AddressV == TextureAddressMode.Border ||
                staticSamplerDesc.AddressW == TextureAddressMode.Border)
            {
                //@TODO - warning for the case, different border color with 'samplerDesc'
            }

            return(true);
        }