Path: blob/21.2-virgl/src/gallium/auxiliary/vl/vl_vertex_buffers.h
4565 views
/**************************************************************************1*2* Copyright 2010 Christian König3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/26#ifndef vl_vertex_buffers_h27#define vl_vertex_buffers_h2829#include "pipe/p_state.h"30#include "pipe/p_video_state.h"3132#include "vl_defines.h"33#include "vl_types.h"3435/* vertex buffers act as a todo list36* uploading all the usefull informations to video ram37* so a vertex shader can work with them38*/3940/* inputs to the vertex shaders */41enum VS_INPUT42{43VS_I_RECT = 0,44VS_I_VPOS = 1,4546VS_I_BLOCK_NUM = 2,4748VS_I_MV_TOP = 2,49VS_I_MV_BOTTOM = 3,5051NUM_VS_INPUTS = 452};5354enum vl_mv_weight55{56PIPE_VIDEO_MV_WEIGHT_MIN = 0,57PIPE_VIDEO_MV_WEIGHT_HALF = 128,58PIPE_VIDEO_MV_WEIGHT_MAX = 25659};6061enum vl_field_select62{63PIPE_VIDEO_FRAME = 0,64PIPE_VIDEO_TOP_FIELD = 1,65PIPE_VIDEO_BOTTOM_FIELD = 3,6667/* TODO68PIPE_VIDEO_DUALPRIME69PIPE_VIDEO_16x870*/71};7273struct vl_motionvector74{75struct {76int16_t x, y;77int16_t field_select; /**< enum pipe_video_field_select */78int16_t weight; /**< enum pipe_video_mv_weight */79} top, bottom;80};8182struct vl_ycbcr_block83{84uint8_t x, y;85uint8_t intra;86uint8_t coding;87float block_num;88};8990struct vl_vertex_buffer91{92unsigned width, height;9394struct {95struct pipe_resource *resource;96struct pipe_transfer *transfer;97struct vl_ycbcr_block *vertex_stream;98} ycbcr[VL_NUM_COMPONENTS];99100struct {101struct pipe_resource *resource;102struct pipe_transfer *transfer;103struct vl_motionvector *vertex_stream;104} mv[VL_MAX_REF_FRAMES];105};106107struct pipe_vertex_buffer vl_vb_upload_quads(struct pipe_context *pipe);108109struct pipe_vertex_buffer vl_vb_upload_pos(struct pipe_context *pipe, unsigned width, unsigned height);110111void *vl_vb_get_ves_ycbcr(struct pipe_context *pipe);112113void *vl_vb_get_ves_mv(struct pipe_context *pipe);114115bool vl_vb_init(struct vl_vertex_buffer *buffer,116struct pipe_context *pipe,117unsigned width, unsigned height);118119unsigned vl_vb_attributes_per_plock(struct vl_vertex_buffer *buffer);120121void vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe);122123struct pipe_vertex_buffer vl_vb_get_ycbcr(struct vl_vertex_buffer *buffer, int component);124125struct vl_ycbcr_block *vl_vb_get_ycbcr_stream(struct vl_vertex_buffer *buffer, int component);126127struct pipe_vertex_buffer vl_vb_get_mv(struct vl_vertex_buffer *buffer, int ref_frame);128129unsigned vl_vb_get_mv_stream_stride(struct vl_vertex_buffer *buffer);130131struct vl_motionvector *vl_vb_get_mv_stream(struct vl_vertex_buffer *buffer, int ref_frame);132133void vl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe);134135void vl_vb_cleanup(struct vl_vertex_buffer *buffer);136137#endif /* vl_vertex_buffers_h */138139140