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

Side by Side Diff: src/gpu/gl/GrGLProgramDesc.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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.h ('k') | src/gpu/gl/GrGLXferProcessor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "GrGLProgramDesc.h" 7 #include "GrGLProgramDesc.h"
8 8
9 #include "GrGLProcessor.h" 9 #include "GrGLProcessor.h"
10 #include "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 uint32_t* key = b->add32n(2); 83 uint32_t* key = b->add32n(2);
84 key[0] = (textureKey << 16 | transformKey); 84 key[0] = (textureKey << 16 | transformKey);
85 key[1] = (classID << 16 | SkToU16(processorKeySize)); 85 key[1] = (classID << 16 | SkToU16(processorKeySize));
86 return true; 86 return true;
87 } 87 }
88 88
89 bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc, 89 bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc,
90 const GrPrimitiveProcessor& primProc, 90 const GrPrimitiveProcessor& primProc,
91 const GrPipeline& pipeline, 91 const GrPipeline& pipeline,
92 const GrProgramDesc::DescInfo& descInfo,
93 const GrGLGpu* gpu, 92 const GrGLGpu* gpu,
94 const GrBatchTracker& batchTracker) { 93 const GrBatchTracker& batchTracker) {
95 // The descriptor is used as a cache key. Thus when a field of the 94 // The descriptor is used as a cache key. Thus when a field of the
96 // descriptor will not affect program generation (because of the attribute 95 // descriptor will not affect program generation (because of the attribute
97 // bindings in use or other descriptor field settings) it should be set 96 // bindings in use or other descriptor field settings) it should be set
98 // to a canonical value to avoid duplicate programs with different keys. 97 // to a canonical value to avoid duplicate programs with different keys.
99 98
100 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t)); 99 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
101 // Make room for everything up to the effect keys. 100 // Make room for everything up to the effect keys.
102 desc->fKey.reset(); 101 desc->fKey.reset();
(...skipping 25 matching lines...) Expand all
128 } 127 }
129 128
130 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- ------------------- 129 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- -------------------
131 // Because header is a pointer into the dynamic array, we can't push any new data into the key 130 // Because header is a pointer into the dynamic array, we can't push any new data into the key
132 // below here. 131 // below here.
133 KeyHeader* header = desc->atOffset<KeyHeader, kHeaderOffset>(); 132 KeyHeader* header = desc->atOffset<KeyHeader, kHeaderOffset>();
134 133
135 // make sure any padding in the header is zeroed. 134 // make sure any padding in the header is zeroed.
136 memset(header, 0, kHeaderSize); 135 memset(header, 0, kHeaderSize);
137 136
138 if (descInfo.fReadsDst) { 137 if (pipeline.readsFragPosition()) {
139 const GrDeviceCoordTexture* dstCopy = pipeline.getDstCopy();
140 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport());
141 const GrTexture* dstCopyTexture = NULL;
142 if (dstCopy) {
143 dstCopyTexture = dstCopy->texture();
144 }
145 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe xture,
146 gpu->glCa ps());
147 SkASSERT(0 != header->fDstReadKey);
148 } else {
149 header->fDstReadKey = 0;
150 }
151
152 if (descInfo.fReadsFragPosition) {
153 header->fFragPosKey = 138 header->fFragPosKey =
154 GrGLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRe nderTarget(), 139 GrGLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRe nderTarget(),
155 gpu->glCaps()) ; 140 gpu->glCaps()) ;
156 } else { 141 } else {
157 header->fFragPosKey = 0; 142 header->fFragPosKey = 0;
158 } 143 }
159 144
160 header->fColorEffectCnt = pipeline.numColorStages(); 145 header->fColorEffectCnt = pipeline.numColorStages();
161 header->fCoverageEffectCnt = pipeline.numCoverageStages(); 146 header->fCoverageEffectCnt = pipeline.numCoverageStages();
162 desc->finalize(); 147 desc->finalize();
163 return true; 148 return true;
164 } 149 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.h ('k') | src/gpu/gl/GrGLXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698