Merge branch '7.8'
[mesa.git] / src / gallium / state_trackers / python / st_device.c
index 0d87c705e7582de34b208d1b0c4b6c00a408c9fb..aac28cacfdea1425f78b49821cd41182f9a2a321 100644 (file)
@@ -31,6 +31,7 @@
 #include "pipe/p_shader_tokens.h"
 #include "util/u_inlines.h"
 #include "cso_cache/cso_context.h"
+#include "util/u_inlines.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_sampler.h"
@@ -84,7 +85,7 @@ st_device_create(boolean hardware)
    if (hardware)
       screen = st_hardware_screen_create();
    else
-      screen = st_software_screen_create();
+      screen = st_software_screen_create("softpipe");
 
    screen = trace_screen_create(screen);
    if (!screen)
@@ -128,7 +129,7 @@ st_context_destroy(struct st_context *st_ctx)
          pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], NULL);
       for(i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
          pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], NULL);
-      pipe_texture_reference(&st_ctx->default_texture, NULL);
+      pipe_resource_reference(&st_ctx->default_texture, NULL);
 
       FREE(st_ctx);
       
@@ -228,9 +229,9 @@ st_context_create(struct st_device *st_dev)
 
    /* default textures */
    {
+      struct pipe_context *pipe = st_ctx->pipe;
       struct pipe_screen *screen = st_dev->screen;
-      struct pipe_texture templat;
-      struct pipe_transfer *transfer;
+      struct pipe_resource templat;
       struct pipe_sampler_view view_templ;
       struct pipe_sampler_view *view;
       unsigned i;
@@ -242,25 +243,23 @@ st_context_create(struct st_device *st_dev)
       templat.height0 = 1;
       templat.depth0 = 1;
       templat.last_level = 0;
+      templat.bind = PIPE_BIND_SAMPLER_VIEW;
    
-      st_ctx->default_texture = screen->texture_create( screen, &templat );
+      st_ctx->default_texture = screen->resource_create( screen, &templat );
       if(st_ctx->default_texture) {
-         transfer = screen->get_tex_transfer(screen,
-                                             st_ctx->default_texture,
-                                             0, 0, 0,
-                                             PIPE_TRANSFER_WRITE,
-                                             0, 0,
-                                             st_ctx->default_texture->width0,
-                                             st_ctx->default_texture->height0);
-         if (transfer) {
-            uint32_t *map;
-            map = (uint32_t *) screen->transfer_map(screen, transfer);
-            if(map) {
-               *map = 0x00000000;
-               screen->transfer_unmap(screen, transfer);
-            }
-            screen->tex_transfer_destroy(transfer);
-         }
+        struct pipe_box box;
+        uint32_t zero = 0;
+        
+        u_box_origin_2d( 1, 1, &box );
+
+        pipe->transfer_inline_write(pipe,
+                                    st_ctx->default_texture,
+                                    u_subresource(0,0),
+                                    PIPE_TRANSFER_WRITE,
+                                    &box,
+                                    &zero,
+                                    sizeof zero,
+                                    0);
       }
 
       u_sampler_view_default_template(&view_templ,