From aaa202ebe7b86f71f596bf01f6177f4cb66f2c4c Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 14 Jul 2016 17:52:07 -0700 Subject: [PATCH] genxml: Make gen6-7 blending look more like gen8 This renames BLEND_STATE to BLEND_STATE_ENTRY and adds an new struct BLEND_STATE which is just an array of 8 BLEND_STATE_ENTRYs. This will make it much easier to write gen-agnostic blend handling code. Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke Cc: "12.0" --- src/intel/genxml/gen6.xml | 8 +++++++- src/intel/genxml/gen7.xml | 8 +++++++- src/intel/genxml/gen75.xml | 8 +++++++- src/intel/vulkan/gen7_pipeline.c | 25 +++++++++++++------------ 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/intel/genxml/gen6.xml b/src/intel/genxml/gen6.xml index 44e28048ac5..dd682dda660 100644 --- a/src/intel/genxml/gen6.xml +++ b/src/intel/genxml/gen6.xml @@ -79,7 +79,7 @@ - + @@ -169,6 +169,12 @@ + + + + + + diff --git a/src/intel/genxml/gen7.xml b/src/intel/genxml/gen7.xml index 2bbfcb7606a..15640011626 100644 --- a/src/intel/genxml/gen7.xml +++ b/src/intel/genxml/gen7.xml @@ -102,7 +102,7 @@ - + @@ -192,6 +192,12 @@ + + + + + + diff --git a/src/intel/genxml/gen75.xml b/src/intel/genxml/gen75.xml index 9ab432cacb0..d813b7b7be2 100644 --- a/src/intel/genxml/gen75.xml +++ b/src/intel/genxml/gen75.xml @@ -112,7 +112,7 @@ - + @@ -202,6 +202,12 @@ + + + + + + diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c index 89cb51f8916..dba24e78ac1 100644 --- a/src/intel/vulkan/gen7_pipeline.c +++ b/src/intel/vulkan/gen7_pipeline.c @@ -86,17 +86,18 @@ gen7_emit_cb_state(struct anv_pipeline *pipeline, pipeline->blend_state = anv_state_pool_emit(&device->dynamic_state_pool, GENX(BLEND_STATE), 64, - .ColorBufferBlendEnable = false, - .WriteDisableAlpha = true, - .WriteDisableRed = true, - .WriteDisableGreen = true, - .WriteDisableBlue = true); + .Entry = { { + .ColorBufferBlendEnable = false, + .WriteDisableAlpha = true, + .WriteDisableRed = true, + .WriteDisableGreen = true, + .WriteDisableBlue = true + } }); } else { const VkPipelineColorBlendAttachmentState *a = &info->pAttachments[0]; - struct GENX(BLEND_STATE) blend = { + struct GENX(BLEND_STATE) blend = { .Entry = { { .AlphaToCoverageEnable = ms_info && ms_info->alphaToCoverageEnable, .AlphaToOneEnable = ms_info && ms_info->alphaToOneEnable, - .LogicOpEnable = info->logicOpEnable, .LogicOpFunction = vk_to_gen_logic_op[info->logicOp], .ColorBufferBlendEnable = a->blendEnable, @@ -113,7 +114,7 @@ gen7_emit_cb_state(struct anv_pipeline *pipeline, .WriteDisableRed = !(a->colorWriteMask & VK_COLOR_COMPONENT_R_BIT), .WriteDisableGreen = !(a->colorWriteMask & VK_COLOR_COMPONENT_G_BIT), .WriteDisableBlue = !(a->colorWriteMask & VK_COLOR_COMPONENT_B_BIT), - }; + } } }; /* Our hardware applies the blend factor prior to the blend function * regardless of what function is used. Technically, this means the @@ -123,13 +124,13 @@ gen7_emit_cb_state(struct anv_pipeline *pipeline, */ if (a->colorBlendOp == VK_BLEND_OP_MIN || a->colorBlendOp == VK_BLEND_OP_MAX) { - blend.SourceBlendFactor = BLENDFACTOR_ONE; - blend.DestinationBlendFactor = BLENDFACTOR_ONE; + blend.Entry[0].SourceBlendFactor = BLENDFACTOR_ONE; + blend.Entry[0].DestinationBlendFactor = BLENDFACTOR_ONE; } if (a->alphaBlendOp == VK_BLEND_OP_MIN || a->alphaBlendOp == VK_BLEND_OP_MAX) { - blend.SourceAlphaBlendFactor = BLENDFACTOR_ONE; - blend.DestinationAlphaBlendFactor = BLENDFACTOR_ONE; + blend.Entry[0].SourceAlphaBlendFactor = BLENDFACTOR_ONE; + blend.Entry[0].DestinationAlphaBlendFactor = BLENDFACTOR_ONE; } pipeline->blend_state = anv_state_pool_alloc(&device->dynamic_state_pool, -- 2.30.2