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

Side by Side Diff: experimental/skpdiff/SkCLImageDiffer.h

Issue 19671002: migrate skpdiff to tools (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: i shake my fist at Visual Studio's default use of tabs Created 7 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 | Annotate | Revision Log
« no previous file with comments | « experimental/skpdiff/README ('k') | experimental/skpdiff/SkCLImageDiffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkCLImageDiffer_DEFINED
9 #define SkCLImageDiffer_DEFINED
10
11 #include <CL/cl.h>
12 #include "SkTDArray.h"
13
14 #include "SkImageDiffer.h"
15
16 class SkStream;
17
18 /**
19 * An SkImageDiffer that requires initialization with an OpenCL device and conte xt.
20 */
21 class SkCLImageDiffer : public SkImageDiffer {
22 public:
23 SkCLImageDiffer();
24
25 virtual bool requiresOpenCL() SK_OVERRIDE { return true; }
26
27 /**
28 * Initializes the OpenCL resources this differ needs to work
29 * @param device An OpenCL device
30 * @param context An OpenCL context of the given device
31 * @return True on success, false otherwise
32 */
33 virtual bool init(cl_device_id device, cl_context context);
34
35 protected:
36 /**
37 * Called by init after fDevice, fContext, and fCommandQueue are successfull y initialized
38 * @return True on success, false otherwise
39 */
40 virtual bool onInit() = 0;
41
42 /**
43 * Loads an OpenCL kernel from the file with the given named entry point. Th is only works after
44 * init is called.
45 * @param file The file path of the kernel
46 * @param name The name of the entry point of the desired kernel in the f ile
47 * @param kernel A pointer to return the loaded kernel into
48 * @return True on success, false otherwise
49 */
50 bool loadKernelFile(const char file[], const char name[], cl_kernel* kernel) ;
51
52 /**
53 * Loads an OpenCL kernel from the stream with the given named entry point. This only works
54 * after init is called.
55 * @param stream The stream that contains the kernel
56 * @param name The name of the entry point of the desired kernel in the stream
57 * @param kernel A pointer to return the loaded kernel into
58 * @return True on success, false otherwise
59 */
60 bool loadKernelStream(SkStream* stream, const char name[], cl_kernel* kernel );
61
62 /**
63 * Loads an OpenCL kernel from the source string with the given named entry point. This only
64 * works after init is called.
65 * @param source The string that contains the kernel
66 * @param name The name of the entry point of the desired kernel in the source string
67 * @param kernel A pointer to return the loaded kernel into
68 * @return True on success, false otherwise
69 */
70 bool loadKernelSource(const char source[], const char name[], cl_kernel* ker nel);
71
72 /**
73 * Loads a read only copy of the given bitmap into device memory and returns the block of
74 * memory. This only works after init is called.
75 * @param bitmap The bitmap to load into memory
76 * @param image A pointer to return the allocated image to
77 * @return True on success, false otherwise
78 */
79 bool makeImage2D(SkBitmap* bitmap, cl_mem* image);
80
81 cl_device_id fDevice;
82 cl_context fContext;
83 cl_command_queue fCommandQueue;
84
85 private:
86
87 typedef SkImageDiffer INHERITED;
88 };
89
90 #endif
OLDNEW
« no previous file with comments | « experimental/skpdiff/README ('k') | experimental/skpdiff/SkCLImageDiffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698