Ejemplo n.º 1
0
        public PipelineLayout(GraphicsDevice graphicsDevice, ref PipelineLayoutDescription description)
            : base(graphicsDevice)
        {
            Description = description;

            PlatformConstruct(graphicsDevice, description);
        }
Ejemplo n.º 2
0
        protected Effect(
            GraphicsDevice graphicsDevice,
            string vertexShaderName,
            string pixelShaderName,
            VertexDescriptor vertexDescriptor,
            PipelineLayoutDescription pipelineLayoutDescription)
        {
            _graphicsDevice = graphicsDevice;

            _vertexShader = AddDisposable(new Shader(graphicsDevice.ShaderLibrary, vertexShaderName));
            _pixelShader  = AddDisposable(new Shader(graphicsDevice.ShaderLibrary, pixelShaderName));

            _cachedPipelineStates = new Dictionary <EffectPipelineStateHandle, PipelineState>();

            _vertexDescriptor = vertexDescriptor;

            _pipelineLayout = AddDisposable(new PipelineLayout(_graphicsDevice, ref pipelineLayoutDescription));
        }
Ejemplo n.º 3
0
        private void PlatformConstruct(GraphicsDevice graphicsDevice, PipelineLayoutDescription description)
        {
            DeviceSamplerStates = new IMTLSamplerState[description.StaticSamplerStates.Length];

            for (var i = 0; i < description.StaticSamplerStates.Length; i++)
            {
                var staticSamplerState = description.StaticSamplerStates[i];

                DeviceSamplerStates[i] = graphicsDevice.Device.CreateSamplerState(new MTLSamplerDescriptor
                {
                    RAddressMode  = MTLSamplerAddressMode.ClampToEdge,
                    SAddressMode  = MTLSamplerAddressMode.ClampToEdge,
                    TAddressMode  = MTLSamplerAddressMode.ClampToEdge,
                    MinFilter     = ToMinMagFilter(staticSamplerState.SamplerStateDescription.Filter),
                    MagFilter     = ToMinMagFilter(staticSamplerState.SamplerStateDescription.Filter),
                    MipFilter     = ToMipFilter(staticSamplerState.SamplerStateDescription.Filter),
                    MaxAnisotropy = (nuint)staticSamplerState.SamplerStateDescription.MaxAnisotropy
                });
            }
        }