diff options
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_private.h')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_private.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index e5f192b7576..f30f9af388b 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -469,4 +469,15 @@ draw_get_rasterizer_no_cull( struct draw_context *draw, #define DRAW_GET_IDX(_elts, _i) \ (((_i) >= draw->pt.user.eltMax) ? 0 : (_elts)[_i]) +/** + * Return index of the given viewport clamping it + * to be between 0 <= and < PIPE_MAX_VIEWPORTS + */ +static INLINE unsigned +draw_clamp_viewport_idx(int idx) +{ + return ((PIPE_MAX_VIEWPORTS > idx || idx < 0) ? idx : 0); +} + + #endif /* DRAW_PRIVATE_H */ |