st/nine: Fix volumetexture dtor on ctor failure
[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
138 /* device changed.* are unused.
139 * Instead nine_context_apply_stateblock is used and will
140 * internally set the right context->changed fields.
141 * Uncomment these only if we want to apply a stateblock onto a stateblock.
142 *
143 * if (apply)
144 * dst->changed.group |= mask->changed.group;
145 */
146
147 if (mask->changed.group & NINE_STATE_VIEWPORT)
148 dst->viewport = src->viewport;
149 if (mask->changed.group & NINE_STATE_SCISSOR)
150 dst->scissor = src->scissor;
151
152 if (mask->changed.group & NINE_STATE_VS)
153 nine_bind(&dst->vs, src->vs);
154 if (mask->changed.group & NINE_STATE_PS)
155 nine_bind(&dst->ps, src->ps);
156
157 /* Vertex constants.
158 *
159 * Various possibilities for optimization here, like creating a per-SB
160 * constant buffer, or memcmp'ing for changes.
161 * Will do that later depending on what works best for specific apps.
162 *
163 * Note: Currently when we apply stateblocks, it's always on the device state.
164 * Should it affect recording stateblocks ? Since it's on device state, there
165 * is no need to copy which ranges are dirty. If it turns out we should affect
166 * recording stateblocks, the info should be copied.
167 */
168 if (mask->changed.group & NINE_STATE_VS_CONST) {
169 struct nine_range *r;
170 for (r = mask->changed.vs_const_f; r; r = r->next) {
171 memcpy(&dst->vs_const_f[r->bgn * 4],
172 &src->vs_const_f[r->bgn * 4],
173 (r->end - r->bgn) * 4 * sizeof(float));
174 }
175 for (r = mask->changed.vs_const_i; r; r = r->next) {
176 memcpy(&dst->vs_const_i[r->bgn * 4],
177 &src->vs_const_i[r->bgn * 4],
178 (r->end - r->bgn) * 4 * sizeof(int));
179 }
180 for (r = mask->changed.vs_const_b; r; r = r->next) {
181 memcpy(&dst->vs_const_b[r->bgn],
182 &src->vs_const_b[r->bgn],
183 (r->end - r->bgn) * sizeof(int));
184 }
185 }
186
187 /* Pixel constants. */
188 if (mask->changed.group & NINE_STATE_PS_CONST) {
189 struct nine_range *r;
190 for (r = mask->changed.ps_const_f; r; r = r->next) {
191 memcpy(&dst->ps_const_f[r->bgn * 4],
192 &src->ps_const_f[r->bgn * 4],
193 (r->end - r->bgn) * 4 * sizeof(float));
194 }
195 if (mask->changed.ps_const_i) {
196 uint16_t m = mask->changed.ps_const_i;
197 for (i = ffs(m) - 1, m >>= i; m; ++i, m >>= 1)
198 if (m & 1)
199 memcpy(dst->ps_const_i[i], src->ps_const_i[i], 4 * sizeof(int));
200 }
201 if (mask->changed.ps_const_b) {
202 uint16_t m = mask->changed.ps_const_b;
203 for (i = ffs(m) - 1, m >>= i; m; ++i, m >>= 1)
204 if (m & 1)
205 dst->ps_const_b[i] = src->ps_const_b[i];
206 }
207 }
208
209 /* Render states.
210 * TODO: Maybe build a list ?
211 */
212 for (i = 0; i < ARRAY_SIZE(mask->changed.rs); ++i) {
213 uint32_t m = mask->changed.rs[i];
214 /* if (apply)
215 * dst->changed.rs[i] |= m; */
216 while (m) {
217 const int r = ffs(m) - 1;
218 m &= ~(1 << r);
219 DBG("State %d %s = %d\n", i * 32 + r, nine_d3drs_to_string(i * 32 + r), (int)src->rs_advertised[i * 32 + r]);
220 dst->rs_advertised[i * 32 + r] = src->rs_advertised[i * 32 + r];
221 }
222 }
223
224
225 /* Clip planes. */
226 if (mask->changed.ucp) {
227 DBG("ucp: %x\n", mask->changed.ucp);
228 for (i = 0; i < PIPE_MAX_CLIP_PLANES; ++i)
229 if (mask->changed.ucp & (1 << i))
230 memcpy(dst->clip.ucp[i],
231 src->clip.ucp[i], sizeof(src->clip.ucp[0]));
232 /* if (apply)
233 * dst->changed.ucp |= mask->changed.ucp;*/
234 }
235
236 /* Sampler state. */
237 if (mask->changed.group & NINE_STATE_SAMPLER) {
238 for (s = 0; s < NINE_MAX_SAMPLERS; ++s) {
239 if (mask->changed.sampler[s] == 0x3ffe) {
240 memcpy(&dst->samp_advertised[s], &src->samp_advertised[s], sizeof(dst->samp_advertised[s]));
241 } else {
242 uint32_t m = mask->changed.sampler[s];
243 DBG("samp %d: changed = %x\n", i, (int)m);
244 while (m) {
245 const int i = ffs(m) - 1;
246 m &= ~(1 << i);
247 dst->samp_advertised[s][i] = src->samp_advertised[s][i];
248 }
249 }
250 /* if (apply)
251 * dst->changed.sampler[s] |= mask->changed.sampler[s];*/
252 }
253 }
254
255 /* Index buffer. */
256 if (mask->changed.group & NINE_STATE_IDXBUF)
257 NineStateBlock9_BindBuffer(device,
258 apply,
259 (struct NineBuffer9 **)&dst->idxbuf,
260 (struct NineBuffer9 *)src->idxbuf);
261
262 /* Vertex streams. */
263 if (mask->changed.vtxbuf | mask->changed.stream_freq) {
264 DBG("vtxbuf/stream_freq: %x/%x\n", mask->changed.vtxbuf, mask->changed.stream_freq);
265 uint32_t m = mask->changed.vtxbuf | mask->changed.stream_freq;
266 for (i = 0; m; ++i, m >>= 1) {
267 if (mask->changed.vtxbuf & (1 << i)) {
268 NineStateBlock9_BindBuffer(device,
269 apply,
270 (struct NineBuffer9 **)&dst->stream[i],
271 (struct NineBuffer9 *)src->stream[i]);
272 if (src->stream[i]) {
273 dst->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset;
274 dst->vtxbuf[i].stride = src->vtxbuf[i].stride;
275 }
276 }
277 if (mask->changed.stream_freq & (1 << i))
278 dst->stream_freq[i] = src->stream_freq[i];
279 }
280 /*
281 * if (apply) {
282 * dst->changed.vtxbuf |= mask->changed.vtxbuf;
283 * dst->changed.stream_freq |= mask->changed.stream_freq;
284 * }*/
285 }
286
287 /* Textures */
288 if (mask->changed.texture) {
289 uint32_t m = mask->changed.texture;
290 for (s = 0; m; ++s, m >>= 1)
291 if (m & 1)
292 NineStateBlock9_BindTexture(device, apply, &dst->texture[s], src->texture[s]);
293 }
294
295 if (!(mask->changed.group & NINE_STATE_FF))
296 return;
297 WARN_ONCE("Fixed function state not handled properly by StateBlocks.\n");
298
299 /* Fixed function state. */
300
301 if (mask->changed.group & NINE_STATE_FF_MATERIAL)
302 dst->ff.material = src->ff.material;
303
304 if (mask->changed.group & NINE_STATE_FF_PS_CONSTS) {
305 for (s = 0; s < NINE_MAX_TEXTURE_STAGES; ++s) {
306 for (i = 0; i < NINED3DTSS_COUNT; ++i)
307 if (mask->ff.changed.tex_stage[s][i / 32] & (1 << (i % 32)))
308 dst->ff.tex_stage[s][i] = src->ff.tex_stage[s][i];
309 /*
310 * if (apply) {
311 * TODO: it's 32 exactly, just offset by 1 as 0 is unused
312 * dst->ff.changed.tex_stage[s][0] |=
313 * mask->ff.changed.tex_stage[s][0];
314 * dst->ff.changed.tex_stage[s][1] |=
315 * mask->ff.changed.tex_stage[s][1];
316 * }*/
317 }
318 }
319 if (mask->changed.group & NINE_STATE_FF_LIGHTING) {
320 unsigned num_lights = MAX2(dst->ff.num_lights, src->ff.num_lights);
321 /* Can happen in Capture() if device state has created new lights after
322 * the stateblock was created.
323 * Can happen in Apply() if the stateblock had recorded the creation of
324 * new lights. */
325 if (dst->ff.num_lights < num_lights) {
326 dst->ff.light = REALLOC(dst->ff.light,
327 dst->ff.num_lights * sizeof(D3DLIGHT9),
328 num_lights * sizeof(D3DLIGHT9));
329 memset(&dst->ff.light[dst->ff.num_lights], 0, (num_lights - dst->ff.num_lights) * sizeof(D3DLIGHT9));
330 /* if mask == dst, a Type of 0 will trigger
331 * "dst->ff.light[i] = src->ff.light[i];" later,
332 * which is what we want in that case. */
333 if (mask != dst) {
334 for (i = dst->ff.num_lights; i < num_lights; ++i)
335 dst->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
336 }
337 dst->ff.num_lights = num_lights;
338 }
339 /* Can happen in Capture() if the stateblock had recorded the creation of
340 * new lights.
341 * Can happen in Apply() if device state has created new lights after
342 * the stateblock was created. */
343 if (src->ff.num_lights < num_lights) {
344 src->ff.light = REALLOC(src->ff.light,
345 src->ff.num_lights * sizeof(D3DLIGHT9),
346 num_lights * sizeof(D3DLIGHT9));
347 memset(&src->ff.light[src->ff.num_lights], 0, (num_lights - src->ff.num_lights) * sizeof(D3DLIGHT9));
348 for (i = src->ff.num_lights; i < num_lights; ++i)
349 src->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
350 src->ff.num_lights = num_lights;
351 }
352 /* Note: mask is either src or dst, so at this point src, dst and mask
353 * have num_lights lights. */
354 for (i = 0; i < num_lights; ++i)
355 if (mask->ff.light[i].Type != NINED3DLIGHT_INVALID)
356 dst->ff.light[i] = src->ff.light[i];
357
358 memcpy(dst->ff.active_light, src->ff.active_light, sizeof(src->ff.active_light) );
359 dst->ff.num_lights_active = src->ff.num_lights_active;
360 }
361 if (mask->changed.group & NINE_STATE_FF_VSTRANSF) {
362 for (i = 0; i < ARRAY_SIZE(mask->ff.changed.transform); ++i) {
363 if (!mask->ff.changed.transform[i])
364 continue;
365 for (s = i * 32; s < (i * 32 + 32); ++s) {
366 if (!(mask->ff.changed.transform[i] & (1 << (s % 32))))
367 continue;
368 *nine_state_access_transform(&dst->ff, s, TRUE) =
369 *nine_state_access_transform(&src->ff, s, FALSE);
370 }
371 /* if (apply)
372 * dst->ff.changed.transform[i] |= mask->ff.changed.transform[i];*/
373 }
374 }
375 }
376
377 static void
378 nine_state_copy_common_all(struct NineDevice9 *device,
379 struct nine_state *dst,
380 struct nine_state *src,
381 struct nine_state *help,
382 const boolean apply,
383 struct nine_range_pool *pool,
384 const int MaxStreams)
385 {
386 unsigned i;
387
388 /* if (apply)
389 * dst->changed.group |= src->changed.group;
390 */
391
392 dst->viewport = src->viewport;
393 dst->scissor = src->scissor;
394
395 nine_bind(&dst->vs, src->vs);
396 nine_bind(&dst->ps, src->ps);
397
398 /* Vertex constants.
399 *
400 * Various possibilities for optimization here, like creating a per-SB
401 * constant buffer, or memcmp'ing for changes.
402 * Will do that later depending on what works best for specific apps.
403 */
404 if (1) {
405 memcpy(&dst->vs_const_f[0],
406 &src->vs_const_f[0], VS_CONST_F_SIZE(device));
407
408 memcpy(dst->vs_const_i, src->vs_const_i, VS_CONST_I_SIZE(device));
409 memcpy(dst->vs_const_b, src->vs_const_b, VS_CONST_B_SIZE(device));
410 }
411
412 /* Pixel constants. */
413 if (1) {
414 struct nine_range *r = help->changed.ps_const_f;
415 memcpy(&dst->ps_const_f[0],
416 &src->ps_const_f[0], (r->end - r->bgn) * 4 * sizeof(float));
417
418 memcpy(dst->ps_const_i, src->ps_const_i, sizeof(dst->ps_const_i));
419 memcpy(dst->ps_const_b, src->ps_const_b, sizeof(dst->ps_const_b));
420 }
421
422 /* Render states. */
423 memcpy(dst->rs_advertised, src->rs_advertised, sizeof(dst->rs_advertised));
424 /* if (apply)
425 * memcpy(dst->changed.rs, src->changed.rs, sizeof(dst->changed.rs));*/
426
427
428 /* Clip planes. */
429 memcpy(&dst->clip, &src->clip, sizeof(dst->clip));
430 /* if (apply)
431 * dst->changed.ucp = src->changed.ucp;*/
432
433 /* Sampler state. */
434 memcpy(dst->samp_advertised, src->samp_advertised, sizeof(dst->samp_advertised));
435 /* if (apply)
436 * memcpy(dst->changed.sampler,
437 * src->changed.sampler, sizeof(dst->changed.sampler));*/
438
439 /* Index buffer. */
440 NineStateBlock9_BindBuffer(device,
441 apply,
442 (struct NineBuffer9 **)&dst->idxbuf,
443 (struct NineBuffer9 *)src->idxbuf);
444
445 /* Vertex streams. */
446 if (1) {
447 for (i = 0; i < ARRAY_SIZE(dst->stream); ++i) {
448 NineStateBlock9_BindBuffer(device,
449 apply,
450 (struct NineBuffer9 **)&dst->stream[i],
451 (struct NineBuffer9 *)src->stream[i]);
452 if (src->stream[i]) {
453 dst->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset;
454 dst->vtxbuf[i].stride = src->vtxbuf[i].stride;
455 }
456 dst->stream_freq[i] = src->stream_freq[i];
457 }
458 /* if (apply) {
459 * dst->changed.vtxbuf = (1ULL << MaxStreams) - 1;
460 * dst->changed.stream_freq = (1ULL << MaxStreams) - 1;
461 * }*/
462 }
463
464 /* Textures */
465 if (1) {
466 for (i = 0; i < NINE_MAX_SAMPLERS; i++)
467 NineStateBlock9_BindTexture(device, apply, &dst->texture[i], src->texture[i]);
468 }
469
470 /* keep this check in case we want to disable FF */
471 if (!(help->changed.group & NINE_STATE_FF))
472 return;
473 WARN_ONCE("Fixed function state not handled properly by StateBlocks.\n");
474
475 /* Fixed function state. */
476 dst->ff.material = src->ff.material;
477
478 memcpy(dst->ff.tex_stage, src->ff.tex_stage, sizeof(dst->ff.tex_stage));
479 /* if (apply) TODO: memset
480 * memcpy(dst->ff.changed.tex_stage,
481 * src->ff.changed.tex_stage, sizeof(dst->ff.changed.tex_stage));*/
482
483 /* Lights. */
484 if (1) {
485 if (dst->ff.num_lights < src->ff.num_lights) {
486 dst->ff.light = REALLOC(dst->ff.light,
487 dst->ff.num_lights * sizeof(D3DLIGHT9),
488 src->ff.num_lights * sizeof(D3DLIGHT9));
489 dst->ff.num_lights = src->ff.num_lights;
490 }
491 memcpy(dst->ff.light,
492 src->ff.light, src->ff.num_lights * sizeof(dst->ff.light[0]));
493
494 memcpy(dst->ff.active_light, src->ff.active_light, sizeof(src->ff.active_light) );
495 dst->ff.num_lights_active = src->ff.num_lights_active;
496 }
497
498 /* Transforms. */
499 if (1) {
500 /* Increase dst size if required (to copy the new states).
501 * Increase src size if required (to initialize missing transforms).
502 */
503 if (dst->ff.num_transforms != src->ff.num_transforms) {
504 int num_transforms = MAX2(src->ff.num_transforms, dst->ff.num_transforms);
505 nine_state_resize_transform(&src->ff, num_transforms);
506 nine_state_resize_transform(&dst->ff, num_transforms);
507 }
508 memcpy(dst->ff.transform,
509 src->ff.transform, dst->ff.num_transforms * sizeof(D3DMATRIX));
510 /* Apply is always used on device state.
511 * src is then the D3DSBT_ALL stateblock which
512 * ff.changed.transform indicates all matrices are dirty.
513 *
514 * if (apply)
515 * memcpy(dst->ff.changed.transform,
516 * src->ff.changed.transform, sizeof(dst->ff.changed.transform));*/
517 }
518 }
519
520 /* Capture those bits of current device state that have been changed between
521 * BeginStateBlock and EndStateBlock.
522 */
523 HRESULT NINE_WINAPI
524 NineStateBlock9_Capture( struct NineStateBlock9 *This )
525 {
526 struct NineDevice9 *device = This->base.device;
527 struct nine_state *dst = &This->state;
528 struct nine_state *src = &device->state;
529 const int MaxStreams = device->caps.MaxStreams;
530
531 DBG("This=%p\n", This);
532
533 if (This->type == NINESBT_ALL)
534 nine_state_copy_common_all(device, dst, src, dst, FALSE, NULL, MaxStreams);
535 else
536 nine_state_copy_common(device, dst, src, dst, FALSE, NULL);
537
538 if (dst->changed.group & NINE_STATE_VDECL)
539 nine_bind(&dst->vdecl, src->vdecl);
540
541 return D3D_OK;
542 }
543
544 /* Set state managed by this StateBlock as current device state. */
545 HRESULT NINE_WINAPI
546 NineStateBlock9_Apply( struct NineStateBlock9 *This )
547 {
548 struct NineDevice9 *device = This->base.device;
549 struct nine_state *dst = &device->state;
550 struct nine_state *src = &This->state;
551 struct nine_range_pool *pool = &device->range_pool;
552 const int MaxStreams = device->caps.MaxStreams;
553
554 DBG("This=%p\n", This);
555
556 if (This->type == NINESBT_ALL)
557 nine_state_copy_common_all(device, dst, src, src, TRUE, pool, MaxStreams);
558 else
559 nine_state_copy_common(device, dst, src, src, TRUE, pool);
560
561 nine_context_apply_stateblock(device, src);
562
563 if ((src->changed.group & NINE_STATE_VDECL) && src->vdecl)
564 nine_bind(&dst->vdecl, src->vdecl);
565
566 return D3D_OK;
567 }
568
569 IDirect3DStateBlock9Vtbl NineStateBlock9_vtable = {
570 (void *)NineUnknown_QueryInterface,
571 (void *)NineUnknown_AddRef,
572 (void *)NineUnknown_Release,
573 (void *)NineUnknown_GetDevice, /* actually part of StateBlock9 iface */
574 (void *)NineStateBlock9_Capture,
575 (void *)NineStateBlock9_Apply
576 };
577
578 static const GUID *NineStateBlock9_IIDs[] = {
579 &IID_IDirect3DStateBlock9,
580 &IID_IUnknown,
581 NULL
582 };
583
584 HRESULT
585 NineStateBlock9_new( struct NineDevice9 *pDevice,
586 struct NineStateBlock9 **ppOut,
587 enum nine_stateblock_type type)
588 {
589 NINE_DEVICE_CHILD_NEW(StateBlock9, ppOut, pDevice, type);
590 }