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

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

Issue 1717393002: Add "sample locations" feature to GrProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_getmultisamp
Patch Set: vk stubs Created 4 years, 9 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/GrGLGpu.cpp ('k') | src/gpu/glsl/GrGLSLFragmentShaderBuilder.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 "GrProcessor.h" 9 #include "GrProcessor.h"
10 #include "GrPipeline.h" 10 #include "GrPipeline.h"
11 #include "GrRenderTargetPriv.h"
11 #include "SkChecksum.h" 12 #include "SkChecksum.h"
12 #include "gl/GrGLDefines.h" 13 #include "gl/GrGLDefines.h"
13 #include "gl/GrGLTexture.h" 14 #include "gl/GrGLTexture.h"
14 #include "gl/GrGLTypes.h" 15 #include "gl/GrGLTypes.h"
15 #include "glsl/GrGLSLFragmentProcessor.h" 16 #include "glsl/GrGLSLFragmentProcessor.h"
16 #include "glsl/GrGLSLFragmentShaderBuilder.h" 17 #include "glsl/GrGLSLFragmentShaderBuilder.h"
17 #include "glsl/GrGLSLCaps.h" 18 #include "glsl/GrGLSLCaps.h"
18 19
19 static uint8_t texture_target_key(GrGLenum target) { 20 static uint8_t texture_target_key(GrGLenum target) {
20 switch (target) { 21 switch (target) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 requiredFeatures |= xp.requiredFeatures(); 141 requiredFeatures |= xp.requiredFeatures();
141 142
142 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- ------------------- 143 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- -------------------
143 // Because header is a pointer into the dynamic array, we can't push any new data into the key 144 // Because header is a pointer into the dynamic array, we can't push any new data into the key
144 // below here. 145 // below here.
145 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>(); 146 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>();
146 147
147 // make sure any padding in the header is zeroed. 148 // make sure any padding in the header is zeroed.
148 memset(header, 0, kHeaderSize); 149 memset(header, 0, kHeaderSize);
149 150
150 if (requiredFeatures & GrProcessor::kFragmentPosition_RequiredFeature) { 151 GrRenderTarget* rt = pipeline.getRenderTarget();
151 header->fFragPosKey = 152
152 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.get RenderTarget()); 153 if (requiredFeatures & (GrProcessor::kFragmentPosition_RequiredFeature |
154 GrProcessor::kSampleLocations_RequiredFeature)) {
155 header->fSurfaceOriginKey = GrGLSLFragmentShaderBuilder::KeyForSurfaceOr igin(rt->origin());
153 } else { 156 } else {
154 header->fFragPosKey = 0; 157 header->fSurfaceOriginKey = 0;
155 } 158 }
156 159
157 header->fOutputSwizzle = 160 if (requiredFeatures & GrProcessor::kSampleLocations_RequiredFeature) {
158 glslCaps.configOutputSwizzle(pipeline.getRenderTarget()->config()).asKey (); 161 SkASSERT(pipeline.isHWAntialiasState());
162 header->fSamplePatternKey =
163 rt->renderTargetPriv().getMultisampleSpecs(pipeline.getStencil()).fU niqueID;
164 } else {
165 header->fSamplePatternKey = 0;
166 }
167
168 header->fOutputSwizzle = glslCaps.configOutputSwizzle(rt->config()).asKey();
159 169
160 if (pipeline.ignoresCoverage()) { 170 if (pipeline.ignoresCoverage()) {
161 header->fIgnoresCoverage = 1; 171 header->fIgnoresCoverage = 1;
162 } else { 172 } else {
163 header->fIgnoresCoverage = 0; 173 header->fIgnoresCoverage = 0;
164 } 174 }
165 175
166 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); 176 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
167 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); 177 header->fColorEffectCnt = pipeline.numColorFragmentProcessors();
168 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); 178 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors();
169 glDesc->finalize(); 179 glDesc->finalize();
170 return true; 180 return true;
171 } 181 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/glsl/GrGLSLFragmentShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698