From: Danylo Piliaiev Date: Tue, 24 Sep 2019 11:12:39 +0000 (+0300) Subject: st/nine: Ignore D3DSIO_RET if it is the last instruction in a shader X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2d8f77db839cb3a83f0b1575a028d5aa4258c322;p=mesa.git st/nine: Ignore D3DSIO_RET if it is the last instruction in a shader RET as a last instruction could be safely ignored. Remove it to prevent crashes/warnings in case underlying driver doesn't implement arbitrary returns. A better way would be to remove the RET after the whole shader is parsed which will handle a possible case when the last RET is followed by a comment. CC: Signed-off-by: Danylo Piliaiev Reviewed-by: Axel Davy --- diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index 93910f90741..1117b55faa1 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -1803,7 +1803,13 @@ DECL_SPECIAL(LOOP) DECL_SPECIAL(RET) { - ureg_RET(tx->ureg); + /* RET as a last instruction could be safely ignored. + * Remove it to prevent crashes/warnings in case underlying + * driver doesn't implement arbitrary returns. + */ + if (*(tx->parse_next) != NINED3DSP_END) { + ureg_RET(tx->ureg); + } return D3D_OK; }