|
|
@ -110,24 +110,8 @@ struct App { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
int main(){ |
|
|
|
App a; |
|
|
|
|
|
|
|
NSAppWrapper app; |
|
|
|
|
|
|
|
app.create_window({ |
|
|
|
[&](ContextParameters){ |
|
|
|
a.initialize(); |
|
|
|
}, |
|
|
|
[&](ContextParameters){ |
|
|
|
a.draw(); |
|
|
|
}, |
|
|
|
nullptr |
|
|
|
}); |
|
|
|
|
|
|
|
app.run(); |
|
|
|
|
|
|
|
struct CLApp { |
|
|
|
void initialize(){ |
|
|
|
auto context = cl::Context::getDefault(); |
|
|
|
cout << context << endl; |
|
|
|
|
|
|
@ -146,8 +130,8 @@ int main(){ |
|
|
|
cl::CommandQueue queue(context, context.getInfo<CL_CONTEXT_DEVICES>().front()); |
|
|
|
|
|
|
|
// make a lot of data
|
|
|
|
constexpr size_t W = 1280 * 4; |
|
|
|
constexpr size_t H = 800 * 4; |
|
|
|
constexpr size_t W = 1280 * 1; |
|
|
|
constexpr size_t H = 800 * 1; |
|
|
|
std::vector<cl_float> input_vector(W*H); |
|
|
|
|
|
|
|
for(int y = 0; y < H; ++y){ |
|
|
@ -159,7 +143,7 @@ int main(){ |
|
|
|
// transfer data into buffers
|
|
|
|
cl::Buffer input(context, input_vector.begin(), input_vector.end(), false, true); |
|
|
|
|
|
|
|
int r = 80, g = 40, b = 20; |
|
|
|
int r = 20, g = 20, b = 20; |
|
|
|
|
|
|
|
// DO IT (in place)
|
|
|
|
for(int i = 0; i < r; ++i){ |
|
|
@ -199,5 +183,27 @@ int main(){ |
|
|
|
} |
|
|
|
cout << "png is saved" << endl; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
int main() { |
|
|
|
App a; |
|
|
|
CLApp b; |
|
|
|
|
|
|
|
NSAppWrapper app; |
|
|
|
|
|
|
|
app.create_window({ |
|
|
|
[&](ContextParameters){ |
|
|
|
a.initialize(); |
|
|
|
b.initialize(); |
|
|
|
}, |
|
|
|
[&](ContextParameters){ |
|
|
|
a.draw(); |
|
|
|
}, |
|
|
|
nullptr |
|
|
|
}); |
|
|
|
|
|
|
|
app.run(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|