Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: src/gpu/GrXferProcessor.cpp

Issue 885923002: Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Back to bool Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrXferProcessor.cpp
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e98ae407a8458b993785c7a613e32817e86ead47
--- /dev/null
+++ b/src/gpu/GrXferProcessor.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrXferProcessor.h"
+#include "gl/GrGLCaps.h"
+
+GrXferProcessor::GrXferProcessor() : fWillReadDstColor(false), fDstCopyTextureOffset() {
+}
+
+GrXferProcessor::GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willReadDstColor)
+ : fWillReadDstColor(willReadDstColor)
+ , fDstCopyTextureOffset() {
+ if (dstCopy && dstCopy->texture()) {
+ fDstCopy.reset(dstCopy->texture());
+ fDstCopyTextureOffset = dstCopy->offset();
+ this->addTextureAccess(&fDstCopy);
+ }
+}
+
+void GrXferProcessor::getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
+ uint32_t key = this->willReadDstColor() ? 0x1 : 0x0;
+ if (this->getDstCopyTexture() &&
+ kTopLeft_GrSurfaceOrigin == this->getDstCopyTexture()->origin()) {
+ key |= 0x2;
+ }
+ b->add32(key);
+ this->onGetGLProcessorKey(caps, b);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI,
+ const GrDeviceCoordTexture* dstCopy,
+ const GrDrawTargetCaps& caps) const {
+#ifdef SK_DEBUG
+ if (this->willReadDstColor()) {
+ if (!caps.dstReadInShaderSupport()) {
+ SkASSERT(dstCopy && dstCopy->texture());
+ } else {
+ SkASSERT(!dstCopy || !dstCopy->texture());
+ }
+ } else {
+ SkASSERT(!dstCopy || !dstCopy->texture());
+
+ }
+#endif
+ return this->onCreateXferProcessor(colorPOI, coveragePOI, dstCopy);
+}
+
+bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps) const {
+ return (this->willReadDstColor() && !caps.dstReadInShaderSupport());
+}
+
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698