Mesa (master): gallium: add new pipe_screen::can_create_resource() function

Brian Paul brianp at kemper.freedesktop.org
Tue Sep 18 02:01:12 UTC 2012


Module: Mesa
Branch: master
Commit: bd8b43a9f467a244ac75dcbf13f162793ccc5f6e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd8b43a9f467a244ac75dcbf13f162793ccc5f6e

Author: Brian Paul <brianp at vmware.com>
Date:   Sun Sep 16 19:40:13 2012 -0600

gallium: add new pipe_screen::can_create_resource() function

Used to implement proxy textures.  If a gallium driver doesn't implement
this function we'll just continue to use the core Mesa fallback code.

Without this hook we really have no good way to implement OpenGL proxy
textures with gallium drivers.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/gallium/docs/source/screen.rst  |   10 ++++++++++
 src/gallium/include/pipe/p_screen.h |    8 ++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 4eb5b32..540d308 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -358,6 +358,16 @@ the maximum allowed legal value is 32.
 
 Returns TRUE if all usages can be satisfied.
 
+
+can_create_resource
+^^^^^^^^^^^^^^^^^^^
+
+Check if a resource can actually be created (but don't actually allocate any
+memory).  This is used to implement OpenGL's proxy textures.  Typically, a
+driver will simply check if the total size of the given resource is less than
+some limit.
+
+
 .. _resource_create:
 
 resource_create
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index fdf6fa2..dff5036 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -138,6 +138,14 @@ struct pipe_screen {
                                          enum pipe_video_profile profile );
 
    /**
+    * Check if we can actually create the given resource (test the dimension,
+    * overall size, etc).  Used to implement proxy textures.
+    * \return TRUE if size is OK, FALSE if too large.
+    */
+   boolean (*can_create_resource)(struct pipe_screen *screen,
+                                  const struct pipe_resource *templat);
+                               
+   /**
     * Create a new texture object, using the given template info.
     */
    struct pipe_resource * (*resource_create)(struct pipe_screen *,




More information about the mesa-commit mailing list