MoonWorks-docs/content/Graphics/Resources/GraphicsPipeline/ColorBlendState.md

33 lines
1018 B
Markdown

---
title: "Color Blend State"
date: 2021-01-27T14:11:42-08:00
weight: 1
---
Color blend state is comprised of three fields - a logical operation, whether that logical operation is enabled, and some blending constants.
`LogicOp` lets you do a bitwise combination of the original and new color. You can read about that in more detail [over here](https://www.khronos.org/registry/vulkan/specs/1.2/html/chap28.html#framebuffer-logicop).
`BlendConstants` are used by the blend factors to produce result colors. You can read about that [here](https://www.khronos.org/registry/vulkan/specs/1.2/html/chap28.html#framebuffer-blendconstants).
Let's put it all together:
```cs
var myBlendConstants = new BlendConstants
{
R = 1f,
G = 1f,
B = 1f,
A = 1f
};
var myColorBlendState = new ColorBlendState
{
LogicOpEnable = true,
LogicOp = LogicOp.And,
BlendConstants = myBlendConstants
};
```
Further blending state control is provided in GraphicsPipelineAttachmentInfo, which will be discussed later.