vk/0.210.0: Move alphaToOne and alphaToCoverate to multisample state
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 1 Dec 2015 01:20:49 +0000 (17:20 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 3 Dec 2015 21:43:52 +0000 (13:43 -0800)
include/vulkan/vulkan.h
src/vulkan/anv_meta_clear.c
src/vulkan/anv_pipeline.c
src/vulkan/gen7_pipeline.c
src/vulkan/gen8_pipeline.c

index 6930dc7d9edde16582493f7229be858de1f13b65..34470999bbf5dcecc0d1b6d8c3f96ed52e1a6be5 100644 (file)
@@ -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;
index 9f3085005f4e31518ec25c243648aecd212d8a16..1403d7d0c3dcc2015eff7ac23abb5b88302ba7c1 100644 (file)
@@ -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,
index 41a26c70d8587cfc6f8ea8aa9f24b4f3bcdc1e1e..47c62754a8ae6e714137a776cb13faccd880d8e0 100644 (file)
@@ -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
index f63ca4dcb4f40577647f6b2d8d5cea0f110d21d6..872025c7367138283898fd23fb80255edb478190 100644 (file)
@@ -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);
index 9bf7d2d555e5f75b09d4e8bfeb334cc867b52c65..8abd29c71e8b93575e945c950f3ab1949fda46ec 100644 (file)
@@ -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);