OLD | NEW |
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" |
11 #include "GrPipeline.h" | 11 #include "GrPipeline.h" |
| 12 #include "GrRenderTargetPriv.h" |
12 #include "GrVkGpu.h" | 13 #include "GrVkGpu.h" |
13 #include "GrVkUtil.h" | 14 #include "GrVkUtil.h" |
14 #include "SkChecksum.h" | 15 #include "SkChecksum.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 #include "shaderc/shaderc.h" | 20 #include "shaderc/shaderc.h" |
20 | 21 |
21 static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc, | 22 static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 requiredFeatures |= xp.requiredFeatures(); | 128 requiredFeatures |= xp.requiredFeatures(); |
128 | 129 |
129 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- | 130 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- |
130 // Because header is a pointer into the dynamic array, we can't push any new
data into the key | 131 // Because header is a pointer into the dynamic array, we can't push any new
data into the key |
131 // below here. | 132 // below here. |
132 KeyHeader* header = vkDesc->atOffset<KeyHeader, kHeaderOffset>(); | 133 KeyHeader* header = vkDesc->atOffset<KeyHeader, kHeaderOffset>(); |
133 | 134 |
134 // make sure any padding in the header is zeroed. | 135 // make sure any padding in the header is zeroed. |
135 memset(header, 0, kHeaderSize); | 136 memset(header, 0, kHeaderSize); |
136 | 137 |
137 if (requiredFeatures & GrProcessor::kFragmentPosition_RequiredFeature) { | 138 GrRenderTarget* rt = pipeline.getRenderTarget(); |
138 header->fFragPosKey = | 139 |
139 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRend
erTarget()); | 140 if (requiredFeatures & (GrProcessor::kFragmentPosition_RequiredFeature | |
| 141 GrProcessor::kSampleLocations_RequiredFeature)) { |
| 142 header->fSurfaceOriginKey = GrGLSLFragmentShaderBuilder::KeyForSurfaceOr
igin(rt->origin()); |
140 } else { | 143 } else { |
141 header->fFragPosKey = 0; | 144 header->fSurfaceOriginKey = 0; |
142 } | 145 } |
143 | 146 |
144 header->fOutputSwizzle = | 147 if (requiredFeatures & GrProcessor::kSampleLocations_RequiredFeature) { |
145 glslCaps.configOutputSwizzle(pipeline.getRenderTarget()->config()).asKey
(); | 148 SkASSERT(pipeline.isHWAntialiasState()); |
| 149 header->fSamplePatternKey = |
| 150 rt->renderTargetPriv().getMultisampleSpecs(pipeline.getStencil()).fU
niqueID; |
| 151 } else { |
| 152 header->fSamplePatternKey = 0; |
| 153 } |
| 154 |
| 155 header->fOutputSwizzle = glslCaps.configOutputSwizzle(rt->config()).asKey(); |
146 | 156 |
147 if (pipeline.ignoresCoverage()) { | 157 if (pipeline.ignoresCoverage()) { |
148 header->fIgnoresCoverage = 1; | 158 header->fIgnoresCoverage = 1; |
149 } else { | 159 } else { |
150 header->fIgnoresCoverage = 0; | 160 header->fIgnoresCoverage = 0; |
151 } | 161 } |
152 | 162 |
153 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); | 163 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); |
154 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); | 164 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); |
155 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); | 165 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); |
156 vkDesc->finalize(); | 166 vkDesc->finalize(); |
157 return true; | 167 return true; |
158 } | 168 } |
OLD | NEW |