1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2012-2021 VMware, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17bf215546Sopenharmony_ci * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
21bf215546Sopenharmony_ci *
22bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
23bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
24bf215546Sopenharmony_ci * of the Software.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci/*
29bf215546Sopenharmony_ci * InputAssembly.cpp --
30bf215546Sopenharmony_ci *    Functions that manipulate the input assembly stage.
31bf215546Sopenharmony_ci */
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#include <stdio.h>
35bf215546Sopenharmony_ci#if defined(_MSC_VER) && !defined(snprintf)
36bf215546Sopenharmony_ci#define snprintf _snprintf
37bf215546Sopenharmony_ci#endif
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci#include "InputAssembly.h"
40bf215546Sopenharmony_ci#include "State.h"
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_ci#include "Debug.h"
43bf215546Sopenharmony_ci#include "Format.h"
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_ci/*
47bf215546Sopenharmony_ci * ----------------------------------------------------------------------
48bf215546Sopenharmony_ci *
49bf215546Sopenharmony_ci * IaSetTopology --
50bf215546Sopenharmony_ci *
51bf215546Sopenharmony_ci *    The IaSetTopology function sets the primitive topology to
52bf215546Sopenharmony_ci *    enable drawing for the input assember.
53bf215546Sopenharmony_ci *
54bf215546Sopenharmony_ci * ----------------------------------------------------------------------
55bf215546Sopenharmony_ci */
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_civoid APIENTRY
58bf215546Sopenharmony_ciIaSetTopology(D3D10DDI_HDEVICE hDevice,                        // IN
59bf215546Sopenharmony_ci              D3D10_DDI_PRIMITIVE_TOPOLOGY PrimitiveTopology)  // IN
60bf215546Sopenharmony_ci{
61bf215546Sopenharmony_ci   LOG_ENTRYPOINT();
62bf215546Sopenharmony_ci
63bf215546Sopenharmony_ci   Device *pDevice = CastDevice(hDevice);
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci   enum pipe_prim_type primitive;
66bf215546Sopenharmony_ci   switch (PrimitiveTopology) {
67bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_UNDEFINED:
68bf215546Sopenharmony_ci      /* Apps might set topology to UNDEFINED when cleaning up on exit. */
69bf215546Sopenharmony_ci      primitive = PIPE_PRIM_MAX;
70bf215546Sopenharmony_ci      break;
71bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_POINTLIST:
72bf215546Sopenharmony_ci      primitive = PIPE_PRIM_POINTS;
73bf215546Sopenharmony_ci      break;
74bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_LINELIST:
75bf215546Sopenharmony_ci      primitive = PIPE_PRIM_LINES;
76bf215546Sopenharmony_ci      break;
77bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_LINESTRIP:
78bf215546Sopenharmony_ci      primitive = PIPE_PRIM_LINE_STRIP;
79bf215546Sopenharmony_ci      break;
80bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_TRIANGLELIST:
81bf215546Sopenharmony_ci      primitive = PIPE_PRIM_TRIANGLES;
82bf215546Sopenharmony_ci      break;
83bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP:
84bf215546Sopenharmony_ci      primitive = PIPE_PRIM_TRIANGLE_STRIP;
85bf215546Sopenharmony_ci      break;
86bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_LINELIST_ADJ:
87bf215546Sopenharmony_ci      primitive = PIPE_PRIM_LINES_ADJACENCY;
88bf215546Sopenharmony_ci      break;
89bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ:
90bf215546Sopenharmony_ci      primitive = PIPE_PRIM_LINE_STRIP_ADJACENCY;
91bf215546Sopenharmony_ci      break;
92bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ:
93bf215546Sopenharmony_ci      primitive = PIPE_PRIM_TRIANGLES_ADJACENCY;
94bf215546Sopenharmony_ci      break;
95bf215546Sopenharmony_ci   case D3D10_DDI_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ:
96bf215546Sopenharmony_ci      primitive = PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY;
97bf215546Sopenharmony_ci      break;
98bf215546Sopenharmony_ci   default:
99bf215546Sopenharmony_ci      assert(0);
100bf215546Sopenharmony_ci      primitive = PIPE_PRIM_MAX;
101bf215546Sopenharmony_ci      break;
102bf215546Sopenharmony_ci   }
103bf215546Sopenharmony_ci
104bf215546Sopenharmony_ci   pDevice->primitive = primitive;
105bf215546Sopenharmony_ci}
106bf215546Sopenharmony_ci
107bf215546Sopenharmony_ci
108bf215546Sopenharmony_ci/*
109bf215546Sopenharmony_ci * ----------------------------------------------------------------------
110bf215546Sopenharmony_ci *
111bf215546Sopenharmony_ci * IaSetVertexBuffers --
112bf215546Sopenharmony_ci *
113bf215546Sopenharmony_ci *    The IaSetVertexBuffers function sets vertex buffers
114bf215546Sopenharmony_ci *    for an input assembler.
115bf215546Sopenharmony_ci *
116bf215546Sopenharmony_ci * ----------------------------------------------------------------------
117bf215546Sopenharmony_ci */
118bf215546Sopenharmony_ci
119bf215546Sopenharmony_civoid APIENTRY
120bf215546Sopenharmony_ciIaSetVertexBuffers(D3D10DDI_HDEVICE hDevice,                                     // IN
121bf215546Sopenharmony_ci                   UINT StartBuffer,                                             // IN
122bf215546Sopenharmony_ci                   UINT NumBuffers,                                              // IN
123bf215546Sopenharmony_ci                   __in_ecount (NumBuffers) const D3D10DDI_HRESOURCE *phBuffers, // IN
124bf215546Sopenharmony_ci                   __in_ecount (NumBuffers) const UINT *pStrides,                // IN
125bf215546Sopenharmony_ci                   __in_ecount (NumBuffers) const UINT *pOffsets)                // IN
126bf215546Sopenharmony_ci{
127bf215546Sopenharmony_ci   static const float dummy[4] = {0.0f, 0.0f, 0.0f, 0.0f};
128bf215546Sopenharmony_ci
129bf215546Sopenharmony_ci   LOG_ENTRYPOINT();
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_ci   Device *pDevice = CastDevice(hDevice);
132bf215546Sopenharmony_ci   struct pipe_context *pipe = pDevice->pipe;
133bf215546Sopenharmony_ci   unsigned i;
134bf215546Sopenharmony_ci
135bf215546Sopenharmony_ci   for (i = 0; i < NumBuffers; i++) {
136bf215546Sopenharmony_ci      struct pipe_vertex_buffer *vb = &pDevice->vertex_buffers[StartBuffer + i];
137bf215546Sopenharmony_ci      struct pipe_resource *resource = CastPipeResource(phBuffers[i]);
138bf215546Sopenharmony_ci      Resource *res = CastResource(phBuffers[i]);
139bf215546Sopenharmony_ci      struct pipe_stream_output_target *so_target =
140bf215546Sopenharmony_ci         res ? res->so_target : NULL;
141bf215546Sopenharmony_ci
142bf215546Sopenharmony_ci      if (so_target && pDevice->draw_so_target != so_target) {
143bf215546Sopenharmony_ci         if (pDevice->draw_so_target) {
144bf215546Sopenharmony_ci            pipe_so_target_reference(&pDevice->draw_so_target, NULL);
145bf215546Sopenharmony_ci         }
146bf215546Sopenharmony_ci         pipe_so_target_reference(&pDevice->draw_so_target,
147bf215546Sopenharmony_ci                                  so_target);
148bf215546Sopenharmony_ci      }
149bf215546Sopenharmony_ci
150bf215546Sopenharmony_ci      if (resource) {
151bf215546Sopenharmony_ci         vb->stride = pStrides[i];
152bf215546Sopenharmony_ci         vb->buffer_offset = pOffsets[i];
153bf215546Sopenharmony_ci         if (vb->is_user_buffer) {
154bf215546Sopenharmony_ci            vb->buffer.resource = NULL;
155bf215546Sopenharmony_ci            vb->is_user_buffer = FALSE;
156bf215546Sopenharmony_ci         }
157bf215546Sopenharmony_ci         pipe_resource_reference(&vb->buffer.resource, resource);
158bf215546Sopenharmony_ci      }
159bf215546Sopenharmony_ci      else {
160bf215546Sopenharmony_ci         vb->stride = 0;
161bf215546Sopenharmony_ci         vb->buffer_offset = 0;
162bf215546Sopenharmony_ci         if (!vb->is_user_buffer) {
163bf215546Sopenharmony_ci            pipe_resource_reference(&vb->buffer.resource, NULL);
164bf215546Sopenharmony_ci            vb->is_user_buffer = TRUE;
165bf215546Sopenharmony_ci         }
166bf215546Sopenharmony_ci         vb->buffer.user = dummy;
167bf215546Sopenharmony_ci      }
168bf215546Sopenharmony_ci   }
169bf215546Sopenharmony_ci
170bf215546Sopenharmony_ci   for (i = 0; i < PIPE_MAX_ATTRIBS; ++i) {
171bf215546Sopenharmony_ci      struct pipe_vertex_buffer *vb = &pDevice->vertex_buffers[i];
172bf215546Sopenharmony_ci
173bf215546Sopenharmony_ci      /* XXX this is odd... */
174bf215546Sopenharmony_ci      if (!vb->is_user_buffer && !vb->buffer.resource) {
175bf215546Sopenharmony_ci         vb->stride = 0;
176bf215546Sopenharmony_ci         vb->buffer_offset = 0;
177bf215546Sopenharmony_ci         vb->is_user_buffer = TRUE;
178bf215546Sopenharmony_ci         vb->buffer.user = dummy;
179bf215546Sopenharmony_ci      }
180bf215546Sopenharmony_ci   }
181bf215546Sopenharmony_ci
182bf215546Sopenharmony_ci   /* Resubmit old and new vertex buffers.
183bf215546Sopenharmony_ci    */
184bf215546Sopenharmony_ci   pipe->set_vertex_buffers(pipe, 0, PIPE_MAX_ATTRIBS, 0, FALSE, pDevice->vertex_buffers);
185bf215546Sopenharmony_ci}
186bf215546Sopenharmony_ci
187bf215546Sopenharmony_ci
188bf215546Sopenharmony_ci/*
189bf215546Sopenharmony_ci * ----------------------------------------------------------------------
190bf215546Sopenharmony_ci *
191bf215546Sopenharmony_ci * IaSetIndexBuffer --
192bf215546Sopenharmony_ci *
193bf215546Sopenharmony_ci *    The IaSetIndexBuffer function sets an index buffer for
194bf215546Sopenharmony_ci *    an input assembler.
195bf215546Sopenharmony_ci *
196bf215546Sopenharmony_ci * ----------------------------------------------------------------------
197bf215546Sopenharmony_ci */
198bf215546Sopenharmony_ci
199bf215546Sopenharmony_civoid APIENTRY
200bf215546Sopenharmony_ciIaSetIndexBuffer(D3D10DDI_HDEVICE hDevice,   // IN
201bf215546Sopenharmony_ci                 D3D10DDI_HRESOURCE hBuffer, // IN
202bf215546Sopenharmony_ci                 DXGI_FORMAT Format,         // IN
203bf215546Sopenharmony_ci                 UINT Offset)                // IN
204bf215546Sopenharmony_ci{
205bf215546Sopenharmony_ci   LOG_ENTRYPOINT();
206bf215546Sopenharmony_ci
207bf215546Sopenharmony_ci   Device *pDevice = CastDevice(hDevice);
208bf215546Sopenharmony_ci   struct pipe_resource *resource = CastPipeResource(hBuffer);
209bf215546Sopenharmony_ci
210bf215546Sopenharmony_ci   if (resource) {
211bf215546Sopenharmony_ci      pDevice->ib_offset = Offset;
212bf215546Sopenharmony_ci
213bf215546Sopenharmony_ci      switch (Format) {
214bf215546Sopenharmony_ci      case DXGI_FORMAT_R16_UINT:
215bf215546Sopenharmony_ci         pDevice->index_size = 2;
216bf215546Sopenharmony_ci         pDevice->restart_index = 0xffff;
217bf215546Sopenharmony_ci         break;
218bf215546Sopenharmony_ci      case DXGI_FORMAT_R32_UINT:
219bf215546Sopenharmony_ci         pDevice->restart_index = 0xffffffff;
220bf215546Sopenharmony_ci         pDevice->index_size = 4;
221bf215546Sopenharmony_ci         break;
222bf215546Sopenharmony_ci      default:
223bf215546Sopenharmony_ci         assert(0);             /* should not happen */
224bf215546Sopenharmony_ci         pDevice->index_size = 2;
225bf215546Sopenharmony_ci         break;
226bf215546Sopenharmony_ci      }
227bf215546Sopenharmony_ci      pipe_resource_reference(&pDevice->index_buffer, resource);
228bf215546Sopenharmony_ci   } else {
229bf215546Sopenharmony_ci      pipe_resource_reference(&pDevice->index_buffer, NULL);
230bf215546Sopenharmony_ci   }
231bf215546Sopenharmony_ci}
232bf215546Sopenharmony_ci
233bf215546Sopenharmony_ci
234bf215546Sopenharmony_ci/*
235bf215546Sopenharmony_ci * ----------------------------------------------------------------------
236bf215546Sopenharmony_ci *
237bf215546Sopenharmony_ci * CalcPrivateElementLayoutSize --
238bf215546Sopenharmony_ci *
239bf215546Sopenharmony_ci *    The CalcPrivateElementLayoutSize function determines the size
240bf215546Sopenharmony_ci *    of the user-mode display driver's private region of memory
241bf215546Sopenharmony_ci *    (that is, the size of internal driver structures, not the size
242bf215546Sopenharmony_ci *    of the resource video memory) for an element layout.
243bf215546Sopenharmony_ci *
244bf215546Sopenharmony_ci * ----------------------------------------------------------------------
245bf215546Sopenharmony_ci */
246bf215546Sopenharmony_ci
247bf215546Sopenharmony_ciSIZE_T APIENTRY
248bf215546Sopenharmony_ciCalcPrivateElementLayoutSize(
249bf215546Sopenharmony_ci   D3D10DDI_HDEVICE hDevice,                                         // IN
250bf215546Sopenharmony_ci   __in const D3D10DDIARG_CREATEELEMENTLAYOUT *pCreateElementLayout) // IN
251bf215546Sopenharmony_ci{
252bf215546Sopenharmony_ci   return sizeof(ElementLayout);
253bf215546Sopenharmony_ci}
254bf215546Sopenharmony_ci
255bf215546Sopenharmony_ci
256bf215546Sopenharmony_ci/*
257bf215546Sopenharmony_ci * ----------------------------------------------------------------------
258bf215546Sopenharmony_ci *
259bf215546Sopenharmony_ci * CreateElementLayout --
260bf215546Sopenharmony_ci *
261bf215546Sopenharmony_ci *    The CreateElementLayout function creates an element layout.
262bf215546Sopenharmony_ci *
263bf215546Sopenharmony_ci * ----------------------------------------------------------------------
264bf215546Sopenharmony_ci */
265bf215546Sopenharmony_ci
266bf215546Sopenharmony_civoid APIENTRY
267bf215546Sopenharmony_ciCreateElementLayout(
268bf215546Sopenharmony_ci   D3D10DDI_HDEVICE hDevice,                                         // IN
269bf215546Sopenharmony_ci   __in const D3D10DDIARG_CREATEELEMENTLAYOUT *pCreateElementLayout, // IN
270bf215546Sopenharmony_ci   D3D10DDI_HELEMENTLAYOUT hElementLayout,                           // IN
271bf215546Sopenharmony_ci   D3D10DDI_HRTELEMENTLAYOUT hRTElementLayout)                       // IN
272bf215546Sopenharmony_ci{
273bf215546Sopenharmony_ci   LOG_ENTRYPOINT();
274bf215546Sopenharmony_ci
275bf215546Sopenharmony_ci   struct pipe_context *pipe = CastPipeContext(hDevice);
276bf215546Sopenharmony_ci   ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
277bf215546Sopenharmony_ci
278bf215546Sopenharmony_ci   struct pipe_vertex_element elements[PIPE_MAX_ATTRIBS];
279bf215546Sopenharmony_ci   memset(elements, 0, sizeof elements);
280bf215546Sopenharmony_ci
281bf215546Sopenharmony_ci   unsigned num_elements = pCreateElementLayout->NumElements;
282bf215546Sopenharmony_ci   unsigned max_elements = 0;
283bf215546Sopenharmony_ci   for (unsigned i = 0; i < num_elements; i++) {
284bf215546Sopenharmony_ci      const D3D10DDIARG_INPUT_ELEMENT_DESC* pVertexElement =
285bf215546Sopenharmony_ci            &pCreateElementLayout->pVertexElements[i];
286bf215546Sopenharmony_ci      struct pipe_vertex_element *ve =
287bf215546Sopenharmony_ci            &elements[pVertexElement->InputRegister];
288bf215546Sopenharmony_ci
289bf215546Sopenharmony_ci      ve->src_offset          = pVertexElement->AlignedByteOffset;
290bf215546Sopenharmony_ci      ve->vertex_buffer_index = pVertexElement->InputSlot;
291bf215546Sopenharmony_ci      ve->src_format          = FormatTranslate(pVertexElement->Format, FALSE);
292bf215546Sopenharmony_ci
293bf215546Sopenharmony_ci      switch (pVertexElement->InputSlotClass) {
294bf215546Sopenharmony_ci      case D3D10_DDI_INPUT_PER_VERTEX_DATA:
295bf215546Sopenharmony_ci         ve->instance_divisor = 0;
296bf215546Sopenharmony_ci         break;
297bf215546Sopenharmony_ci      case D3D10_DDI_INPUT_PER_INSTANCE_DATA:
298bf215546Sopenharmony_ci         if (!pVertexElement->InstanceDataStepRate) {
299bf215546Sopenharmony_ci            LOG_UNSUPPORTED(!pVertexElement->InstanceDataStepRate);
300bf215546Sopenharmony_ci            ve->instance_divisor = ~0;
301bf215546Sopenharmony_ci         } else {
302bf215546Sopenharmony_ci            ve->instance_divisor = pVertexElement->InstanceDataStepRate;
303bf215546Sopenharmony_ci         }
304bf215546Sopenharmony_ci         break;
305bf215546Sopenharmony_ci      default:
306bf215546Sopenharmony_ci         assert(0);
307bf215546Sopenharmony_ci         break;
308bf215546Sopenharmony_ci      }
309bf215546Sopenharmony_ci
310bf215546Sopenharmony_ci      max_elements = MAX2(max_elements, pVertexElement->InputRegister + 1);
311bf215546Sopenharmony_ci   }
312bf215546Sopenharmony_ci
313bf215546Sopenharmony_ci   /* XXX: What do we do when there's a gap? */
314bf215546Sopenharmony_ci   if (max_elements != num_elements) {
315bf215546Sopenharmony_ci      DebugPrintf("%s: gap\n", __FUNCTION__);
316bf215546Sopenharmony_ci   }
317bf215546Sopenharmony_ci
318bf215546Sopenharmony_ci   pElementLayout->handle =
319bf215546Sopenharmony_ci         pipe->create_vertex_elements_state(pipe, max_elements, elements);
320bf215546Sopenharmony_ci}
321bf215546Sopenharmony_ci
322bf215546Sopenharmony_ci
323bf215546Sopenharmony_ci/*
324bf215546Sopenharmony_ci * ----------------------------------------------------------------------
325bf215546Sopenharmony_ci *
326bf215546Sopenharmony_ci * DestroyElementLayout --
327bf215546Sopenharmony_ci *
328bf215546Sopenharmony_ci *    The DestroyElementLayout function destroys the specified
329bf215546Sopenharmony_ci *    element layout object. The element layout object can be
330bf215546Sopenharmony_ci *    destoyed only if it is not currently bound to a display device.
331bf215546Sopenharmony_ci *
332bf215546Sopenharmony_ci * ----------------------------------------------------------------------
333bf215546Sopenharmony_ci */
334bf215546Sopenharmony_ci
335bf215546Sopenharmony_civoid APIENTRY
336bf215546Sopenharmony_ciDestroyElementLayout(D3D10DDI_HDEVICE hDevice,                 // IN
337bf215546Sopenharmony_ci                     D3D10DDI_HELEMENTLAYOUT hElementLayout)   // IN
338bf215546Sopenharmony_ci{
339bf215546Sopenharmony_ci   LOG_ENTRYPOINT();
340bf215546Sopenharmony_ci
341bf215546Sopenharmony_ci   struct pipe_context *pipe = CastPipeContext(hDevice);
342bf215546Sopenharmony_ci   ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
343bf215546Sopenharmony_ci
344bf215546Sopenharmony_ci   pipe->delete_vertex_elements_state(pipe, pElementLayout->handle);}
345bf215546Sopenharmony_ci
346bf215546Sopenharmony_ci
347bf215546Sopenharmony_ci/*
348bf215546Sopenharmony_ci * ----------------------------------------------------------------------
349bf215546Sopenharmony_ci *
350bf215546Sopenharmony_ci * IaSetInputLayout --
351bf215546Sopenharmony_ci *
352bf215546Sopenharmony_ci *    The IaSetInputLayout function sets an input layout for
353bf215546Sopenharmony_ci *    the input assembler.
354bf215546Sopenharmony_ci *
355bf215546Sopenharmony_ci * ----------------------------------------------------------------------
356bf215546Sopenharmony_ci */
357bf215546Sopenharmony_ci
358bf215546Sopenharmony_civoid APIENTRY
359bf215546Sopenharmony_ciIaSetInputLayout(D3D10DDI_HDEVICE hDevice,               // IN
360bf215546Sopenharmony_ci                 D3D10DDI_HELEMENTLAYOUT hInputLayout)   // IN
361bf215546Sopenharmony_ci{
362bf215546Sopenharmony_ci   LOG_ENTRYPOINT();
363bf215546Sopenharmony_ci
364bf215546Sopenharmony_ci   struct pipe_context *pipe = CastPipeContext(hDevice);
365bf215546Sopenharmony_ci   void *state = CastPipeInputLayout(hInputLayout);
366bf215546Sopenharmony_ci
367bf215546Sopenharmony_ci   pipe->bind_vertex_elements_state(pipe, state);
368bf215546Sopenharmony_ci}
369bf215546Sopenharmony_ci
370bf215546Sopenharmony_ci
371