diff options
author | Miklós Máté <[email protected]> | 2017-12-02 23:35:18 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-12-25 14:32:23 +0100 |
commit | 4003ad298af3e94c0496d3a88fa7d9fbf42befb0 (patch) | |
tree | bcf13bd761ee6ec9c533cd37d145b55f81e0f3f5 /src/mesa/main | |
parent | 178a3dfb0ebc517bef3fec37afaaa75af2fdc48d (diff) |
mesa: fix crash when an ATI_fs pass begins with an alpha inst
This fixes crash when:
- first pass begins with alpha inst
- first pass ends with color inst, second pass begins with alpha inst
Also, use the symbolic name instead of a number.
Piglit: spec/ati_fragment_shader/api-alphafirst
v2: fixed formatting
Signed-off-by: Miklós Máté <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/atifragshader.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c index 49ddb6e5af6..d61455e12f8 100644 --- a/src/mesa/main/atifragshader.c +++ b/src/mesa/main/atifragshader.c @@ -597,9 +597,13 @@ _mesa_FragmentOpXATI(GLint optype, GLuint arg_count, GLenum op, GLuint dst, else if (curProg->cur_pass==2) curProg->cur_pass=3; - /* decide whether this is a new instruction or not ... all color instructions are new, - and alpha instructions might also be new if there was no preceding color inst */ - if ((optype == 0) || (curProg->last_optype == optype)) { + /* Decide whether this is a new instruction or not. All color instructions + * are new, and alpha instructions might also be new if there was no + * preceding color inst. This may also be the first inst of the pass + */ + if (optype == ATI_FRAGMENT_SHADER_COLOR_OP || + curProg->last_optype == optype || + curProg->numArithInstr[curProg->cur_pass >> 1] == 0) { if (curProg->numArithInstr[curProg->cur_pass >> 1] > 7) { _mesa_error(ctx, GL_INVALID_OPERATION, "C/AFragmentOpATI(instrCount)"); return; |