forked from halide/Halide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeGen_OpenGLCompute_Dev.h
More file actions
79 lines (59 loc) · 1.99 KB
/
CodeGen_OpenGLCompute_Dev.h
File metadata and controls
79 lines (59 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef HALIDE_CODEGEN_OPENGLCOMPUTE_DEV_H
#define HALIDE_CODEGEN_OPENGLCOMPUTE_DEV_H
/** \file
* Defines the code-generator for producing GLSL kernel code for OpenGL Compute.
*/
#include <sstream>
#include <map>
#include "CodeGen_C.h"
#include "CodeGen_GPU_Dev.h"
#include "CodeGen_OpenGL_Dev.h"
#include "Target.h"
namespace Halide {
namespace Internal {
class CodeGen_OpenGLCompute_Dev : public CodeGen_GPU_Dev {
public:
CodeGen_OpenGLCompute_Dev(Target target);
// CodeGen_GPU_Dev interface
void add_kernel(Stmt stmt,
const std::string &name,
const std::vector<DeviceArgument> &args);
void init_module();
std::vector<char> compile_to_src();
std::string get_current_kernel_name();
void dump();
virtual std::string print_gpu_name(const std::string &name);
std::string api_unique_name() { return "openglcompute"; }
protected:
class CodeGen_OpenGLCompute_C : public CodeGen_GLSLBase {
public:
CodeGen_OpenGLCompute_C(std::ostream &s) : CodeGen_GLSLBase(s) {}
void add_kernel(Stmt stmt,
Target target,
const std::string &name,
const std::vector<DeviceArgument> &args);
protected:
std::string print_type(Type type, AppendSpaceIfNeeded space_option = DoNotAppendSpace);
using CodeGen_C::visit;
void visit(const For *);
void visit(const Ramp *op);
void visit(const Broadcast *op);
void visit(const Load *op);
void visit(const Store *op);
void visit(const Cast *op);
void visit(const Call *op);
void visit(const Allocate *op);
void visit(const Free *op);
void visit(const Select *op);
void visit(const Evaluate *op);
void visit(const IntImm *op);
public:
int workgroup_size[3];
};
std::ostringstream src_stream;
std::string cur_kernel_name;
CodeGen_OpenGLCompute_C glc;
Target target;
};
}}
#endif