1bf215546Sopenharmony_ci/********************************************************** 2bf215546Sopenharmony_ci * Copyright 2008-2009 VMware, Inc. All rights reserved. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person 5bf215546Sopenharmony_ci * obtaining a copy of this software and associated documentation 6bf215546Sopenharmony_ci * files (the "Software"), to deal in the Software without 7bf215546Sopenharmony_ci * restriction, including without limitation the rights to use, copy, 8bf215546Sopenharmony_ci * modify, merge, publish, distribute, sublicense, and/or sell copies 9bf215546Sopenharmony_ci * of the Software, and to permit persons to whom the Software is 10bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions: 11bf215546Sopenharmony_ci * 12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be 13bf215546Sopenharmony_ci * included in all copies or substantial portions of the Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18bf215546Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19bf215546Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20bf215546Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21bf215546Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22bf215546Sopenharmony_ci * SOFTWARE. 23bf215546Sopenharmony_ci * 24bf215546Sopenharmony_ci **********************************************************/ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci#ifndef SVGA_SWTNL_PRIVATE_H 27bf215546Sopenharmony_ci#define SVGA_SWTNL_PRIVATE_H 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_ci#include "svga_swtnl.h" 30bf215546Sopenharmony_ci#include "draw/draw_vertex.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci#include "svga_types.h" 33bf215546Sopenharmony_ci#include "svga3d_reg.h" 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_ci/** 36bf215546Sopenharmony_ci * Primitive renderer for svga. 37bf215546Sopenharmony_ci */ 38bf215546Sopenharmony_cistruct svga_vbuf_render { 39bf215546Sopenharmony_ci struct vbuf_render base; 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_ci struct svga_context *svga; 42bf215546Sopenharmony_ci struct vertex_info vertex_info; 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_ci unsigned vertex_size; 45bf215546Sopenharmony_ci 46bf215546Sopenharmony_ci SVGA3dElementLayoutId layout_id; /**< current element layout id */ 47bf215546Sopenharmony_ci 48bf215546Sopenharmony_ci enum pipe_prim_type prim; 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_ci struct pipe_resource *vbuf; 51bf215546Sopenharmony_ci struct pipe_resource *ibuf; 52bf215546Sopenharmony_ci struct pipe_transfer *vbuf_transfer; 53bf215546Sopenharmony_ci struct pipe_transfer *ibuf_transfer; 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_ci void *vbuf_ptr; 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ci /* current size of buffer */ 58bf215546Sopenharmony_ci size_t vbuf_size; 59bf215546Sopenharmony_ci size_t ibuf_size; 60bf215546Sopenharmony_ci 61bf215546Sopenharmony_ci /* size of that the buffer should be */ 62bf215546Sopenharmony_ci size_t vbuf_alloc_size; 63bf215546Sopenharmony_ci size_t ibuf_alloc_size; 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci /* current write place */ 66bf215546Sopenharmony_ci size_t vbuf_offset; 67bf215546Sopenharmony_ci size_t ibuf_offset; 68bf215546Sopenharmony_ci 69bf215546Sopenharmony_ci /* currently used */ 70bf215546Sopenharmony_ci size_t vbuf_used; 71bf215546Sopenharmony_ci 72bf215546Sopenharmony_ci SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS]; 73bf215546Sopenharmony_ci unsigned vdecl_offset; 74bf215546Sopenharmony_ci unsigned vdecl_count; 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_ci ushort min_index; 77bf215546Sopenharmony_ci ushort max_index; 78bf215546Sopenharmony_ci}; 79bf215546Sopenharmony_ci 80bf215546Sopenharmony_ci/** 81bf215546Sopenharmony_ci * Basically a cast wrapper. 82bf215546Sopenharmony_ci */ 83bf215546Sopenharmony_cistatic inline struct svga_vbuf_render * 84bf215546Sopenharmony_cisvga_vbuf_render( struct vbuf_render *render ) 85bf215546Sopenharmony_ci{ 86bf215546Sopenharmony_ci assert(render); 87bf215546Sopenharmony_ci return (struct svga_vbuf_render *)render; 88bf215546Sopenharmony_ci} 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci 91bf215546Sopenharmony_cistruct vbuf_render * 92bf215546Sopenharmony_cisvga_vbuf_render_create( struct svga_context *svga ); 93bf215546Sopenharmony_ci 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_cienum pipe_error 96bf215546Sopenharmony_cisvga_swtnl_update_vdecl( struct svga_context *svga ); 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_ci 99bf215546Sopenharmony_ci#endif 100