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"
46 struct svga_winsys_context
;
47 struct svga_winsys_buffer
;
48 struct svga_winsys_surface
;
52 * SVGA Device Interoperability
56 SVGA3D_FIFOReserve(struct svga_winsys_context
*swc
, uint32 cmd
, uint32 cmdSize
, uint32 nr_relocs
);
59 SVGA_FIFOCommitAll(struct svga_winsys_context
*swc
);
67 SVGA3D_DefineContext(struct svga_winsys_context
*swc
);
70 SVGA3D_DestroyContext(struct svga_winsys_context
*swc
);
78 SVGA3D_BeginDefineSurface(struct svga_winsys_context
*swc
,
79 struct svga_winsys_surface
*sid
,
80 SVGA3dSurfaceFlags flags
,
81 SVGA3dSurfaceFormat format
,
82 SVGA3dSurfaceFace
**faces
,
83 SVGA3dSize
**mipSizes
,
86 SVGA3D_DefineSurface2D(struct svga_winsys_context
*swc
,
87 struct svga_winsys_surface
*sid
,
90 SVGA3dSurfaceFormat format
);
92 SVGA3D_DestroySurface(struct svga_winsys_context
*swc
,
93 struct svga_winsys_surface
*sid
);
101 SVGA3D_SurfaceDMA(struct svga_winsys_context
*swc
,
102 struct svga_transfer
*st
,
103 SVGA3dTransferType transfer
,
104 const SVGA3dCopyBox
*boxes
,
108 SVGA3D_BufferDMA(struct svga_winsys_context
*swc
,
109 struct svga_winsys_buffer
*guest
,
110 struct svga_winsys_surface
*host
,
111 SVGA3dTransferType transfer
,
115 SVGA3dSurfaceDMAFlags flags
);
123 SVGA3D_BeginClear(struct svga_winsys_context
*swc
,
124 SVGA3dClearFlag flags
,
125 uint32 color
, float depth
, uint32 stencil
,
126 SVGA3dRect
**rects
, uint32 numRects
);
129 SVGA3D_ClearRect(struct svga_winsys_context
*swc
,
130 SVGA3dClearFlag flags
, uint32 color
, float depth
,
131 uint32 stencil
, uint32 x
, uint32 y
, uint32 w
, uint32 h
);
134 SVGA3D_BeginDrawPrimitives(struct svga_winsys_context
*swc
,
135 SVGA3dVertexDecl
**decls
,
136 uint32 numVertexDecls
,
137 SVGA3dPrimitiveRange
**ranges
,
145 SVGA3D_BeginSurfaceCopy(struct svga_winsys_context
*swc
,
146 struct pipe_surface
*src
,
147 struct pipe_surface
*dest
,
148 SVGA3dCopyBox
**boxes
, uint32 numBoxes
);
152 SVGA3D_SurfaceStretchBlt(struct svga_winsys_context
*swc
,
153 struct pipe_surface
*src
,
154 struct pipe_surface
*dest
,
155 SVGA3dBox
*boxSrc
, SVGA3dBox
*boxDest
,
156 SVGA3dStretchBltMode mode
);
159 * Shared FFP/Shader Render State
163 SVGA3D_SetRenderTarget(struct svga_winsys_context
*swc
,
164 SVGA3dRenderTargetType type
,
165 struct pipe_surface
*surface
);
168 SVGA3D_SetZRange(struct svga_winsys_context
*swc
,
169 float zMin
, float zMax
);
172 SVGA3D_SetViewport(struct svga_winsys_context
*swc
,
176 SVGA3D_SetScissorRect(struct svga_winsys_context
*swc
,
180 SVGA3D_SetClipPlane(struct svga_winsys_context
*swc
,
181 uint32 index
, const float *plane
);
184 SVGA3D_BeginSetTextureState(struct svga_winsys_context
*swc
,
185 SVGA3dTextureState
**states
,
189 SVGA3D_BeginSetRenderState(struct svga_winsys_context
*swc
,
190 SVGA3dRenderState
**states
,
199 SVGA3D_DefineShader(struct svga_winsys_context
*swc
,
200 uint32 shid
, SVGA3dShaderType type
,
201 const uint32
*bytecode
, uint32 bytecodeLen
);
204 SVGA3D_DestroyShader(struct svga_winsys_context
*swc
,
205 uint32 shid
, SVGA3dShaderType type
);
208 SVGA3D_SetShaderConst(struct svga_winsys_context
*swc
,
209 uint32 reg
, SVGA3dShaderType type
,
210 SVGA3dShaderConstType ctype
, const void *value
);
213 SVGA3D_SetShader(struct svga_winsys_context
*swc
,
214 SVGA3dShaderType type
, uint32 shid
);
222 SVGA3D_BeginQuery(struct svga_winsys_context
*swc
,
223 SVGA3dQueryType type
);
226 SVGA3D_EndQuery(struct svga_winsys_context
*swc
,
227 SVGA3dQueryType type
,
228 struct svga_winsys_buffer
*buffer
);
231 SVGA3D_WaitForQuery(struct svga_winsys_context
*swc
,
232 SVGA3dQueryType type
,
233 struct svga_winsys_buffer
*buffer
);
235 #endif /* __SVGA3D_H__ */