svga: create buffer surfaces for incompatible bind flags
authorCharmaine Lee <charmainel@vmware.com>
Wed, 16 Nov 2016 23:31:00 +0000 (15:31 -0800)
committerBrian Paul <brianp@vmware.com>
Tue, 27 Jun 2017 13:49:02 +0000 (07:49 -0600)
commiteea6223184e312bebbd751c892584e19301cf716
tree5c91da493939bfc4e27c69696dca29e2dc0293fe
parent7abfb0b0d50798a476907d4b2f47db05a314cb49
svga: create buffer surfaces for incompatible bind flags

In cases where certain bind flags cannot be enabled together,
such as CONSTANT_BUFFER cannot be combined with any other flags,
a separate host surface will be created.
For example, if a stream output buffer is reused as a constant buffer,
two host surfaces will be created, one for stream output,
and another one for constant buffer. Data will be copied from the
stream output surface to the constant buffer surface.

Fixes piglit test ext_transform_feedback-immediate-reuse-index-buffer,
                  ext_transform_feedback-immediate-reuse-uniform-buffer

Tested with MTT piglit, MTT glretrace, Nature, NobelClinician Viewer, Tropics.

v2: Fix bind flags compatibility check as suggested by Brian.
v3: Use the list utility to maintain the buffer surface list.
v4: Use the SAFE rev of LIST_FOR_EACH_ENTRY

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/drivers/svga/svga_resource_buffer.c
src/gallium/drivers/svga/svga_resource_buffer.h
src/gallium/drivers/svga/svga_resource_buffer_upload.c
src/gallium/drivers/svga/svga_resource_buffer_upload.h