gallium lies. buffer_size is not actually buffer_size but available
size, which is 'buffer_size - buffer_offset' so by adding buffer
offset we'd incorrectly compute overflow.
Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
for (i = 0; i < draw->so.num_targets; i++) {
struct draw_so_target *target = draw->so.targets[i];
if (target) {
- buffer_total_bytes[i] = target->internal_offset +
- target->target.buffer_offset;
+ buffer_total_bytes[i] = target->internal_offset;
} else {
buffer_total_bytes[i] = 0;
}
* have been written. The internal offset can be stored on the device
* and the CPU actually doesn't have to query it.
*
+ * Note that the buffer_size variable is actually specifying the available
+ * space in the buffer, not the size of the attached buffer.
+ * In other words in majority of cases buffer_size would simply be
+ * 'buffer->width0 - buffer_offset', so buffer_size refers to the size
+ * of the buffer left, after accounting for buffer offset, for stream output
+ * to write to.
+ *
* Use PIPE_QUERY_SO_STATISTICS to know how many primitives have
* actually been written.
*/