1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
|
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Blit9.cpp: Surface copy utility class.
#include "libANGLE/renderer/d3d/d3d9/Blit9.h"
#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h"
namespace
{
// Precompiled shaders
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h"
const BYTE* const g_shaderCode[] =
{
g_vs20_standardvs,
g_vs20_flipyvs,
g_ps20_passthroughps,
g_ps20_luminanceps,
g_ps20_componentmaskps
};
const size_t g_shaderSize[] =
{
sizeof(g_vs20_standardvs),
sizeof(g_vs20_flipyvs),
sizeof(g_ps20_passthroughps),
sizeof(g_ps20_luminanceps),
sizeof(g_ps20_componentmaskps)
};
}
namespace rx
{
Blit9::Blit9(Renderer9 *renderer)
: mRenderer(renderer),
mGeometryLoaded(false),
mQuadVertexBuffer(NULL),
mQuadVertexDeclaration(NULL),
mSavedStateBlock(NULL),
mSavedRenderTarget(NULL),
mSavedDepthStencil(NULL)
{
memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
}
Blit9::~Blit9()
{
SafeRelease(mSavedStateBlock);
SafeRelease(mQuadVertexBuffer);
SafeRelease(mQuadVertexDeclaration);
for (int i = 0; i < SHADER_COUNT; i++)
{
SafeRelease(mCompiledShaders[i]);
}
}
gl::Error Blit9::initialize()
{
if (mGeometryLoaded)
{
return gl::Error(GL_NO_ERROR);
}
static const float quad[] =
{
-1, -1,
-1, 1,
1, -1,
1, 1
};
IDirect3DDevice9 *device = mRenderer->getDevice();
HRESULT result = device->CreateVertexBuffer(sizeof(quad), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &mQuadVertexBuffer, NULL);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::Error(GL_OUT_OF_MEMORY, "Failed to create internal blit vertex shader, result: 0x%X.", result);
}
void *lockPtr = NULL;
result = mQuadVertexBuffer->Lock(0, 0, &lockPtr, 0);
if (FAILED(result) || lockPtr == NULL)
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
SafeRelease(mQuadVertexBuffer);
return gl::Error(GL_OUT_OF_MEMORY, "Failed to lock internal blit vertex shader, result: 0x%X.", result);
}
memcpy(lockPtr, quad, sizeof(quad));
mQuadVertexBuffer->Unlock();
static const D3DVERTEXELEMENT9 elements[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
D3DDECL_END()
};
result = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
SafeRelease(mQuadVertexBuffer);
return gl::Error(GL_OUT_OF_MEMORY, "Failed to lock internal blit vertex declaration, result: 0x%X.", result);
}
mGeometryLoaded = true;
return gl::Error(GL_NO_ERROR);
}
template <class D3DShaderType>
gl::Error Blit9::setShader(ShaderId source, const char *profile,
gl::Error (Renderer9::*createShader)(const DWORD *, size_t length, D3DShaderType **outShader),
HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*))
{
IDirect3DDevice9 *device = mRenderer->getDevice();
D3DShaderType *shader = nullptr;
if (mCompiledShaders[source] != NULL)
{
shader = static_cast<D3DShaderType*>(mCompiledShaders[source]);
}
else
{
const BYTE* shaderCode = g_shaderCode[source];
size_t shaderSize = g_shaderSize[source];
gl::Error error = (mRenderer->*createShader)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize, &shader);
if (error.isError())
{
return error;
}
mCompiledShaders[source] = shader;
}
HRESULT hr = (device->*setShader)(shader);
if (FAILED(hr))
{
return gl::Error(GL_OUT_OF_MEMORY, "Failed to set shader for blit operation, result: 0x%X.", hr);
}
return gl::Error(GL_NO_ERROR);
}
gl::Error Blit9::setVertexShader(ShaderId shader)
{
return setShader<IDirect3DVertexShader9>(shader, "vs_2_0", &Renderer9::createVertexShader, &IDirect3DDevice9::SetVertexShader);
}
gl::Error Blit9::setPixelShader(ShaderId shader)
{
return setShader<IDirect3DPixelShader9>(shader, "ps_2_0", &Renderer9::createPixelShader, &IDirect3DDevice9::SetPixelShader);
}
RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const
{
D3DSURFACE_DESC desc;
surface->GetDesc(&desc);
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = desc.Width;
rect.bottom = desc.Height;
return rect;
}
gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{
gl::Error error = initialize();
if (error.isError())
{
return error;
}
IDirect3DTexture9 *texture = NULL;
error = copySurfaceToTexture(source, getSurfaceRect(source), &texture);
if (error.isError())
{
return error;
}
IDirect3DDevice9 *device = mRenderer->getDevice();
saveState();
device->SetTexture(0, texture);
device->SetRenderTarget(0, dest);
setVertexShader(SHADER_VS_STANDARD);
setPixelShader(SHADER_PS_PASSTHROUGH);
setCommonBlitState();
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
setViewport(getSurfaceRect(dest), gl::Offset(0, 0, 0));
render();
SafeRelease(texture);
restoreState();
return gl::Error(GL_NO_ERROR);
}
gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{
gl::Error error = initialize();
if (error.isError())
{
return error;
}
const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
ASSERT(colorbuffer);
RenderTarget9 *renderTarget9 = nullptr;
error = colorbuffer->getRenderTarget(&renderTarget9);
if (error.isError())
{
return error;
}
ASSERT(renderTarget9);
IDirect3DSurface9 *source = renderTarget9->getSurface();
ASSERT(source);
IDirect3DSurface9 *destSurface = NULL;
TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
error = storage9->getSurfaceLevel(GL_TEXTURE_2D, level, true, &destSurface);
if (error.isError())
{
SafeRelease(source);
return error;
}
ASSERT(destSurface);
gl::Error result = copy(source, sourceRect, destFormat, destOffset, destSurface);
SafeRelease(destSurface);
SafeRelease(source);
return result;
}
gl::Error Blit9::copyCube(const gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, GLenum target, GLint level)
{
gl::Error error = initialize();
if (error.isError())
{
return error;
}
const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
ASSERT(colorbuffer);
RenderTarget9 *renderTarget9 = nullptr;
error = colorbuffer->getRenderTarget(&renderTarget9);
if (error.isError())
{
return error;
}
ASSERT(renderTarget9);
IDirect3DSurface9 *source = renderTarget9->getSurface();
ASSERT(source);
IDirect3DSurface9 *destSurface = NULL;
TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
error = storage9->getSurfaceLevel(target, level, true, &destSurface);
if (error.isError())
{
SafeRelease(source);
return error;
}
ASSERT(destSurface);
gl::Error result = copy(source, sourceRect, destFormat, destOffset, destSurface);
SafeRelease(destSurface);
SafeRelease(source);
return result;
}
gl::Error Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, IDirect3DSurface9 *dest)
{
ASSERT(source != NULL && dest != NULL);
IDirect3DDevice9 *device = mRenderer->getDevice();
D3DSURFACE_DESC sourceDesc;
D3DSURFACE_DESC destDesc;
source->GetDesc(&sourceDesc);
dest->GetDesc(&destDesc);
if (sourceDesc.Format == destDesc.Format && destDesc.Usage & D3DUSAGE_RENDERTARGET &&
d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat)) // Can use StretchRect
{
RECT destRect = { destOffset.x, destOffset.y, destOffset.x + (sourceRect.right - sourceRect.left), destOffset.y + (sourceRect.bottom - sourceRect.top)};
HRESULT result = device->StretchRect(source, &sourceRect, dest, &destRect, D3DTEXF_POINT);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::Error(GL_OUT_OF_MEMORY, "Failed to blit between textures, StretchRect result: 0x%X.", result);
}
return gl::Error(GL_NO_ERROR);
}
else
{
return formatConvert(source, sourceRect, destFormat, destOffset, dest);
}
}
gl::Error Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, IDirect3DSurface9 *dest)
{
gl::Error error = initialize();
if (error.isError())
{
return error;
}
IDirect3DTexture9 *texture = NULL;
error = copySurfaceToTexture(source, sourceRect, &texture);
if (error.isError())
{
return error;
}
IDirect3DDevice9 *device = mRenderer->getDevice();
saveState();
device->SetTexture(0, texture);
device->SetRenderTarget(0, dest);
setViewport(sourceRect, destOffset);
setCommonBlitState();
error = setFormatConvertShaders(destFormat);
if (!error.isError())
{
render();
}
SafeRelease(texture);
restoreState();
return error;
}
gl::Error Blit9::setFormatConvertShaders(GLenum destFormat)
{
gl::Error error = setVertexShader(SHADER_VS_STANDARD);
if (error.isError())
{
return error;
}
switch (destFormat)
{
default: UNREACHABLE();
case GL_RGBA:
case GL_BGRA_EXT:
case GL_RGB:
case GL_RG_EXT:
case GL_RED_EXT:
case GL_ALPHA:
error = setPixelShader(SHADER_PS_COMPONENTMASK);
break;
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
error = setPixelShader(SHADER_PS_LUMINANCE);
break;
}
if (error.isError())
{
return error;
}
enum { X = 0, Y = 1, Z = 2, W = 3 };
// The meaning of this constant depends on the shader that was selected.
// See the shader assembly code above for details.
// Allocate one array for both registers and split it into two float4's.
float psConst[8] = { 0 };
float *multConst = &psConst[0];
float *addConst = &psConst[4];
switch (destFormat)
{
default: UNREACHABLE();
case GL_RGBA:
case GL_BGRA_EXT:
multConst[X] = 1;
multConst[Y] = 1;
multConst[Z] = 1;
multConst[W] = 1;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 0;
break;
case GL_RGB:
multConst[X] = 1;
multConst[Y] = 1;
multConst[Z] = 1;
multConst[W] = 0;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 1;
break;
case GL_RG_EXT:
multConst[X] = 1;
multConst[Y] = 1;
multConst[Z] = 0;
multConst[W] = 0;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 1;
break;
case GL_RED_EXT:
multConst[X] = 1;
multConst[Y] = 0;
multConst[Z] = 0;
multConst[W] = 0;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 1;
break;
case GL_ALPHA:
multConst[X] = 0;
multConst[Y] = 0;
multConst[Z] = 0;
multConst[W] = 1;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 0;
break;
case GL_LUMINANCE:
multConst[X] = 1;
multConst[Y] = 0;
multConst[Z] = 0;
multConst[W] = 0;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 1;
break;
case GL_LUMINANCE_ALPHA:
multConst[X] = 1;
multConst[Y] = 0;
multConst[Z] = 0;
multConst[W] = 1;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 0;
break;
}
mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2);
return gl::Error(GL_NO_ERROR);
}
gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect, IDirect3DTexture9 **outTexture)
{
ASSERT(surface);
IDirect3DDevice9 *device = mRenderer->getDevice();
D3DSURFACE_DESC sourceDesc;
surface->GetDesc(&sourceDesc);
// Copy the render target into a texture
IDirect3DTexture9 *texture;
HRESULT result = device->CreateTexture(sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1, D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, NULL);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::Error(GL_OUT_OF_MEMORY, "Failed to allocate internal texture for blit, result: 0x%X.", result);
}
IDirect3DSurface9 *textureSurface;
result = texture->GetSurfaceLevel(0, &textureSurface);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
SafeRelease(texture);
return gl::Error(GL_OUT_OF_MEMORY, "Failed to query surface of internal blit texture, result: 0x%X.", result);
}
mRenderer->endScene();
result = device->StretchRect(surface, &sourceRect, textureSurface, NULL, D3DTEXF_NONE);
SafeRelease(textureSurface);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
SafeRelease(texture);
return gl::Error(GL_OUT_OF_MEMORY, "Failed to copy between internal blit textures, result: 0x%X.", result);
}
*outTexture = texture;
return gl::Error(GL_NO_ERROR);
}
void Blit9::setViewport(const RECT &sourceRect, const gl::Offset &offset)
{
IDirect3DDevice9 *device = mRenderer->getDevice();
D3DVIEWPORT9 vp;
vp.X = offset.x;
vp.Y = offset.y;
vp.Width = sourceRect.right - sourceRect.left;
vp.Height = sourceRect.bottom - sourceRect.top;
vp.MinZ = 0.0f;
vp.MaxZ = 1.0f;
device->SetViewport(&vp);
float halfPixelAdjust[4] = { -1.0f/vp.Width, 1.0f/vp.Height, 0, 0 };
device->SetVertexShaderConstantF(0, halfPixelAdjust, 1);
}
void Blit9::setCommonBlitState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
device->SetDepthStencilSurface(NULL);
device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
device->SetSamplerState(0, D3DSAMP_SRGBTEXTURE, FALSE);
device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
RECT scissorRect = {0}; // Scissoring is disabled for flipping, but we need this to capture and restore the old rectangle
device->SetScissorRect(&scissorRect);
for(int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
device->SetStreamSourceFreq(i, 1);
}
}
void Blit9::render()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
HRESULT hr = device->SetStreamSource(0, mQuadVertexBuffer, 0, 2 * sizeof(float));
hr = device->SetVertexDeclaration(mQuadVertexDeclaration);
mRenderer->startScene();
hr = device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
void Blit9::saveState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
HRESULT hr;
device->GetDepthStencilSurface(&mSavedDepthStencil);
device->GetRenderTarget(0, &mSavedRenderTarget);
if (mSavedStateBlock == NULL)
{
hr = device->BeginStateBlock();
ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
setCommonBlitState();
static const float dummyConst[8] = { 0 };
device->SetVertexShader(NULL);
device->SetVertexShaderConstantF(0, dummyConst, 2);
device->SetPixelShader(NULL);
device->SetPixelShaderConstantF(0, dummyConst, 2);
D3DVIEWPORT9 dummyVp;
dummyVp.X = 0;
dummyVp.Y = 0;
dummyVp.Width = 1;
dummyVp.Height = 1;
dummyVp.MinZ = 0;
dummyVp.MaxZ = 1;
device->SetViewport(&dummyVp);
device->SetTexture(0, NULL);
device->SetStreamSource(0, mQuadVertexBuffer, 0, 0);
device->SetVertexDeclaration(mQuadVertexDeclaration);
hr = device->EndStateBlock(&mSavedStateBlock);
ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
}
ASSERT(mSavedStateBlock != NULL);
if (mSavedStateBlock != NULL)
{
hr = mSavedStateBlock->Capture();
ASSERT(SUCCEEDED(hr));
}
}
void Blit9::restoreState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
device->SetDepthStencilSurface(mSavedDepthStencil);
SafeRelease(mSavedDepthStencil);
device->SetRenderTarget(0, mSavedRenderTarget);
SafeRelease(mSavedRenderTarget);
ASSERT(mSavedStateBlock != NULL);
if (mSavedStateBlock != NULL)
{
mSavedStateBlock->Apply();
}
}
}
|