diff options
author | Jose Maria Casanova Crespo <[email protected]> | 2019-02-26 14:37:23 +0100 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-26 13:28:38 -0800 |
commit | 4122665dd90dc8997840194094bbd8cbefd7a4c3 (patch) | |
tree | b4697ecd08b1ab4840f24cfe665210fe2c488caa /src/gallium/drivers/iris/iris_draw.c | |
parent | 1c9fdcefd4bf589128bce4ab3bbfdaa4f6faa600 (diff) |
iris: Enable ARB_shader_draw_parameters support
Additional VERTEX_ELEMENT_STATE are used to store basevertex and
baseinstance and drawid updating the DWordLength of the
3DSTATE_VERTEX_ELEMENTS command.
This passes all piglit tests for spec.*draw_parameters.* tests
and VK-GL-CTS KHR-GL45.shader_draw_parameters_tests.* tests.
Now we only mark a dirty_update when parameters are changed or
when we have an indirect draw.
We enable PIPE_CAP_DRAW_PARAMETERS on Iris.
There is no edge flag support in the Vertex Elements setup.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_draw.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_draw.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_draw.c b/src/gallium/drivers/iris/iris_draw.c index 9dc102d2b70..e30f12974fb 100644 --- a/src/gallium/drivers/iris/iris_draw.c +++ b/src/gallium/drivers/iris/iris_draw.c @@ -73,6 +73,40 @@ iris_update_draw_info(struct iris_context *ice, ice->state.primitive_restart = info->primitive_restart; ice->state.cut_index = info->restart_index; } + + if (info->indirect) { + pipe_resource_reference(&ice->draw.draw_params_res, + info->indirect->buffer); + ice->draw.draw_params_offset = info->indirect->offset + + (info->index_size ? 12 : 8); + ice->draw.params.firstvertex = 0; + ice->draw.params.baseinstance = 0; + ice->state.dirty |= IRIS_DIRTY_VERTEX_BUFFERS | + IRIS_DIRTY_VERTEX_ELEMENTS | + IRIS_DIRTY_VF_SGVS; + } else if (ice->draw.is_indirect || + ice->draw.params.firstvertex != + (info->index_size ? info->index_bias : info->start) || + (ice->draw.params.baseinstance != info->start_instance)) { + pipe_resource_reference(&ice->draw.draw_params_res, NULL); + ice->draw.draw_params_offset = 0; + ice->draw.params.firstvertex = + info->index_size ? info->index_bias : info->start; + ice->draw.params.baseinstance = info->start_instance; + ice->state.dirty |= IRIS_DIRTY_VERTEX_BUFFERS | + IRIS_DIRTY_VERTEX_ELEMENTS | + IRIS_DIRTY_VF_SGVS; + } + ice->draw.is_indirect = info->indirect; + + if (ice->draw.derived_params.drawid != info->drawid || + ice->draw.derived_params.is_indexed_draw != (info->index_size ? ~0 : 0)) { + ice->draw.derived_params.drawid = info->drawid; + ice->draw.derived_params.is_indexed_draw = info->index_size ? ~0 : 0; + ice->state.dirty |= IRIS_DIRTY_VERTEX_BUFFERS | + IRIS_DIRTY_VERTEX_ELEMENTS | + IRIS_DIRTY_VF_SGVS; + } } /** |