This is needed for renderbuffer support. --- src/gallium/winsys/sw/null/null_sw_winsys.c | 52 +++++++++++++++++++++++---- 1 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/src/gallium/winsys/sw/null/null_sw_winsys.c b/src/gallium/winsys/sw/null/null_sw_winsys.c index 73b777f..4af2e2b 100644 --- a/src/gallium/winsys/sw/null/null_sw_winsys.c +++ b/src/gallium/winsys/sw/null/null_sw_winsys.c @@ -39,16 +39,29 @@ #include "pipe/p_format.h" #include "util/u_memory.h" +#include "util/u_format.h" +#include "util/u_inlines.h" #include "state_tracker/sw_winsys.h" #include "null_sw_winsys.h" +struct null_displaytarget +{ + enum pipe_format format; + unsigned width; + unsigned height; + unsigned stride; + void *data; + void *mapped; +}; + + static boolean null_sw_is_displaytarget_format_supported(struct sw_winsys *ws, unsigned tex_usage, enum pipe_format format ) { - return FALSE; + return TRUE; } @@ -57,8 +70,9 @@ null_sw_displaytarget_map(struct sw_winsys *ws, struct sw_displaytarget *dt, unsigned flags ) { - assert(0); - return NULL; + struct null_displaytarget *null_dt = (struct null_displaytarget *)dt; + null_dt->mapped = null_dt->data; + return null_dt->mapped; } @@ -66,7 +80,8 @@ static void null_sw_displaytarget_unmap(struct sw_winsys *ws, struct sw_displaytarget *dt ) { - assert(0); + struct null_displaytarget *null_dt = (struct null_displaytarget *)dt; + null_dt->mapped = NULL; } @@ -74,7 +89,9 @@ static void null_sw_displaytarget_destroy(struct sw_winsys *winsys, struct sw_displaytarget *dt) { - assert(0); + struct null_displaytarget *null_dt = (struct null_displaytarget *)dt; + FREE(null_dt->data); + FREE(null_dt); } @@ -86,8 +103,29 @@ null_sw_displaytarget_create(struct sw_winsys *winsys, unsigned alignment, unsigned *stride) { - fprintf(stderr, "null_sw_displaytarget_create() returning NULL\n"); - return NULL; + struct null_displaytarget *dt; + unsigned nblocksy, size; + + dt = CALLOC_STRUCT(null_displaytarget); + if (!dt) + return NULL; + + dt->format = format; + dt->width = width; + dt->height = height; + + nblocksy = util_format_get_nblocksy(format, height); + dt->stride = align(util_format_get_stride(format, width), alignment); + size = dt->stride * nblocksy; + + dt->data = align_malloc(size, alignment); + if (!dt->data) { + FREE(dt); + return NULL; + } + + *stride = dt->stride; + return (struct sw_displaytarget *)dt; } -- 1.7.6 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev