aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/svga/include/svga3d_surfacedefs.h')
-rw-r--r--src/gallium/drivers/svga/include/svga3d_surfacedefs.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/include/svga3d_surfacedefs.h b/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
index 89baff3d2bc..9054e72207d 100644
--- a/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
+++ b/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
@@ -1102,6 +1102,30 @@ svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format,
/**
+ * svga3dsurface_get_serialized_size_extended - Returns the number of bytes
+ * required for a surface with given parameters. Support for sample count.
+ *
+ */
+static inline uint32
+svga3dsurface_get_serialized_size_extended(SVGA3dSurfaceFormat format,
+ SVGA3dSize base_level_size,
+ uint32 num_mip_levels,
+ uint32 num_layers,
+ uint32 num_samples)
+{
+ uint64_t total_size = svga3dsurface_get_serialized_size(format,
+ base_level_size,
+ num_mip_levels,
+ num_layers);
+
+ total_size *= (num_samples > 1 ? num_samples : 1);
+
+ return (total_size > (uint64_t) MAX_UINT32) ? MAX_UINT32 :
+ (uint32) total_size;
+}
+
+
+/**
* Compute the offset (in bytes) to a pixel in an image (or volume).
* 'width' is the image width in pixels
* 'height' is the image height in pixels