aboutsummaryrefslogtreecommitdiffstats
path: root/vmware/svga3d.h
blob: 1242754186e9cc0cf76065c546799a784cd8fc5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/**********************************************************
 * Copyright 2008-2009 VMware, Inc.  All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 **********************************************************/

/*
 * svga3d.h --
 *
 *      FIFO command level interface to the SVGA3D protocol used by
 *      the VMware SVGA device.
 */

#ifndef __SVGA3D_H__
#define __SVGA3D_H__

#include "svga.h"
#include "svga3d_reg.h"


/*
 * SVGA Device Interoperability
 */

Bool SVGA3D_Init(void);
void SVGA3D_BeginPresent(uint32 sid, SVGA3dCopyRect **rects, uint32 numRects);
void SVGA3D_BeginPresentReadback(SVGA3dRect **rects, uint32 numRects);
void SVGA3D_BlitSurfaceToScreen(const SVGA3dSurfaceImageId *srcImage,
                                const SVGASignedRect *srcRect,
                                uint32 destScreenId,
                                const SVGASignedRect *destRect);
void SVGA3D_BeginBlitSurfaceToScreen(const SVGA3dSurfaceImageId *srcImage,
                                     const SVGASignedRect *srcRect,
                                     uint32 destScreenId,
                                     const SVGASignedRect *destRect,
                                     SVGASignedRect **clipRects,
                                     uint32 numClipRects);


/*
 * Surface Management
 */

void SVGA3D_BeginDefineSurface(uint32 sid,
                               SVGA3dSurfaceFlags flags,
                               SVGA3dSurfaceFormat format,
                               SVGA3dSurfaceFace **faces,
                               SVGA3dSize **mipSizes,
                               uint32 numMipSizes);
void SVGA3D_DestroySurface(uint32 sid);
void SVGA3D_BeginSurfaceDMA(SVGA3dGuestImage *guestImage,
                            SVGA3dSurfaceImageId *hostImage,
                            SVGA3dTransferType transfer,
                            SVGA3dCopyBox **boxes,
                            uint32 numBoxes);


/*
 * Context Management
 */

void SVGA3D_DefineContext(uint32 cid);
void SVGA3D_DestroyContext(uint32 cid);


/*
 * Drawing Operations
 */

void SVGA3D_BeginClear(uint32 cid, SVGA3dClearFlag flags,
                       uint32 color, float depth, uint32 stencil,
                       SVGA3dRect **rects, uint32 numRects);
void SVGA3D_BeginDrawPrimitives(uint32 cid,
                                SVGA3dVertexDecl **decls,
                                uint32 numVertexDecls,
                                SVGA3dPrimitiveRange **ranges,
                                uint32 numRanges);

/*
 * Blits
 */

void SVGA3D_BeginSurfaceCopy(SVGA3dSurfaceImageId *src,
                             SVGA3dSurfaceImageId *dest,
                             SVGA3dCopyBox **boxes, uint32 numBoxes);

void SVGA3D_SurfaceStretchBlt(SVGA3dSurfaceImageId *src,
                              SVGA3dSurfaceImageId *dest,
                              SVGA3dBox *boxSrc, SVGA3dBox *boxDest,
                              SVGA3dStretchBltMode mode);

/*
 * Shared FFP/Shader Render State
 */

void SVGA3D_SetRenderTarget(uint32 cid, SVGA3dRenderTargetType type,
                            SVGA3dSurfaceImageId *target);
void SVGA3D_SetZRange(uint32 cid, float zMin, float zMax);
void SVGA3D_SetViewport(uint32 cid, SVGA3dRect *rect);
void SVGA3D_SetScissorRect(uint32 cid, SVGA3dRect *rect);
void SVGA3D_SetClipPlane(uint32 cid, uint32 index, const float *plane);
void SVGA3D_BeginSetTextureState(uint32 cid, SVGA3dTextureState **states,
                                 uint32 numStates);
void SVGA3D_BeginSetRenderState(uint32 cid, SVGA3dRenderState **states,
                                uint32 numStates);


/*
 * Fixed-function Render State
 */

void SVGA3D_SetTransform(uint32 cid, SVGA3dTransformType type,
                         const float *matrix);
void SVGA3D_SetMaterial(uint32 cid, SVGA3dFace face, const SVGA3dMaterial *material);
void SVGA3D_SetLightData(uint32 cid, uint32 index, const SVGA3dLightData *data);
void SVGA3D_SetLightEnabled(uint32 cid, uint32 index, Bool enabled);


/*
 * Shaders
 */

void SVGA3D_DefineShader(uint32 cid, uint32 shid, SVGA3dShaderType type,
                         const uint32 *bytecode, uint32 bytecodeLen);
void SVGA3D_DestroyShader(uint32 cid, uint32 shid, SVGA3dShaderType type);
void SVGA3D_SetShaderConst(uint32 cid, uint32 reg, SVGA3dShaderType type,
                           SVGA3dShaderConstType ctype, const void *value);
void SVGA3D_SetShader(uint32 cid, SVGA3dShaderType type, uint32 shid);

#endif /* __SVGA3D_H__ */