Path: blob/21.2-virgl/src/gallium/drivers/swr/swr_scratch.h
4570 views
/****************************************************************************1* Copyright (C) 2015 Intel Corporation. All Rights Reserved.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* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* 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 NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21***************************************************************************/2223#ifndef SWR_SCRATCH_H24#define SWR_SCRATCH_H2526struct swr_scratch_space {27void *head;28unsigned int current_size;29/* TODO XXX: Add a fence for wrap condition. */3031void *base;32};3334struct swr_scratch_buffers {35struct swr_scratch_space vs_constants;36struct swr_scratch_space fs_constants;37struct swr_scratch_space gs_constants;38struct swr_scratch_space tcs_constants;39struct swr_scratch_space tes_constants;40struct swr_scratch_space vertex_buffer;41struct swr_scratch_space index_buffer;42};434445/*46* swr_copy_to_scratch_space47* Copies size bytes of user_buffer into the scratch ring buffer.48* Used to store temporary data such as client arrays and constants.49*50* Inputs:51* space ptr to scratch pool (vs_constants, fs_constants)52* user_buffer, data to copy into scratch space53* size to be copied54* Returns:55* pointer to data copied to scratch space.56*/57void *swr_copy_to_scratch_space(struct swr_context *ctx,58struct swr_scratch_space *space,59const void *user_buffer,60unsigned int size);6162void swr_init_scratch_buffers(struct swr_context *ctx);63void swr_destroy_scratch_buffers(struct swr_context *ctx);6465#endif666768