ilo: clean up transfer format conversion
[mesa.git] / src / gallium / drivers / galahad / glhd_objects.c
index c9680d13e1509b0cf75ecfcc9b672829ee4bd431..e4a8f28f352fb147a2378307d165ea2daf8a0197 100644 (file)
@@ -71,7 +71,8 @@ galahad_resource_destroy(struct galahad_resource *glhd_resource)
 
 
 struct pipe_surface *
-galahad_surface_create(struct galahad_resource *glhd_resource,
+galahad_surface_create(struct galahad_context *glhd_context,
+                        struct galahad_resource *glhd_resource,
                         struct pipe_surface *surface)
 {
    struct galahad_surface *glhd_surface;
@@ -100,7 +101,8 @@ error:
 }
 
 void
-galahad_surface_destroy(struct galahad_surface *glhd_surface)
+galahad_surface_destroy(struct galahad_context *glhd_context,
+                         struct galahad_surface *glhd_surface)
 {
    pipe_resource_reference(&glhd_surface->base.texture, NULL);
    pipe_surface_reference(&glhd_surface->surface, NULL);
@@ -125,8 +127,9 @@ galahad_sampler_view_create(struct galahad_context *glhd_context,
    glhd_view->base = *view;
    glhd_view->base.reference.count = 1;
    glhd_view->base.texture = NULL;
-   pipe_resource_reference(&glhd_view->base.texture, glhd_resource->resource);
-   glhd_view->base.context = glhd_context->pipe;
+   pipe_resource_reference(&glhd_view->base.texture, &glhd_resource->base);
+   glhd_view->base.context = &glhd_context->base;
+   glhd_view->sampler_view = view;
 
    return &glhd_view->base;
 error:
@@ -137,9 +140,8 @@ void
 galahad_sampler_view_destroy(struct galahad_context *glhd_context,
                               struct galahad_sampler_view *glhd_view)
 {
+   pipe_sampler_view_reference(&glhd_view->sampler_view, NULL);
    pipe_resource_reference(&glhd_view->base.texture, NULL);
-   glhd_context->pipe->sampler_view_destroy(glhd_context->pipe,
-                                          glhd_view->sampler_view);
    FREE(glhd_view);
 }
 
@@ -171,7 +173,7 @@ galahad_transfer_create(struct galahad_context *glhd_context,
    return &glhd_transfer->base;
 
 error:
-   glhd_context->pipe->transfer_destroy(glhd_context->pipe, transfer);
+   glhd_context->pipe->transfer_unmap(glhd_context->pipe, transfer);
    return NULL;
 }
 
@@ -180,7 +182,5 @@ galahad_transfer_destroy(struct galahad_context *glhd_context,
                           struct galahad_transfer *glhd_transfer)
 {
    pipe_resource_reference(&glhd_transfer->base.resource, NULL);
-   glhd_context->pipe->transfer_destroy(glhd_context->pipe,
-                                        glhd_transfer->transfer);
    FREE(glhd_transfer);
 }