summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorDanylo Piliaiev <[email protected]>2019-09-24 14:12:39 +0300
committerDylan Baker <[email protected]>2019-09-26 08:47:50 -0700
commit960ab3e465f876195ea238d873fb2d4637f10d97 (patch)
treea13d5f3f7f0fe25cc72436804a8e50f8062fc858 /src/gallium/state_trackers
parent41b57b8b73ec08a553c691542b00d77180bff422 (diff)
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: <[email protected]> Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Axel Davy <[email protected]> (cherry picked from commit 2d8f77db839cb3a83f0b1575a028d5aa4258c322)
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/nine_shader.c8
1 files changed, 7 insertions, 1 deletions
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;
}