OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 return false; | 404 return false; |
405 } | 405 } |
406 return true; | 406 return true; |
407 } | 407 } |
408 | 408 |
409 bool GrDrawTarget::setupDstReadIfNecessary(DrawInfo* info) { | 409 bool GrDrawTarget::setupDstReadIfNecessary(DrawInfo* info) { |
410 if (!this->getDrawState().willEffectReadDst()) { | 410 if (!this->getDrawState().willEffectReadDst()) { |
411 return true; | 411 return true; |
412 } | 412 } |
413 GrRenderTarget* rt = this->drawState()->getRenderTarget(); | 413 GrRenderTarget* rt = this->drawState()->getRenderTarget(); |
414 // If the dst is not a texture then we don't currently have a way of copying
the | |
415 // texture. TODO: API-specific impl of onCopySurface that can handle more ca
ses. | |
416 if (NULL == rt->asTexture()) { | |
417 GrPrintf("Reading Dst of non-texture render target is not currently supp
orted.\n"); | |
418 return false; | |
419 } | |
420 | 414 |
421 const GrClipData* clip = this->getClip(); | 415 const GrClipData* clip = this->getClip(); |
422 GrIRect copyRect; | 416 GrIRect copyRect; |
423 clip->getConservativeBounds(this->getDrawState().getRenderTarget(), ©Rec
t); | 417 clip->getConservativeBounds(this->getDrawState().getRenderTarget(), ©Rec
t); |
424 SkIRect drawIBounds; | 418 SkIRect drawIBounds; |
425 if (info->getDevIBounds(&drawIBounds)) { | 419 if (info->getDevIBounds(&drawIBounds)) { |
426 if (!copyRect.intersect(drawIBounds)) { | 420 if (!copyRect.intersect(drawIBounds)) { |
427 #if GR_DEBUG | 421 #if GR_DEBUG |
428 GrPrintf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); | 422 GrPrintf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); |
429 #endif | 423 #endif |
430 return false; | 424 return false; |
431 } | 425 } |
432 } else { | 426 } else { |
433 #if GR_DEBUG | 427 #if GR_DEBUG |
434 //GrPrintf("No dev bounds when dst copy is made.\n"); | 428 //GrPrintf("No dev bounds when dst copy is made.\n"); |
435 #endif | 429 #endif |
436 } | 430 } |
437 | 431 |
438 // The draw will resolve dst if it has MSAA. Two things to consider in the f
uture: | 432 // MSAA consideration: When there is support for reading MSAA samples in the
shader we could |
439 // 1) to make the dst values be pre-resolve we'd need to be able to copy to
MSAA | 433 // have per-sample dst values by making the copy multisampled. |
440 // texture and sample it correctly in the shader. 2) If 1 isn't available th
en we | |
441 // should just resolve and use the resolved texture directly rather than mak
ing a | |
442 // copy of it. | |
443 GrTextureDesc desc; | 434 GrTextureDesc desc; |
444 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 435 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
445 desc.fWidth = copyRect.width(); | 436 desc.fWidth = copyRect.width(); |
446 desc.fHeight = copyRect.height(); | 437 desc.fHeight = copyRect.height(); |
447 desc.fSampleCnt = 0; | 438 desc.fSampleCnt = 0; |
448 desc.fConfig = rt->config(); | 439 desc.fConfig = rt->config(); |
449 | 440 |
450 GrAutoScratchTexture ast(fContext, desc, GrContext::kApprox_ScratchTexMatch)
; | 441 GrAutoScratchTexture ast(fContext, desc, GrContext::kApprox_ScratchTexMatch)
; |
451 | 442 |
452 if (NULL == ast.texture()) { | 443 if (NULL == ast.texture()) { |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); | 930 GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); |
940 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); | 931 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); |
941 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); | 932 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); |
942 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); | 933 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); |
943 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); | 934 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); |
944 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); | 935 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); |
945 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); | 936 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); |
946 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); | 937 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); |
947 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); | 938 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); |
948 } | 939 } |
OLD | NEW |