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

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

Issue 1583863002: Beginning of support for texture rectangles. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 11 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/GrGLProgramDataManager.cpp ('k') | src/gpu/gl/SkGLContext.cpp » ('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 "GrGLGpu.h"
11 #include "GrPipeline.h" 10 #include "GrPipeline.h"
12 #include "SkChecksum.h" 11 #include "SkChecksum.h"
12 #include "gl/GrGLDefines.h"
13 #include "gl/GrGLTexture.h"
14 #include "gl/GrGLTypes.h"
13 #include "glsl/GrGLSLFragmentProcessor.h" 15 #include "glsl/GrGLSLFragmentProcessor.h"
14 #include "glsl/GrGLSLFragmentShaderBuilder.h" 16 #include "glsl/GrGLSLFragmentShaderBuilder.h"
17 #include "glsl/GrGLSLCaps.h"
15 18
19 static uint16_t texture_target_key(GrGLenum target) {
20 SkASSERT((uint32_t)target < SK_MaxU16);
21 return target;
22 }
16 23
17 static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc, 24 static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc,
18 const GrGLSLCaps& caps) { 25 const GrGLSLCaps& caps) {
19 int numTextures = proc.numTextures(); 26 int numTextures = proc.numTextures();
20 // Need two bytes per key (swizzle and target). 27 // Need two bytes per key (swizzle and target).
21 int word32Count = (proc.numTextures() + 1) / 2; 28 int word32Count = (proc.numTextures() + 1) / 2;
22 if (0 == word32Count) { 29 if (0 == word32Count) {
23 return; 30 return;
24 } 31 }
25 uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count)); 32 uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count));
26 for (int i = 0; i < numTextures; ++i) { 33 for (int i = 0; i < numTextures; ++i) {
27 const GrTextureAccess& access = proc.textureAccess(i); 34 const GrTextureAccess& access = proc.textureAccess(i);
28 bool isExternal = (GR_GL_TEXTURE_EXTERNAL == 35 GrGLTexture* texture = static_cast<GrGLTexture*>(access.getTexture());
29 static_cast<GrGLTexture*>(access.getTexture())->targe t()); 36 k16[i] = caps.configTextureSwizzle(texture->config()).asKey() |
30 k16[i] = caps.configTextureSwizzle(access.getTexture()->config()).asKey( ) | 37 (texture_target_key(texture->target()) << 16);
31 (isExternal ? 0xFF00 : 0x0000);
32 } 38 }
33 // zero the last 16 bits if the number of textures is odd. 39 // zero the last 16 bits if the number of textures is odd.
34 if (numTextures & 0x1) { 40 if (numTextures & 0x1) {
35 k16[numTextures] = 0; 41 k16[numTextures] = 0;
36 } 42 }
37 } 43 }
38 44
39 /** 45 /**
40 * A function which emits a meta key into the key builder. This is required bec ause shader code may 46 * A function which emits a meta key into the key builder. This is required bec ause shader code may
41 * be dependent on properties of the effect that the effect itself doesn't use 47 * be dependent on properties of the effect that the effect itself doesn't use
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } else { 150 } else {
145 header->fIgnoresCoverage = 0; 151 header->fIgnoresCoverage = 0;
146 } 152 }
147 153
148 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); 154 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
149 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); 155 header->fColorEffectCnt = pipeline.numColorFragmentProcessors();
150 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); 156 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors();
151 glDesc->finalize(); 157 glDesc->finalize();
152 return true; 158 return true;
153 } 159 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.cpp ('k') | src/gpu/gl/SkGLContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698