anv/pipeline: Allow the user to pass a null MultisampleCreateInfo
[mesa.git] / src / vulkan / anv_pipeline.c
index 367d5180bd3df8c6689834060bfe3a66ffc23d4c..bf983ed8f2ab7107b4cca04b241880f42572ac4a 100644 (file)
@@ -315,10 +315,14 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
    if (pipeline->layout && pipeline->layout->stage[stage].has_dynamic_offsets)
       prog_data->nr_params += MAX_DYNAMIC_BUFFERS * 2;
 
+   if (pipeline->layout && pipeline->layout->stage[stage].image_count > 0)
+      prog_data->nr_params += pipeline->layout->stage[stage].image_count *
+                              BRW_IMAGE_PARAM_SIZE;
+
    if (prog_data->nr_params > 0) {
       /* XXX: I think we're leaking this */
-      prog_data->param = (const gl_constant_value **)
-         malloc(prog_data->nr_params * sizeof(gl_constant_value *));
+      prog_data->param = (const union gl_constant_value **)
+         malloc(prog_data->nr_params * sizeof(union gl_constant_value *));
 
       /* We now set the param values to be offsets into a
        * anv_push_constant_data structure.  Since the compiler doesn't
@@ -329,7 +333,7 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
       if (nir->num_uniforms > 0) {
          /* Fill out the push constants section of the param array */
          for (unsigned i = 0; i < MAX_PUSH_CONSTANTS_SIZE / sizeof(float); i++)
-            prog_data->param[i] = (const gl_constant_value *)
+            prog_data->param[i] = (const union gl_constant_value *)
                &null_data->client_data[i * sizeof(float)];
       }
    }
@@ -338,7 +342,8 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
    anv_nir_apply_dynamic_offsets(pipeline, nir, prog_data);
 
    /* Apply the actual pipeline layout to UBOs, SSBOs, and textures */
-   anv_nir_apply_pipeline_layout(nir, pipeline->layout);
+   if (pipeline->layout)
+      anv_nir_apply_pipeline_layout(nir, prog_data, pipeline->layout);
 
    /* All binding table offsets provided by apply_pipeline_layout() are
     * relative to the start of the bindint table (plus MAX_RTS for VS).
@@ -357,7 +362,7 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
    /* nir_lower_io will only handle the push constants; we need to set this
     * to the full number of possible uniforms.
     */
-   nir->num_uniforms = prog_data->nr_params;
+   nir->num_uniforms = prog_data->nr_params * 4;
 
    return nir;
 }
@@ -373,8 +378,12 @@ anv_pipeline_upload_kernel(struct anv_pipeline *pipeline,
 
    memcpy(state.map, data, size);
 
+   if (!pipeline->device->info.has_llc)
+      anv_state_clflush(state);
+
    return state.offset;
 }
+
 static void
 anv_pipeline_add_compiled_stage(struct anv_pipeline *pipeline,
                                 gl_shader_stage stage,
@@ -504,7 +513,7 @@ anv_pipeline_compile_gs(struct anv_pipeline *pipeline,
    }
 
    /* TODO: SIMD8 GS */
-   pipeline->gs_vec4 =
+   pipeline->gs_kernel =
       anv_pipeline_upload_kernel(pipeline, shader_code, code_size);
    pipeline->gs_vertex_count = nir->info.gs.vertices_in;
 
@@ -891,7 +900,6 @@ anv_pipeline_validate_create_info(const VkGraphicsPipelineCreateInfo *info)
    assert(info->pInputAssemblyState);
    assert(info->pViewportState);
    assert(info->pRasterizationState);
-   assert(info->pMultisampleState);
 
    if (subpass && subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED)
       assert(info->pDepthStencilState);
@@ -957,7 +965,7 @@ anv_pipeline_init(struct anv_pipeline *pipeline, struct anv_device *device,
 
    pipeline->vs_simd8 = NO_KERNEL;
    pipeline->vs_vec4 = NO_KERNEL;
-   pipeline->gs_vec4 = NO_KERNEL;
+   pipeline->gs_kernel = NO_KERNEL;
 
    pipeline->active_stages = 0;
    pipeline->total_scratch = 0;