summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-03-22 15:36:46 -0700
committerJason Ekstrand <[email protected]>2017-05-03 11:25:46 -0700
commitca5bdfdfc68c065980db2dd06a5979c2c4fe674b (patch)
treec7387b417a046b4eaac388ed11263a4b832695ef
parentc4549e05aa882f9f27dd9a5b8256af72a632b632 (diff)
anv/pipeline: Add a subpass field to anv_pipeline
This simplifies the code a variety of places. Reviewed-by: Iago Toral Quiroga <[email protected]>
-rw-r--r--src/intel/vulkan/anv_pipeline.c12
-rw-r--r--src/intel/vulkan/anv_private.h1
2 files changed, 8 insertions, 5 deletions
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 599286c2169..85b3290e7b4 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -279,7 +279,6 @@ populate_wm_prog_key(const struct anv_pipeline *pipeline,
struct brw_wm_prog_key *key)
{
const struct gen_device_info *devinfo = &pipeline->device->info;
- ANV_FROM_HANDLE(anv_render_pass, render_pass, info->renderPass);
memset(key, 0, sizeof(*key));
@@ -297,8 +296,7 @@ populate_wm_prog_key(const struct anv_pipeline *pipeline,
/* XXX Vulkan doesn't appear to specify */
key->clamp_fragment_color = false;
- key->nr_color_regions =
- render_pass->subpasses[info->subpass].color_count;
+ key->nr_color_regions = pipeline->subpass->color_count;
key->replicate_alpha = key->nr_color_regions > 1 &&
info->pMultisampleState &&
@@ -1028,8 +1026,7 @@ copy_non_dynamic_state(struct anv_pipeline *pipeline,
const VkGraphicsPipelineCreateInfo *pCreateInfo)
{
anv_cmd_dirty_mask_t states = ANV_CMD_DIRTY_DYNAMIC_ALL;
- ANV_FROM_HANDLE(anv_render_pass, pass, pCreateInfo->renderPass);
- struct anv_subpass *subpass = &pass->subpasses[pCreateInfo->subpass];
+ struct anv_subpass *subpass = pipeline->subpass;
pipeline->dynamic_state = default_dynamic_state;
@@ -1232,6 +1229,11 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
alloc = &device->alloc;
pipeline->device = device;
+
+ ANV_FROM_HANDLE(anv_render_pass, render_pass, pCreateInfo->renderPass);
+ assert(pCreateInfo->subpass < render_pass->subpass_count);
+ pipeline->subpass = &render_pass->subpasses[pCreateInfo->subpass];
+
pipeline->layout = anv_pipeline_layout_from_handle(pCreateInfo->layout);
result = anv_reloc_list_init(&pipeline->batch_relocs, alloc);
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 4e742170da2..e0725b708de 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1797,6 +1797,7 @@ struct anv_pipeline {
uint32_t dynamic_state_mask;
struct anv_dynamic_state dynamic_state;
+ struct anv_subpass * subpass;
struct anv_pipeline_layout * layout;
bool needs_data_cache;