diff options
author | Ilia Mirkin <[email protected]> | 2014-01-11 21:04:52 -0500 |
---|---|---|
committer | Maarten Lankhorst <[email protected]> | 2014-01-27 16:40:42 +0100 |
commit | 006095b38af8ce80c678941d3fbe9b9509067c3a (patch) | |
tree | f07b8fd7dbfd29ebeb1db463a14a8bdeb8d36be7 /src | |
parent | c4adbd5a579a0b5952674106c1a4e0420209b321 (diff) |
nv50: VP_RESULT_MAP_SIZE has to be positive
Make sure that we never try to use a 0-sized map. This can happen when
using a gp, so add a dummy mapping when computing vp_gp_mapping in that
case.
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_shader_state.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c index 6bd1974b4ae..9a435028704 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c @@ -461,6 +461,7 @@ nv50_fp_linkage_validate(struct nv50_context *nv50) BEGIN_NV04(push, NV50_3D(SEMANTIC_PRIM_ID), 1); PUSH_DATA (push, primid); + assert(m > 0); BEGIN_NV04(push, NV50_3D(VP_RESULT_MAP_SIZE), 1); PUSH_DATA (push, m); BEGIN_NV04(push, NV50_3D(VP_RESULT_MAP(0)), n); @@ -523,6 +524,8 @@ nv50_vp_gp_mapping(uint8_t *map, int m, oid += mv & 1; } } + if (!m) + map[m++] = 0; return m; } @@ -547,6 +550,7 @@ nv50_gp_linkage_validate(struct nv50_context *nv50) BEGIN_NV04(push, NV50_3D(VP_GP_BUILTIN_ATTR_EN), 1); PUSH_DATA (push, vp->vp.attrs[2] | gp->vp.attrs[2]); + assert(m > 0); BEGIN_NV04(push, NV50_3D(VP_RESULT_MAP_SIZE), 1); PUSH_DATA (push, m); BEGIN_NV04(push, NV50_3D(VP_RESULT_MAP(0)), n); |