| 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 "GrRenderTargetPriv.h" |
| 13 #include "GrVkGpu.h" | 13 #include "GrVkGpu.h" |
| 14 #include "GrVkUtil.h" | 14 #include "GrVkUtil.h" |
| 15 #include "SkChecksum.h" | 15 #include "SkChecksum.h" |
| 16 #include "glsl/GrGLSLFragmentProcessor.h" | 16 #include "glsl/GrGLSLFragmentProcessor.h" |
| 17 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 17 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 18 #include "glsl/GrGLSLCaps.h" | 18 #include "glsl/GrGLSLCaps.h" |
| 19 | 19 |
| 20 #include "shaderc/shaderc.h" | 20 #include "shaderc/shaderc.h" |
| 21 | 21 |
| 22 static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc, | 22 static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc, |
| 23 const GrGLSLCaps& caps) { | 23 const GrGLSLCaps& caps) { |
| 24 int numTextures = proc.numTextures(); | 24 int numTextures = proc.numTextures(); |
| 25 SkASSERT(0 == proc.numBuffers()); |
| 25 // Need two bytes per key (swizzle, sampler type, and precision). | 26 // Need two bytes per key (swizzle, sampler type, and precision). |
| 26 int word32Count = (proc.numTextures() + 1) / 2; | 27 int word32Count = (proc.numTextures() + 1) / 2; |
| 27 if (0 == word32Count) { | 28 if (0 == word32Count) { |
| 28 return; | 29 return; |
| 29 } | 30 } |
| 30 uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count)); | 31 uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count)); |
| 31 for (int i = 0; i < numTextures; ++i) { | 32 for (int i = 0; i < numTextures; ++i) { |
| 32 const GrTextureAccess& access = proc.textureAccess(i); | 33 const GrTextureAccess& access = proc.textureAccess(i); |
| 33 GrTexture* texture = access.getTexture(); | 34 GrTexture* texture = access.getTexture(); |
| 34 k16[i] = SkToU16(caps.configTextureSwizzle(texture->config()).asKey() | | 35 k16[i] = SkToU16(caps.configTextureSwizzle(texture->config()).asKey() | |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } else { | 161 } else { |
| 161 header->fIgnoresCoverage = 0; | 162 header->fIgnoresCoverage = 0; |
| 162 } | 163 } |
| 163 | 164 |
| 164 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); | 165 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); |
| 165 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); | 166 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); |
| 166 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); | 167 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); |
| 167 vkDesc->finalize(); | 168 vkDesc->finalize(); |
| 168 return true; | 169 return true; |
| 169 } | 170 } |
| OLD | NEW |