コード例 #1
0
 public static EffectPipelineStateHandle GetHandle(ref EffectPipelineState state)
 {
     lock (Handles)
     {
         if (!Handles.TryGetValue(state, out var handle))
         {
             handle = new EffectPipelineStateHandle(state);
             Handles.Add(state, handle);
         }
         return(handle);
     }
 }
コード例 #2
0
ファイル: Effect.cs プロジェクト: ElonGame/OpenSAGE
        private PipelineState GetPipelineState(EffectPipelineStateHandle pipelineStateHandle)
        {
            if (!_cachedPipelineStates.TryGetValue(pipelineStateHandle, out var result))
            {
                var description = PipelineStateDescription.Default;

                description.PipelineLayout     = _pipelineLayout;
                description.RenderTargetFormat = _graphicsDevice.BackBufferFormat;
                description.VertexDescriptor   = _vertexDescriptor;
                description.VertexShader       = _vertexShader;
                description.PixelShader        = _pixelShader;

                description.RasterizerState   = pipelineStateHandle.EffectPipelineState.RasterizerState;
                description.DepthStencilState = pipelineStateHandle.EffectPipelineState.DepthStencilState;
                description.BlendState        = pipelineStateHandle.EffectPipelineState.BlendState;

                _cachedPipelineStates[pipelineStateHandle] = result = AddDisposable(new PipelineState(_graphicsDevice, description));
            }

            return(result);
        }
コード例 #3
0
ファイル: Effect.cs プロジェクト: ElonGame/OpenSAGE
 public void SetPipelineState(EffectPipelineStateHandle pipelineStateHandle)
 {
     _pipelineState = GetPipelineState(pipelineStateHandle);
     _dirtyFlags   |= EffectDirtyFlags.PipelineState;
 }