summaryrefslogtreecommitdiffstats
path: root/src/vulkan/gen7_pipeline.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-09 15:58:19 -0800
committerJason Ekstrand <[email protected]>2015-11-09 16:04:06 -0800
commite8c2a52a704d1c5cefc55b59a28a62e59f70ce6a (patch)
tree943f68971c7670a70d5ba537eccfa7b36b044b39 /src/vulkan/gen7_pipeline.c
parent862da6a891ecf570ab02ce9f07d1d22fff04b7ef (diff)
anv/gen7: Properly handle missing color-blend state
Diffstat (limited to 'src/vulkan/gen7_pipeline.c')
-rw-r--r--src/vulkan/gen7_pipeline.c96
1 files changed, 54 insertions, 42 deletions
diff --git a/src/vulkan/gen7_pipeline.c b/src/vulkan/gen7_pipeline.c
index affe04c526f..3622071ead2 100644
--- a/src/vulkan/gen7_pipeline.c
+++ b/src/vulkan/gen7_pipeline.c
@@ -253,54 +253,66 @@ gen7_emit_cb_state(struct anv_pipeline *pipeline,
{
struct anv_device *device = pipeline->device;
- /* FIXME-GEN7: All render targets share blend state settings on gen7, we
- * can't implement this.
- */
- const VkPipelineColorBlendAttachmentState *a = &info->pAttachments[0];
-
uint32_t num_dwords = GEN7_BLEND_STATE_length;
pipeline->blend_state =
anv_state_pool_alloc(&device->dynamic_state_pool, num_dwords * 4, 64);
- struct GEN7_BLEND_STATE blend_state = {
- .ColorBufferBlendEnable = a->blendEnable,
- .IndependentAlphaBlendEnable = true, /* FIXME: yes? */
- .AlphaBlendFunction = vk_to_gen_blend_op[a->blendOpAlpha],
-
- .SourceAlphaBlendFactor = vk_to_gen_blend[a->srcBlendAlpha],
- .DestinationAlphaBlendFactor = vk_to_gen_blend[a->destBlendAlpha],
-
- .ColorBlendFunction = vk_to_gen_blend_op[a->blendOpColor],
- .SourceBlendFactor = vk_to_gen_blend[a->srcBlendColor],
- .DestinationBlendFactor = vk_to_gen_blend[a->destBlendColor],
- .AlphaToCoverageEnable = info->alphaToCoverageEnable,
-
-#if 0
- bool AlphaToOneEnable;
- bool AlphaToCoverageDitherEnable;
-#endif
-
- .WriteDisableAlpha = !(a->channelWriteMask & VK_CHANNEL_A_BIT),
- .WriteDisableRed = !(a->channelWriteMask & VK_CHANNEL_R_BIT),
- .WriteDisableGreen = !(a->channelWriteMask & VK_CHANNEL_G_BIT),
- .WriteDisableBlue = !(a->channelWriteMask & VK_CHANNEL_B_BIT),
-
- .LogicOpEnable = info->logicOpEnable,
- .LogicOpFunction = vk_to_gen_logic_op[info->logicOp],
+ if (info->pAttachments == NULL) {
+ struct GEN7_BLEND_STATE blend_state = {
+ .ColorBufferBlendEnable = false,
+ .WriteDisableAlpha = false,
+ .WriteDisableRed = false,
+ .WriteDisableGreen = false,
+ .WriteDisableBlue = false,
+ };
-#if 0
- bool AlphaTestEnable;
- uint32_t AlphaTestFunction;
- bool ColorDitherEnable;
- uint32_t XDitherOffset;
- uint32_t YDitherOffset;
- uint32_t ColorClampRange;
- bool PreBlendColorClampEnable;
- bool PostBlendColorClampEnable;
-#endif
- };
+ GEN7_BLEND_STATE_pack(NULL, pipeline->blend_state.map, &blend_state);
+ } else {
+ /* FIXME-GEN7: All render targets share blend state settings on gen7, we
+ * can't implement this.
+ */
+ const VkPipelineColorBlendAttachmentState *a = &info->pAttachments[0];
+
+ struct GEN7_BLEND_STATE blend_state = {
+ .ColorBufferBlendEnable = a->blendEnable,
+ .IndependentAlphaBlendEnable = true, /* FIXME: yes? */
+ .AlphaBlendFunction = vk_to_gen_blend_op[a->blendOpAlpha],
+
+ .SourceAlphaBlendFactor = vk_to_gen_blend[a->srcBlendAlpha],
+ .DestinationAlphaBlendFactor = vk_to_gen_blend[a->destBlendAlpha],
+
+ .ColorBlendFunction = vk_to_gen_blend_op[a->blendOpColor],
+ .SourceBlendFactor = vk_to_gen_blend[a->srcBlendColor],
+ .DestinationBlendFactor = vk_to_gen_blend[a->destBlendColor],
+ .AlphaToCoverageEnable = info->alphaToCoverageEnable,
+
+# if 0
+ bool AlphaToOneEnable;
+ bool AlphaToCoverageDitherEnable;
+# endif
+
+ .WriteDisableAlpha = !(a->channelWriteMask & VK_CHANNEL_A_BIT),
+ .WriteDisableRed = !(a->channelWriteMask & VK_CHANNEL_R_BIT),
+ .WriteDisableGreen = !(a->channelWriteMask & VK_CHANNEL_G_BIT),
+ .WriteDisableBlue = !(a->channelWriteMask & VK_CHANNEL_B_BIT),
+
+ .LogicOpEnable = info->logicOpEnable,
+ .LogicOpFunction = vk_to_gen_logic_op[info->logicOp],
+
+# if 0
+ bool AlphaTestEnable;
+ uint32_t AlphaTestFunction;
+ bool ColorDitherEnable;
+ uint32_t XDitherOffset;
+ uint32_t YDitherOffset;
+ uint32_t ColorClampRange;
+ bool PreBlendColorClampEnable;
+ bool PostBlendColorClampEnable;
+# endif
+ };
- GEN7_BLEND_STATE_pack(NULL, pipeline->blend_state.map, &blend_state);
+ GEN7_BLEND_STATE_pack(NULL, pipeline->blend_state.map, &blend_state);
+ }
anv_batch_emit(&pipeline->batch, GEN7_3DSTATE_BLEND_STATE_POINTERS,
.BlendStatePointer = pipeline->blend_state.offset);