2 * Copyright © 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 #include "anv_private.h"
32 #include "gen7_pack.h"
33 #include "gen75_pack.h"
35 #include "genX_pipeline_util.h"
38 emit_vertex_input(struct anv_pipeline
*pipeline
,
39 const VkPipelineVertexInputStateCreateInfo
*info
,
40 const struct anv_graphics_pipeline_create_info
*extra
)
43 if (extra
&& extra
->disable_vs
) {
44 /* If the VS is disabled, just assume the user knows what they're
45 * doing and apply the layout blindly. This can only come from
46 * meta, so this *should* be safe.
49 for (uint32_t i
= 0; i
< info
->vertexAttributeDescriptionCount
; i
++)
50 elements
|= (1 << info
->pVertexAttributeDescriptions
[i
].location
);
52 /* Pull inputs_read out of the VS prog data */
53 uint64_t inputs_read
= pipeline
->vs_prog_data
.inputs_read
;
54 assert((inputs_read
& ((1 << VERT_ATTRIB_GENERIC0
) - 1)) == 0);
55 elements
= inputs_read
>> VERT_ATTRIB_GENERIC0
;
58 uint32_t vb_count
= __builtin_popcount(elements
);
60 if (pipeline
->vs_prog_data
.uses_vertexid
||
61 pipeline
->vs_prog_data
.uses_instanceid
)
67 const uint32_t num_dwords
= 1 + vb_count
* 2;
69 uint32_t *p
= anv_batch_emitn(&pipeline
->batch
, num_dwords
,
70 GEN7_3DSTATE_VERTEX_ELEMENTS
);
71 memset(p
+ 1, 0, (num_dwords
- 1) * 4);
73 for (uint32_t i
= 0; i
< info
->vertexAttributeDescriptionCount
; i
++) {
74 const VkVertexInputAttributeDescription
*desc
=
75 &info
->pVertexAttributeDescriptions
[i
];
76 enum isl_format format
= anv_get_isl_format(desc
->format
,
77 VK_IMAGE_ASPECT_COLOR_BIT
,
78 VK_IMAGE_TILING_LINEAR
);
80 assert(desc
->binding
< 32);
82 if ((elements
& (1 << desc
->location
)) == 0)
83 continue; /* Binding unused */
85 uint32_t slot
= __builtin_popcount(elements
& ((1 << desc
->location
) - 1));
87 struct GEN7_VERTEX_ELEMENT_STATE element
= {
88 .VertexBufferIndex
= desc
->binding
,
90 .SourceElementFormat
= format
,
91 .EdgeFlagEnable
= false,
92 .SourceElementOffset
= desc
->offset
,
93 .Component0Control
= vertex_element_comp_control(format
, 0),
94 .Component1Control
= vertex_element_comp_control(format
, 1),
95 .Component2Control
= vertex_element_comp_control(format
, 2),
96 .Component3Control
= vertex_element_comp_control(format
, 3),
98 GEN7_VERTEX_ELEMENT_STATE_pack(NULL
, &p
[1 + slot
* 2], &element
);
101 if (pipeline
->vs_prog_data
.uses_vertexid
||
102 pipeline
->vs_prog_data
.uses_instanceid
) {
103 struct GEN7_VERTEX_ELEMENT_STATE element
= {
105 /* FIXME: Do we need to provide the base vertex as component 0 here
106 * to support the correct base vertex ID? */
107 .Component0Control
= VFCOMP_STORE_0
,
108 .Component1Control
= VFCOMP_STORE_0
,
109 .Component2Control
= VFCOMP_STORE_VID
,
110 .Component3Control
= VFCOMP_STORE_IID
112 GEN7_VERTEX_ELEMENT_STATE_pack(NULL
, &p
[1 + (vb_count
- 1) * 2], &element
);
117 gen7_emit_rs_state(struct anv_pipeline
*pipeline
,
118 const VkPipelineRasterizationStateCreateInfo
*info
,
119 const struct anv_graphics_pipeline_create_info
*extra
)
121 struct GEN7_3DSTATE_SF sf
= {
122 GEN7_3DSTATE_SF_header
,
124 /* FIXME: Get this from pass info */
125 .DepthBufferSurfaceFormat
= D24_UNORM_X8_UINT
,
127 /* LegacyGlobalDepthBiasEnable */
129 .StatisticsEnable
= true,
130 .FrontFaceFillMode
= vk_to_gen_fillmode
[info
->polygonMode
],
131 .BackFaceFillMode
= vk_to_gen_fillmode
[info
->polygonMode
],
132 .ViewTransformEnable
= !(extra
&& extra
->disable_viewport
),
133 .FrontWinding
= vk_to_gen_front_face
[info
->frontFace
],
134 /* bool AntiAliasingEnable; */
136 .CullMode
= vk_to_gen_cullmode
[info
->cullMode
],
138 /* uint32_t LineEndCapAntialiasingRegionWidth; */
139 .ScissorRectangleEnable
= !(extra
&& extra
->disable_scissor
),
141 /* uint32_t MultisampleRasterizationMode; */
142 /* bool LastPixelEnable; */
144 .TriangleStripListProvokingVertexSelect
= 0,
145 .LineStripListProvokingVertexSelect
= 0,
146 .TriangleFanProvokingVertexSelect
= 0,
148 /* uint32_t AALineDistanceMode; */
149 /* uint32_t VertexSubPixelPrecisionSelect; */
150 .UsePointWidthState
= !pipeline
->writes_point_size
,
154 GEN7_3DSTATE_SF_pack(NULL
, &pipeline
->gen7
.sf
, &sf
);
158 gen7_emit_ds_state(struct anv_pipeline
*pipeline
,
159 const VkPipelineDepthStencilStateCreateInfo
*info
)
162 /* We're going to OR this together with the dynamic state. We need
163 * to make sure it's initialized to something useful.
165 memset(pipeline
->gen7
.depth_stencil_state
, 0,
166 sizeof(pipeline
->gen7
.depth_stencil_state
));
170 struct GEN7_DEPTH_STENCIL_STATE state
= {
171 .DepthTestEnable
= info
->depthTestEnable
,
172 .DepthBufferWriteEnable
= info
->depthWriteEnable
,
173 .DepthTestFunction
= vk_to_gen_compare_op
[info
->depthCompareOp
],
174 .DoubleSidedStencilEnable
= true,
176 .StencilTestEnable
= info
->stencilTestEnable
,
177 .StencilFailOp
= vk_to_gen_stencil_op
[info
->front
.failOp
],
178 .StencilPassDepthPassOp
= vk_to_gen_stencil_op
[info
->front
.passOp
],
179 .StencilPassDepthFailOp
= vk_to_gen_stencil_op
[info
->front
.depthFailOp
],
180 .StencilTestFunction
= vk_to_gen_compare_op
[info
->front
.compareOp
],
182 .BackfaceStencilFailOp
= vk_to_gen_stencil_op
[info
->back
.failOp
],
183 .BackfaceStencilPassDepthPassOp
= vk_to_gen_stencil_op
[info
->back
.passOp
],
184 .BackfaceStencilPassDepthFailOp
= vk_to_gen_stencil_op
[info
->back
.depthFailOp
],
185 .BackFaceStencilTestFunction
= vk_to_gen_compare_op
[info
->back
.compareOp
],
188 GEN7_DEPTH_STENCIL_STATE_pack(NULL
, &pipeline
->gen7
.depth_stencil_state
, &state
);
192 gen7_emit_cb_state(struct anv_pipeline
*pipeline
,
193 const VkPipelineColorBlendStateCreateInfo
*info
,
194 const VkPipelineMultisampleStateCreateInfo
*ms_info
)
196 struct anv_device
*device
= pipeline
->device
;
198 if (info
->pAttachments
== NULL
) {
199 pipeline
->blend_state
=
200 anv_state_pool_emit(&device
->dynamic_state_pool
,
201 GEN7_BLEND_STATE
, 64,
202 .ColorBufferBlendEnable
= false,
203 .WriteDisableAlpha
= false,
204 .WriteDisableRed
= false,
205 .WriteDisableGreen
= false,
206 .WriteDisableBlue
= false);
208 /* FIXME-GEN7: All render targets share blend state settings on gen7, we
209 * can't implement this.
211 const VkPipelineColorBlendAttachmentState
*a
= &info
->pAttachments
[0];
212 pipeline
->blend_state
=
213 anv_state_pool_emit(&device
->dynamic_state_pool
,
214 GEN7_BLEND_STATE
, 64,
216 .ColorBufferBlendEnable
= a
->blendEnable
,
217 .IndependentAlphaBlendEnable
= true, /* FIXME: yes? */
218 .AlphaBlendFunction
= vk_to_gen_blend_op
[a
->alphaBlendOp
],
220 .SourceAlphaBlendFactor
= vk_to_gen_blend
[a
->srcAlphaBlendFactor
],
221 .DestinationAlphaBlendFactor
= vk_to_gen_blend
[a
->dstAlphaBlendFactor
],
223 .ColorBlendFunction
= vk_to_gen_blend_op
[a
->colorBlendOp
],
224 .SourceBlendFactor
= vk_to_gen_blend
[a
->srcColorBlendFactor
],
225 .DestinationBlendFactor
= vk_to_gen_blend
[a
->dstColorBlendFactor
],
226 .AlphaToCoverageEnable
= ms_info
&& ms_info
->alphaToCoverageEnable
,
229 bool AlphaToOneEnable
;
230 bool AlphaToCoverageDitherEnable
;
233 .WriteDisableAlpha
= !(a
->colorWriteMask
& VK_COLOR_COMPONENT_A_BIT
),
234 .WriteDisableRed
= !(a
->colorWriteMask
& VK_COLOR_COMPONENT_R_BIT
),
235 .WriteDisableGreen
= !(a
->colorWriteMask
& VK_COLOR_COMPONENT_G_BIT
),
236 .WriteDisableBlue
= !(a
->colorWriteMask
& VK_COLOR_COMPONENT_B_BIT
),
238 .LogicOpEnable
= info
->logicOpEnable
,
239 .LogicOpFunction
= vk_to_gen_logic_op
[info
->logicOp
],
242 bool AlphaTestEnable
;
243 uint32_t AlphaTestFunction
;
244 bool ColorDitherEnable
;
245 uint32_t XDitherOffset
;
246 uint32_t YDitherOffset
;
247 uint32_t ColorClampRange
;
248 bool PreBlendColorClampEnable
;
249 bool PostBlendColorClampEnable
;
254 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_BLEND_STATE_POINTERS
,
255 .BlendStatePointer
= pipeline
->blend_state
.offset
);
258 static inline uint32_t
259 scratch_space(const struct brw_stage_prog_data
*prog_data
)
261 return ffs(prog_data
->total_scratch
/ 1024);
264 GENX_FUNC(GEN7
, GEN75
) VkResult
265 genX(graphics_pipeline_create
)(
267 const VkGraphicsPipelineCreateInfo
* pCreateInfo
,
268 const struct anv_graphics_pipeline_create_info
*extra
,
269 const VkAllocationCallbacks
* pAllocator
,
270 VkPipeline
* pPipeline
)
272 ANV_FROM_HANDLE(anv_device
, device
, _device
);
273 struct anv_pipeline
*pipeline
;
276 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
);
278 pipeline
= anv_alloc2(&device
->alloc
, pAllocator
, sizeof(*pipeline
), 8,
279 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
280 if (pipeline
== NULL
)
281 return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY
);
283 result
= anv_pipeline_init(pipeline
, device
, pCreateInfo
, extra
, pAllocator
);
284 if (result
!= VK_SUCCESS
) {
285 anv_free2(&device
->alloc
, pAllocator
, pipeline
);
289 assert(pCreateInfo
->pVertexInputState
);
290 emit_vertex_input(pipeline
, pCreateInfo
->pVertexInputState
, extra
);
292 assert(pCreateInfo
->pRasterizationState
);
293 gen7_emit_rs_state(pipeline
, pCreateInfo
->pRasterizationState
, extra
);
295 gen7_emit_ds_state(pipeline
, pCreateInfo
->pDepthStencilState
);
297 gen7_emit_cb_state(pipeline
, pCreateInfo
->pColorBlendState
,
298 pCreateInfo
->pMultisampleState
);
300 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_VF_STATISTICS
,
301 .StatisticsEnable
= true);
302 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_HS
, .Enable
= false);
303 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_TE
, .TEEnable
= false);
304 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_DS
, .DSFunctionEnable
= false);
305 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_STREAMOUT
, .SOFunctionEnable
= false);
307 /* From the IVB PRM Vol. 2, Part 1, Section 3.2.1:
309 * "A PIPE_CONTROL with Post-Sync Operation set to 1h and a depth stall
310 * needs to be sent just prior to any 3DSTATE_VS, 3DSTATE_URB_VS,
311 * 3DSTATE_CONSTANT_VS, 3DSTATE_BINDING_TABLE_POINTER_VS,
312 * 3DSTATE_SAMPLER_STATE_POINTER_VS command. Only one PIPE_CONTROL
313 * needs to be sent before any combination of VS associated 3DSTATE."
315 anv_batch_emit(&pipeline
->batch
, GEN7_PIPE_CONTROL
,
316 .DepthStallEnable
= true,
317 .PostSyncOperation
= WriteImmediateData
,
318 .Address
= { &device
->workaround_bo
, 0 });
320 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS
,
321 .ConstantBufferOffset
= 0,
322 .ConstantBufferSize
= 4);
323 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS
,
324 .ConstantBufferOffset
= 4,
325 .ConstantBufferSize
= 4);
326 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS
,
327 .ConstantBufferOffset
= 8,
328 .ConstantBufferSize
= 4);
330 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_AA_LINE_PARAMETERS
);
332 const VkPipelineRasterizationStateCreateInfo
*rs_info
=
333 pCreateInfo
->pRasterizationState
;
335 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_CLIP
,
336 .FrontWinding
= vk_to_gen_front_face
[rs_info
->frontFace
],
337 .CullMode
= vk_to_gen_cullmode
[rs_info
->cullMode
],
339 .APIMode
= APIMODE_OGL
,
340 .ViewportXYClipTestEnable
= !(extra
&& extra
->disable_viewport
),
341 .ClipMode
= CLIPMODE_NORMAL
,
342 .TriangleStripListProvokingVertexSelect
= 0,
343 .LineStripListProvokingVertexSelect
= 0,
344 .TriangleFanProvokingVertexSelect
= 0,
345 .MinimumPointWidth
= 0.125,
346 .MaximumPointWidth
= 255.875);
348 uint32_t samples
= 1;
349 uint32_t log2_samples
= __builtin_ffs(samples
) - 1;
351 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_MULTISAMPLE
,
352 .PixelLocation
= PIXLOC_CENTER
,
353 .NumberofMultisamples
= log2_samples
);
355 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_SAMPLE_MASK
,
358 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_URB_VS
,
359 .VSURBStartingAddress
= pipeline
->urb
.vs_start
,
360 .VSURBEntryAllocationSize
= pipeline
->urb
.vs_size
- 1,
361 .VSNumberofURBEntries
= pipeline
->urb
.nr_vs_entries
);
363 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_URB_GS
,
364 .GSURBStartingAddress
= pipeline
->urb
.gs_start
,
365 .GSURBEntryAllocationSize
= pipeline
->urb
.gs_size
- 1,
366 .GSNumberofURBEntries
= pipeline
->urb
.nr_gs_entries
);
368 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_URB_HS
,
369 .HSURBStartingAddress
= pipeline
->urb
.vs_start
,
370 .HSURBEntryAllocationSize
= 0,
371 .HSNumberofURBEntries
= 0);
373 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_URB_DS
,
374 .DSURBStartingAddress
= pipeline
->urb
.vs_start
,
375 .DSURBEntryAllocationSize
= 0,
376 .DSNumberofURBEntries
= 0);
378 const struct brw_vue_prog_data
*vue_prog_data
= &pipeline
->vs_prog_data
.base
;
379 /* The last geometry producing stage will set urb_offset and urb_length,
380 * which we use in 3DSTATE_SBE. Skip the VUE header and position slots. */
381 uint32_t urb_offset
= 1;
382 uint32_t urb_length
= (vue_prog_data
->vue_map
.num_slots
+ 1) / 2 - urb_offset
;
385 /* From gen7_vs_state.c */
388 * From Graphics BSpec: 3D-Media-GPGPU Engine > 3D Pipeline Stages >
389 * Geometry > Geometry Shader > State:
391 * "Note: Because of corruption in IVB:GT2, software needs to flush the
392 * whole fixed function pipeline when the GS enable changes value in
395 * The hardware architects have clarified that in this context "flush the
396 * whole fixed function pipeline" means to emit a PIPE_CONTROL with the "CS
399 if (!brw
->is_haswell
&& !brw
->is_baytrail
)
400 gen7_emit_vs_workaround_flush(brw
);
403 if (pipeline
->vs_vec4
== NO_KERNEL
|| (extra
&& extra
->disable_vs
))
404 anv_batch_emit(&pipeline
->batch
, GENX(3DSTATE_VS
), .VSFunctionEnable
= false);
406 anv_batch_emit(&pipeline
->batch
, GENX(3DSTATE_VS
),
407 .KernelStartPointer
= pipeline
->vs_vec4
,
408 .ScratchSpaceBaseOffset
= pipeline
->scratch_start
[MESA_SHADER_VERTEX
],
409 .PerThreadScratchSpace
= scratch_space(&vue_prog_data
->base
),
411 .DispatchGRFStartRegisterforURBData
=
412 vue_prog_data
->base
.dispatch_grf_start_reg
,
413 .VertexURBEntryReadLength
= vue_prog_data
->urb_read_length
,
414 .VertexURBEntryReadOffset
= 0,
416 .MaximumNumberofThreads
= device
->info
.max_vs_threads
- 1,
417 .StatisticsEnable
= true,
418 .VSFunctionEnable
= true);
420 const struct brw_gs_prog_data
*gs_prog_data
= &pipeline
->gs_prog_data
;
422 if (pipeline
->gs_kernel
== NO_KERNEL
|| (extra
&& extra
->disable_vs
)) {
423 anv_batch_emit(&pipeline
->batch
, GENX(3DSTATE_GS
), .GSEnable
= false);
426 urb_length
= (gs_prog_data
->base
.vue_map
.num_slots
+ 1) / 2 - urb_offset
;
428 anv_batch_emit(&pipeline
->batch
, GENX(3DSTATE_GS
),
429 .KernelStartPointer
= pipeline
->gs_kernel
,
430 .ScratchSpaceBasePointer
= pipeline
->scratch_start
[MESA_SHADER_GEOMETRY
],
431 .PerThreadScratchSpace
= scratch_space(&gs_prog_data
->base
.base
),
433 .OutputVertexSize
= gs_prog_data
->output_vertex_size_hwords
* 2 - 1,
434 .OutputTopology
= gs_prog_data
->output_topology
,
435 .VertexURBEntryReadLength
= gs_prog_data
->base
.urb_read_length
,
436 .IncludeVertexHandles
= gs_prog_data
->base
.include_vue_handles
,
437 .DispatchGRFStartRegisterforURBData
=
438 gs_prog_data
->base
.base
.dispatch_grf_start_reg
,
440 .MaximumNumberofThreads
= device
->info
.max_gs_threads
- 1,
441 /* This in the next dword on HSW. */
442 .ControlDataFormat
= gs_prog_data
->control_data_format
,
443 .ControlDataHeaderSize
= gs_prog_data
->control_data_header_size_hwords
,
444 .InstanceControl
= MAX2(gs_prog_data
->invocations
, 1) - 1,
445 .DispatchMode
= gs_prog_data
->base
.dispatch_mode
,
446 .GSStatisticsEnable
= true,
447 .IncludePrimitiveID
= gs_prog_data
->include_primitive_id
,
448 # if (ANV_IS_HASWELL)
449 .ReorderMode
= REORDER_TRAILING
,
451 .ReorderEnable
= true,
456 const struct brw_wm_prog_data
*wm_prog_data
= &pipeline
->wm_prog_data
;
457 if (wm_prog_data
->urb_setup
[VARYING_SLOT_BFC0
] != -1 ||
458 wm_prog_data
->urb_setup
[VARYING_SLOT_BFC1
] != -1)
459 anv_finishme("two-sided color needs sbe swizzling setup");
460 if (wm_prog_data
->urb_setup
[VARYING_SLOT_PRIMITIVE_ID
] != -1)
461 anv_finishme("primitive_id needs sbe swizzling setup");
463 /* FIXME: generated header doesn't emit attr swizzle fields */
464 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_SBE
,
465 .NumberofSFOutputAttributes
= pipeline
->wm_prog_data
.num_varying_inputs
,
466 .VertexURBEntryReadLength
= urb_length
,
467 .VertexURBEntryReadOffset
= urb_offset
,
468 .PointSpriteTextureCoordinateOrigin
= UPPERLEFT
);
470 anv_batch_emit(&pipeline
->batch
, GENX(3DSTATE_PS
),
471 .KernelStartPointer0
= pipeline
->ps_ksp0
,
472 .ScratchSpaceBasePointer
= pipeline
->scratch_start
[MESA_SHADER_FRAGMENT
],
473 .PerThreadScratchSpace
= scratch_space(&wm_prog_data
->base
),
475 .MaximumNumberofThreads
= device
->info
.max_wm_threads
- 1,
476 .PushConstantEnable
= wm_prog_data
->base
.nr_params
> 0,
477 .AttributeEnable
= wm_prog_data
->num_varying_inputs
> 0,
478 .oMaskPresenttoRenderTarget
= wm_prog_data
->uses_omask
,
480 .RenderTargetFastClearEnable
= false,
481 .DualSourceBlendEnable
= false,
482 .RenderTargetResolveEnable
= false,
484 .PositionXYOffsetSelect
= wm_prog_data
->uses_pos_offset
?
485 POSOFFSET_SAMPLE
: POSOFFSET_NONE
,
487 ._32PixelDispatchEnable
= false,
488 ._16PixelDispatchEnable
= pipeline
->ps_simd16
!= NO_KERNEL
,
489 ._8PixelDispatchEnable
= pipeline
->ps_simd8
!= NO_KERNEL
,
491 .DispatchGRFStartRegisterforConstantSetupData0
= pipeline
->ps_grf_start0
,
492 .DispatchGRFStartRegisterforConstantSetupData1
= 0,
493 .DispatchGRFStartRegisterforConstantSetupData2
= pipeline
->ps_grf_start2
,
496 /* Haswell requires the sample mask to be set in this packet as well as
497 * in 3DSTATE_SAMPLE_MASK; the values should match. */
498 /* _NEW_BUFFERS, _NEW_MULTISAMPLE */
501 .KernelStartPointer1
= 0,
502 .KernelStartPointer2
= pipeline
->ps_ksp2
);
504 /* FIXME-GEN7: This needs a lot more work, cf gen7 upload_wm_state(). */
505 anv_batch_emit(&pipeline
->batch
, GEN7_3DSTATE_WM
,
506 .StatisticsEnable
= true,
507 .ThreadDispatchEnable
= true,
508 .LineEndCapAntialiasingRegionWidth
= 0, /* 0.5 pixels */
509 .LineAntialiasingRegionWidth
= 1, /* 1.0 pixels */
510 .EarlyDepthStencilControl
= EDSC_NORMAL
,
511 .PointRasterizationRule
= RASTRULE_UPPER_RIGHT
,
512 .PixelShaderComputedDepthMode
= wm_prog_data
->computed_depth_mode
,
513 .BarycentricInterpolationMode
= wm_prog_data
->barycentric_interp_modes
);
515 *pPipeline
= anv_pipeline_to_handle(pipeline
);
520 GENX_FUNC(GEN7
, GEN75
) VkResult
521 genX(compute_pipeline_create
)(
523 const VkComputePipelineCreateInfo
* pCreateInfo
,
524 const VkAllocationCallbacks
* pAllocator
,
525 VkPipeline
* pPipeline
)
527 anv_finishme("primitive_id needs sbe swizzling setup");