diff options
author | Jason Ekstrand <[email protected]> | 2015-10-23 21:30:21 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-10-26 16:25:02 -0700 |
commit | ab6ed2e1ac98745c62a10a82e414eb17e4e4ba44 (patch) | |
tree | a3fdc837dbee7d38c336d17cd1a923fba8f7e57a /src/vulkan | |
parent | 9006e555ce5ca539289a71d5234f876752a6c00d (diff) |
anv/gen8_pipeline: Emit a real 3DSTATE_SBE_SWIZ packet
Diffstat (limited to 'src/vulkan')
-rw-r--r-- | src/vulkan/gen8_pipeline.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c index 3468ce02154..a51cf4924ae 100644 --- a/src/vulkan/gen8_pipeline.c +++ b/src/vulkan/gen8_pipeline.c @@ -351,7 +351,6 @@ gen8_graphics_pipeline_create( anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_WM_CHROMAKEY, .ChromaKeyKillEnable = false); - anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_SBE_SWIZ); anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_AA_LINE_PARAMETERS); anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_CLIP, @@ -496,13 +495,51 @@ gen8_graphics_pipeline_create( const struct brw_wm_prog_data *wm_prog_data = &pipeline->wm_prog_data; + /* TODO: We should clean this up. Among other things, this is mostly + * shared with other gens. + */ + const struct brw_vue_map *fs_input_map; + if (pipeline->gs_vec4 == NO_KERNEL) + fs_input_map = &vue_prog_data->vue_map; + else + fs_input_map = &gs_prog_data->base.vue_map; + + struct GEN8_3DSTATE_SBE_SWIZ swiz = { + GEN8_3DSTATE_SBE_SWIZ_header, + }; + + int max_source_attr = 0; + for (int attr = 0; attr < VARYING_SLOT_MAX; attr++) { + int input_index = wm_prog_data->urb_setup[attr]; + + if (input_index < 0) + continue; + + /* We have to subtract two slots to accout for the URB entry output + * read offset in the VS and GS stages. + */ + int source_attr = fs_input_map->varying_to_slot[attr] - 2; + max_source_attr = MAX2(max_source_attr, source_attr); + + if (input_index >= 16) + continue; + + swiz.Attribute[input_index].SourceAttribute = source_attr; + } + anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_SBE, + .AttributeSwizzleEnable = true, .ForceVertexURBEntryReadLength = false, .ForceVertexURBEntryReadOffset = false, + .VertexURBEntryReadLength = DIV_ROUND_UP(max_source_attr + 1, 2), .PointSpriteTextureCoordinateOrigin = UPPERLEFT, .NumberofSFOutputAttributes = wm_prog_data->num_varying_inputs); + uint32_t *dw = anv_batch_emit_dwords(&pipeline->batch, + GEN8_3DSTATE_SBE_SWIZ_length); + GEN8_3DSTATE_SBE_SWIZ_pack(&pipeline->batch, dw, &swiz); + anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_PS, .KernelStartPointer0 = pipeline->ps_ksp0, |