st/nine: Capture also default matrices for D3DSBT_ALL
[mesa.git] / src / gallium / state_trackers / nine / stateblock9.c
1 /*
2 * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22
23 #include "stateblock9.h"
24 #include "device9.h"
25 #include "basetexture9.h"
26 #include "nine_helpers.h"
27 #include "vertexdeclaration9.h"
28 #include "vertexbuffer9.h"
29 #include "indexbuffer9.h"
30
31 #define DBG_CHANNEL DBG_STATEBLOCK
32
33 /* XXX TODO: handling of lights is broken */
34
35 HRESULT
36 NineStateBlock9_ctor( struct NineStateBlock9 *This,
37 struct NineUnknownParams *pParams,
38 enum nine_stateblock_type type )
39 {
40 HRESULT hr = NineUnknown_ctor(&This->base, pParams);
41
42 DBG("This=%p pParams=%p type=%d\n", This, pParams, type);
43
44 if (FAILED(hr))
45 return hr;
46
47 This->type = type;
48
49 This->state.vs_const_f = MALLOC(VS_CONST_F_SIZE(This->base.device));
50 This->state.ps_const_f = MALLOC(This->base.device->ps_const_size);
51 This->state.vs_const_i = MALLOC(VS_CONST_I_SIZE(This->base.device));
52 This->state.vs_const_b = MALLOC(VS_CONST_B_SIZE(This->base.device));
53 if (!This->state.vs_const_f || !This->state.ps_const_f ||
54 !This->state.vs_const_i || !This->state.vs_const_b)
55 return E_OUTOFMEMORY;
56
57 return D3D_OK;
58 }
59
60 void
61 NineStateBlock9_dtor( struct NineStateBlock9 *This )
62 {
63 struct nine_state *state = &This->state;
64 struct nine_range *r;
65 struct nine_range_pool *pool = &This->base.device->range_pool;
66
67 nine_state_clear(state, false);
68
69 FREE(state->vs_const_f);
70 FREE(state->ps_const_f);
71 FREE(state->vs_const_i);
72 FREE(state->vs_const_b);
73
74 FREE(state->ff.light);
75
76 FREE(state->ff.transform);
77
78 if (This->state.changed.ps_const_f) {
79 for (r = This->state.changed.ps_const_f; r->next; r = r->next);
80 nine_range_pool_put_chain(pool, This->state.changed.ps_const_f, r);
81 }
82 if (This->state.changed.vs_const_f) {
83 for (r = This->state.changed.vs_const_f; r->next; r = r->next);
84 nine_range_pool_put_chain(pool, This->state.changed.vs_const_f, r);
85 }
86 if (This->state.changed.vs_const_i) {
87 for (r = This->state.changed.vs_const_i; r->next; r = r->next);
88 nine_range_pool_put_chain(pool, This->state.changed.vs_const_i, r);
89 }
90 if (This->state.changed.vs_const_b) {
91 for (r = This->state.changed.vs_const_b; r->next; r = r->next);
92 nine_range_pool_put_chain(pool, This->state.changed.vs_const_b, r);
93 }
94
95 NineUnknown_dtor(&This->base);
96 }
97
98 static void
99 NineStateBlock9_BindBuffer( struct NineDevice9 *device,
100 boolean applyToDevice,
101 struct NineBuffer9 **slot,
102 struct NineBuffer9 *buf )
103 {
104 if (applyToDevice)
105 NineBindBufferToDevice(device, slot, buf);
106 else
107 nine_bind(slot, buf);
108 }
109
110 static void
111 NineStateBlock9_BindTexture( struct NineDevice9 *device,
112 boolean applyToDevice,
113 struct NineBaseTexture9 **slot,
114 struct NineBaseTexture9 *tex )
115 {
116 if (applyToDevice)
117 NineBindTextureToDevice(device, slot, tex);
118 else
119 nine_bind(slot, tex);
120 }
121
122 /* Copy state marked changed in @mask from @src to @dst.
123 * If @apply is false, updating dst->changed can be omitted.
124 * TODO: compare ?
125 */
126 static void
127 nine_state_copy_common(struct NineDevice9 *device,
128 struct nine_state *dst,
129 struct nine_state *src,
130 struct nine_state *mask, /* aliases either src or dst */
131 const boolean apply,
132 struct nine_range_pool *pool)
133 {
134 unsigned i, s;
135
136 DBG("apply:%d changed.group: %x\n", (int)apply, (int)mask->changed.group );
137 if (apply)
138 dst->changed.group |= mask->changed.group;
139
140 if (mask->changed.group & NINE_STATE_VIEWPORT)
141 dst->viewport = src->viewport;
142 if (mask->changed.group & NINE_STATE_SCISSOR)
143 dst->scissor = src->scissor;
144
145 if (mask->changed.group & NINE_STATE_VS)
146 nine_bind(&dst->vs, src->vs);
147 if (mask->changed.group & NINE_STATE_PS)
148 nine_bind(&dst->ps, src->ps);
149
150 /* Vertex constants.
151 *
152 * Various possibilities for optimization here, like creating a per-SB
153 * constant buffer, or memcmp'ing for changes.
154 * Will do that later depending on what works best for specific apps.
155 *
156 * Note: Currently when we apply stateblocks, it's always on the device state.
157 * Should it affect recording stateblocks ? Since it's on device state, there
158 * is no need to copy which ranges are dirty. If it turns out we should affect
159 * recording stateblocks, the info should be copied.
160 */
161 if (mask->changed.group & NINE_STATE_VS_CONST) {
162 struct nine_range *r;
163 for (r = mask->changed.vs_const_f; r; r = r->next) {
164 memcpy(&dst->vs_const_f[r->bgn * 4],
165 &src->vs_const_f[r->bgn * 4],
166 (r->end - r->bgn) * 4 * sizeof(float));
167 }
168 for (r = mask->changed.vs_const_i; r; r = r->next) {
169 memcpy(&dst->vs_const_i[r->bgn * 4],
170 &src->vs_const_i[r->bgn * 4],
171 (r->end - r->bgn) * 4 * sizeof(int));
172 }
173 for (r = mask->changed.vs_const_b; r; r = r->next) {
174 memcpy(&dst->vs_const_b[r->bgn],
175 &src->vs_const_b[r->bgn],
176 (r->end - r->bgn) * sizeof(int));
177 }
178 }
179
180 /* Pixel constants. */
181 if (mask->changed.group & NINE_STATE_PS_CONST) {
182 struct nine_range *r;
183 for (r = mask->changed.ps_const_f; r; r = r->next) {
184 memcpy(&dst->ps_const_f[r->bgn * 4],
185 &src->ps_const_f[r->bgn * 4],
186 (r->end - r->bgn) * 4 * sizeof(float));
187 }
188 if (mask->changed.ps_const_i) {
189 uint16_t m = mask->changed.ps_const_i;
190 for (i = ffs(m) - 1, m >>= i; m; ++i, m >>= 1)
191 if (m & 1)
192 memcpy(dst->ps_const_i[i], src->ps_const_i[i], 4 * sizeof(int));
193 }
194 if (mask->changed.ps_const_b) {
195 uint16_t m = mask->changed.ps_const_b;
196 for (i = ffs(m) - 1, m >>= i; m; ++i, m >>= 1)
197 if (m & 1)
198 dst->ps_const_b[i] = src->ps_const_b[i];
199 }
200 }
201
202 /* Render states.
203 * TODO: Maybe build a list ?
204 */
205 for (i = 0; i < ARRAY_SIZE(dst->changed.rs); ++i) {
206 uint32_t m = mask->changed.rs[i];
207 if (apply)
208 dst->changed.rs[i] |= m;
209 while (m) {
210 const int r = ffs(m) - 1;
211 m &= ~(1 << r);
212 DBG("State %d %s = %d\n", i * 32 + r, nine_d3drs_to_string(i * 32 + r), (int)src->rs_advertised[i * 32 + r]);
213 dst->rs_advertised[i * 32 + r] = src->rs_advertised[i * 32 + r];
214 }
215 }
216
217
218 /* Clip planes. */
219 if (mask->changed.ucp) {
220 DBG("ucp: %x\n", mask->changed.ucp);
221 for (i = 0; i < PIPE_MAX_CLIP_PLANES; ++i)
222 if (mask->changed.ucp & (1 << i))
223 memcpy(dst->clip.ucp[i],
224 src->clip.ucp[i], sizeof(src->clip.ucp[0]));
225 if (apply)
226 dst->changed.ucp |= mask->changed.ucp;
227 }
228
229 /* Sampler state. */
230 if (mask->changed.group & NINE_STATE_SAMPLER) {
231 for (s = 0; s < NINE_MAX_SAMPLERS; ++s) {
232 if (mask->changed.sampler[s] == 0x3ffe) {
233 memcpy(&dst->samp_advertised[s], &src->samp_advertised[s], sizeof(dst->samp_advertised[s]));
234 } else {
235 uint32_t m = mask->changed.sampler[s];
236 DBG("samp %d: changed = %x\n", i, (int)m);
237 while (m) {
238 const int i = ffs(m) - 1;
239 m &= ~(1 << i);
240 dst->samp_advertised[s][i] = src->samp_advertised[s][i];
241 }
242 }
243 if (apply)
244 dst->changed.sampler[s] |= mask->changed.sampler[s];
245 }
246 }
247
248 /* Index buffer. */
249 if (mask->changed.group & NINE_STATE_IDXBUF)
250 NineStateBlock9_BindBuffer(device,
251 apply,
252 (struct NineBuffer9 **)&dst->idxbuf,
253 (struct NineBuffer9 *)src->idxbuf);
254
255 /* Vertex streams. */
256 if (mask->changed.vtxbuf | mask->changed.stream_freq) {
257 DBG("vtxbuf/stream_freq: %x/%x\n", mask->changed.vtxbuf, mask->changed.stream_freq);
258 uint32_t m = mask->changed.vtxbuf | mask->changed.stream_freq;
259 for (i = 0; m; ++i, m >>= 1) {
260 if (mask->changed.vtxbuf & (1 << i)) {
261 NineStateBlock9_BindBuffer(device,
262 apply,
263 (struct NineBuffer9 **)&dst->stream[i],
264 (struct NineBuffer9 *)src->stream[i]);
265 if (src->stream[i]) {
266 dst->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset;
267 dst->vtxbuf[i].stride = src->vtxbuf[i].stride;
268 }
269 }
270 if (mask->changed.stream_freq & (1 << i))
271 dst->stream_freq[i] = src->stream_freq[i];
272 }
273 if (apply) {
274 dst->changed.vtxbuf |= mask->changed.vtxbuf;
275 dst->changed.stream_freq |= mask->changed.stream_freq;
276 }
277 }
278
279 /* Textures */
280 if (mask->changed.texture) {
281 uint32_t m = mask->changed.texture;
282 for (s = 0; m; ++s, m >>= 1)
283 if (m & 1)
284 NineStateBlock9_BindTexture(device, apply, &dst->texture[s], src->texture[s]);
285 }
286
287 if (!(mask->changed.group & NINE_STATE_FF))
288 return;
289 WARN_ONCE("Fixed function state not handled properly by StateBlocks.\n");
290
291 /* Fixed function state. */
292
293 if (mask->changed.group & NINE_STATE_FF_MATERIAL)
294 dst->ff.material = src->ff.material;
295
296 if (mask->changed.group & NINE_STATE_FF_PS_CONSTS) {
297 for (s = 0; s < NINE_MAX_TEXTURE_STAGES; ++s) {
298 for (i = 0; i < NINED3DTSS_COUNT; ++i)
299 if (mask->ff.changed.tex_stage[s][i / 32] & (1 << (i % 32)))
300 dst->ff.tex_stage[s][i] = src->ff.tex_stage[s][i];
301 if (apply) {
302 /* TODO: it's 32 exactly, just offset by 1 as 0 is unused */
303 dst->ff.changed.tex_stage[s][0] |=
304 mask->ff.changed.tex_stage[s][0];
305 dst->ff.changed.tex_stage[s][1] |=
306 mask->ff.changed.tex_stage[s][1];
307 }
308 }
309 }
310 if (mask->changed.group & NINE_STATE_FF_LIGHTING) {
311 unsigned num_lights = MAX2(dst->ff.num_lights, src->ff.num_lights);
312 /* Can happen in Capture() if device state has created new lights after
313 * the stateblock was created.
314 * Can happen in Apply() if the stateblock had recorded the creation of
315 * new lights. */
316 if (dst->ff.num_lights < num_lights) {
317 dst->ff.light = REALLOC(dst->ff.light,
318 dst->ff.num_lights * sizeof(D3DLIGHT9),
319 num_lights * sizeof(D3DLIGHT9));
320 memset(&dst->ff.light[dst->ff.num_lights], 0, (num_lights - dst->ff.num_lights) * sizeof(D3DLIGHT9));
321 /* if mask == dst, a Type of 0 will trigger
322 * "dst->ff.light[i] = src->ff.light[i];" later,
323 * which is what we want in that case. */
324 if (mask != dst) {
325 for (i = dst->ff.num_lights; i < num_lights; ++i)
326 dst->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
327 }
328 dst->ff.num_lights = num_lights;
329 }
330 /* Can happen in Capture() if the stateblock had recorded the creation of
331 * new lights.
332 * Can happen in Apply() if device state has created new lights after
333 * the stateblock was created. */
334 if (src->ff.num_lights < num_lights) {
335 src->ff.light = REALLOC(src->ff.light,
336 src->ff.num_lights * sizeof(D3DLIGHT9),
337 num_lights * sizeof(D3DLIGHT9));
338 memset(&src->ff.light[src->ff.num_lights], 0, (num_lights - src->ff.num_lights) * sizeof(D3DLIGHT9));
339 for (i = src->ff.num_lights; i < num_lights; ++i)
340 src->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
341 src->ff.num_lights = num_lights;
342 }
343 /* Note: mask is either src or dst, so at this point src, dst and mask
344 * have num_lights lights. */
345 for (i = 0; i < num_lights; ++i)
346 if (mask->ff.light[i].Type != NINED3DLIGHT_INVALID)
347 dst->ff.light[i] = src->ff.light[i];
348
349 memcpy(dst->ff.active_light, src->ff.active_light, sizeof(src->ff.active_light) );
350 dst->ff.num_lights_active = src->ff.num_lights_active;
351 }
352 if (mask->changed.group & NINE_STATE_FF_VSTRANSF) {
353 for (i = 0; i < ARRAY_SIZE(mask->ff.changed.transform); ++i) {
354 if (!mask->ff.changed.transform[i])
355 continue;
356 for (s = i * 32; s < (i * 32 + 32); ++s) {
357 if (!(mask->ff.changed.transform[i] & (1 << (s % 32))))
358 continue;
359 *nine_state_access_transform(&dst->ff, s, TRUE) =
360 *nine_state_access_transform(&src->ff, s, FALSE);
361 }
362 if (apply)
363 dst->ff.changed.transform[i] |= mask->ff.changed.transform[i];
364 }
365 }
366 }
367
368 static void
369 nine_state_copy_common_all(struct NineDevice9 *device,
370 struct nine_state *dst,
371 struct nine_state *src,
372 struct nine_state *help,
373 const boolean apply,
374 struct nine_range_pool *pool,
375 const int MaxStreams)
376 {
377 unsigned i;
378
379 if (apply)
380 dst->changed.group |= src->changed.group;
381
382 dst->viewport = src->viewport;
383 dst->scissor = src->scissor;
384
385 nine_bind(&dst->vs, src->vs);
386 nine_bind(&dst->ps, src->ps);
387
388 /* Vertex constants.
389 *
390 * Various possibilities for optimization here, like creating a per-SB
391 * constant buffer, or memcmp'ing for changes.
392 * Will do that later depending on what works best for specific apps.
393 */
394 if (1) {
395 memcpy(&dst->vs_const_f[0],
396 &src->vs_const_f[0], VS_CONST_F_SIZE(device));
397
398 memcpy(dst->vs_const_i, src->vs_const_i, VS_CONST_I_SIZE(device));
399 memcpy(dst->vs_const_b, src->vs_const_b, VS_CONST_B_SIZE(device));
400 }
401
402 /* Pixel constants. */
403 if (1) {
404 struct nine_range *r = help->changed.ps_const_f;
405 memcpy(&dst->ps_const_f[0],
406 &src->ps_const_f[0], (r->end - r->bgn) * 4 * sizeof(float));
407
408 memcpy(dst->ps_const_i, src->ps_const_i, sizeof(dst->ps_const_i));
409 memcpy(dst->ps_const_b, src->ps_const_b, sizeof(dst->ps_const_b));
410 }
411
412 /* Render states. */
413 memcpy(dst->rs_advertised, src->rs_advertised, sizeof(dst->rs_advertised));
414 if (apply)
415 memcpy(dst->changed.rs, src->changed.rs, sizeof(dst->changed.rs));
416
417
418 /* Clip planes. */
419 memcpy(&dst->clip, &src->clip, sizeof(dst->clip));
420 if (apply)
421 dst->changed.ucp = src->changed.ucp;
422
423 /* Sampler state. */
424 memcpy(dst->samp_advertised, src->samp_advertised, sizeof(dst->samp_advertised));
425 if (apply)
426 memcpy(dst->changed.sampler,
427 src->changed.sampler, sizeof(dst->changed.sampler));
428
429 /* Index buffer. */
430 NineStateBlock9_BindBuffer(device,
431 apply,
432 (struct NineBuffer9 **)&dst->idxbuf,
433 (struct NineBuffer9 *)src->idxbuf);
434
435 /* Vertex streams. */
436 if (1) {
437 for (i = 0; i < ARRAY_SIZE(dst->stream); ++i) {
438 NineStateBlock9_BindBuffer(device,
439 apply,
440 (struct NineBuffer9 **)&dst->stream[i],
441 (struct NineBuffer9 *)src->stream[i]);
442 if (src->stream[i]) {
443 dst->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset;
444 dst->vtxbuf[i].stride = src->vtxbuf[i].stride;
445 }
446 dst->stream_freq[i] = src->stream_freq[i];
447 }
448 if (apply) {
449 dst->changed.vtxbuf = (1ULL << MaxStreams) - 1;
450 dst->changed.stream_freq = (1ULL << MaxStreams) - 1;
451 }
452 }
453
454 /* Textures */
455 if (1) {
456 for (i = 0; i < NINE_MAX_SAMPLERS; i++)
457 NineStateBlock9_BindTexture(device, apply, &dst->texture[i], src->texture[i]);
458 }
459
460 /* keep this check in case we want to disable FF */
461 if (!(help->changed.group & NINE_STATE_FF))
462 return;
463 WARN_ONCE("Fixed function state not handled properly by StateBlocks.\n");
464
465 /* Fixed function state. */
466 dst->ff.material = src->ff.material;
467
468 memcpy(dst->ff.tex_stage, src->ff.tex_stage, sizeof(dst->ff.tex_stage));
469 if (apply) /* TODO: memset */
470 memcpy(dst->ff.changed.tex_stage,
471 src->ff.changed.tex_stage, sizeof(dst->ff.changed.tex_stage));
472
473 /* Lights. */
474 if (1) {
475 if (dst->ff.num_lights < src->ff.num_lights) {
476 dst->ff.light = REALLOC(dst->ff.light,
477 dst->ff.num_lights * sizeof(D3DLIGHT9),
478 src->ff.num_lights * sizeof(D3DLIGHT9));
479 dst->ff.num_lights = src->ff.num_lights;
480 }
481 memcpy(dst->ff.light,
482 src->ff.light, src->ff.num_lights * sizeof(dst->ff.light[0]));
483
484 memcpy(dst->ff.active_light, src->ff.active_light, sizeof(src->ff.active_light) );
485 dst->ff.num_lights_active = src->ff.num_lights_active;
486 }
487
488 /* Transforms. */
489 if (1) {
490 /* Increase dst size if required (to copy the new states).
491 * Increase src size if required (to initialize missing transforms).
492 */
493 if (dst->ff.num_transforms != src->ff.num_transforms) {
494 int num_transforms = MAX2(src->ff.num_transforms, dst->ff.num_transforms);
495 nine_state_resize_transform(&src->ff, num_transforms);
496 nine_state_resize_transform(&dst->ff, num_transforms);
497 }
498 memcpy(dst->ff.transform,
499 src->ff.transform, dst->ff.num_transforms * sizeof(D3DMATRIX));
500 /* Apply is always used on device state.
501 * src is then the D3DSBT_ALL stateblock which
502 * ff.changed.transform indicates all matrices are dirty.
503 */
504 if (apply)
505 memcpy(dst->ff.changed.transform,
506 src->ff.changed.transform, sizeof(dst->ff.changed.transform));
507 }
508 }
509
510 /* Capture those bits of current device state that have been changed between
511 * BeginStateBlock and EndStateBlock.
512 */
513 HRESULT NINE_WINAPI
514 NineStateBlock9_Capture( struct NineStateBlock9 *This )
515 {
516 struct NineDevice9 *device = This->base.device;
517 struct nine_state *dst = &This->state;
518 struct nine_state *src = &device->state;
519 const int MaxStreams = device->caps.MaxStreams;
520
521 DBG("This=%p\n", This);
522
523 if (This->type == NINESBT_ALL)
524 nine_state_copy_common_all(device, dst, src, dst, FALSE, NULL, MaxStreams);
525 else
526 nine_state_copy_common(device, dst, src, dst, FALSE, NULL);
527
528 if (dst->changed.group & NINE_STATE_VDECL)
529 nine_bind(&dst->vdecl, src->vdecl);
530
531 return D3D_OK;
532 }
533
534 /* Set state managed by this StateBlock as current device state. */
535 HRESULT NINE_WINAPI
536 NineStateBlock9_Apply( struct NineStateBlock9 *This )
537 {
538 struct NineDevice9 *device = This->base.device;
539 struct nine_state *dst = &device->state;
540 struct nine_state *src = &This->state;
541 struct nine_range_pool *pool = &device->range_pool;
542 const int MaxStreams = device->caps.MaxStreams;
543
544 DBG("This=%p\n", This);
545
546 if (This->type == NINESBT_ALL)
547 nine_state_copy_common_all(device, dst, src, src, TRUE, pool, MaxStreams);
548 else
549 nine_state_copy_common(device, dst, src, src, TRUE, pool);
550
551 nine_context_apply_stateblock(device, src);
552
553 if ((src->changed.group & NINE_STATE_VDECL) && src->vdecl)
554 nine_bind(&dst->vdecl, src->vdecl);
555
556 return D3D_OK;
557 }
558
559 IDirect3DStateBlock9Vtbl NineStateBlock9_vtable = {
560 (void *)NineUnknown_QueryInterface,
561 (void *)NineUnknown_AddRef,
562 (void *)NineUnknown_Release,
563 (void *)NineUnknown_GetDevice, /* actually part of StateBlock9 iface */
564 (void *)NineStateBlock9_Capture,
565 (void *)NineStateBlock9_Apply
566 };
567
568 static const GUID *NineStateBlock9_IIDs[] = {
569 &IID_IDirect3DStateBlock9,
570 &IID_IUnknown,
571 NULL
572 };
573
574 HRESULT
575 NineStateBlock9_new( struct NineDevice9 *pDevice,
576 struct NineStateBlock9 **ppOut,
577 enum nine_stateblock_type type)
578 {
579 NINE_DEVICE_CHILD_NEW(StateBlock9, ppOut, pDevice, type);
580 }