softpipe: fix texture view crashes
[mesa.git] / src / gallium / drivers / softpipe / sp_buffer.c
index 69717baa1a05d8f6e60f3d04073fedc7c69f85cf..e91d2af78e9ed0e69bf584853e5d786a4b0f1910 100644 (file)
@@ -59,7 +59,7 @@ sp_tgsi_load(const struct tgsi_buffer *buffer,
    unsigned char *data_ptr;
    const struct util_format_description *format_desc = util_format_description(PIPE_FORMAT_R32_UINT);
 
-   if (params->unit > PIPE_MAX_SHADER_BUFFERS)
+   if (params->unit >= PIPE_MAX_SHADER_BUFFERS)
       goto fail_write_all_zero;
 
    bview = &sp_buf->sp_bview[params->unit];
@@ -117,7 +117,7 @@ sp_tgsi_store(const struct tgsi_buffer *buffer,
    int j, c;
    const struct util_format_description *format_desc = util_format_description(PIPE_FORMAT_R32_UINT);
 
-   if (params->unit > PIPE_MAX_SHADER_BUFFERS)
+   if (params->unit >= PIPE_MAX_SHADER_BUFFERS)
       return;
 
    bview = &sp_buf->sp_bview[params->unit];
@@ -159,7 +159,7 @@ handle_op_uint(const struct pipe_shader_buffer *bview,
                bool just_read,
                unsigned char *data_ptr,
                uint qi,
-               unsigned opcode,
+               enum tgsi_opcode opcode,
                unsigned writemask,
                float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE],
                float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
@@ -281,7 +281,7 @@ handle_op_uint(const struct pipe_shader_buffer *bview,
 static void
 sp_tgsi_op(const struct tgsi_buffer *buffer,
            const struct tgsi_buffer_params *params,
-           unsigned opcode,
+           enum tgsi_opcode opcode,
            const int s[TGSI_QUAD_SIZE],
            float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE],
            float rgba2[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE])
@@ -293,7 +293,7 @@ sp_tgsi_op(const struct tgsi_buffer *buffer,
    int j, c;
    unsigned char *data_ptr;
 
-   if (params->unit > PIPE_MAX_SHADER_BUFFERS)
+   if (params->unit >= PIPE_MAX_SHADER_BUFFERS)
       return;
 
    bview = &sp_buf->sp_bview[params->unit];
@@ -345,7 +345,7 @@ sp_tgsi_get_dims(const struct tgsi_buffer *buffer,
    struct pipe_shader_buffer *bview;
    struct softpipe_resource *spr;
 
-   if (params->unit > PIPE_MAX_SHADER_BUFFERS)
+   if (params->unit >= PIPE_MAX_SHADER_BUFFERS)
       return;
 
    bview = &sp_buf->sp_bview[params->unit];