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

Side by Side Diff: src/effects/SkColorCubeFilter.cpp

Issue 1490283004: Create GLSLUniformHandler class for gpu backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up public api of uniformhandler Created 5 years 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/effects/SkBlurMaskFilter.cpp ('k') | src/effects/SkColorMatrixFilter.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 2014 Google Inc. 2 * Copyright 2014 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 7
8 #include "SkColorCubeFilter.h" 8 #include "SkColorCubeFilter.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkOnce.h" 10 #include "SkOnce.h"
11 #include "SkOpts.h" 11 #include "SkOpts.h"
12 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
13 #include "SkUnPreMultiply.h" 13 #include "SkUnPreMultiply.h"
14 #include "SkWriteBuffer.h" 14 #include "SkWriteBuffer.h"
15 #if SK_SUPPORT_GPU 15 #if SK_SUPPORT_GPU
16 #include "GrContext.h" 16 #include "GrContext.h"
17 #include "GrCoordTransform.h" 17 #include "GrCoordTransform.h"
18 #include "GrInvariantOutput.h" 18 #include "GrInvariantOutput.h"
19 #include "GrTexturePriv.h" 19 #include "GrTexturePriv.h"
20 #include "SkGr.h" 20 #include "SkGr.h"
21 #include "glsl/GrGLSLFragmentProcessor.h" 21 #include "glsl/GrGLSLFragmentProcessor.h"
22 #include "glsl/GrGLSLFragmentShaderBuilder.h" 22 #include "glsl/GrGLSLFragmentShaderBuilder.h"
23 #include "glsl/GrGLSLProgramBuilder.h"
24 #include "glsl/GrGLSLProgramDataManager.h" 23 #include "glsl/GrGLSLProgramDataManager.h"
24 #include "glsl/GrGLSLUniformHandler.h"
25 #endif 25 #endif
26 26
27 /////////////////////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////////////
28 namespace { 28 namespace {
29 29
30 int32_t SkNextColorCubeUniqueID() { 30 int32_t SkNextColorCubeUniqueID() {
31 static int32_t gColorCubeUniqueID; 31 static int32_t gColorCubeUniqueID;
32 // do a loop in case our global wraps around, as we never want to return a 0 32 // do a loop in case our global wraps around, as we never want to return a 0
33 int32_t genID; 33 int32_t genID;
34 do { 34 do {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 240
241 GrColorCubeEffect::GLSLProcessor::~GLSLProcessor() { 241 GrColorCubeEffect::GLSLProcessor::~GLSLProcessor() {
242 } 242 }
243 243
244 void GrColorCubeEffect::GLSLProcessor::emitCode(EmitArgs& args) { 244 void GrColorCubeEffect::GLSLProcessor::emitCode(EmitArgs& args) {
245 if (nullptr == args.fInputColor) { 245 if (nullptr == args.fInputColor) {
246 args.fInputColor = "vec4(1)"; 246 args.fInputColor = "vec4(1)";
247 } 247 }
248 248
249 fColorCubeSizeUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragmen t_Visibility, 249 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
250 kFloat_GrSLType, kDefault_GrSLPrecis ion, 250 fColorCubeSizeUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragme nt_Visibility,
251 "Size"); 251 kFloat_GrSLType, kDefault_GrS LPrecision,
252 const char* colorCubeSizeUni = args.fBuilder->getUniformCStr(fColorCubeSizeU ni); 252 "Size");
253 fColorCubeInvSizeUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFrag ment_Visibility, 253 const char* colorCubeSizeUni = uniformHandler->getUniformCStr(fColorCubeSize Uni);
254 kFloat_GrSLType, kDefault_GrSLPre cision, 254 fColorCubeInvSizeUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFra gment_Visibility,
255 "InvSize"); 255 kFloat_GrSLType, kDefault_ GrSLPrecision,
256 const char* colorCubeInvSizeUni = args.fBuilder->getUniformCStr(fColorCubeIn vSizeUni); 256 "InvSize");
257 const char* colorCubeInvSizeUni = uniformHandler->getUniformCStr(fColorCubeI nvSizeUni);
257 258
258 const char* nonZeroAlpha = "nonZeroAlpha"; 259 const char* nonZeroAlpha = "nonZeroAlpha";
259 const char* unPMColor = "unPMColor"; 260 const char* unPMColor = "unPMColor";
260 const char* cubeIdx = "cubeIdx"; 261 const char* cubeIdx = "cubeIdx";
261 const char* cCoords1 = "cCoords1"; 262 const char* cCoords1 = "cCoords1";
262 const char* cCoords2 = "cCoords2"; 263 const char* cCoords2 = "cCoords2";
263 264
264 // Note: if implemented using texture3D in OpenGL ES older than OpenGL ES 3. 0, 265 // Note: if implemented using texture3D in OpenGL ES older than OpenGL ES 3. 0,
265 // the shader might need "#extension GL_OES_texture_3D : enable". 266 // the shader might need "#extension GL_OES_texture_3D : enable".
266 267
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (textureCube) { 328 if (textureCube) {
328 context->textureProvider()->assignUniqueKeyToTexture(key, textureCub e); 329 context->textureProvider()->assignUniqueKeyToTexture(key, textureCub e);
329 } else { 330 } else {
330 return nullptr; 331 return nullptr;
331 } 332 }
332 } 333 }
333 334
334 return GrColorCubeEffect::Create(textureCube); 335 return GrColorCubeEffect::Create(textureCube);
335 } 336 }
336 #endif 337 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698