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

Side by Side Diff: src/gpu/vk/GrVkProgramDesc.cpp

Issue 1734163002: Replace fWillReadFragmentPosition with a bitfield (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: BuiltInState -> RequiredFeatures 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/glsl/GrGLSLProgramBuilder.cpp ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 "GrVkProgramDesc.h" 7 #include "GrVkProgramDesc.h"
8 8
9 //#include "GrVkProcessor.h" 9 //#include "GrVkProcessor.h"
10 #include "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 vkDesc->key().reset(); 100 vkDesc->key().reset();
101 vkDesc->key().push_back_n(kProcessorKeysOffset); 101 vkDesc->key().push_back_n(kProcessorKeysOffset);
102 102
103 GrProcessorKeyBuilder b(&vkDesc->key()); 103 GrProcessorKeyBuilder b(&vkDesc->key());
104 104
105 primProc.getGLSLProcessorKey(glslCaps, &b); 105 primProc.getGLSLProcessorKey(glslCaps, &b);
106 if (!gen_meta_key(primProc, glslCaps, 0, &b)) { 106 if (!gen_meta_key(primProc, glslCaps, 0, &b)) {
107 vkDesc->key().reset(); 107 vkDesc->key().reset();
108 return false; 108 return false;
109 } 109 }
110 GrProcessor::RequiredFeatures requiredFeatures = primProc.requiredFeatures() ;
110 111
111 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) { 112 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
112 const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i); 113 const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i);
113 if (!gen_frag_proc_and_meta_keys(primProc, fp, glslCaps, &b)) { 114 if (!gen_frag_proc_and_meta_keys(primProc, fp, glslCaps, &b)) {
114 vkDesc->key().reset(); 115 vkDesc->key().reset();
115 return false; 116 return false;
116 } 117 }
118 requiredFeatures |= fp.requiredFeatures();
117 } 119 }
118 120
119 const GrXferProcessor& xp = pipeline.getXferProcessor(); 121 const GrXferProcessor& xp = pipeline.getXferProcessor();
120 xp.getGLSLProcessorKey(glslCaps, &b); 122 xp.getGLSLProcessorKey(glslCaps, &b);
121 if (!gen_meta_key(xp, glslCaps, 0, &b)) { 123 if (!gen_meta_key(xp, glslCaps, 0, &b)) {
122 vkDesc->key().reset(); 124 vkDesc->key().reset();
123 return false; 125 return false;
124 } 126 }
127 requiredFeatures |= xp.requiredFeatures();
125 128
126 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- ------------------- 129 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- -------------------
127 // 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
128 // below here. 131 // below here.
129 KeyHeader* header = vkDesc->atOffset<KeyHeader, kHeaderOffset>(); 132 KeyHeader* header = vkDesc->atOffset<KeyHeader, kHeaderOffset>();
130 133
131 // make sure any padding in the header is zeroed. 134 // make sure any padding in the header is zeroed.
132 memset(header, 0, kHeaderSize); 135 memset(header, 0, kHeaderSize);
133 136
134 if (pipeline.readsFragPosition()) { 137 if (requiredFeatures & GrProcessor::kFragmentPosition_RequiredFeature) {
135 header->fFragPosKey = 138 header->fFragPosKey =
136 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRend erTarget()); 139 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRend erTarget());
137 } else { 140 } else {
138 header->fFragPosKey = 0; 141 header->fFragPosKey = 0;
139 } 142 }
140 143
141 header->fOutputSwizzle = 144 header->fOutputSwizzle =
142 glslCaps.configOutputSwizzle(pipeline.getRenderTarget()->config()).asKey (); 145 glslCaps.configOutputSwizzle(pipeline.getRenderTarget()->config()).asKey ();
143 146
144 if (pipeline.ignoresCoverage()) { 147 if (pipeline.ignoresCoverage()) {
145 header->fIgnoresCoverage = 1; 148 header->fIgnoresCoverage = 1;
146 } else { 149 } else {
147 header->fIgnoresCoverage = 0; 150 header->fIgnoresCoverage = 0;
148 } 151 }
149 152
150 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); 153 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
151 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); 154 header->fColorEffectCnt = pipeline.numColorFragmentProcessors();
152 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); 155 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors();
153 vkDesc->finalize(); 156 vkDesc->finalize();
154 return true; 157 return true;
155 } 158 }
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLProgramBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698