public void SetDepthStencilState(H1DepthStencilDescription depthStencilDesc) { DepthStencilStateDescription newDepthStencilStateDesc = DepthStencilStateDescription.Default(); newDepthStencilStateDesc.IsDepthEnabled = depthStencilDesc.DepthEnable; newDepthStencilStateDesc.DepthWriteMask = H1RHIDefinitionHelper.ConvertToDepthWriteMask(depthStencilDesc.DepthWriteMask); newDepthStencilStateDesc.DepthComparison = H1RHIDefinitionHelper.ConvertToComparisonFunc(depthStencilDesc.DepthFunc); newDepthStencilStateDesc.IsStencilEnabled = depthStencilDesc.StencilEnable; newDepthStencilStateDesc.StencilReadMask = depthStencilDesc.StencilReadMask; newDepthStencilStateDesc.StencilWriteMask = depthStencilDesc.StencilWriteMask; newDepthStencilStateDesc.FrontFace = new DepthStencilOperationDescription(); newDepthStencilStateDesc.FrontFace.DepthFailOperation = H1RHIDefinitionHelper.ConvertToStencilOp(depthStencilDesc.FrontFace.StencilDepthFailOp); newDepthStencilStateDesc.FrontFace.FailOperation = H1RHIDefinitionHelper.ConvertToStencilOp(depthStencilDesc.FrontFace.StencilFailOp); newDepthStencilStateDesc.FrontFace.PassOperation = H1RHIDefinitionHelper.ConvertToStencilOp(depthStencilDesc.FrontFace.StencilPassOp); newDepthStencilStateDesc.FrontFace.Comparison = H1RHIDefinitionHelper.ConvertToComparisonFunc(depthStencilDesc.FrontFace.StencilFunc); newDepthStencilStateDesc.BackFace = new DepthStencilOperationDescription(); newDepthStencilStateDesc.BackFace.DepthFailOperation = H1RHIDefinitionHelper.ConvertToStencilOp(depthStencilDesc.BackFace.StencilDepthFailOp); newDepthStencilStateDesc.BackFace.FailOperation = H1RHIDefinitionHelper.ConvertToStencilOp(depthStencilDesc.BackFace.StencilFailOp); newDepthStencilStateDesc.BackFace.PassOperation = H1RHIDefinitionHelper.ConvertToStencilOp(depthStencilDesc.BackFace.StencilPassOp); newDepthStencilStateDesc.BackFace.Comparison = H1RHIDefinitionHelper.ConvertToComparisonFunc(depthStencilDesc.BackFace.StencilFunc); m_GraphicsPipelineStateDesc.DepthStencilState = newDepthStencilStateDesc; }
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); }