mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-11-30 22:24:15 +01:00
[dxvk] Refactored blend constants
This will make things a little less painful when capturing blend constants in a lambda function, as required for CSMT.
This commit is contained in:
parent
62a43cbdbe
commit
2dd24a14d2
@ -39,7 +39,9 @@ namespace dxvk {
|
||||
m_defaultRasterizerState = static_cast<D3D11RasterizerState*>(defaultRasterizerState.ptr());
|
||||
m_defaultRasterizerState->BindToContext(m_context);
|
||||
|
||||
m_context->setBlendConstants(m_state.om.blendFactor);
|
||||
m_context->setBlendConstants(DxvkBlendConstants {
|
||||
m_state.om.blendFactor[0], m_state.om.blendFactor[1],
|
||||
m_state.om.blendFactor[2], m_state.om.blendFactor[3] });
|
||||
m_context->setStencilReference(m_state.om.stencilRef);
|
||||
|
||||
// Create a default sampler that we're going to bind
|
||||
@ -1481,9 +1483,11 @@ namespace dxvk {
|
||||
blendState->BindToContext(m_context, SampleMask);
|
||||
}
|
||||
|
||||
if ((BlendFactor != nullptr) && (!std::memcmp(m_state.om.blendFactor, BlendFactor, 4 * sizeof(FLOAT)))) {
|
||||
if (BlendFactor != nullptr) {
|
||||
std::memcpy(m_state.om.blendFactor, BlendFactor, 4 * sizeof(FLOAT));
|
||||
m_context->setBlendConstants(BlendFactor);
|
||||
|
||||
m_context->setBlendConstants(DxvkBlendConstants {
|
||||
BlendFactor[0], BlendFactor[1], BlendFactor[2], BlendFactor[3] });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,17 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
/**
|
||||
* \brief Blend constants
|
||||
*
|
||||
* Stores a blend factor
|
||||
* as an RGBA color value.
|
||||
*/
|
||||
struct DxvkBlendConstants {
|
||||
float r, g, b, a;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Input assembly state
|
||||
*
|
||||
|
@ -1002,9 +1002,9 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkContext::setBlendConstants(
|
||||
const float blendConstants[4]) {
|
||||
const DxvkBlendConstants& blendConstants) {
|
||||
for (uint32_t i = 0; i < 4; i++)
|
||||
m_state.om.blendConstants[i] = blendConstants[i];
|
||||
m_state.om.blendConstants = blendConstants;
|
||||
|
||||
this->updateBlendConstants();
|
||||
}
|
||||
@ -1400,7 +1400,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkContext::updateBlendConstants() {
|
||||
m_cmd->cmdSetBlendConstants(m_state.om.blendConstants);
|
||||
m_cmd->cmdSetBlendConstants(&m_state.om.blendConstants.r);
|
||||
}
|
||||
|
||||
|
||||
|
@ -438,7 +438,7 @@ namespace dxvk {
|
||||
* \param [in] blendConstants Blend constants
|
||||
*/
|
||||
void setBlendConstants(
|
||||
const float blendConstants[4]);
|
||||
const DxvkBlendConstants& blendConstants);
|
||||
|
||||
/**
|
||||
* \brief Sets stencil reference
|
||||
|
@ -57,8 +57,8 @@ namespace dxvk {
|
||||
struct DxvkOutputMergerState {
|
||||
Rc<DxvkFramebuffer> framebuffer;
|
||||
|
||||
float blendConstants[4];
|
||||
uint32_t stencilReference;
|
||||
DxvkBlendConstants blendConstants;
|
||||
uint32_t stencilReference;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user