public void Update() { // The vertex buffer size is calculated using a different // method when doing indexed draws, so we need to make sure // to update the vertex buffers if we are doing a regular // draw after a indexed one and vice-versa. if (_drawState.DrawIndexed != _prevDrawIndexed) { _updateTracker.ForceDirty(VertexBufferStateIndex); _prevDrawIndexed = _drawState.DrawIndexed; } bool tfEnable = _state.State.TfEnable; if (!tfEnable && _prevTfEnable) { _context.Renderer.Pipeline.EndTransformFeedback(); _prevTfEnable = false; } _updateTracker.Update(ulong.MaxValue); CommitBindings(); if (tfEnable && !_prevTfEnable) { _context.Renderer.Pipeline.BeginTransformFeedback(_drawState.Topology); _prevTfEnable = true; } }
public void Update() { // The vertex buffer size is calculated using a different // method when doing indexed draws, so we need to make sure // to update the vertex buffers if we are doing a regular // draw after a indexed one and vice-versa. if (_drawState.DrawIndexed != _prevDrawIndexed) { _updateTracker.ForceDirty(VertexBufferStateIndex); // If PrimitiveRestartDrawArrays is false and this is a non-indexed draw, we need to ensure primitive restart is disabled. // If PrimitiveRestartDrawArrays is false and this is a indexed draw, we need to ensure primitive restart enable matches GPU state. // If PrimitiveRestartDrawArrays is true, then primitive restart enable should always match GPU state. // That is because "PrimitiveRestartDrawArrays" is not configurable on the backend, it is always // true on OpenGL and always false on Vulkan. if (!_state.State.PrimitiveRestartDrawArrays && _state.State.PrimitiveRestartState.Enable) { _updateTracker.ForceDirty(PrimitiveRestartStateIndex); } _prevDrawIndexed = _drawState.DrawIndexed; } bool tfEnable = _state.State.TfEnable; if (!tfEnable && _prevTfEnable) { _context.Renderer.Pipeline.EndTransformFeedback(); _prevTfEnable = false; } _updateTracker.Update(ulong.MaxValue); CommitBindings(); if (tfEnable && !_prevTfEnable) { _context.Renderer.Pipeline.BeginTransformFeedback(_drawState.Topology); _prevTfEnable = true; } }
public void Update() { // If any state that the shader depends on changed, // then we may need to compile/bind a different version // of the shader for the new state. if (_shaderSpecState != null) { if (!_shaderSpecState.MatchesGraphics(_channel, GetPoolState())) { ForceShaderUpdate(); } } // The vertex buffer size is calculated using a different // method when doing indexed draws, so we need to make sure // to update the vertex buffers if we are doing a regular // draw after a indexed one and vice-versa. if (_drawState.DrawIndexed != _prevDrawIndexed) { _updateTracker.ForceDirty(VertexBufferStateIndex); // If PrimitiveRestartDrawArrays is false and this is a non-indexed draw, we need to ensure primitive restart is disabled. // If PrimitiveRestartDrawArrays is false and this is a indexed draw, we need to ensure primitive restart enable matches GPU state. // If PrimitiveRestartDrawArrays is true, then primitive restart enable should always match GPU state. // That is because "PrimitiveRestartDrawArrays" is not configurable on the backend, it is always // true on OpenGL and always false on Vulkan. if (!_state.State.PrimitiveRestartDrawArrays && _state.State.PrimitiveRestartState.Enable) { _updateTracker.ForceDirty(PrimitiveRestartStateIndex); } _prevDrawIndexed = _drawState.DrawIndexed; } // In some cases, the index type is also used to guess the // vertex buffer size, so we must update it if the type changed too. if (_drawState.DrawIndexed && (_prevIndexType != _state.State.IndexBufferState.Type || _prevFirstVertex != _state.State.FirstVertex)) { _updateTracker.ForceDirty(VertexBufferStateIndex); _prevIndexType = _state.State.IndexBufferState.Type; _prevFirstVertex = _state.State.FirstVertex; } bool tfEnable = _state.State.TfEnable; if (!tfEnable && _prevTfEnable) { _context.Renderer.Pipeline.EndTransformFeedback(); _prevTfEnable = false; } _updateTracker.Update(ulong.MaxValue); CommitBindings(); if (tfEnable && !_prevTfEnable) { _context.Renderer.Pipeline.BeginTransformFeedback(_drawState.Topology); _prevTfEnable = true; } }