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

Side by Side Diff: src/gpu/gl/GrGLFragmentProcessor.h

Issue 1251173002: Added GrGLFragmentProcessor::EmitArgs struct for use with emitCode() (Closed) Base URL: https://skia.googlesource.com/skia@composeshader_gpu
Patch Set: Created 5 years, 5 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/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.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 7
8 #ifndef GrGLFragmentProcessor_DEFINED 8 #ifndef GrGLFragmentProcessor_DEFINED
9 #define GrGLFragmentProcessor_DEFINED 9 #define GrGLFragmentProcessor_DEFINED
10 10
(...skipping 23 matching lines...) Expand all
34 @param outputColor A predefined vec4 in the FS in which the stage shoul d place its output 34 @param outputColor A predefined vec4 in the FS in which the stage shoul d place its output
35 color (or coverage). 35 color (or coverage).
36 @param inputColor A vec4 that holds the input color to the stage in th e FS. This may be 36 @param inputColor A vec4 that holds the input color to the stage in th e FS. This may be
37 NULL in which case the implied input is solid white (all ones). 37 NULL in which case the implied input is solid white (all ones).
38 TODO: Better system for communicating optimization i nfo (e.g. input 38 TODO: Better system for communicating optimization i nfo (e.g. input
39 color is solid white, trans black, known to be opaqu e, etc.) that allows 39 color is solid white, trans black, known to be opaqu e, etc.) that allows
40 the processor to communicate back similar known info about its output. 40 the processor to communicate back similar known info about its output.
41 @param samplers Contains one entry for each GrTextureAccess of the G rProcessor. These 41 @param samplers Contains one entry for each GrTextureAccess of the G rProcessor. These
42 can be passed to the builder to emit texture reads i n the generated 42 can be passed to the builder to emit texture reads i n the generated
43 code. 43 code.
44 TODO this should take a struct
45 */ 44 */
46 virtual void emitCode(GrGLFPBuilder* builder, 45
47 const GrFragmentProcessor&, 46 struct EmitArgs {
48 const char* outputColor, 47 EmitArgs(GrGLFPBuilder* builder,
49 const char* inputColor, 48 const GrFragmentProcessor& fp,
50 const TransformedCoordsArray& coords, 49 const char* outputColor,
51 const TextureSamplerArray& samplers) = 0; 50 const char* inputColor,
51 const TransformedCoordsArray& coords,
52 const TextureSamplerArray& samplers)
53 : fBuilder(builder)
54 , fFp(fp)
55 , fOutputColor(outputColor)
56 , fInputColor(inputColor)
57 , fCoords(coords)
58 , fSamplers(samplers) {}
59 GrGLFPBuilder* fBuilder;
60 const GrFragmentProcessor& fFp;
61 const char* fOutputColor;
62 const char* fInputColor;
63 const TransformedCoordsArray& fCoords;
64 const TextureSamplerArray& fSamplers;
65 };
66
67 virtual void emitCode(EmitArgs&) = 0;
52 68
53 /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProces sor that produces 69 /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProces sor that produces
54 the same stage key; this function reads data from a GrFragmentProcessor and uploads any 70 the same stage key; this function reads data from a GrFragmentProcessor and uploads any
55 uniform variables required by the shaders created in emitCode(). The GrF ragmentProcessor 71 uniform variables required by the shaders created in emitCode(). The GrF ragmentProcessor
56 parameter is guaranteed to be of the same type that created this GrGLFra gmentProcessor and 72 parameter is guaranteed to be of the same type that created this GrGLFra gmentProcessor and
57 to have an identical processor key as the one that created this GrGLFrag mentProcessor. */ 73 to have an identical processor key as the one that created this GrGLFrag mentProcessor. */
58 // TODO update this to pass in GrFragmentProcessor 74 // TODO update this to pass in GrFragmentProcessor
59 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} 75 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {}
60 76
61 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) {} 77 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) {}
62 78
63 private: 79 private:
64 typedef GrGLProcessor INHERITED; 80 typedef GrGLProcessor INHERITED;
65 }; 81 };
66 82
67 #endif 83 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698