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

Side by Side Diff: src/gpu/gl/GrGLProgramDesc.cpp

Issue 14633007: Key shader on whether frag pos read is relative to top-left or bottom-left (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.h ('k') | src/gpu/gl/GrGLShaderBuilder.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 7
8 #include "GrGLProgramDesc.h" 8 #include "GrGLProgramDesc.h"
9 #include "GrBackendEffectFactory.h" 9 #include "GrBackendEffectFactory.h"
10 #include "GrDrawEffect.h" 10 #include "GrDrawEffect.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 desc->fCoverageInput = kTransBlack_ColorInput; 69 desc->fCoverageInput = kTransBlack_ColorInput;
70 } else if (covIsSolidWhite) { 70 } else if (covIsSolidWhite) {
71 desc->fCoverageInput = kSolidWhite_ColorInput; 71 desc->fCoverageInput = kSolidWhite_ColorInput;
72 } else if (GR_GL_NO_CONSTANT_ATTRIBUTES && !requiresCoverageAttrib) { 72 } else if (GR_GL_NO_CONSTANT_ATTRIBUTES && !requiresCoverageAttrib) {
73 desc->fCoverageInput = kUniform_ColorInput; 73 desc->fCoverageInput = kUniform_ColorInput;
74 } else { 74 } else {
75 desc->fCoverageInput = kAttribute_ColorInput; 75 desc->fCoverageInput = kAttribute_ColorInput;
76 } 76 }
77 77
78 bool readsDst = false; 78 bool readsDst = false;
79 bool readFragPosition = false;
79 int lastEnabledStage = -1; 80 int lastEnabledStage = -1;
80 81
81 for (int s = 0; s < GrDrawState::kNumStages; ++s) { 82 for (int s = 0; s < GrDrawState::kNumStages; ++s) {
82 83
83 bool skip = s < drawState.getFirstCoverageStage() ? skipColor : skipCove rage; 84 bool skip = s < drawState.getFirstCoverageStage() ? skipColor : skipCove rage;
84 if (!skip && drawState.isStageEnabled(s)) { 85 if (!skip && drawState.isStageEnabled(s)) {
85 lastEnabledStage = s; 86 lastEnabledStage = s;
86 const GrEffectRef& effect = *drawState.getStage(s).getEffect(); 87 const GrEffectRef& effect = *drawState.getStage(s).getEffect();
87 const GrBackendEffectFactory& factory = effect->getFactory(); 88 const GrBackendEffectFactory& factory = effect->getFactory();
88 GrDrawEffect drawEffect(drawState.getStage(s), requiresLocalCoordAtt rib); 89 GrDrawEffect drawEffect(drawState.getStage(s), requiresLocalCoordAtt rib);
89 desc->fEffectKeys[s] = factory.glEffectKey(drawEffect, gpu->glCaps() ); 90 desc->fEffectKeys[s] = factory.glEffectKey(drawEffect, gpu->glCaps() );
90 if (effect->willReadDstColor()) { 91 if (effect->willReadDstColor()) {
91 readsDst = true; 92 readsDst = true;
92 } 93 }
94 if (effect->willReadFragmentPosition()) {
95 readFragPosition = true;
96 }
93 } else { 97 } else {
94 desc->fEffectKeys[s] = 0; 98 desc->fEffectKeys[s] = 0;
95 } 99 }
96 } 100 }
97 101
98 if (readsDst) { 102 if (readsDst) {
99 GrAssert(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport()); 103 GrAssert(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport());
100 const GrTexture* dstCopyTexture = NULL; 104 const GrTexture* dstCopyTexture = NULL;
101 if (NULL != dstCopy) { 105 if (NULL != dstCopy) {
102 dstCopyTexture = dstCopy->texture(); 106 dstCopyTexture = dstCopy->texture();
103 } 107 }
104 desc->fDstRead = GrGLShaderBuilder::KeyForDstRead(dstCopyTexture, gpu->g lCaps()); 108 desc->fDstReadKey = GrGLShaderBuilder::KeyForDstRead(dstCopyTexture, gpu ->glCaps());
105 GrAssert(0 != desc->fDstRead); 109 GrAssert(0 != desc->fDstReadKey);
106 } else { 110 } else {
107 desc->fDstRead = 0; 111 desc->fDstReadKey = 0;
112 }
113
114 if (readFragPosition) {
115 desc->fFragPosKey = GrGLShaderBuilder::KeyForFragmentPosition(drawState. getRenderTarget(),
116 gpu->glCap s());
117 } else {
118 desc->fFragPosKey = 0;
108 } 119 }
109 120
110 desc->fCoverageOutput = kModulate_CoverageOutput; 121 desc->fCoverageOutput = kModulate_CoverageOutput;
111 122
112 // Currently the experimental GS will only work with triangle prims (and it doesn't do anything 123 // Currently the experimental GS will only work with triangle prims (and it doesn't do anything
113 // other than pass through values from the VS to the FS anyway). 124 // other than pass through values from the VS to the FS anyway).
114 #if GR_GL_EXPERIMENTAL_GS 125 #if GR_GL_EXPERIMENTAL_GS
115 #if 0 126 #if 0
116 desc->fExperimentalGS = gpu->caps().geometryShaderSupport(); 127 desc->fExperimentalGS = gpu->caps().geometryShaderSupport();
117 #else 128 #else
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 202
192 if (requiresCoverageAttrib) { 203 if (requiresCoverageAttrib) {
193 desc->fCoverageAttributeIndex = drawState.coverageVertexAttributeIndex() ; 204 desc->fCoverageAttributeIndex = drawState.coverageVertexAttributeIndex() ;
194 } else if (GrGLProgramDesc::kAttribute_ColorInput == desc->fCoverageInput) { 205 } else if (GrGLProgramDesc::kAttribute_ColorInput == desc->fCoverageInput) {
195 GrAssert(availableAttributeIndex < GrDrawState::kMaxVertexAttribCnt); 206 GrAssert(availableAttributeIndex < GrDrawState::kMaxVertexAttribCnt);
196 desc->fCoverageAttributeIndex = availableAttributeIndex; 207 desc->fCoverageAttributeIndex = availableAttributeIndex;
197 } else { 208 } else {
198 desc->fCoverageAttributeIndex = -1; 209 desc->fCoverageAttributeIndex = -1;
199 } 210 }
200 } 211 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.h ('k') | src/gpu/gl/GrGLShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698