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 #include "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 | 10 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 379 } |
380 | 380 |
381 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, | 381 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, |
382 const GrProcOptInfo& colorPOI, | 382 const GrProcOptInfo& colorPOI, |
383 const GrProcOptInfo& coveragePOI, | 383 const GrProcOptInfo& coveragePOI, |
384 GrDeviceCoordTexture* dstCopy, | 384 GrDeviceCoordTexture* dstCopy, |
385 const SkRect* drawBounds) { | 385 const SkRect* drawBounds) { |
386 if (!pipelineBuilder.willXPNeedDstCopy(*this->caps(), colorPOI, coveragePOI)
) { | 386 if (!pipelineBuilder.willXPNeedDstCopy(*this->caps(), colorPOI, coveragePOI)
) { |
387 return true; | 387 return true; |
388 } | 388 } |
| 389 |
| 390 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
| 391 |
| 392 if (this->caps()->textureBarrierSupport()) { |
| 393 if (GrTexture* rtTex = rt->asTexture()) { |
| 394 // The render target is a texture, se we can read from it directly i
n the shader. The XP |
| 395 // will be responsible to detect this situation and request a textur
e barrier. |
| 396 dstCopy->setTexture(rtTex); |
| 397 dstCopy->setOffset(0, 0); |
| 398 return true; |
| 399 } |
| 400 } |
| 401 |
389 SkIRect copyRect; | 402 SkIRect copyRect; |
390 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | |
391 pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); | 403 pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); |
392 | 404 |
393 if (drawBounds) { | 405 if (drawBounds) { |
394 SkIRect drawIBounds; | 406 SkIRect drawIBounds; |
395 drawBounds->roundOut(&drawIBounds); | 407 drawBounds->roundOut(&drawIBounds); |
396 if (!copyRect.intersect(drawIBounds)) { | 408 if (!copyRect.intersect(drawIBounds)) { |
397 #ifdef SK_DEBUG | 409 #ifdef SK_DEBUG |
398 SkDebugf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); | 410 SkDebugf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); |
399 #endif | 411 #endif |
400 return false; | 412 return false; |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 fDstReadInShaderSupport = false; | 1072 fDstReadInShaderSupport = false; |
1061 fDiscardRenderTargetSupport = false; | 1073 fDiscardRenderTargetSupport = false; |
1062 fReuseScratchTextures = true; | 1074 fReuseScratchTextures = true; |
1063 fGpuTracingSupport = false; | 1075 fGpuTracingSupport = false; |
1064 fCompressedTexSubImageSupport = false; | 1076 fCompressedTexSubImageSupport = false; |
1065 fOversizedStencilSupport = false; | 1077 fOversizedStencilSupport = false; |
1066 fTextureBarrierSupport = false; | 1078 fTextureBarrierSupport = false; |
1067 | 1079 |
1068 fUseDrawInsteadOfClear = false; | 1080 fUseDrawInsteadOfClear = false; |
1069 | 1081 |
| 1082 fBlendEquationSupport = kBasic_BlendEquationSupport; |
1070 fMapBufferFlags = kNone_MapFlags; | 1083 fMapBufferFlags = kNone_MapFlags; |
1071 | 1084 |
1072 fMaxRenderTargetSize = 0; | 1085 fMaxRenderTargetSize = 0; |
1073 fMaxTextureSize = 0; | 1086 fMaxTextureSize = 0; |
1074 fMaxSampleCount = 0; | 1087 fMaxSampleCount = 0; |
1075 | 1088 |
1076 fShaderPrecisionVaries = false; | 1089 fShaderPrecisionVaries = false; |
1077 | 1090 |
1078 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); | 1091 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); |
1079 memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport)); | 1092 memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport)); |
(...skipping 11 matching lines...) Expand all Loading... |
1091 fDstReadInShaderSupport = other.fDstReadInShaderSupport; | 1104 fDstReadInShaderSupport = other.fDstReadInShaderSupport; |
1092 fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport; | 1105 fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport; |
1093 fReuseScratchTextures = other.fReuseScratchTextures; | 1106 fReuseScratchTextures = other.fReuseScratchTextures; |
1094 fGpuTracingSupport = other.fGpuTracingSupport; | 1107 fGpuTracingSupport = other.fGpuTracingSupport; |
1095 fCompressedTexSubImageSupport = other.fCompressedTexSubImageSupport; | 1108 fCompressedTexSubImageSupport = other.fCompressedTexSubImageSupport; |
1096 fOversizedStencilSupport = other.fOversizedStencilSupport; | 1109 fOversizedStencilSupport = other.fOversizedStencilSupport; |
1097 fTextureBarrierSupport = other.fTextureBarrierSupport; | 1110 fTextureBarrierSupport = other.fTextureBarrierSupport; |
1098 | 1111 |
1099 fUseDrawInsteadOfClear = other.fUseDrawInsteadOfClear; | 1112 fUseDrawInsteadOfClear = other.fUseDrawInsteadOfClear; |
1100 | 1113 |
| 1114 fBlendEquationSupport = other.fBlendEquationSupport; |
1101 fMapBufferFlags = other.fMapBufferFlags; | 1115 fMapBufferFlags = other.fMapBufferFlags; |
1102 | 1116 |
1103 fMaxRenderTargetSize = other.fMaxRenderTargetSize; | 1117 fMaxRenderTargetSize = other.fMaxRenderTargetSize; |
1104 fMaxTextureSize = other.fMaxTextureSize; | 1118 fMaxTextureSize = other.fMaxTextureSize; |
1105 fMaxSampleCount = other.fMaxSampleCount; | 1119 fMaxSampleCount = other.fMaxSampleCount; |
1106 | 1120 |
1107 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende
rSupport)); | 1121 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende
rSupport)); |
1108 memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTex
tureSupport)); | 1122 memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTex
tureSupport)); |
1109 | 1123 |
1110 fShaderPrecisionVaries = other.fShaderPrecisionVaries; | 1124 fShaderPrecisionVaries = other.fShaderPrecisionVaries; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSuppor
t]); | 1191 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSuppor
t]); |
1178 r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSub
ImageSupport]); | 1192 r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSub
ImageSupport]); |
1179 r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencil
Support]); | 1193 r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencil
Support]); |
1180 r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSu
pport]); | 1194 r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSu
pport]); |
1181 r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOf
Clear]); | 1195 r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOf
Clear]); |
1182 | 1196 |
1183 r.appendf("Max Texture Size : %d\n", fMaxTextureSize); | 1197 r.appendf("Max Texture Size : %d\n", fMaxTextureSize); |
1184 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize)
; | 1198 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize)
; |
1185 r.appendf("Max Sample Count : %d\n", fMaxSampleCount); | 1199 r.appendf("Max Sample Count : %d\n", fMaxSampleCount); |
1186 | 1200 |
| 1201 static const char* kBlendEquationSupportNames[] = { |
| 1202 "Basic", |
| 1203 "Advanced", |
| 1204 "Advanced Coherent", |
| 1205 }; |
| 1206 GR_STATIC_ASSERT(0 == kBasic_BlendEquationSupport); |
| 1207 GR_STATIC_ASSERT(1 == kAdvanced_BlendEquationSupport); |
| 1208 GR_STATIC_ASSERT(2 == kAdvancedCoherent_BlendEquationSupport); |
| 1209 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kBlendEquationSupportNames) == kLast_BlendEq
uationSupport + 1); |
| 1210 |
| 1211 r.appendf("Blend Equation Support : %s\n", |
| 1212 kBlendEquationSupportNames[fBlendEquationSupport]); |
1187 r.appendf("Map Buffer Support : %s\n", | 1213 r.appendf("Map Buffer Support : %s\n", |
1188 map_flags_to_string(fMapBufferFlags).c_str()); | 1214 map_flags_to_string(fMapBufferFlags).c_str()); |
1189 | 1215 |
1190 static const char* kConfigNames[] = { | 1216 static const char* kConfigNames[] = { |
1191 "Unknown", // kUnknown_GrPixelConfig | 1217 "Unknown", // kUnknown_GrPixelConfig |
1192 "Alpha8", // kAlpha_8_GrPixelConfig, | 1218 "Alpha8", // kAlpha_8_GrPixelConfig, |
1193 "Index8", // kIndex_8_GrPixelConfig, | 1219 "Index8", // kIndex_8_GrPixelConfig, |
1194 "RGB565", // kRGB_565_GrPixelConfig, | 1220 "RGB565", // kRGB_565_GrPixelConfig, |
1195 "RGBA444", // kRGBA_4444_GrPixelConfig, | 1221 "RGBA444", // kRGBA_4444_GrPixelConfig, |
1196 "RGBA8888", // kRGBA_8888_GrPixelConfig, | 1222 "RGBA8888", // kRGBA_8888_GrPixelConfig, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, | 1289 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, |
1264 GrPipelineBuilder::AutoRestoreStencil* ars, | 1290 GrPipelineBuilder::AutoRestoreStencil* ars, |
1265 GrScissorState* scissorState, | 1291 GrScissorState* scissorState, |
1266 const SkRect* devBounds) { | 1292 const SkRect* devBounds) { |
1267 return fClipMaskManager.setupClipping(pipelineBuilder, | 1293 return fClipMaskManager.setupClipping(pipelineBuilder, |
1268 arfp, | 1294 arfp, |
1269 ars, | 1295 ars, |
1270 scissorState, | 1296 scissorState, |
1271 devBounds); | 1297 devBounds); |
1272 } | 1298 } |
OLD | NEW |