Final small little tweak to distinguish whats going on in image buffer creation

master
MitchellHansen 8 years ago
parent 1e54243b99
commit 1bda0fa2f1

@ -51,10 +51,10 @@ public:
bool compile_kernel(std::string kernel_path, std::string kernel_name);
// Create an image buffer from an SF texture. Access Type is the read/write specifier required by OpenCL
bool create_image_buffer(std::string buffer_name, sf::Texture* texture, cl_int access_type);
bool create_image_buffer_from_texture(std::string buffer_name, sf::Texture* texture, cl_int access_type);
// Have CL create and manage the texture for the image buffer. Access Type is the read/write specifier required by OpenCL
bool create_image_buffer(std::string buffer_name, sf::Vector2i size, cl_int access_type);
bool create_image_buffer(std::string buffer_name, sf::Vector2i size, sf::Vector2f position, cl_int access_type);
// Create a buffer with CL_MEM_READ_ONLY and CL_MEM_COPY_HOST_PTR
int create_buffer(std::string buffer_name, cl_uint size, void* data);

@ -226,7 +226,7 @@ bool OpenCL::compile_kernel(std::string kernel_path, std::string kernel_name) {
return true;
}
bool OpenCL::create_image_buffer(std::string buffer_name, sf::Texture* texture, cl_int access_type) {
bool OpenCL::create_image_buffer_from_texture(std::string buffer_name, sf::Texture* texture, cl_int access_type) {
if (buffer_map.count(buffer_name) > 0) {
release_buffer(buffer_name);
@ -249,7 +249,7 @@ bool OpenCL::create_image_buffer(std::string buffer_name, sf::Texture* texture,
}
bool OpenCL::create_image_buffer(std::string buffer_name, sf::Vector2i size, cl_int access_type) {
bool OpenCL::create_image_buffer(std::string buffer_name, sf::Vector2i size, sf::Vector2f position, cl_int access_type) {
if (buffer_map.count(buffer_name) > 0) {
release_buffer(buffer_name);
@ -270,8 +270,9 @@ bool OpenCL::create_image_buffer(std::string buffer_name, sf::Vector2i size, cl_
return false;
sf::Sprite sprite(*texture);
sprite.setPosition(position);
image_map[buffer_name] = std::pair<sf::Sprite, std::unique_ptr<sf::Texture>>(sf::Sprite(*texture), std::move(texture));
image_map[buffer_name] = std::pair<sf::Sprite, std::unique_ptr<sf::Texture>>(sprite, std::move(texture));
store_buffer(buff, buffer_name);

@ -47,7 +47,7 @@ int main() {
std::cin.get();
}
cl.create_image_buffer("viewport_image", image_resolution, CL_MEM_WRITE_ONLY);
cl.create_image_buffer("viewport_image", image_resolution, sf::Vector2f(100, 100), CL_MEM_WRITE_ONLY);
cl.create_buffer("image_res", sizeof(sf::Vector2i), &image_resolution);
cl.create_buffer("range", sizeof(sf::Vector4f), (void*)&range, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR);

Loading…
Cancel
Save