Returns the level of the gl_texture_image with respect to the resource
it's allocated within. Example: returns 0 for non-finalized texture.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19827>
stImage->transfer[index].transfer = transfer;
}
+/* See st_texture.h for more information. */
+GLuint
+st_texture_image_resource_level(struct gl_texture_image *stImage)
+{
+ /* An image for a non-finalized texture object only has a single level. */
+ if (stImage->pt != stImage->TexObject->pt)
+ return 0;
+
+ /* An immutable texture object may have views with an LOD offset. */
+ if (stImage->TexObject->Immutable)
+ return stImage->Level + stImage->TexObject->Attrib.MinLevel;
+
+ return stImage->Level;
+}
+
/**
* Map a texture image and return the address for a particular 2D face/slice/
* layer. The stImage indicates the cube face and mipmap level. The slice
unsigned index,
struct pipe_transfer *transfer);
+/**
+ * Returns the level of the gl_texture_image with respect to the resource it
+ * is allocated within. Example: returns 0 for non-finalized texture.
+ */
+GLuint
+st_texture_image_resource_level(struct gl_texture_image *stImage);
+
/* Return a pointer to an image within a texture. Return image stride as
* well.
*/