From 9fa6e328ebac4616148a23a7a4fbe7ed25ec315f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 30 Nov 2015 17:20:49 -0800 Subject: [PATCH] vk/0.210.0: Move alphaToOne and alphaToCoverate to multisample state --- include/vulkan/vulkan.h | 4 ++-- src/vulkan/anv_meta_clear.c | 6 ++---- src/vulkan/anv_pipeline.c | 3 ++- src/vulkan/gen7_pipeline.c | 8 +++++--- src/vulkan/gen8_pipeline.c | 10 ++++++---- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 6930dc7d9ed..34470999bbf 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -1703,6 +1703,8 @@ typedef struct VkPipelineMultisampleStateCreateInfo { VkBool32 sampleShadingEnable; float minSampleShading; const VkSampleMask* pSampleMask; + VkBool32 alphaToCoverageEnable; + VkBool32 alphaToOneEnable; } VkPipelineMultisampleStateCreateInfo; typedef struct VkStencilOpState { @@ -1745,8 +1747,6 @@ typedef struct VkPipelineColorBlendStateCreateInfo { VkStructureType sType; const void* pNext; VkPipelineColorBlendStateCreateFlags flags; - VkBool32 alphaToCoverageEnable; - VkBool32 alphaToOneEnable; VkBool32 logicOpEnable; VkLogicOp logicOp; uint32_t attachmentCount; diff --git a/src/vulkan/anv_meta_clear.c b/src/vulkan/anv_meta_clear.c index 9f3085005f4..1403d7d0c3d 100644 --- a/src/vulkan/anv_meta_clear.c +++ b/src/vulkan/anv_meta_clear.c @@ -188,6 +188,8 @@ create_pipeline(struct anv_device *device, .rasterSamples = 1, /* FINISHME: Multisampling */ .sampleShadingEnable = false, .pSampleMask = (VkSampleMask[]) { UINT32_MAX }, + .alphaToCoverageEnable = false, + .alphaToOneEnable = false, }, .pDepthStencilState = ds_state, .pColorBlendState = cb_state, @@ -285,8 +287,6 @@ init_color_pipeline(struct anv_device *device) const VkPipelineColorBlendStateCreateInfo cb_state = { .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, - .alphaToCoverageEnable = false, - .alphaToOneEnable = false, .logicOpEnable = false, .attachmentCount = 1, .pAttachments = (VkPipelineColorBlendAttachmentState []) { @@ -469,8 +469,6 @@ create_depthstencil_pipeline(struct anv_device *device, const VkPipelineColorBlendStateCreateInfo cb_state = { .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, - .alphaToCoverageEnable = false, - .alphaToOneEnable = false, .logicOpEnable = false, .attachmentCount = 0, .pAttachments = NULL, diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c index 41a26c70d85..47c62754a8a 100644 --- a/src/vulkan/anv_pipeline.c +++ b/src/vulkan/anv_pipeline.c @@ -311,7 +311,8 @@ populate_wm_prog_key(const struct brw_device_info *devinfo, key->nr_color_regions = render_pass->subpasses[info->subpass].color_count; key->replicate_alpha = key->nr_color_regions > 1 && - info->pColorBlendState->alphaToCoverageEnable; + info->pMultisampleState && + info->pMultisampleState->alphaToCoverageEnable; if (info->pMultisampleState && info->pMultisampleState->rasterSamples > 1) { /* We should probably pull this out of the shader, but it's fairly diff --git a/src/vulkan/gen7_pipeline.c b/src/vulkan/gen7_pipeline.c index f63ca4dcb4f..872025c7367 100644 --- a/src/vulkan/gen7_pipeline.c +++ b/src/vulkan/gen7_pipeline.c @@ -248,7 +248,8 @@ gen7_emit_ds_state(struct anv_pipeline *pipeline, static void gen7_emit_cb_state(struct anv_pipeline *pipeline, - const VkPipelineColorBlendStateCreateInfo *info) + const VkPipelineColorBlendStateCreateInfo *info, + const VkPipelineMultisampleStateCreateInfo *ms_info) { struct anv_device *device = pipeline->device; @@ -283,7 +284,7 @@ gen7_emit_cb_state(struct anv_pipeline *pipeline, .ColorBlendFunction = vk_to_gen_blend_op[a->colorBlendOp], .SourceBlendFactor = vk_to_gen_blend[a->srcColorBlendFactor], .DestinationBlendFactor = vk_to_gen_blend[a->dstColorBlendFactor], - .AlphaToCoverageEnable = info->alphaToCoverageEnable, + .AlphaToCoverageEnable = ms_info && ms_info->alphaToCoverageEnable, # if 0 bool AlphaToOneEnable; @@ -355,7 +356,8 @@ genX(graphics_pipeline_create)( gen7_emit_ds_state(pipeline, pCreateInfo->pDepthStencilState); - gen7_emit_cb_state(pipeline, pCreateInfo->pColorBlendState); + gen7_emit_cb_state(pipeline, pCreateInfo->pColorBlendState, + pCreateInfo->pMultisampleState); anv_batch_emit(&pipeline->batch, GEN7_3DSTATE_VF_STATISTICS, .StatisticsEnable = true); diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c index 9bf7d2d555e..8abd29c71e8 100644 --- a/src/vulkan/gen8_pipeline.c +++ b/src/vulkan/gen8_pipeline.c @@ -148,7 +148,8 @@ emit_rs_state(struct anv_pipeline *pipeline, static void emit_cb_state(struct anv_pipeline *pipeline, - const VkPipelineColorBlendStateCreateInfo *info) + const VkPipelineColorBlendStateCreateInfo *info, + const VkPipelineMultisampleStateCreateInfo *ms_info) { struct anv_device *device = pipeline->device; @@ -206,8 +207,8 @@ emit_cb_state(struct anv_pipeline *pipeline, anv_state_pool_alloc(&device->dynamic_state_pool, num_dwords * 4, 64); struct GENX(BLEND_STATE) blend_state = { - .AlphaToCoverageEnable = info->alphaToCoverageEnable, - .AlphaToOneEnable = info->alphaToOneEnable, + .AlphaToCoverageEnable = ms_info && ms_info->alphaToCoverageEnable, + .AlphaToOneEnable = ms_info && ms_info->alphaToOneEnable, }; for (uint32_t i = 0; i < info->attachmentCount; i++) { @@ -365,7 +366,8 @@ genX(graphics_pipeline_create)( assert(pCreateInfo->pRasterState); emit_rs_state(pipeline, pCreateInfo->pRasterState, extra); emit_ds_state(pipeline, pCreateInfo->pDepthStencilState); - emit_cb_state(pipeline, pCreateInfo->pColorBlendState); + emit_cb_state(pipeline, pCreateInfo->pColorBlendState, + pCreateInfo->pMultisampleState); anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VF_STATISTICS), .StatisticsEnable = true); -- 2.30.2