free(spec_entries);
+ if (stage == MESA_SHADER_FRAGMENT) {
+ nir_lower_wpos_center(nir);
+ nir_validate_shader(nir);
+ }
+
nir_lower_returns(nir);
nir_validate_shader(nir);
/* XXX Vulkan doesn't appear to specify */
key->clamp_fragment_color = false;
- /* Vulkan always specifies upper-left coordinates */
- key->drawable_height = 0;
- key->render_to_fbo = false;
-
if (extra && extra->color_attachment_count >= 0) {
key->nr_color_regions = extra->color_attachment_count;
} else {
if (pipeline->layout && pipeline->layout->stage[stage].has_dynamic_offsets)
prog_data->nr_params += MAX_DYNAMIC_BUFFERS * 2;
- if (nir->info.num_images > 0)
+ if (nir->info.num_images > 0) {
prog_data->nr_params += nir->info.num_images * BRW_IMAGE_PARAM_SIZE;
+ pipeline->needs_data_cache = true;
+ }
+
+ if (stage == MESA_SHADER_COMPUTE)
+ ((struct brw_cs_prog_data *)prog_data)->thread_local_id_index =
+ prog_data->nr_params++; /* The CS Thread ID uniform */
+
+ if (nir->info.num_ssbos > 0)
+ pipeline->needs_data_cache = true;
if (prog_data->nr_params > 0) {
/* XXX: I think we're leaking this */
return VK_SUCCESS;
}
-static void
-gen7_compute_urb_partition(struct anv_pipeline *pipeline)
+
+void
+anv_setup_pipeline_l3_config(struct anv_pipeline *pipeline)
+{
+ const struct brw_device_info *devinfo = &pipeline->device->info;
+ switch (devinfo->gen) {
+ case 7:
+ if (devinfo->is_haswell)
+ gen75_setup_pipeline_l3_config(pipeline);
+ else
+ gen7_setup_pipeline_l3_config(pipeline);
+ break;
+ case 8:
+ gen8_setup_pipeline_l3_config(pipeline);
+ break;
+ case 9:
+ gen9_setup_pipeline_l3_config(pipeline);
+ break;
+ default:
+ unreachable("unsupported gen\n");
+ }
+}
+
+void
+anv_compute_urb_partition(struct anv_pipeline *pipeline)
{
const struct brw_device_info *devinfo = &pipeline->device->info;
+
bool vs_present = pipeline->active_stages & VK_SHADER_STAGE_VERTEX_BIT;
unsigned vs_size = vs_present ?
get_vs_prog_data(pipeline)->base.urb_entry_size : 1;
unsigned chunk_size_bytes = 8192;
/* Determine the size of the URB in chunks. */
- unsigned urb_chunks = devinfo->urb.size * 1024 / chunk_size_bytes;
+ unsigned urb_chunks = pipeline->urb.total_size * 1024 / chunk_size_bytes;
/* Reserve space for push constants */
unsigned push_constant_kb;
pipeline->urb.start[MESA_SHADER_TESS_EVAL] = push_constant_chunks;
pipeline->urb.size[MESA_SHADER_TESS_EVAL] = 1;
pipeline->urb.entries[MESA_SHADER_TESS_EVAL] = 0;
-
- const unsigned stages =
- _mesa_bitcount(pipeline->active_stages & VK_SHADER_STAGE_ALL_GRAPHICS);
- unsigned size_per_stage = stages ? (push_constant_kb / stages) : 0;
- unsigned used_kb = 0;
-
- /* Broadwell+ and Haswell gt3 require that the push constant sizes be in
- * units of 2KB. Incidentally, these are the same platforms that have
- * 32KB worth of push constant space.
- */
- if (push_constant_kb == 32)
- size_per_stage &= ~1u;
-
- for (int i = MESA_SHADER_VERTEX; i < MESA_SHADER_FRAGMENT; i++) {
- pipeline->urb.push_size[i] =
- (pipeline->active_stages & (1 << i)) ? size_per_stage : 0;
- used_kb += pipeline->urb.push_size[i];
- assert(used_kb <= push_constant_kb);
- }
-
- pipeline->urb.push_size[MESA_SHADER_FRAGMENT] =
- push_constant_kb - used_kb;
}
static void
pipeline->use_repclear = extra && extra->use_repclear;
+ pipeline->needs_data_cache = false;
+
/* When we free the pipeline, we detect stages based on the NULL status
* of various prog_data pointers. Make them NULL by default.
*/
assert(extra->disable_vs);
}
- gen7_compute_urb_partition(pipeline);
+ anv_setup_pipeline_l3_config(pipeline);
+ anv_compute_urb_partition(pipeline);
const VkPipelineVertexInputStateCreateInfo *vi_info =
pCreateInfo->pVertexInputState;