radeonsi: only upload (dump to L2) those descriptors that are used by shaders
[mesa.git] / src / gallium / drivers / svga / svga_cmd.c
index e45b3e72aebf9ed25bf8e367a2d702287625b0b1..7b78cb735472ccf94a2ceb38c4f12980233390ad 100644 (file)
@@ -119,6 +119,8 @@ SVGA3D_FIFOReserve(struct svga_winsys_context *swc,
    header->id = cmd;
    header->size = cmdSize;
 
+   swc->last_command = cmd;
+
    return &header[1];
 }
 
@@ -1868,6 +1870,24 @@ SVGA3D_InvalidateGBImagePartial(struct svga_winsys_context *swc,
    return PIPE_OK;
 }
 
+enum pipe_error
+SVGA3D_InvalidateGBSurface(struct svga_winsys_context *swc,
+                           struct svga_winsys_surface *surface)
+{
+   SVGA3dCmdInvalidateGBSurface *cmd =
+      SVGA3D_FIFOReserve(swc,
+                         SVGA_3D_CMD_INVALIDATE_GB_SURFACE,
+                         sizeof *cmd,
+                         1);  /* one relocation */
+   if (!cmd)
+      return PIPE_ERROR_OUT_OF_MEMORY;
+
+   swc->surface_relocation(swc, &cmd->sid, NULL, surface,
+                           SVGA_RELOC_READ | SVGA_RELOC_INTERNAL);
+   swc->commit(swc);
+
+   return PIPE_OK;
+}
 
 enum pipe_error
 SVGA3D_SetGBShaderConstsInline(struct svga_winsys_context *swc,