1 /**********************************************************
2 * Copyright 2008-2009 VMware, Inc. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 **********************************************************/
29 * Command construction utility for the SVGA3D protocol used by
30 * the VMware SVGA device, based on the svgautil library.
37 #include "svga_types.h"
39 #include "svga3d_reg.h"
41 #include "pipe/p_defines.h"
47 struct svga_winsys_context
;
48 struct svga_winsys_buffer
;
49 struct svga_winsys_surface
;
53 * SVGA Device Interoperability
57 SVGA3D_FIFOReserve(struct svga_winsys_context
*swc
, uint32 cmd
, uint32 cmdSize
, uint32 nr_relocs
);
60 SVGA_FIFOCommitAll(struct svga_winsys_context
*swc
);
68 SVGA3D_DefineContext(struct svga_winsys_context
*swc
);
71 SVGA3D_DestroyContext(struct svga_winsys_context
*swc
);
79 SVGA3D_BeginDefineSurface(struct svga_winsys_context
*swc
,
80 struct svga_winsys_surface
*sid
,
81 SVGA3dSurfaceFlags flags
,
82 SVGA3dSurfaceFormat format
,
83 SVGA3dSurfaceFace
**faces
,
84 SVGA3dSize
**mipSizes
,
87 SVGA3D_DefineSurface2D(struct svga_winsys_context
*swc
,
88 struct svga_winsys_surface
*sid
,
91 SVGA3dSurfaceFormat format
);
93 SVGA3D_DestroySurface(struct svga_winsys_context
*swc
,
94 struct svga_winsys_surface
*sid
);
102 SVGA3D_SurfaceDMA(struct svga_winsys_context
*swc
,
103 struct svga_transfer
*st
,
104 SVGA3dTransferType transfer
,
105 const SVGA3dCopyBox
*boxes
,
109 SVGA3D_BufferDMA(struct svga_winsys_context
*swc
,
110 struct svga_winsys_buffer
*guest
,
111 struct svga_winsys_surface
*host
,
112 SVGA3dTransferType transfer
,
116 SVGA3dSurfaceDMAFlags flags
);
124 SVGA3D_BeginClear(struct svga_winsys_context
*swc
,
125 SVGA3dClearFlag flags
,
126 uint32 color
, float depth
, uint32 stencil
,
127 SVGA3dRect
**rects
, uint32 numRects
);
130 SVGA3D_ClearRect(struct svga_winsys_context
*swc
,
131 SVGA3dClearFlag flags
, uint32 color
, float depth
,
132 uint32 stencil
, uint32 x
, uint32 y
, uint32 w
, uint32 h
);
135 SVGA3D_BeginDrawPrimitives(struct svga_winsys_context
*swc
,
136 SVGA3dVertexDecl
**decls
,
137 uint32 numVertexDecls
,
138 SVGA3dPrimitiveRange
**ranges
,
146 SVGA3D_BeginSurfaceCopy(struct svga_winsys_context
*swc
,
147 struct pipe_surface
*src
,
148 struct pipe_surface
*dest
,
149 SVGA3dCopyBox
**boxes
, uint32 numBoxes
);
153 SVGA3D_SurfaceStretchBlt(struct svga_winsys_context
*swc
,
154 struct pipe_surface
*src
,
155 struct pipe_surface
*dest
,
156 SVGA3dBox
*boxSrc
, SVGA3dBox
*boxDest
,
157 SVGA3dStretchBltMode mode
);
160 * Shared FFP/Shader Render State
164 SVGA3D_SetRenderTarget(struct svga_winsys_context
*swc
,
165 SVGA3dRenderTargetType type
,
166 struct pipe_surface
*surface
);
169 SVGA3D_SetZRange(struct svga_winsys_context
*swc
,
170 float zMin
, float zMax
);
173 SVGA3D_SetViewport(struct svga_winsys_context
*swc
,
177 SVGA3D_SetScissorRect(struct svga_winsys_context
*swc
,
181 SVGA3D_SetClipPlane(struct svga_winsys_context
*swc
,
182 uint32 index
, const float *plane
);
185 SVGA3D_BeginSetTextureState(struct svga_winsys_context
*swc
,
186 SVGA3dTextureState
**states
,
190 SVGA3D_BeginSetRenderState(struct svga_winsys_context
*swc
,
191 SVGA3dRenderState
**states
,
200 SVGA3D_DefineShader(struct svga_winsys_context
*swc
,
201 uint32 shid
, SVGA3dShaderType type
,
202 const uint32
*bytecode
, uint32 bytecodeLen
);
205 SVGA3D_DestroyShader(struct svga_winsys_context
*swc
,
206 uint32 shid
, SVGA3dShaderType type
);
209 SVGA3D_SetShaderConst(struct svga_winsys_context
*swc
,
210 uint32 reg
, SVGA3dShaderType type
,
211 SVGA3dShaderConstType ctype
, const void *value
);
214 SVGA3D_SetShader(struct svga_winsys_context
*swc
,
215 SVGA3dShaderType type
, uint32 shid
);
223 SVGA3D_BeginQuery(struct svga_winsys_context
*swc
,
224 SVGA3dQueryType type
);
227 SVGA3D_EndQuery(struct svga_winsys_context
*swc
,
228 SVGA3dQueryType type
,
229 struct svga_winsys_buffer
*buffer
);
232 SVGA3D_WaitForQuery(struct svga_winsys_context
*swc
,
233 SVGA3dQueryType type
,
234 struct svga_winsys_buffer
*buffer
);
236 #endif /* __SVGA3D_H__ */