Path: blob/21.2-virgl/src/gallium/drivers/r300/r300_resource.c
4570 views
/*1* Copyright 2010 Red Hat Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* on the rights to use, copy, modify, merge, publish, distribute, sub7* license, and/or sell copies of the Software, and to permit persons to whom8* the Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE20* USE OR OTHER DEALINGS IN THE SOFTWARE.21*22* Authors: Dave Airlie23*/2425#include "r300_context.h"26#include "r300_texture.h"27#include "r300_transfer.h"28#include "r300_screen_buffer.h"2930static struct pipe_resource *31r300_resource_create(struct pipe_screen *screen,32const struct pipe_resource *templ)33{34if (templ->target == PIPE_BUFFER)35return r300_buffer_create(screen, templ);36else37return r300_texture_create(screen, templ);3839}4041void r300_init_resource_functions(struct r300_context *r300)42{43r300->context.buffer_map = r300_buffer_transfer_map;44r300->context.texture_map = r300_texture_transfer_map;45r300->context.transfer_flush_region = u_default_transfer_flush_region;46r300->context.buffer_unmap = r300_buffer_transfer_unmap;47r300->context.texture_unmap = r300_texture_transfer_unmap;48r300->context.buffer_subdata = u_default_buffer_subdata;49r300->context.texture_subdata = u_default_texture_subdata;50r300->context.create_surface = r300_create_surface;51r300->context.surface_destroy = r300_surface_destroy;52}5354void r300_init_screen_resource_functions(struct r300_screen *r300screen)55{56r300screen->screen.resource_create = r300_resource_create;57r300screen->screen.resource_from_handle = r300_texture_from_handle;58r300screen->screen.resource_get_handle = r300_resource_get_handle;59r300screen->screen.resource_destroy = r300_resource_destroy;60}616263