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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 611653002: Cleanup of shader building system (Closed) Base URL: https://skia.googlesource.com/skia.git@solo_gp
Patch Set: Created 6 years, 2 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/builders/GrGLVertexShaderBuilder.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 // This is a GPU-backend specific test. It relies on static intializers to work 9 // This is a GPU-backend specific test. It relies on static intializers to work
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 12
13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
14 14
15 #include "GrBackendProcessorFactory.h" 15 #include "GrBackendProcessorFactory.h"
16 #include "GrContextFactory.h" 16 #include "GrContextFactory.h"
17 #include "GrOptDrawState.h" 17 #include "GrOptDrawState.h"
18 #include "effects/GrConfigConversionEffect.h" 18 #include "effects/GrConfigConversionEffect.h"
19 #include "gl/builders/GrGLProgramBuilder.h"
19 #include "gl/GrGLPathRendering.h" 20 #include "gl/GrGLPathRendering.h"
20 #include "gl/GrGpuGL.h" 21 #include "gl/GrGpuGL.h"
21 #include "SkChecksum.h" 22 #include "SkChecksum.h"
22 #include "SkRandom.h" 23 #include "SkRandom.h"
23 #include "Test.h" 24 #include "Test.h"
24 25
25 static void get_stage_stats(const GrFragmentStage stage, bool* readsDst, 26 static void get_stage_stats(const GrFragmentStage stage, bool* readsDst,
26 bool* readsFragPosition, bool* requiresVertexShader) { 27 bool* readsFragPosition, bool* requiresVertexShader) {
27 if (stage.getFragmentProcessor()->willReadDstColor()) { 28 if (stage.getProcessor()->willReadDstColor()) {
28 *readsDst = true; 29 *readsDst = true;
29 } 30 }
30 if (stage.getProcessor()->willReadFragmentPosition()) { 31 if (stage.getProcessor()->willReadFragmentPosition()) {
31 *readsFragPosition = true; 32 *readsFragPosition = true;
32 } 33 }
33 } 34 }
34 35
35 bool GrGLProgramDesc::setRandom(SkRandom* random, 36 bool GrGLProgramDesc::setRandom(SkRandom* random,
36 GrGpuGL* gpu, 37 GrGpuGL* gpu,
37 const GrRenderTarget* dstRenderTarget, 38 const GrRenderTarget* dstRenderTarget,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 numColorStages, 329 numColorStages,
329 numCoverageStages, 330 numCoverageStages,
330 currAttribIndex, 331 currAttribIndex,
331 drawType)) { 332 drawType)) {
332 return false; 333 return false;
333 } 334 }
334 335
335 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDr awState(), 336 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDr awState(),
336 *this->caps (), 337 *this->caps (),
337 drawType)); 338 drawType));
338 SkAutoTUnref<GrGLProgram> program(GrGLProgram::Create(this, 339 SkAutoTUnref<GrGLProgram> program(
339 *optState.get(), 340 GrGLProgramBuilder::CreateProgram(*optState,
340 pdesc, 341 pdesc,
341 geometryProcessor. get(), 342 drawType,
342 stages, 343 geometryProcessor,
343 stages + numColorS tages)); 344 stages,
345 stages + numColorStage s,
346 this));
344 for (int s = 0; s < numStages; ++s) { 347 for (int s = 0; s < numStages; ++s) {
345 SkDELETE(stages[s]); 348 SkDELETE(stages[s]);
346 } 349 }
347 if (NULL == program.get()) { 350 if (NULL == program.get()) {
348 return false; 351 return false;
349 } 352 }
350 353
351 // We have to reset the drawstate because we might have added a gp 354 // We have to reset the drawstate because we might have added a gp
352 this->drawState()->reset(); 355 this->drawState()->reset();
353 } 356 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1)); 393 SkRect::MakeWH(SK_Scalar1, SK_Scalar1), SK_Scalar1));
391 GrConfigConversionEffect::Create(NULL, 394 GrConfigConversionEffect::Create(NULL,
392 false, 395 false,
393 GrConfigConversionEffect::kNone_PMConversio n, 396 GrConfigConversionEffect::kNone_PMConversio n,
394 SkMatrix::I()); 397 SkMatrix::I());
395 SkScalar matrix[20]; 398 SkScalar matrix[20];
396 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix)); 399 SkAutoTUnref<SkColorMatrixFilter> cmf(SkColorMatrixFilter::Create(matrix));
397 } 400 }
398 401
399 #endif 402 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698