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@vmware.com>
This commit is contained in:
Brian Paul 2012-09-16 19:40:13 -06:00
parent a0fc7620f5
commit bd8b43a9f4
2 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -137,6 +137,14 @@ struct pipe_screen {
enum pipe_format format,
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.
*/