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); } }
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); }
public void SetPipelineState(EffectPipelineStateHandle pipelineStateHandle) { _pipelineState = GetPipelineState(pipelineStateHandle); _dirtyFlags |= EffectDirtyFlags.PipelineState; }