diff options
author | Jose Maria Casanova Crespo <[email protected]> | 2019-02-27 20:44:27 +0100 |
---|---|---|
committer | José Casanova Crespo <[email protected]> | 2019-03-06 22:19:08 +0000 |
commit | ffa9082c406d17680c0ceeeac921ace5e793e5af (patch) | |
tree | adada651f6b8bf310e2120c8476df958d0c81b4d /src/gallium/drivers/iris/iris_program.c | |
parent | c4d2da1f1471a742de7156e45ca52f83c75f0ba9 (diff) |
iris: setup EdgeFlag Vertex Element when needed.
If Vertex Shader uses EdgeFlag the hardware request that it is setup
as the last VERTEX_ELEMENT_STATE. If SGVS are add at draw time we
need to also reconfigure the last 3DSTATE_VF_INSTANCING so its
VertexElementIndex points to the new Vertex Element that contains
the EdgeFlag.
So if draw parameters or edgeflag are not used the CSO generated at
iris_create_vertex_element is sent directly in the batches. But if
edge flag is used we adjust last VERTEX_ELEMENT_STATE and
last 3DSTATE_VF_INSTANCING using their alternative edge flag version
we generate at iris_create_vertex_element and store at the CSO.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_program.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_program.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index ad3eab6d8ce..2feb43a367f 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -626,15 +626,22 @@ iris_update_compiled_vs(struct iris_context *ice) const bool needs_sgvs_element = uses_draw_params || vs_prog_data->uses_instanceid || vs_prog_data->uses_vertexid; + bool needs_edge_flag = false; + nir_foreach_variable(var, &ish->nir->inputs) { + if (var->data.location == VERT_ATTRIB_EDGEFLAG) + needs_edge_flag = true; + } if (ice->state.vs_uses_draw_params != uses_draw_params || - ice->state.vs_uses_derived_draw_params != uses_derived_draw_params) { + ice->state.vs_uses_derived_draw_params != uses_derived_draw_params || + ice->state.vs_needs_edge_flag != needs_edge_flag) { ice->state.dirty |= IRIS_DIRTY_VERTEX_BUFFERS | IRIS_DIRTY_VERTEX_ELEMENTS; } ice->state.vs_uses_draw_params = uses_draw_params; ice->state.vs_uses_derived_draw_params = uses_derived_draw_params; ice->state.vs_needs_sgvs_element = needs_sgvs_element; + ice->state.vs_needs_edge_flag = needs_edge_flag; } } |