summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/gen8_pipeline.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-03-07 17:28:00 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2016-03-08 15:40:11 -0800
commitcce65471b8667e1752754c53361031cded5b39d1 (patch)
tree178546b008cbd296c8a3e21a617f8e5404c35add /src/intel/vulkan/gen8_pipeline.c
parent75af420cb1145f5fc34af6728047a2404b5f1add (diff)
downloadexternal_mesa3d-cce65471b8667e1752754c53361031cded5b39d1.zip
external_mesa3d-cce65471b8667e1752754c53361031cded5b39d1.tar.gz
external_mesa3d-cce65471b8667e1752754c53361031cded5b39d1.tar.bz2
anv: Compact render targets
Previously, we would always emit all of the render targets in the subpass. This commit changes it so that we compact render targets just like we do with other resources. Render targets are represented in the surface map by using a descriptor set index of UINT16_MAX.
Diffstat (limited to 'src/intel/vulkan/gen8_pipeline.c')
-rw-r--r--src/intel/vulkan/gen8_pipeline.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c
index 10dd645..71705d2 100644
--- a/src/intel/vulkan/gen8_pipeline.c
+++ b/src/intel/vulkan/gen8_pipeline.c
@@ -114,9 +114,33 @@ emit_cb_state(struct anv_pipeline *pipeline,
.AlphaToOneEnable = ms_info && ms_info->alphaToOneEnable,
};
+ /* Default everything to disabled */
+ for (uint32_t i = 0; i < 8; i++) {
+ blend_state.Entry[i].WriteDisableAlpha = true;
+ blend_state.Entry[i].WriteDisableRed = true;
+ blend_state.Entry[i].WriteDisableGreen = true;
+ blend_state.Entry[i].WriteDisableBlue = true;
+ }
+
+ struct anv_pipeline_bind_map *map =
+ &pipeline->bindings[MESA_SHADER_FRAGMENT];
+
bool has_writeable_rt = false;
- for (uint32_t i = 0; i < info->attachmentCount; i++) {
- const VkPipelineColorBlendAttachmentState *a = &info->pAttachments[i];
+ for (unsigned i = 0; i < map->surface_count; i++) {
+ struct anv_pipeline_binding *binding = &map->surface_to_descriptor[i];
+
+ /* All color attachments are at the beginning of the binding table */
+ if (binding->set != ANV_DESCRIPTOR_SET_COLOR_ATTACHMENTS)
+ break;
+
+ /* We can have at most 8 attachments */
+ assert(i < 8);
+
+ if (binding->offset >= info->attachmentCount)
+ continue;
+
+ const VkPipelineColorBlendAttachmentState *a =
+ &info->pAttachments[binding->offset];
if (a->srcColorBlendFactor != a->srcAlphaBlendFactor ||
a->dstColorBlendFactor != a->dstAlphaBlendFactor ||
@@ -165,13 +189,6 @@ emit_cb_state(struct anv_pipeline *pipeline,
}
}
- for (uint32_t i = info->attachmentCount; i < 8; i++) {
- blend_state.Entry[i].WriteDisableAlpha = true;
- blend_state.Entry[i].WriteDisableRed = true;
- blend_state.Entry[i].WriteDisableGreen = true;
- blend_state.Entry[i].WriteDisableBlue = true;
- }
-
if (info->attachmentCount > 0) {
struct GENX(BLEND_STATE_ENTRY) *bs = &blend_state.Entry[0];