Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / gallium / drivers / softpipe / sp_texture.c
index 52df89504b8a97de1508ef8371c9ca401bfffd3c..c9a22a97891ae0ea4ddd35efc0be32e11f6eac81 100644 (file)
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_transfer.h"
+#include "util/u_surface.h"
 
 #include "sp_context.h"
 #include "sp_flush.h"
 #include "sp_texture.h"
 #include "sp_screen.h"
 
-#include "state_tracker/sw_winsys.h"
+#include "frontend/sw_winsys.h"
 
 
 /**
@@ -111,7 +112,7 @@ softpipe_resource_layout(struct pipe_screen *screen,
  * Check the size of the texture specified by 'res'.
  * \return TRUE if OK, FALSE if too large.
  */
-static boolean
+static bool
 softpipe_can_create_resource(struct pipe_screen *screen,
                              const struct pipe_resource *res)
 {
@@ -165,9 +166,9 @@ softpipe_resource_create_front(struct pipe_screen *screen,
    pipe_reference_init(&spr->base.reference, 1);
    spr->base.screen = screen;
 
-   spr->pot = (util_is_power_of_two(templat->width0) &&
-               util_is_power_of_two(templat->height0) &&
-               util_is_power_of_two(templat->depth0));
+   spr->pot = (util_is_power_of_two_or_zero(templat->width0) &&
+               util_is_power_of_two_or_zero(templat->height0) &&
+               util_is_power_of_two_or_zero(templat->depth0));
 
    if (spr->base.bind & (PIPE_BIND_DISPLAY_TARGET |
                         PIPE_BIND_SCANOUT |
@@ -218,7 +219,8 @@ softpipe_resource_destroy(struct pipe_screen *pscreen,
 static struct pipe_resource *
 softpipe_resource_from_handle(struct pipe_screen *screen,
                               const struct pipe_resource *templat,
-                              struct winsys_handle *whandle)
+                              struct winsys_handle *whandle,
+                              unsigned usage)
 {
    struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
    struct softpipe_resource *spr = CALLOC_STRUCT(softpipe_resource);
@@ -229,9 +231,9 @@ softpipe_resource_from_handle(struct pipe_screen *screen,
    pipe_reference_init(&spr->base.reference, 1);
    spr->base.screen = screen;
 
-   spr->pot = (util_is_power_of_two(templat->width0) &&
-               util_is_power_of_two(templat->height0) &&
-               util_is_power_of_two(templat->depth0));
+   spr->pot = (util_is_power_of_two_or_zero(templat->width0) &&
+               util_is_power_of_two_or_zero(templat->height0) &&
+               util_is_power_of_two_or_zero(templat->depth0));
 
    spr->dt = winsys->displaytarget_from_handle(winsys,
                                                templat,
@@ -248,17 +250,19 @@ softpipe_resource_from_handle(struct pipe_screen *screen,
 }
 
 
-static boolean
+static bool
 softpipe_resource_get_handle(struct pipe_screen *screen,
+                             struct pipe_context *ctx,
                              struct pipe_resource *pt,
-                             struct winsys_handle *whandle)
+                             struct winsys_handle *whandle,
+                             unsigned usage)
 {
    struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
    struct softpipe_resource *spr = softpipe_resource(pt);
 
    assert(spr->dt);
    if (!spr->dt)
-      return FALSE;
+      return false;
 
    return winsys->displaytarget_get_handle(winsys, spr->dt, whandle);
 }
@@ -268,9 +272,9 @@ softpipe_resource_get_handle(struct pipe_screen *screen,
  * Helper function to compute offset (in bytes) for a particular
  * texture level/face/slice from the start of the buffer.
  */
-static unsigned
-sp_get_tex_image_offset(const struct softpipe_resource *spr,
-                        unsigned level, unsigned layer)
+unsigned
+softpipe_get_tex_image_offset(const struct softpipe_resource *spr,
+                              unsigned level, unsigned layer)
 {
    unsigned offset = spr->level_offset[level];
 
@@ -420,7 +424,7 @@ softpipe_transfer_map(struct pipe_context *pipe,
    pt->stride = spr->stride[level];
    pt->layer_stride = spr->img_stride[level];
 
-   spt->offset = sp_get_tex_image_offset(spr, level, box->z);
+   spt->offset = softpipe_get_tex_image_offset(spr, level, box->z);
 
    spt->offset +=
          box->y / util_format_get_blockheight(format) * spt->base.stride +
@@ -512,10 +516,12 @@ softpipe_init_texture_funcs(struct pipe_context *pipe)
    pipe->transfer_unmap = softpipe_transfer_unmap;
 
    pipe->transfer_flush_region = u_default_transfer_flush_region;
-   pipe->transfer_inline_write = u_default_transfer_inline_write;
+   pipe->buffer_subdata = u_default_buffer_subdata;
+   pipe->texture_subdata = u_default_texture_subdata;
 
    pipe->create_surface = softpipe_create_surface;
    pipe->surface_destroy = softpipe_surface_destroy;
+   pipe->clear_texture = util_clear_texture;
 }