svga: sync with upstream changes to surface flags
[mesa.git] / src / gallium / drivers / svga / svga_screen_cache.c
index 0816ff68c8acce4608809503b5955fe0f33066b1..82dd2b2c3a0b83fea9ad561995ac6efd9e6d61c3 100644 (file)
@@ -48,6 +48,7 @@ surface_size(const struct svga_host_surface_cache_key *key)
 
    assert(key->numMipLevels > 0);
    assert(key->numFaces > 0);
+   assert(key->arraySize > 0);
 
    if (key->format == SVGA3D_BUFFER) {
       /* Special case: we don't want to count vertex/index buffers
@@ -68,7 +69,7 @@ surface_size(const struct svga_host_surface_cache_key *key)
       total_size += img_size;
    }
 
-   total_size *= key->numFaces;
+   total_size *= key->numFaces * key->arraySize * MAX2(1, key->sampleCount);
 
    return total_size;
 }
@@ -363,7 +364,7 @@ svga_screen_cache_flush(struct svga_screen *svgascreen,
           * It will be done using the current context.
           */
          if (svga->swc->surface_invalidate(svga->swc, entry->handle) != PIPE_OK) {
-            enum pipe_error ret;
+            MAYBE_UNUSED enum pipe_error ret;
 
             /* Even though surface invalidation here is done after the command
              * buffer is flushed, it is still possible that it will
@@ -477,7 +478,7 @@ svga_screen_surface_create(struct svga_screen *svgascreen,
    if (cachable) {
       /* Try to re-cycle a previously freed, cached surface */
       if (key->format == SVGA3D_BUFFER) {
-         SVGA3dSurfaceFlags hint_flag;
+         SVGA3dSurfaceAllFlags hint_flag;
 
          /* For buffers, round the buffer size up to the nearest power
           * of two to increase the probability of cache hits.  Keep