1/**********************************************************
2 * Copyright 2008-2009 VMware, Inc.  All rights reserved.
3 *
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:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
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
22 * SOFTWARE.
23 *
24 **********************************************************/
25
26/*
27 * svga_cmd.h --
28 *
29 *      Command construction utility for the SVGA3D protocol used by
30 *      the VMware SVGA device, based on the svgautil library.
31 */
32
33#ifndef __SVGA3D_H__
34#define __SVGA3D_H__
35
36
37#include "svga_types.h"
38#include "svga_winsys.h"
39#include "svga_reg.h"
40#include "svga3d_reg.h"
41
42#include "pipe/p_defines.h"
43
44
45struct pipe_surface;
46struct svga_transfer;
47struct svga_winsys_context;
48struct svga_winsys_buffer;
49struct svga_winsys_surface;
50struct svga_winsys_gb_shader;
51struct svga_winsys_gb_query;
52
53
54/*
55 * SVGA Device Interoperability
56 */
57
58void *
59SVGA3D_FIFOReserve(struct svga_winsys_context *swc, uint32 cmd, uint32 cmdSize, uint32 nr_relocs);
60
61void
62SVGA_FIFOCommitAll(struct svga_winsys_context *swc);
63
64/**
65 * Return the last command id put in the command buffer.
66 */
67static inline SVGAFifo3dCmdId
68SVGA3D_GetLastCommand(const struct svga_winsys_context *swc)
69{
70   return swc->last_command;
71}
72
73/**
74 * Reset/clear the last command put in the command buffer.
75 * To be called when buffer is flushed.
76 */
77static inline void
78SVGA3D_ResetLastCommand(struct svga_winsys_context *swc)
79{
80   swc->last_command = 0;
81}
82
83
84/*
85 * Context Management
86 */
87
88enum pipe_error
89SVGA3D_DefineContext(struct svga_winsys_context *swc);
90
91enum pipe_error
92SVGA3D_DestroyContext(struct svga_winsys_context *swc);
93
94
95/*
96 * Surface Management
97 */
98
99enum pipe_error
100SVGA3D_BeginDefineSurface(struct svga_winsys_context *swc,
101                          struct svga_winsys_surface *sid,
102                          SVGA3dSurface1Flags flags,
103                          SVGA3dSurfaceFormat format,
104                          SVGA3dSurfaceFace **faces,
105                          SVGA3dSize **mipSizes,
106                          uint32 numMipSizes);
107enum pipe_error
108SVGA3D_DefineSurface2D(struct svga_winsys_context *swc,
109                       struct svga_winsys_surface *sid,
110                       uint32 width,
111                       uint32 height,
112                       SVGA3dSurfaceFormat format);
113enum pipe_error
114SVGA3D_DestroySurface(struct svga_winsys_context *swc,
115                      struct svga_winsys_surface *sid);
116
117
118/*
119 * Surface Operations
120 */
121
122enum pipe_error
123SVGA3D_SurfaceDMA(struct svga_winsys_context *swc,
124                  struct svga_transfer *st,
125                  SVGA3dTransferType transfer,
126                  const SVGA3dCopyBox *boxes,
127                  uint32 numBoxes,
128                  SVGA3dSurfaceDMAFlags flags);
129
130enum pipe_error
131SVGA3D_BufferDMA(struct svga_winsys_context *swc,
132                 struct svga_winsys_buffer *guest,
133                 struct svga_winsys_surface *host,
134                 SVGA3dTransferType transfer,
135                 uint32 size,
136                 uint32 guest_offset,
137                 uint32 host_offset,
138                 SVGA3dSurfaceDMAFlags flags);
139
140/*
141 * Drawing Operations
142 */
143
144
145enum pipe_error
146SVGA3D_BeginClear(struct svga_winsys_context *swc,
147                  SVGA3dClearFlag flags,
148                  uint32 color, float depth, uint32 stencil,
149                  SVGA3dRect **rects, uint32 numRects);
150
151enum pipe_error
152SVGA3D_ClearRect(struct svga_winsys_context *swc,
153                 SVGA3dClearFlag flags, uint32 color, float depth,
154                 uint32 stencil, uint32 x, uint32 y, uint32 w, uint32 h);
155
156enum pipe_error
157SVGA3D_BeginDrawPrimitives(struct svga_winsys_context *swc,
158                           SVGA3dVertexDecl **decls,
159                           uint32 numVertexDecls,
160                           SVGA3dPrimitiveRange **ranges,
161                           uint32 numRanges);
162
163/*
164 * Blits
165 */
166
167enum pipe_error
168SVGA3D_BeginSurfaceCopy(struct svga_winsys_context *swc,
169                        struct pipe_surface *src,
170                        struct pipe_surface *dest,
171                        SVGA3dCopyBox **boxes, uint32 numBoxes);
172
173
174enum pipe_error
175SVGA3D_SurfaceStretchBlt(struct svga_winsys_context *swc,
176                         struct pipe_surface *src,
177                         struct pipe_surface *dest,
178                         SVGA3dBox *boxSrc, SVGA3dBox *boxDest,
179                         SVGA3dStretchBltMode mode);
180
181/*
182 * Shared FFP/Shader Render State
183 */
184
185enum pipe_error
186SVGA3D_SetRenderTarget(struct svga_winsys_context *swc,
187                       SVGA3dRenderTargetType type,
188                       struct pipe_surface *surface);
189
190enum pipe_error
191SVGA3D_SetZRange(struct svga_winsys_context *swc,
192                 float zMin, float zMax);
193
194enum pipe_error
195SVGA3D_SetViewport(struct svga_winsys_context *swc,
196                   SVGA3dRect *rect);
197
198enum pipe_error
199SVGA3D_SetScissorRect(struct svga_winsys_context *swc,
200                      SVGA3dRect *rect);
201
202enum pipe_error
203SVGA3D_SetClipPlane(struct svga_winsys_context *swc,
204                    uint32 index, const float *plane);
205
206enum pipe_error
207SVGA3D_BeginSetTextureState(struct svga_winsys_context *swc,
208                            SVGA3dTextureState **states,
209                            uint32 numStates);
210
211enum pipe_error
212SVGA3D_BeginSetRenderState(struct svga_winsys_context *swc,
213                           SVGA3dRenderState **states,
214                           uint32 numStates);
215
216
217/*
218 * Shaders
219 */
220
221enum pipe_error
222SVGA3D_DefineShader(struct svga_winsys_context *swc,
223                    uint32 shid, SVGA3dShaderType type,
224                    const uint32 *bytecode, uint32 bytecodeLen);
225
226enum pipe_error
227SVGA3D_DestroyShader(struct svga_winsys_context *swc,
228                     uint32 shid, SVGA3dShaderType type);
229
230enum pipe_error
231SVGA3D_SetShaderConst(struct svga_winsys_context *swc,
232                      uint32 reg, SVGA3dShaderType type,
233                      SVGA3dShaderConstType ctype, const void *value);
234
235enum pipe_error
236SVGA3D_SetShaderConsts(struct svga_winsys_context *swc,
237                       uint32 reg,
238                       uint32 numRegs,
239                       SVGA3dShaderType type,
240                       SVGA3dShaderConstType ctype,
241                       const void *values);
242
243enum pipe_error
244SVGA3D_SetShader(struct svga_winsys_context *swc,
245                 SVGA3dShaderType type, uint32 shid);
246
247
248/*
249 * Guest-backed surface functions
250 */
251
252enum pipe_error
253SVGA3D_BindGBShader(struct svga_winsys_context *swc,
254                    struct svga_winsys_gb_shader *gbshader);
255
256enum pipe_error
257SVGA3D_SetGBShader(struct svga_winsys_context *swc,
258                   SVGA3dShaderType type,
259                   struct svga_winsys_gb_shader *gbshader);
260
261enum pipe_error
262SVGA3D_BindGBSurface(struct svga_winsys_context *swc,
263                     struct svga_winsys_surface *surface);
264
265enum pipe_error
266SVGA3D_UpdateGBImage(struct svga_winsys_context *swc,
267                     struct svga_winsys_surface *surface,
268                     const SVGA3dBox *box,
269                     unsigned face, unsigned mipLevel);
270
271enum pipe_error
272SVGA3D_UpdateGBSurface(struct svga_winsys_context *swc,
273                       struct svga_winsys_surface *surface);
274
275
276enum pipe_error
277SVGA3D_ReadbackGBImage(struct svga_winsys_context *swc,
278                       struct svga_winsys_surface *surface,
279                       unsigned face, unsigned mipLevel);
280
281
282enum pipe_error
283SVGA3D_ReadbackGBSurface(struct svga_winsys_context *swc,
284                         struct svga_winsys_surface *surface);
285
286
287enum pipe_error
288SVGA3D_ReadbackGBImagePartial(struct svga_winsys_context *swc,
289                              struct svga_winsys_surface *surface,
290                              unsigned face, unsigned mipLevel,
291                              const SVGA3dBox *box,
292                              bool invertBox);
293
294
295enum pipe_error
296SVGA3D_InvalidateGBImagePartial(struct svga_winsys_context *swc,
297                                struct svga_winsys_surface *surface,
298                                unsigned face, unsigned mipLevel,
299                                const SVGA3dBox *box,
300                                bool invertBox);
301
302enum pipe_error
303SVGA3D_InvalidateGBSurface(struct svga_winsys_context *swc,
304                           struct svga_winsys_surface *surface);
305
306
307enum pipe_error
308SVGA3D_SetGBShaderConstsInline(struct svga_winsys_context *swc,
309                               unsigned regStart,
310                               unsigned numRegs,
311                               SVGA3dShaderType shaderType,
312                               SVGA3dShaderConstType constType,
313                               const void *values);
314
315/*
316 * Queries
317 */
318
319enum pipe_error
320SVGA3D_BeginQuery(struct svga_winsys_context *swc,
321                  SVGA3dQueryType type);
322
323enum pipe_error
324SVGA3D_EndQuery(struct svga_winsys_context *swc,
325                SVGA3dQueryType type,
326                struct svga_winsys_buffer *buffer);
327
328enum pipe_error
329SVGA3D_WaitForQuery(struct svga_winsys_context *swc,
330                    SVGA3dQueryType type,
331                    struct svga_winsys_buffer *buffer);
332
333
334
335/*
336 * VGPU10 commands
337 */
338
339enum pipe_error
340SVGA3D_vgpu10_PredCopyRegion(struct svga_winsys_context *swc,
341                             struct svga_winsys_surface *dstSurf,
342                             uint32 dstSubResource,
343                             struct svga_winsys_surface *srcSurf,
344                             uint32 srcSubResource,
345                             const SVGA3dCopyBox *box);
346
347enum pipe_error
348SVGA3D_vgpu10_PredCopy(struct svga_winsys_context *swc,
349                       struct svga_winsys_surface *dstSurf,
350                       struct svga_winsys_surface *srcSurf);
351
352enum pipe_error
353SVGA3D_vgpu10_SetViewports(struct svga_winsys_context *swc,
354                           unsigned count, const SVGA3dViewport *viewports);
355
356enum pipe_error
357SVGA3D_vgpu10_SetShader(struct svga_winsys_context *swc,
358                        SVGA3dShaderType type,
359                        struct svga_winsys_gb_shader *gbshader,
360                        SVGA3dShaderId shaderId);
361
362enum pipe_error
363SVGA3D_vgpu10_SetShaderResources(struct svga_winsys_context *swc,
364                                 SVGA3dShaderType type,
365                                 uint32 startView,
366                                 unsigned count,
367                                 const SVGA3dShaderResourceViewId ids[],
368                                 struct svga_winsys_surface **views);
369
370enum pipe_error
371SVGA3D_vgpu10_SetSamplers(struct svga_winsys_context *swc,
372                          unsigned count,
373                          uint32 startSampler,
374                          SVGA3dShaderType type,
375                          const SVGA3dSamplerId *samplerIds);
376
377enum pipe_error
378SVGA3D_vgpu10_SetRenderTargets(struct svga_winsys_context *swc,
379                               unsigned color_count,
380                               struct pipe_surface **color_surfs,
381                               struct pipe_surface *depth_stencil_surf);
382
383enum pipe_error
384SVGA3D_vgpu10_SetBlendState(struct svga_winsys_context *swc,
385                            SVGA3dBlendStateId blendId,
386                            const float *blendFactor, uint32 sampleMask);
387
388enum pipe_error
389SVGA3D_vgpu10_SetDepthStencilState(struct svga_winsys_context *swc,
390                                   SVGA3dDepthStencilStateId depthStencilId,
391                                   uint32 stencilRef);
392
393enum pipe_error
394SVGA3D_vgpu10_SetRasterizerState(struct svga_winsys_context *swc,
395                                 SVGA3dRasterizerStateId rasterizerId);
396
397enum pipe_error
398SVGA3D_vgpu10_SetPredication(struct svga_winsys_context *swc,
399                             SVGA3dQueryId queryId,
400                             uint32 predicateValue);
401
402enum pipe_error
403SVGA3D_vgpu10_SetSOTargets(struct svga_winsys_context *swc,
404                           unsigned count, const SVGA3dSoTarget *targets,
405                           struct svga_winsys_surface **surfaces);
406
407enum pipe_error
408SVGA3D_vgpu10_SetScissorRects(struct svga_winsys_context *swc,
409                              unsigned count,
410                              const SVGASignedRect *rects);
411
412enum pipe_error
413SVGA3D_vgpu10_SetStreamOutput(struct svga_winsys_context *swc,
414                              SVGA3dStreamOutputId soid);
415
416enum pipe_error
417SVGA3D_vgpu10_Draw(struct svga_winsys_context *swc,
418                   uint32 vertexCount, uint32 startVertexLocation);
419
420enum pipe_error
421SVGA3D_vgpu10_DrawIndexed(struct svga_winsys_context *swc,
422                          uint32 indexCount, uint32 startIndexLocation,
423                          int32 baseVertexLocation);
424
425enum pipe_error
426SVGA3D_vgpu10_DrawInstanced(struct svga_winsys_context *swc,
427                            uint32 vertexCountPerInstance,
428                            uint32 instanceCount,
429                            uint32 startVertexLocation,
430                            uint32 startInstanceLocation);
431
432enum pipe_error
433SVGA3D_vgpu10_DrawIndexedInstanced(struct svga_winsys_context *swc,
434                                   uint32 indexCountPerInstance,
435                                   uint32 instanceCount,
436                                   uint32 startIndexLocation,
437                                   int32  baseVertexLocation,
438                                   uint32 startInstanceLocation);
439
440enum pipe_error
441SVGA3D_vgpu10_DrawAuto(struct svga_winsys_context *swc);
442
443enum pipe_error
444SVGA3D_vgpu10_DefineQuery(struct svga_winsys_context *swc,
445                          SVGA3dQueryId queryId,
446                          SVGA3dQueryType type,
447                          SVGA3dDXQueryFlags flags);
448
449enum pipe_error
450SVGA3D_vgpu10_DestroyQuery(struct svga_winsys_context *swc,
451                           SVGA3dQueryId queryId);
452
453enum pipe_error
454SVGA3D_vgpu10_BindQuery(struct svga_winsys_context *swc,
455                        struct svga_winsys_gb_query *gbQuery,
456                        SVGA3dQueryId queryId);
457
458enum pipe_error
459SVGA3D_vgpu10_SetQueryOffset(struct svga_winsys_context *swc,
460                             SVGA3dQueryId queryId,
461                             uint32 mobOffset);
462
463enum pipe_error
464SVGA3D_vgpu10_BeginQuery(struct svga_winsys_context *swc,
465                         SVGA3dQueryId queryId);
466
467enum pipe_error
468SVGA3D_vgpu10_EndQuery(struct svga_winsys_context *swc,
469                       SVGA3dQueryId queryId);
470
471enum pipe_error
472SVGA3D_vgpu10_ClearRenderTargetView(struct svga_winsys_context *swc,
473                                    struct pipe_surface *color_surf,
474                                    const float *rgba);
475
476enum pipe_error
477SVGA3D_vgpu10_ClearDepthStencilView(struct svga_winsys_context *swc,
478                                    struct pipe_surface *ds_surf,
479                                    uint16 flags, uint16 stencil, float depth);
480
481enum pipe_error
482SVGA3D_vgpu10_DefineShaderResourceView(struct svga_winsys_context *swc,
483                             SVGA3dShaderResourceViewId shaderResourceViewId,
484                             struct svga_winsys_surface *surf,
485                             SVGA3dSurfaceFormat format,
486                             SVGA3dResourceType resourceDimension,
487                             const SVGA3dShaderResourceViewDesc *desc);
488
489enum pipe_error
490SVGA3D_vgpu10_DestroyShaderResourceView(struct svga_winsys_context *swc,
491                            SVGA3dShaderResourceViewId shaderResourceViewId);
492
493enum pipe_error
494SVGA3D_vgpu10_DefineRenderTargetView(struct svga_winsys_context *swc,
495                                  SVGA3dRenderTargetViewId renderTargetViewId,
496                                  struct svga_winsys_surface *surface,
497                                  SVGA3dSurfaceFormat format,
498                                  SVGA3dResourceType resourceDimension,
499                                  const SVGA3dRenderTargetViewDesc *desc);
500
501enum pipe_error
502SVGA3D_vgpu10_DestroyRenderTargetView(struct svga_winsys_context *swc,
503                                SVGA3dRenderTargetViewId renderTargetViewId);
504
505enum pipe_error
506SVGA3D_vgpu10_DefineDepthStencilView(struct svga_winsys_context *swc,
507                                  SVGA3dDepthStencilViewId depthStencilViewId,
508                                  struct svga_winsys_surface *surface,
509                                  SVGA3dSurfaceFormat format,
510                                  SVGA3dResourceType resourceDimension,
511                                  const SVGA3dRenderTargetViewDesc *desc);
512
513
514enum pipe_error
515SVGA3D_vgpu10_DestroyDepthStencilView(struct svga_winsys_context *swc,
516                                SVGA3dDepthStencilViewId depthStencilViewId);
517
518enum pipe_error
519SVGA3D_vgpu10_DefineElementLayout(struct svga_winsys_context *swc,
520                               unsigned count,
521                               SVGA3dElementLayoutId elementLayoutId,
522                               const SVGA3dInputElementDesc *elements);
523
524enum pipe_error
525SVGA3D_vgpu10_DestroyElementLayout(struct svga_winsys_context *swc,
526                                   SVGA3dElementLayoutId elementLayoutId);
527
528enum pipe_error
529SVGA3D_vgpu10_DefineBlendState(struct svga_winsys_context *swc,
530                               SVGA3dBlendStateId blendId,
531                               uint8 alphaToCoverageEnable,
532                               uint8 independentBlendEnable,
533                               const SVGA3dDXBlendStatePerRT *perRT);
534
535enum pipe_error
536SVGA3D_vgpu10_DestroyBlendState(struct svga_winsys_context *swc,
537                                SVGA3dBlendStateId blendId);
538
539enum pipe_error
540SVGA3D_vgpu10_DefineDepthStencilState(struct svga_winsys_context *swc,
541                                      SVGA3dDepthStencilStateId depthStencilId,
542                                      uint8 depthEnable,
543                                      SVGA3dDepthWriteMask depthWriteMask,
544                                      SVGA3dComparisonFunc depthFunc,
545                                      uint8 stencilEnable,
546                                      uint8 frontEnable,
547                                      uint8 backEnable,
548                                      uint8 stencilReadMask,
549                                      uint8 stencilWriteMask,
550                                      uint8 frontStencilFailOp,
551                                      uint8 frontStencilDepthFailOp,
552                                      uint8 frontStencilPassOp,
553                                      SVGA3dComparisonFunc frontStencilFunc,
554                                      uint8 backStencilFailOp,
555                                      uint8 backStencilDepthFailOp,
556                                      uint8 backStencilPassOp,
557                                      SVGA3dComparisonFunc backStencilFunc);
558
559enum pipe_error
560SVGA3D_vgpu10_DestroyDepthStencilState(struct svga_winsys_context *swc,
561                                       SVGA3dDepthStencilStateId depthStencilId);
562
563enum pipe_error
564SVGA3D_vgpu10_DefineRasterizerState(struct svga_winsys_context *swc,
565                                    SVGA3dRasterizerStateId rasterizerId,
566                                    uint8 fillMode,
567                                    SVGA3dCullMode cullMode,
568                                    uint8 frontCounterClockwise,
569                                    int32 depthBias,
570                                    float depthBiasClamp,
571                                    float slopeScaledDepthBias,
572                                    uint8 depthClipEnable,
573                                    uint8 scissorEnable,
574                                    uint8 multisampleEnable,
575                                    uint8 antialiasedLineEnable,
576                                    float lineWidth,
577                                    uint8 lineStippleEnable,
578                                    uint8 lineStippleFactor,
579                                    uint16 lineStipplePattern,
580                                    uint8 provokingVertexLast);
581
582enum pipe_error
583SVGA3D_vgpu10_DestroyRasterizerState(struct svga_winsys_context *swc,
584                                     SVGA3dRasterizerStateId rasterizerId);
585
586enum pipe_error
587SVGA3D_vgpu10_DefineSamplerState(struct svga_winsys_context *swc,
588                                 SVGA3dSamplerId samplerId,
589                                 SVGA3dFilter filter,
590                                 uint8 addressU,
591                                 uint8 addressV,
592                                 uint8 addressW,
593                                 float mipLODBias,
594                                 uint8 maxAnisotropy,
595                                 uint8 comparisonFunc,
596                                 SVGA3dRGBAFloat borderColor,
597                                 float minLOD,
598                                 float maxLOD);
599
600enum pipe_error
601SVGA3D_vgpu10_DestroySamplerState(struct svga_winsys_context *swc,
602                                  SVGA3dSamplerId samplerId);
603
604enum pipe_error
605SVGA3D_vgpu10_DestroyShader(struct svga_winsys_context *swc,
606                            SVGA3dShaderId shaderId);
607
608enum pipe_error
609SVGA3D_vgpu10_DefineAndBindShader(struct svga_winsys_context *swc,
610                                  struct svga_winsys_gb_shader *gbshader,
611                                  SVGA3dShaderId shaderId,
612                                  SVGA3dShaderType type,
613                                  uint32 sizeInBytes);
614
615enum pipe_error
616SVGA3D_vgpu10_DefineStreamOutput(struct svga_winsys_context *swc,
617      SVGA3dStreamOutputId soid,
618      uint32 numOutputStreamEntries,
619      uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS],
620      const SVGA3dStreamOutputDeclarationEntry decl[SVGA3D_MAX_STREAMOUT_DECLS]);
621
622enum pipe_error
623SVGA3D_vgpu10_DestroyStreamOutput(struct svga_winsys_context *swc,
624                                  SVGA3dStreamOutputId soid);
625
626enum pipe_error
627SVGA3D_vgpu10_ReadbackSubResource(struct svga_winsys_context *swc,
628                                  struct svga_winsys_surface *surface,
629                                  unsigned subResource);
630
631enum pipe_error
632SVGA3D_vgpu10_SetInputLayout(struct svga_winsys_context *swc,
633                             SVGA3dElementLayoutId elementLayoutId);
634
635enum pipe_error
636SVGA3D_vgpu10_SetVertexBuffers(struct svga_winsys_context *swc,
637                               unsigned count,
638                               uint32 startBuffer,
639                               const SVGA3dVertexBuffer_v2 *bufferInfo,
640                               struct svga_winsys_surface **surfaces);
641
642enum pipe_error
643SVGA3D_vgpu10_SetVertexBuffers_v2(struct svga_winsys_context *swc,
644                               unsigned count,
645                               uint32 startBuffer,
646                               const SVGA3dVertexBuffer_v2 *bufferInfo,
647                               struct svga_winsys_surface **surfaces);
648
649enum pipe_error
650SVGA3D_vgpu10_SetVertexBuffersOffsetAndSize(struct svga_winsys_context *swc,
651                               unsigned count,
652                               uint32 startBuffer,
653                               const SVGA3dVertexBuffer_v2 *bufferInfo);
654
655enum pipe_error
656SVGA3D_vgpu10_SetTopology(struct svga_winsys_context *swc,
657                          SVGA3dPrimitiveType topology);
658
659enum pipe_error
660SVGA3D_vgpu10_SetIndexBuffer(struct svga_winsys_context *swc,
661                             struct svga_winsys_surface *indexes,
662                             SVGA3dSurfaceFormat format, uint32 offset);
663
664enum pipe_error
665SVGA3D_vgpu10_SetIndexBuffer_v2(struct svga_winsys_context *swc,
666                                struct svga_winsys_surface *indexes,
667                                SVGA3dSurfaceFormat format, uint32 offset,
668                                uint32 sizeInBytes);
669
670enum pipe_error
671SVGA3D_vgpu10_SetIndexBufferOffsetAndSize(struct svga_winsys_context *swc,
672                             SVGA3dSurfaceFormat format, uint32 offset,
673                             uint32 sizeInBytes);
674
675enum pipe_error
676SVGA3D_vgpu10_SetSingleConstantBuffer(struct svga_winsys_context *swc,
677                                      unsigned slot,
678                                      SVGA3dShaderType type,
679                                      struct svga_winsys_surface *surface,
680                                      uint32 offsetInBytes,
681                                      uint32 sizeInBytes);
682
683enum pipe_error
684SVGA3D_vgpu10_SetConstantBufferOffset(struct svga_winsys_context *swc,
685                                      unsigned command,
686                                      unsigned slot,
687                                      uint32 offsetInBytes);
688
689enum pipe_error
690SVGA3D_vgpu10_UpdateSubResource(struct svga_winsys_context *swc,
691                                struct svga_winsys_surface *surface,
692                                const SVGA3dBox *box,
693                                unsigned subResource);
694
695enum pipe_error
696SVGA3D_vgpu10_GenMips(struct svga_winsys_context *swc,
697                      SVGA3dShaderResourceViewId shaderResourceViewId,
698                      struct svga_winsys_surface *view);
699
700enum pipe_error
701SVGA3D_vgpu10_BufferCopy(struct svga_winsys_context *swc,
702                         struct svga_winsys_surface *src,
703                         struct svga_winsys_surface *dst,
704                         unsigned srcx, unsigned dstx, unsigned width);
705
706enum pipe_error
707SVGA3D_vgpu10_TransferFromBuffer(struct svga_winsys_context *swc,
708                                 struct svga_winsys_surface *src,
709                                 unsigned srcOffset, unsigned srcPitch,
710                                 unsigned srcSlicePitch,
711                                 struct svga_winsys_surface *dst,
712                                 unsigned dstSubResource,
713                                 SVGA3dBox *dstBox);
714
715/*Cap2 commands*/
716enum pipe_error
717SVGA3D_vgpu10_IntraSurfaceCopy(struct svga_winsys_context *swc,
718                               struct svga_winsys_surface *src,
719                               unsigned level, unsigned face,
720                               const SVGA3dCopyBox *box);
721
722enum pipe_error
723SVGA3D_vgpu10_ResolveCopy(struct svga_winsys_context *swc,
724                          unsigned dstSubResource,
725                          struct svga_winsys_surface *dst,
726                          unsigned srcSubResource,
727                          struct svga_winsys_surface *src,
728                          const SVGA3dSurfaceFormat copyFormat);
729
730enum pipe_error
731SVGA3D_sm5_DrawIndexedInstancedIndirect(struct svga_winsys_context *swc,
732                                        struct svga_winsys_surface *argBuffer,
733                                        unsigned argOffset);
734
735enum pipe_error
736SVGA3D_sm5_DrawInstancedIndirect(struct svga_winsys_context *swc,
737                                 struct svga_winsys_surface *argBuffer,
738                                 unsigned argOffset);
739
740enum pipe_error
741SVGA3D_sm5_DefineUAView(struct svga_winsys_context *swc,
742                        SVGA3dUAViewId uaViewId,
743                        struct svga_winsys_surface *surface,
744                        SVGA3dSurfaceFormat format,
745                        SVGA3dResourceType resourceDimension,
746                        const SVGA3dUAViewDesc *desc);
747
748enum pipe_error
749SVGA3D_sm5_DestroyUAView(struct svga_winsys_context *swc,
750                         SVGA3dUAViewId uaViewId);
751
752enum pipe_error
753SVGA3D_sm5_SetUAViews(struct svga_winsys_context *swc,
754                      uint32 uavSpliceIndex,
755                      unsigned count,
756                      const SVGA3dUAViewId ids[],
757                      struct svga_winsys_surface **uaViews);
758
759enum pipe_error
760SVGA3D_sm5_SetCSUAViews(struct svga_winsys_context *swc,
761                        unsigned count,
762                        const SVGA3dUAViewId ids[],
763                        struct svga_winsys_surface **uaViews);
764
765enum pipe_error
766SVGA3D_sm5_Dispatch(struct svga_winsys_context *swc,
767                    const uint32 threadGroupCount[3]);
768
769enum pipe_error
770SVGA3D_sm5_DispatchIndirect(struct svga_winsys_context *swc,
771                            struct svga_winsys_surface *argBuffer,
772                            uint32 argOffset);
773
774enum pipe_error
775SVGA3D_sm5_DefineAndBindStreamOutput(struct svga_winsys_context *swc,
776       SVGA3dStreamOutputId soid,
777       uint32 numOutputStreamEntries,
778       uint32 numOutputStreamStrides,
779       uint32 streamOutputStrideInBytes[SVGA3D_DX_MAX_SOTARGETS],
780       struct svga_winsys_buffer *declBuf,
781       uint32 rasterizedStream,
782       uint32 sizeInBytes);
783
784enum pipe_error
785SVGA3D_sm5_DefineRasterizerState_v2(struct svga_winsys_context *swc,
786                                    SVGA3dRasterizerStateId rasterizerId,
787                                    uint8 fillMode,
788                                    SVGA3dCullMode cullMode,
789                                    uint8 frontCounterClockwise,
790                                    int32 depthBias,
791                                    float depthBiasClamp,
792                                    float slopeScaledDepthBias,
793                                    uint8 depthClipEnable,
794                                    uint8 scissorEnable,
795                                    uint8 multisampleEnable,
796                                    uint8 antialiasedLineEnable,
797                                    float lineWidth,
798                                    uint8 lineStippleEnable,
799                                    uint8 lineStippleFactor,
800                                    uint16 lineStipplePattern,
801                                    uint8 provokingVertexLast,
802                                    uint32 forcedSampleCount);
803#endif /* __SVGA3D_H__ */
804