intel: Remove unnecessary dualBlendMode enable
bug #12925
header version: r29511
Can determine dualBlendModeEnable from blend information provided.
Integrate review feedback.
diff --git a/icd/common/icd-format.h b/icd/common/icd-format.h
index 0d52c46..28c2dca 100644
--- a/icd/common/icd-format.h
+++ b/icd/common/icd-format.h
@@ -59,6 +59,25 @@
return (icd_format_is_compressed(format)) ? 4 : 1;
}
+static inline bool icd_blend_mode_is_dual_src(XGL_BLEND mode)
+{
+ return (mode == XGL_BLEND_SRC1_COLOR) ||
+ (mode == XGL_BLEND_SRC1_ALPHA) ||
+ (mode == XGL_BLEND_ONE_MINUS_SRC1_COLOR) ||
+ (mode == XGL_BLEND_ONE_MINUS_SRC1_ALPHA);
+}
+
+static inline bool icd_pipeline_cb_att_needs_dual_source_blending(const XGL_PIPELINE_CB_ATTACHMENT_STATE *att)
+{
+ if (icd_blend_mode_is_dual_src(att->srcBlendColor) ||
+ icd_blend_mode_is_dual_src(att->srcBlendAlpha) ||
+ icd_blend_mode_is_dual_src(att->destBlendColor) ||
+ icd_blend_mode_is_dual_src(att->destBlendAlpha)) {
+ return true;
+ }
+ return false;
+}
+
size_t icd_format_get_size(XGL_FORMAT format);
XGL_IMAGE_FORMAT_CLASS icd_format_get_class(XGL_FORMAT format);
diff --git a/icd/intel/cmd_pipeline.c b/icd/intel/cmd_pipeline.c
index 6e211a2..e2cdafc 100644
--- a/icd/intel/cmd_pipeline.c
+++ b/icd/intel/cmd_pipeline.c
@@ -585,7 +585,7 @@
if (fs->uses & INTEL_SHADER_USE_W)
dw5 |= GEN6_WM_DW5_PS_USE_W;
- if (pipeline->cb_state.dualSourceBlendEnable)
+ if (pipeline->dual_source_blend_enable)
dw5 |= GEN6_WM_DW5_DUAL_SOURCE_BLEND;
dw6 = fs->in_count << GEN6_WM_DW6_SF_ATTR_COUNT__SHIFT |
@@ -689,7 +689,7 @@
if (fs->in_count)
dw4 |= GEN7_PS_DW4_ATTR_ENABLE;
- if (pipeline->cb_state.dualSourceBlendEnable)
+ if (pipeline->dual_source_blend_enable)
dw4 |= GEN7_PS_DW4_DUAL_SOURCE_BLEND;
dw5 = fs->urb_grf_start << GEN7_PS_DW5_URB_GRF_START0__SHIFT |
diff --git a/icd/intel/pipeline.c b/icd/intel/pipeline.c
index 95de6c0..2fb38f0 100644
--- a/icd/intel/pipeline.c
+++ b/icd/intel/pipeline.c
@@ -1149,6 +1149,8 @@
att->srcBlendAlpha != att->srcBlendColor ||
att->destBlendAlpha != att->destBlendColor)
dw0 |= 1 << 30;
+
+ pipeline->dual_source_blend_enable = icd_pipeline_cb_att_needs_dual_source_blending(att);
}
if (info->cb.logicOp != XGL_LOGIC_OP_COPY) {
diff --git a/icd/intel/pipeline.h b/icd/intel/pipeline.h
index 5983f9c..3e42f13 100644
--- a/icd/intel/pipeline.h
+++ b/icd/intel/pipeline.h
@@ -211,6 +211,8 @@
uint32_t cmds[INTEL_PSO_CMD_ENTRIES];
uint32_t cmd_len;
+ bool dual_source_blend_enable;
+
/* The following are only partial HW commands that will need
* more processing before sending to the HW
*/
diff --git a/include/xgl.h b/include/xgl.h
index e27b910..cd6f4ba 100644
--- a/include/xgl.h
+++ b/include/xgl.h
@@ -33,7 +33,7 @@
#include "xglPlatform.h"
// XGL API version supported by this file
-#define XGL_API_VERSION XGL_MAKE_VERSION(0, 48, 1)
+#define XGL_API_VERSION XGL_MAKE_VERSION(0, 48, 2)
#ifdef __cplusplus
extern "C"
@@ -1966,7 +1966,6 @@
XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO
const void* pNext; // Pointer to next structure
bool32_t alphaToCoverageEnable;
- bool32_t dualSourceBlendEnable; // optional (GL45)
bool32_t logicOpEnable;
XGL_LOGIC_OP logicOp;
uint32_t attachmentCount; // # of pAttachments
diff --git a/tests/xglrenderframework.cpp b/tests/xglrenderframework.cpp
index 9fc0786..e30013c 100644
--- a/tests/xglrenderframework.cpp
+++ b/tests/xglrenderframework.cpp
@@ -776,7 +776,6 @@
m_cb_state.sType = XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO;
m_cb_state.pNext = &m_rs_state;
m_cb_state.alphaToCoverageEnable = XGL_FALSE;
- m_cb_state.dualSourceBlendEnable = XGL_FALSE;
m_cb_state.logicOp = XGL_LOGIC_OP_COPY;
m_ms_state.pNext = &m_cb_state;