To ensure stream output target surfaces are available for the draw commands,
we need to rebind the current stream output targets at the first draw in the
command buffer.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
if (ret != PIPE_OK)
return ret;
+ /* Rebind stream output targets */
+ ret = svga_rebind_stream_output_targets(svga);
+ if (ret != PIPE_OK)
+ return ret;
+
/* Rebind index buffer */
if (svga->state.hw_draw.ib) {
struct svga_winsys_context *swc = svga->swc;
svga->num_so_targets = num_targets;
}
+/**
+ * Rebind stream output target surfaces
+ */
+enum pipe_error
+svga_rebind_stream_output_targets(struct svga_context *svga)
+{
+ struct svga_winsys_context *swc = svga->swc;
+ enum pipe_error ret;
+ unsigned i;
+
+ for (i = 0; i < svga->num_so_targets; i++) {
+ ret = swc->resource_rebind(swc, svga->so_surfaces[i], NULL, SVGA_RELOC_WRITE);
+ if (ret != PIPE_OK)
+ return ret;
+ }
+
+ return PIPE_OK;
+}
+
void
svga_init_stream_output_functions(struct svga_context *svga)
{
svga_delete_stream_output(struct svga_context *svga,
struct svga_stream_output *streamout);
+enum pipe_error
+svga_rebind_stream_output_targets(struct svga_context *svga);
+
#endif /* SVGA_STREAMOUT_H */