1848b8605Smrg/**********************************************************
2848b8605Smrg * Copyright 2008-2009 VMware, Inc.  All rights reserved.
3848b8605Smrg *
4848b8605Smrg * Permission is hereby granted, free of charge, to any person
5848b8605Smrg * obtaining a copy of this software and associated documentation
6848b8605Smrg * files (the "Software"), to deal in the Software without
7848b8605Smrg * restriction, including without limitation the rights to use, copy,
8848b8605Smrg * modify, merge, publish, distribute, sublicense, and/or sell copies
9848b8605Smrg * of the Software, and to permit persons to whom the Software is
10848b8605Smrg * furnished to do so, subject to the following conditions:
11848b8605Smrg *
12848b8605Smrg * The above copyright notice and this permission notice shall be
13848b8605Smrg * included in all copies or substantial portions of the Software.
14848b8605Smrg *
15848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16848b8605Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18848b8605Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19848b8605Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20848b8605Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21848b8605Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22848b8605Smrg * SOFTWARE.
23848b8605Smrg *
24848b8605Smrg **********************************************************/
25848b8605Smrg
26848b8605Smrg/*
27848b8605Smrg * svga_cmd.h --
28848b8605Smrg *
29848b8605Smrg *      Command construction utility for the SVGA3D protocol used by
30848b8605Smrg *      the VMware SVGA device, based on the svgautil library.
31848b8605Smrg */
32848b8605Smrg
33848b8605Smrg#ifndef __SVGA3D_H__
34848b8605Smrg#define __SVGA3D_H__
35848b8605Smrg
36848b8605Smrg
37848b8605Smrg#include "svga_types.h"
38b8e80941Smrg#include "svga_winsys.h"
39848b8605Smrg#include "svga_reg.h"
40848b8605Smrg#include "svga3d_reg.h"
41848b8605Smrg
42848b8605Smrg#include "pipe/p_defines.h"
43848b8605Smrg
44848b8605Smrg
45848b8605Smrgstruct pipe_surface;
46848b8605Smrgstruct svga_transfer;
47848b8605Smrgstruct svga_winsys_context;
48848b8605Smrgstruct svga_winsys_buffer;
49848b8605Smrgstruct svga_winsys_surface;
50848b8605Smrgstruct svga_winsys_gb_shader;
51b8e80941Smrgstruct svga_winsys_gb_query;
52848b8605Smrg
53848b8605Smrg
54848b8605Smrg/*
55848b8605Smrg * SVGA Device Interoperability
56848b8605Smrg */
57848b8605Smrg
58848b8605Smrgvoid *
59848b8605SmrgSVGA3D_FIFOReserve(struct svga_winsys_context *swc, uint32 cmd, uint32 cmdSize, uint32 nr_relocs);
60848b8605Smrg
61848b8605Smrgvoid
62848b8605SmrgSVGA_FIFOCommitAll(struct svga_winsys_context *swc);
63848b8605Smrg
64b8e80941Smrg/**
65b8e80941Smrg * Return the last command id put in the command buffer.
66b8e80941Smrg */
67b8e80941Smrgstatic inline SVGAFifo3dCmdId
68b8e80941SmrgSVGA3D_GetLastCommand(const struct svga_winsys_context *swc)
69b8e80941Smrg{
70b8e80941Smrg   return swc->last_command;
71b8e80941Smrg}
72b8e80941Smrg
73b8e80941Smrg/**
74b8e80941Smrg * Reset/clear the last command put in the command buffer.
75b8e80941Smrg * To be called when buffer is flushed.
76b8e80941Smrg */
77b8e80941Smrgstatic inline void
78b8e80941SmrgSVGA3D_ResetLastCommand(struct svga_winsys_context *swc)
79b8e80941Smrg{
80b8e80941Smrg   swc->last_command = 0;
81b8e80941Smrg}
82b8e80941Smrg
83848b8605Smrg
84848b8605Smrg/*
85848b8605Smrg * Context Management
86848b8605Smrg */
87848b8605Smrg
88848b8605Smrgenum pipe_error
89848b8605SmrgSVGA3D_DefineContext(struct svga_winsys_context *swc);
90848b8605Smrg
91848b8605Smrgenum pipe_error
92848b8605SmrgSVGA3D_DestroyContext(struct svga_winsys_context *swc);
93848b8605Smrg
94848b8605Smrg
95848b8605Smrg/*
96848b8605Smrg * Surface Management
97848b8605Smrg */
98848b8605Smrg
99848b8605Smrgenum pipe_error
100848b8605SmrgSVGA3D_BeginDefineSurface(struct svga_winsys_context *swc,
101848b8605Smrg                          struct svga_winsys_surface *sid,
102b8e80941Smrg                          SVGA3dSurface1Flags flags,
103848b8605Smrg                          SVGA3dSurfaceFormat format,
104848b8605Smrg                          SVGA3dSurfaceFace **faces,
105848b8605Smrg                          SVGA3dSize **mipSizes,
106848b8605Smrg                          uint32 numMipSizes);
107848b8605Smrgenum pipe_error
108848b8605SmrgSVGA3D_DefineSurface2D(struct svga_winsys_context *swc,
109848b8605Smrg                       struct svga_winsys_surface *sid,
110848b8605Smrg                       uint32 width,
111848b8605Smrg                       uint32 height,
112848b8605Smrg                       SVGA3dSurfaceFormat format);
113848b8605Smrgenum pipe_error
114848b8605SmrgSVGA3D_DestroySurface(struct svga_winsys_context *swc,
115848b8605Smrg                      struct svga_winsys_surface *sid);
116848b8605Smrg
117848b8605Smrg
118848b8605Smrg/*
119848b8605Smrg * Surface Operations
120848b8605Smrg */
121848b8605Smrg
122848b8605Smrgenum pipe_error
123848b8605SmrgSVGA3D_SurfaceDMA(struct svga_winsys_context *swc,
124848b8605Smrg                  struct svga_transfer *st,
125848b8605Smrg                  SVGA3dTransferType transfer,
126848b8605Smrg                  const SVGA3dCopyBox *boxes,
127848b8605Smrg                  uint32 numBoxes,
128848b8605Smrg                  SVGA3dSurfaceDMAFlags flags);
129848b8605Smrg
130848b8605Smrgenum pipe_error
131848b8605SmrgSVGA3D_BufferDMA(struct svga_winsys_context *swc,
132848b8605Smrg                 struct svga_winsys_buffer *guest,
133848b8605Smrg                 struct svga_winsys_surface *host,
134848b8605Smrg                 SVGA3dTransferType transfer,
135848b8605Smrg                 uint32 size,
136848b8605Smrg                 uint32 guest_offset,
137848b8605Smrg                 uint32 host_offset,
138848b8605Smrg                 SVGA3dSurfaceDMAFlags flags);
139848b8605Smrg
140848b8605Smrg/*
141848b8605Smrg * Drawing Operations
142848b8605Smrg */
143848b8605Smrg
144848b8605Smrg
145848b8605Smrgenum pipe_error
146848b8605SmrgSVGA3D_BeginClear(struct svga_winsys_context *swc,
147848b8605Smrg                  SVGA3dClearFlag flags,
148848b8605Smrg                  uint32 color, float depth, uint32 stencil,
149848b8605Smrg                  SVGA3dRect **rects, uint32 numRects);
150848b8605Smrg
151848b8605Smrgenum pipe_error
152848b8605SmrgSVGA3D_ClearRect(struct svga_winsys_context *swc,
153848b8605Smrg                 SVGA3dClearFlag flags, uint32 color, float depth,
154848b8605Smrg                 uint32 stencil, uint32 x, uint32 y, uint32 w, uint32 h);
155848b8605Smrg
156848b8605Smrgenum pipe_error
157848b8605SmrgSVGA3D_BeginDrawPrimitives(struct svga_winsys_context *swc,
158848b8605Smrg                           SVGA3dVertexDecl **decls,
159848b8605Smrg                           uint32 numVertexDecls,
160848b8605Smrg                           SVGA3dPrimitiveRange **ranges,
161848b8605Smrg                           uint32 numRanges);
162848b8605Smrg
163848b8605Smrg/*
164848b8605Smrg * Blits
165848b8605Smrg */
166848b8605Smrg
167848b8605Smrgenum pipe_error
168848b8605SmrgSVGA3D_BeginSurfaceCopy(struct svga_winsys_context *swc,
169848b8605Smrg                        struct pipe_surface *src,
170848b8605Smrg                        struct pipe_surface *dest,
171848b8605Smrg                        SVGA3dCopyBox **boxes, uint32 numBoxes);
172848b8605Smrg
173848b8605Smrg
174848b8605Smrgenum pipe_error
175848b8605SmrgSVGA3D_SurfaceStretchBlt(struct svga_winsys_context *swc,
176848b8605Smrg                         struct pipe_surface *src,
177848b8605Smrg                         struct pipe_surface *dest,
178848b8605Smrg                         SVGA3dBox *boxSrc, SVGA3dBox *boxDest,
179848b8605Smrg                         SVGA3dStretchBltMode mode);
180848b8605Smrg
181848b8605Smrg/*
182848b8605Smrg * Shared FFP/Shader Render State
183848b8605Smrg */
184848b8605Smrg
185848b8605Smrgenum pipe_error
186848b8605SmrgSVGA3D_SetRenderTarget(struct svga_winsys_context *swc,
187848b8605Smrg                       SVGA3dRenderTargetType type,
188848b8605Smrg                       struct pipe_surface *surface);
189848b8605Smrg
190848b8605Smrgenum pipe_error
191848b8605SmrgSVGA3D_SetZRange(struct svga_winsys_context *swc,
192848b8605Smrg                 float zMin, float zMax);
193848b8605Smrg
194848b8605Smrgenum pipe_error
195848b8605SmrgSVGA3D_SetViewport(struct svga_winsys_context *swc,
196848b8605Smrg                   SVGA3dRect *rect);
197848b8605Smrg
198848b8605Smrgenum pipe_error
199848b8605SmrgSVGA3D_SetScissorRect(struct svga_winsys_context *swc,
200848b8605Smrg                      SVGA3dRect *rect);
201848b8605Smrg
202848b8605Smrgenum pipe_error
203848b8605SmrgSVGA3D_SetClipPlane(struct svga_winsys_context *swc,
204848b8605Smrg                    uint32 index, const float *plane);
205848b8605Smrg
206848b8605Smrgenum pipe_error
207848b8605SmrgSVGA3D_BeginSetTextureState(struct svga_winsys_context *swc,
208848b8605Smrg                            SVGA3dTextureState **states,
209848b8605Smrg                            uint32 numStates);
210848b8605Smrg
211848b8605Smrgenum pipe_error
212848b8605SmrgSVGA3D_BeginSetRenderState(struct svga_winsys_context *swc,
213848b8605Smrg                           SVGA3dRenderState **states,
214848b8605Smrg                           uint32 numStates);
215848b8605Smrg
216848b8605Smrg
217848b8605Smrg/*
218848b8605Smrg * Shaders
219848b8605Smrg */
220848b8605Smrg
221848b8605Smrgenum pipe_error
222848b8605SmrgSVGA3D_DefineShader(struct svga_winsys_context *swc,
223848b8605Smrg                    uint32 shid, SVGA3dShaderType type,
224848b8605Smrg                    const uint32 *bytecode, uint32 bytecodeLen);
225848b8605Smrg
226848b8605Smrgenum pipe_error
227848b8605SmrgSVGA3D_DestroyShader(struct svga_winsys_context *swc,
228848b8605Smrg                     uint32 shid, SVGA3dShaderType type);
229848b8605Smrg
230848b8605Smrgenum pipe_error
231848b8605SmrgSVGA3D_SetShaderConst(struct svga_winsys_context *swc,
232848b8605Smrg                      uint32 reg, SVGA3dShaderType type,
233848b8605Smrg                      SVGA3dShaderConstType ctype, const void *value);
234848b8605Smrg
235848b8605Smrgenum pipe_error
236848b8605SmrgSVGA3D_SetShaderConsts(struct svga_winsys_context *swc,
237848b8605Smrg                       uint32 reg,
238848b8605Smrg                       uint32 numRegs,
239848b8605Smrg                       SVGA3dShaderType type,
240848b8605Smrg                       SVGA3dShaderConstType ctype,
241848b8605Smrg                       const void *values);
242848b8605Smrg
243848b8605Smrgenum pipe_error
244848b8605SmrgSVGA3D_SetShader(struct svga_winsys_context *swc,
245848b8605Smrg                 SVGA3dShaderType type, uint32 shid);
246848b8605Smrg
247848b8605Smrg
248848b8605Smrg/*
249848b8605Smrg * Guest-backed surface functions
250848b8605Smrg */
251848b8605Smrg
252848b8605Smrgenum pipe_error
253848b8605SmrgSVGA3D_BindGBShader(struct svga_winsys_context *swc,
254848b8605Smrg                    struct svga_winsys_gb_shader *gbshader);
255848b8605Smrg
256848b8605Smrgenum pipe_error
257848b8605SmrgSVGA3D_SetGBShader(struct svga_winsys_context *swc,
258848b8605Smrg                   SVGA3dShaderType type,
259848b8605Smrg                   struct svga_winsys_gb_shader *gbshader);
260848b8605Smrg
261848b8605Smrgenum pipe_error
262848b8605SmrgSVGA3D_BindGBSurface(struct svga_winsys_context *swc,
263848b8605Smrg                     struct svga_winsys_surface *surface);
264848b8605Smrg
265848b8605Smrgenum pipe_error
266848b8605SmrgSVGA3D_UpdateGBImage(struct svga_winsys_context *swc,
267848b8605Smrg                     struct svga_winsys_surface *surface,
268848b8605Smrg                     const SVGA3dBox *box,
269848b8605Smrg                     unsigned face, unsigned mipLevel);
270848b8605Smrg
271848b8605Smrgenum pipe_error
272848b8605SmrgSVGA3D_UpdateGBSurface(struct svga_winsys_context *swc,
273848b8605Smrg                       struct svga_winsys_surface *surface);
274848b8605Smrg
275848b8605Smrg
276848b8605Smrgenum pipe_error
277848b8605SmrgSVGA3D_ReadbackGBImage(struct svga_winsys_context *swc,
278848b8605Smrg                       struct svga_winsys_surface *surface,
279848b8605Smrg                       unsigned face, unsigned mipLevel);
280848b8605Smrg
281848b8605Smrg
282848b8605Smrgenum pipe_error
283848b8605SmrgSVGA3D_ReadbackGBSurface(struct svga_winsys_context *swc,
284848b8605Smrg                         struct svga_winsys_surface *surface);
285848b8605Smrg
286848b8605Smrg
287848b8605Smrgenum pipe_error
288848b8605SmrgSVGA3D_ReadbackGBImagePartial(struct svga_winsys_context *swc,
289848b8605Smrg                              struct svga_winsys_surface *surface,
290848b8605Smrg                              unsigned face, unsigned mipLevel,
291848b8605Smrg                              const SVGA3dBox *box,
292848b8605Smrg                              bool invertBox);
293848b8605Smrg
294848b8605Smrg
295848b8605Smrgenum pipe_error
296848b8605SmrgSVGA3D_InvalidateGBImagePartial(struct svga_winsys_context *swc,
297848b8605Smrg                                struct svga_winsys_surface *surface,
298848b8605Smrg                                unsigned face, unsigned mipLevel,
299848b8605Smrg                                const SVGA3dBox *box,
300848b8605Smrg                                bool invertBox);
301848b8605Smrg
302b8e80941Smrgenum pipe_error
303b8e80941SmrgSVGA3D_InvalidateGBSurface(struct svga_winsys_context *swc,
304b8e80941Smrg                           struct svga_winsys_surface *surface);
305b8e80941Smrg
306848b8605Smrg
307848b8605Smrgenum pipe_error
308848b8605SmrgSVGA3D_SetGBShaderConstsInline(struct svga_winsys_context *swc,
309848b8605Smrg                               unsigned regStart,
310848b8605Smrg                               unsigned numRegs,
311848b8605Smrg                               SVGA3dShaderType shaderType,
312848b8605Smrg                               SVGA3dShaderConstType constType,
313848b8605Smrg                               const void *values);
314848b8605Smrg
315848b8605Smrg/*
316848b8605Smrg * Queries
317848b8605Smrg */
318848b8605Smrg
319848b8605Smrgenum pipe_error
320848b8605SmrgSVGA3D_BeginQuery(struct svga_winsys_context *swc,
321848b8605Smrg                  SVGA3dQueryType type);
322848b8605Smrg
323848b8605Smrgenum pipe_error
324848b8605SmrgSVGA3D_EndQuery(struct svga_winsys_context *swc,
325848b8605Smrg                SVGA3dQueryType type,
326848b8605Smrg                struct svga_winsys_buffer *buffer);
327848b8605Smrg
328848b8605Smrgenum pipe_error
329848b8605SmrgSVGA3D_WaitForQuery(struct svga_winsys_context *swc,
330848b8605Smrg                    SVGA3dQueryType type,
331848b8605Smrg                    struct svga_winsys_buffer *buffer);
332848b8605Smrg
333b8e80941Smrg
334b8e80941Smrg
335b8e80941Smrg/*
336b8e80941Smrg * VGPU10 commands
337b8e80941Smrg */
338b8e80941Smrg
339b8e80941Smrgenum pipe_error
340b8e80941SmrgSVGA3D_vgpu10_PredCopyRegion(struct svga_winsys_context *swc,
341b8e80941Smrg                             struct svga_winsys_surface *dstSurf,
342b8e80941Smrg                             uint32 dstSubResource,
343b8e80941Smrg                             struct svga_winsys_surface *srcSurf,
344b8e80941Smrg                             uint32 srcSubResource,
345b8e80941Smrg                             const SVGA3dCopyBox *box);
346b8e80941Smrg
347b8e80941Smrgenum pipe_error
348b8e80941SmrgSVGA3D_vgpu10_PredCopy(struct svga_winsys_context *swc,
349b8e80941Smrg                       struct svga_winsys_surface *dstSurf,
350b8e80941Smrg                       struct svga_winsys_surface *srcSurf);
351b8e80941Smrg
352b8e80941Smrgenum pipe_error
353b8e80941SmrgSVGA3D_vgpu10_SetViewports(struct svga_winsys_context *swc,
354b8e80941Smrg                           unsigned count, const SVGA3dViewport *viewports);
355b8e80941Smrg
356b8e80941Smrgenum pipe_error
357b8e80941SmrgSVGA3D_vgpu10_SetShader(struct svga_winsys_context *swc,
358b8e80941Smrg                        SVGA3dShaderType type,
359b8e80941Smrg                        struct svga_winsys_gb_shader *gbshader,
360b8e80941Smrg                        SVGA3dShaderId shaderId);
361b8e80941Smrg
362b8e80941Smrgenum pipe_error
363b8e80941SmrgSVGA3D_vgpu10_SetShaderResources(struct svga_winsys_context *swc,
364b8e80941Smrg                                 SVGA3dShaderType type,
365b8e80941Smrg                                 uint32 startView,
366b8e80941Smrg                                 unsigned count,
367b8e80941Smrg                                 const SVGA3dShaderResourceViewId ids[],
368b8e80941Smrg                                 struct svga_winsys_surface **views);
369b8e80941Smrg
370b8e80941Smrgenum pipe_error
371b8e80941SmrgSVGA3D_vgpu10_SetSamplers(struct svga_winsys_context *swc,
372b8e80941Smrg                          unsigned count,
373b8e80941Smrg                          uint32 startSampler,
374b8e80941Smrg                          SVGA3dShaderType type,
375b8e80941Smrg                          const SVGA3dSamplerId *samplerIds);
376b8e80941Smrg
377b8e80941Smrgenum pipe_error
378b8e80941SmrgSVGA3D_vgpu10_SetRenderTargets(struct svga_winsys_context *swc,
379b8e80941Smrg                               unsigned color_count,
380b8e80941Smrg                               struct pipe_surface **color_surfs,
381b8e80941Smrg                               struct pipe_surface *depth_stencil_surf);
382b8e80941Smrg
383b8e80941Smrgenum pipe_error
384b8e80941SmrgSVGA3D_vgpu10_SetBlendState(struct svga_winsys_context *swc,
385b8e80941Smrg                            SVGA3dBlendStateId blendId,
386b8e80941Smrg                            const float *blendFactor, uint32 sampleMask);
387b8e80941Smrg
388b8e80941Smrgenum pipe_error
389b8e80941SmrgSVGA3D_vgpu10_SetDepthStencilState(struct svga_winsys_context *swc,
390b8e80941Smrg                                   SVGA3dDepthStencilStateId depthStencilId,
391b8e80941Smrg                                   uint32 stencilRef);
392b8e80941Smrg
393b8e80941Smrgenum pipe_error
394b8e80941SmrgSVGA3D_vgpu10_SetRasterizerState(struct svga_winsys_context *swc,
395b8e80941Smrg                                 SVGA3dRasterizerStateId rasterizerId);
396b8e80941Smrg
397b8e80941Smrgenum pipe_error
398b8e80941SmrgSVGA3D_vgpu10_SetPredication(struct svga_winsys_context *swc,
399b8e80941Smrg                             SVGA3dQueryId queryId,
400b8e80941Smrg                             uint32 predicateValue);
401b8e80941Smrg
402b8e80941Smrgenum pipe_error
403b8e80941SmrgSVGA3D_vgpu10_SetSOTargets(struct svga_winsys_context *swc,
404b8e80941Smrg                           unsigned count, const SVGA3dSoTarget *targets,
405b8e80941Smrg                           struct svga_winsys_surface **surfaces);
406b8e80941Smrg
407b8e80941Smrgenum pipe_error
408b8e80941SmrgSVGA3D_vgpu10_SetScissorRects(struct svga_winsys_context *swc,
409b8e80941Smrg                              unsigned count,
410b8e80941Smrg                              const SVGASignedRect *rects);
411b8e80941Smrg
412b8e80941Smrgenum pipe_error
413b8e80941SmrgSVGA3D_vgpu10_SetStreamOutput(struct svga_winsys_context *swc,
414b8e80941Smrg                              SVGA3dStreamOutputId soid);
415b8e80941Smrg
416b8e80941Smrgenum pipe_error
417b8e80941SmrgSVGA3D_vgpu10_Draw(struct svga_winsys_context *swc,
418b8e80941Smrg                   uint32 vertexCount, uint32 startVertexLocation);
419b8e80941Smrg
420b8e80941Smrgenum pipe_error
421b8e80941SmrgSVGA3D_vgpu10_DrawIndexed(struct svga_winsys_context *swc,
422b8e80941Smrg                          uint32 indexCount, uint32 startIndexLocation,
423b8e80941Smrg                          int32 baseVertexLocation);
424b8e80941Smrg
425b8e80941Smrgenum pipe_error
426b8e80941SmrgSVGA3D_vgpu10_DrawInstanced(struct svga_winsys_context *swc,
427b8e80941Smrg                            uint32 vertexCountPerInstance,
428b8e80941Smrg                            uint32 instanceCount,
429b8e80941Smrg                            uint32 startVertexLocation,
430b8e80941Smrg                            uint32 startInstanceLocation);
431b8e80941Smrg
432b8e80941Smrgenum pipe_error
433b8e80941SmrgSVGA3D_vgpu10_DrawIndexedInstanced(struct svga_winsys_context *swc,
434b8e80941Smrg                                   uint32 indexCountPerInstance,
435b8e80941Smrg                                   uint32 instanceCount,
436b8e80941Smrg                                   uint32 startIndexLocation,
437b8e80941Smrg                                   int32  baseVertexLocation,
438b8e80941Smrg                                   uint32 startInstanceLocation);
439b8e80941Smrg
440b8e80941Smrgenum pipe_error
441b8e80941SmrgSVGA3D_vgpu10_DrawAuto(struct svga_winsys_context *swc);
442b8e80941Smrg
443b8e80941Smrgenum pipe_error
444b8e80941SmrgSVGA3D_vgpu10_DefineQuery(struct svga_winsys_context *swc,
445b8e80941Smrg                          SVGA3dQueryId queryId,
446b8e80941Smrg                          SVGA3dQueryType type,
447b8e80941Smrg                          SVGA3dDXQueryFlags flags);
448b8e80941Smrg
449b8e80941Smrgenum pipe_error
450b8e80941SmrgSVGA3D_vgpu10_DestroyQuery(struct svga_winsys_context *swc,
451b8e80941Smrg                           SVGA3dQueryId queryId);
452b8e80941Smrg
453b8e80941Smrgenum pipe_error
454b8e80941SmrgSVGA3D_vgpu10_BindQuery(struct svga_winsys_context *swc,
455b8e80941Smrg                        struct svga_winsys_gb_query *gbQuery,
456b8e80941Smrg                        SVGA3dQueryId queryId);
457b8e80941Smrg
458b8e80941Smrgenum pipe_error
459b8e80941SmrgSVGA3D_vgpu10_SetQueryOffset(struct svga_winsys_context *swc,
460b8e80941Smrg                             SVGA3dQueryId queryId,
461b8e80941Smrg                             uint32 mobOffset);
462b8e80941Smrg
463b8e80941Smrgenum pipe_error
464b8e80941SmrgSVGA3D_vgpu10_BeginQuery(struct svga_winsys_context *swc,
465b8e80941Smrg                         SVGA3dQueryId queryId);
466b8e80941Smrg
467b8e80941Smrgenum pipe_error
468b8e80941SmrgSVGA3D_vgpu10_EndQuery(struct svga_winsys_context *swc,
469b8e80941Smrg                       SVGA3dQueryId queryId);
470b8e80941Smrg
471b8e80941Smrgenum pipe_error
472b8e80941SmrgSVGA3D_vgpu10_ClearRenderTargetView(struct svga_winsys_context *swc,
473b8e80941Smrg                                    struct pipe_surface *color_surf,
474b8e80941Smrg                                    const float *rgba);
475b8e80941Smrg
476b8e80941Smrgenum pipe_error
477b8e80941SmrgSVGA3D_vgpu10_ClearDepthStencilView(struct svga_winsys_context *swc,
478b8e80941Smrg                                    struct pipe_surface *ds_surf,
479b8e80941Smrg                                    uint16 flags, uint16 stencil, float depth);
480b8e80941Smrg
481b8e80941Smrgenum pipe_error
482b8e80941SmrgSVGA3D_vgpu10_DefineShaderResourceView(struct svga_winsys_context *swc,
483b8e80941Smrg                             SVGA3dShaderResourceViewId shaderResourceViewId,
484b8e80941Smrg                             struct svga_winsys_surface *surf,
485b8e80941Smrg                             SVGA3dSurfaceFormat format,
486b8e80941Smrg                             SVGA3dResourceType resourceDimension,
487b8e80941Smrg                             const SVGA3dShaderResourceViewDesc *desc);
488b8e80941Smrg
489b8e80941Smrgenum pipe_error
490b8e80941SmrgSVGA3D_vgpu10_DestroyShaderResourceView(struct svga_winsys_context *swc,
491b8e80941Smrg                            SVGA3dShaderResourceViewId shaderResourceViewId);
492b8e80941Smrg
493b8e80941Smrgenum pipe_error
494b8e80941SmrgSVGA3D_vgpu10_DefineRenderTargetView(struct svga_winsys_context *swc,
495b8e80941Smrg                                  SVGA3dRenderTargetViewId renderTargetViewId,
496b8e80941Smrg                                  struct svga_winsys_surface *surface,
497b8e80941Smrg                                  SVGA3dSurfaceFormat format,
498b8e80941Smrg                                  SVGA3dResourceType resourceDimension,
499b8e80941Smrg                                  const SVGA3dRenderTargetViewDesc *desc);
500b8e80941Smrg
501b8e80941Smrgenum pipe_error
502b8e80941SmrgSVGA3D_vgpu10_DestroyRenderTargetView(struct svga_winsys_context *swc,
503b8e80941Smrg                                SVGA3dRenderTargetViewId renderTargetViewId);
504b8e80941Smrg
505b8e80941Smrgenum pipe_error
506b8e80941SmrgSVGA3D_vgpu10_DefineDepthStencilView(struct svga_winsys_context *swc,
507b8e80941Smrg                                  SVGA3dDepthStencilViewId depthStencilViewId,
508b8e80941Smrg                                  struct svga_winsys_surface *surface,
509b8e80941Smrg                                  SVGA3dSurfaceFormat format,
510b8e80941Smrg                                  SVGA3dResourceType resourceDimension,
511b8e80941Smrg                                  const SVGA3dRenderTargetViewDesc *desc);
512b8e80941Smrg
513b8e80941Smrg
514b8e80941Smrgenum pipe_error
515b8e80941SmrgSVGA3D_vgpu10_DestroyDepthStencilView(struct svga_winsys_context *swc,
516b8e80941Smrg                                SVGA3dDepthStencilViewId depthStencilViewId);
517b8e80941Smrg
518b8e80941Smrgenum pipe_error
519b8e80941SmrgSVGA3D_vgpu10_DefineElementLayout(struct svga_winsys_context *swc,
520b8e80941Smrg                               unsigned count,
521b8e80941Smrg                               SVGA3dElementLayoutId elementLayoutId,
522b8e80941Smrg                               const SVGA3dInputElementDesc *elements);
523b8e80941Smrg
524b8e80941Smrgenum pipe_error
525b8e80941SmrgSVGA3D_vgpu10_DestroyElementLayout(struct svga_winsys_context *swc,
526b8e80941Smrg                                   SVGA3dElementLayoutId elementLayoutId);
527b8e80941Smrg
528b8e80941Smrgenum pipe_error
529b8e80941SmrgSVGA3D_vgpu10_DefineBlendState(struct svga_winsys_context *swc,
530b8e80941Smrg                               SVGA3dBlendStateId blendId,
531b8e80941Smrg                               uint8 alphaToCoverageEnable,
532b8e80941Smrg                               uint8 independentBlendEnable,
533b8e80941Smrg                               const SVGA3dDXBlendStatePerRT *perRT);
534b8e80941Smrg
535b8e80941Smrgenum pipe_error
536b8e80941SmrgSVGA3D_vgpu10_DestroyBlendState(struct svga_winsys_context *swc,
537b8e80941Smrg                                SVGA3dBlendStateId blendId);
538b8e80941Smrg
539b8e80941Smrgenum pipe_error
540b8e80941SmrgSVGA3D_vgpu10_DefineDepthStencilState(struct svga_winsys_context *swc,
541b8e80941Smrg                                      SVGA3dDepthStencilStateId depthStencilId,
542b8e80941Smrg                                      uint8 depthEnable,
543b8e80941Smrg                                      SVGA3dDepthWriteMask depthWriteMask,
544b8e80941Smrg                                      SVGA3dComparisonFunc depthFunc,
545b8e80941Smrg                                      uint8 stencilEnable,
546b8e80941Smrg                                      uint8 frontEnable,
547b8e80941Smrg                                      uint8 backEnable,
548b8e80941Smrg                                      uint8 stencilReadMask,
549b8e80941Smrg                                      uint8 stencilWriteMask,
550b8e80941Smrg                                      uint8 frontStencilFailOp,
551b8e80941Smrg                                      uint8 frontStencilDepthFailOp,
552b8e80941Smrg                                      uint8 frontStencilPassOp,
553b8e80941Smrg                                      SVGA3dComparisonFunc frontStencilFunc,
554b8e80941Smrg                                      uint8 backStencilFailOp,
555b8e80941Smrg                                      uint8 backStencilDepthFailOp,
556b8e80941Smrg                                      uint8 backStencilPassOp,
557b8e80941Smrg                                      SVGA3dComparisonFunc backStencilFunc);
558b8e80941Smrg
559b8e80941Smrgenum pipe_error
560b8e80941SmrgSVGA3D_vgpu10_DestroyDepthStencilState(struct svga_winsys_context *swc,
561b8e80941Smrg                                       SVGA3dDepthStencilStateId depthStencilId);
562b8e80941Smrg
563b8e80941Smrgenum pipe_error
564b8e80941SmrgSVGA3D_vgpu10_DefineRasterizerState(struct svga_winsys_context *swc,
565b8e80941Smrg                                    SVGA3dRasterizerStateId rasterizerId,
566b8e80941Smrg                                    uint8 fillMode,
567b8e80941Smrg                                    SVGA3dCullMode cullMode,
568b8e80941Smrg                                    uint8 frontCounterClockwise,
569b8e80941Smrg                                    int32 depthBias,
570b8e80941Smrg                                    float depthBiasClamp,
571b8e80941Smrg                                    float slopeScaledDepthBias,
572b8e80941Smrg                                    uint8 depthClipEnable,
573b8e80941Smrg                                    uint8 scissorEnable,
574b8e80941Smrg                                    uint8 multisampleEnable,
575b8e80941Smrg                                    uint8 antialiasedLineEnable,
576b8e80941Smrg                                    float lineWidth,
577b8e80941Smrg                                    uint8 lineStippleEnable,
578b8e80941Smrg                                    uint8 lineStippleFactor,
579b8e80941Smrg                                    uint16 lineStipplePattern,
580b8e80941Smrg                                    uint8 provokingVertexLast);
581b8e80941Smrg
582b8e80941Smrgenum pipe_error
583b8e80941SmrgSVGA3D_vgpu10_DestroyRasterizerState(struct svga_winsys_context *swc,
584b8e80941Smrg                                     SVGA3dRasterizerStateId rasterizerId);
585b8e80941Smrg
586b8e80941Smrgenum pipe_error
587b8e80941SmrgSVGA3D_vgpu10_DefineSamplerState(struct svga_winsys_context *swc,
588b8e80941Smrg                                 SVGA3dSamplerId samplerId,
589b8e80941Smrg                                 SVGA3dFilter filter,
590b8e80941Smrg                                 uint8 addressU,
591b8e80941Smrg                                 uint8 addressV,
592b8e80941Smrg                                 uint8 addressW,
593b8e80941Smrg                                 float mipLODBias,
594b8e80941Smrg                                 uint8 maxAnisotropy,
595b8e80941Smrg                                 uint8 comparisonFunc,
596b8e80941Smrg                                 SVGA3dRGBAFloat borderColor,
597b8e80941Smrg                                 float minLOD,
598b8e80941Smrg                                 float maxLOD);
599b8e80941Smrg
600b8e80941Smrgenum pipe_error
601b8e80941SmrgSVGA3D_vgpu10_DestroySamplerState(struct svga_winsys_context *swc,
602b8e80941Smrg                                  SVGA3dSamplerId samplerId);
603b8e80941Smrg
604b8e80941Smrgenum pipe_error
605b8e80941SmrgSVGA3D_vgpu10_DestroyShader(struct svga_winsys_context *swc,
606b8e80941Smrg                            SVGA3dShaderId shaderId);
607b8e80941Smrg
608b8e80941Smrgenum pipe_error
609b8e80941SmrgSVGA3D_vgpu10_DefineAndBindShader(struct svga_winsys_context *swc,
610b8e80941Smrg                                  struct svga_winsys_gb_shader *gbshader,
611b8e80941Smrg                                  SVGA3dShaderId shaderId,
612b8e80941Smrg                                  SVGA3dShaderType type,
613b8e80941Smrg                                  uint32 sizeInBytes);
614b8e80941Smrg
615b8e80941Smrgenum pipe_error
616b8e80941SmrgSVGA3D_vgpu10_DefineStreamOutput(struct svga_winsys_context *swc,
617b8e80941Smrg      SVGA3dStreamOutputId soid,
618b8e80941Smrg      uint32 numOutputStreamEntries,
619b8e80941Smrg      uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS],
620b8e80941Smrg      const SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_STREAMOUT_DECLS]);
621b8e80941Smrg
622b8e80941Smrgenum pipe_error
623b8e80941SmrgSVGA3D_vgpu10_DestroyStreamOutput(struct svga_winsys_context *swc,
624b8e80941Smrg                                  SVGA3dStreamOutputId soid);
625b8e80941Smrg
626b8e80941Smrgenum pipe_error
627b8e80941SmrgSVGA3D_vgpu10_ReadbackSubResource(struct svga_winsys_context *swc,
628b8e80941Smrg                                  struct svga_winsys_surface *surface,
629b8e80941Smrg                                  unsigned subResource);
630b8e80941Smrg
631b8e80941Smrgenum pipe_error
632b8e80941SmrgSVGA3D_vgpu10_SetInputLayout(struct svga_winsys_context *swc,
633b8e80941Smrg                             SVGA3dElementLayoutId elementLayoutId);
634b8e80941Smrg
635b8e80941Smrgenum pipe_error
636b8e80941SmrgSVGA3D_vgpu10_SetVertexBuffers(struct svga_winsys_context *swc,
637b8e80941Smrg                               unsigned count,
638b8e80941Smrg                               uint32 startBuffer,
639b8e80941Smrg                               const SVGA3dVertexBuffer *bufferInfo,
640b8e80941Smrg                               struct svga_winsys_surface **surfaces);
641b8e80941Smrg
642b8e80941Smrgenum pipe_error
643b8e80941SmrgSVGA3D_vgpu10_SetTopology(struct svga_winsys_context *swc,
644b8e80941Smrg                          SVGA3dPrimitiveType topology);
645b8e80941Smrg
646b8e80941Smrgenum pipe_error
647b8e80941SmrgSVGA3D_vgpu10_SetIndexBuffer(struct svga_winsys_context *swc,
648b8e80941Smrg                             struct svga_winsys_surface *indexes,
649b8e80941Smrg                             SVGA3dSurfaceFormat format, uint32 offset);
650b8e80941Smrg
651b8e80941Smrgenum pipe_error
652b8e80941SmrgSVGA3D_vgpu10_SetSingleConstantBuffer(struct svga_winsys_context *swc,
653b8e80941Smrg                                      unsigned slot,
654b8e80941Smrg                                      SVGA3dShaderType type,
655b8e80941Smrg                                      struct svga_winsys_surface *surface,
656b8e80941Smrg                                      uint32 offsetInBytes,
657b8e80941Smrg                                      uint32 sizeInBytes);
658b8e80941Smrg
659b8e80941Smrgenum pipe_error
660b8e80941SmrgSVGA3D_vgpu10_UpdateSubResource(struct svga_winsys_context *swc,
661b8e80941Smrg                                struct svga_winsys_surface *surface,
662b8e80941Smrg                                const SVGA3dBox *box,
663b8e80941Smrg                                unsigned subResource);
664b8e80941Smrg
665b8e80941Smrgenum pipe_error
666b8e80941SmrgSVGA3D_vgpu10_GenMips(struct svga_winsys_context *swc,
667b8e80941Smrg                      SVGA3dShaderResourceViewId shaderResourceViewId,
668b8e80941Smrg                      struct svga_winsys_surface *view);
669b8e80941Smrg
670b8e80941Smrgenum pipe_error
671b8e80941SmrgSVGA3D_vgpu10_BufferCopy(struct svga_winsys_context *swc,
672b8e80941Smrg                         struct svga_winsys_surface *src,
673b8e80941Smrg                         struct svga_winsys_surface *dst,
674b8e80941Smrg                         unsigned srcx, unsigned dstx, unsigned width);
675b8e80941Smrg
676b8e80941Smrgenum pipe_error
677b8e80941SmrgSVGA3D_vgpu10_TransferFromBuffer(struct svga_winsys_context *swc,
678b8e80941Smrg                                 struct svga_winsys_surface *src,
679b8e80941Smrg                                 unsigned srcOffset, unsigned srcPitch,
680b8e80941Smrg                                 unsigned srcSlicePitch,
681b8e80941Smrg                                 struct svga_winsys_surface *dst,
682b8e80941Smrg                                 unsigned dstSubResource,
683b8e80941Smrg                                 SVGA3dBox *dstBox);
684b8e80941Smrg
685b8e80941Smrg/*Cap2 commands*/
686b8e80941Smrgenum pipe_error
687b8e80941SmrgSVGA3D_vgpu10_IntraSurfaceCopy(struct svga_winsys_context *swc,
688b8e80941Smrg                               struct svga_winsys_surface *src,
689b8e80941Smrg                               unsigned level, unsigned face,
690b8e80941Smrg                               const SVGA3dCopyBox *box);
691b8e80941Smrg
692b8e80941Smrgenum pipe_error
693b8e80941SmrgSVGA3D_vgpu10_ResolveCopy(struct svga_winsys_context *swc,
694b8e80941Smrg                          unsigned dstSubResource,
695b8e80941Smrg                          struct svga_winsys_surface *dst,
696b8e80941Smrg                          unsigned srcSubResource,
697b8e80941Smrg                          struct svga_winsys_surface *src,
698b8e80941Smrg                          const SVGA3dSurfaceFormat copyFormat);
699b8e80941Smrg
700848b8605Smrg#endif /* __SVGA3D_H__ */
701