public void ClearBuffers(GLQueueClearBufferMask combinedMask) { ClearBufferMask bitmask = ((combinedMask & GLQueueClearBufferMask.Color) == GLQueueClearBufferMask.Color) ? ClearBufferMask.ColorBufferBit: 0; bitmask |= ((combinedMask & GLQueueClearBufferMask.Depth) == GLQueueClearBufferMask.Depth) ? ClearBufferMask.DepthBufferBit: 0; bitmask |= ((combinedMask & GLQueueClearBufferMask.Stencil) == GLQueueClearBufferMask.Stencil) ? ClearBufferMask.StencilBufferBit: 0; GL.Clear(bitmask); }
void ApplyClearBuffers(GLCmdClearValuesParameter clearState, GLQueueClearBufferMask combinedMask) { if (clearState.Attachments.Length > 0) { // TODO : use clear buffers foreach (var state in clearState.Attachments) { if (state.Attachment.LoadOp == MgAttachmentLoadOp.CLEAR) { if (state.Attachment.AttachmentType == GLClearAttachmentType.COLOR_INT || state.Attachment.AttachmentType == GLClearAttachmentType.COLOR_FLOAT || state.Attachment.AttachmentType == GLClearAttachmentType.COLOR_UINT) { var clearValue = state.Color; if (!mPastClearValues.ClearColor.Equals(clearValue)) { mClear.SetClearColor(clearValue); mPastClearValues.ClearColor = clearValue; } } else if (state.Attachment.AttachmentType == GLClearAttachmentType.DEPTH_STENCIL) { var clearValue = state.Value.DepthStencil; if (Math.Abs(mPastClearValues.DepthValue - clearValue.Depth) > float.Epsilon) { mClear.SetClearDepthValue(clearValue.Depth); mPastClearValues.DepthValue = clearValue.Depth; } } } if (state.Attachment.StencilLoadOp == MgAttachmentLoadOp.CLEAR) { if (state.Attachment.AttachmentType == GLClearAttachmentType.DEPTH_STENCIL) { var clearValue = state.Value.DepthStencil.Stencil; if (mPastClearValues.StencilValue != clearValue) { mClear.SetClearStencilValue(clearValue); mPastClearValues.StencilValue = clearValue; } } } } mClear.ClearBuffers(combinedMask); } }
public void ClearBuffers(GLQueueClearBufferMask combinedMask) { throw new NotImplementedException(); }