[arrayfire] 65/284: Change to gfx to handle Arrays created by async calls
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:19 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.
commit c06f24d585f67989629a0f7eff7c845334981531
Author: pradeep <pradeep at arrayfire.com>
Date: Wed Dec 9 17:02:07 2015 -0500
Change to gfx to handle Arrays created by async calls
---
src/backend/cpu/hist_graphics.cpp | 4 +++
src/backend/cpu/image.cpp | 58 +++++++++++++++++++++------------------
src/backend/cpu/plot.cpp | 53 ++++++++++++++++++-----------------
src/backend/cpu/plot3.cpp | 53 ++++++++++++++++++-----------------
src/backend/cpu/surface.cpp | 53 ++++++++++++++++++-----------------
5 files changed, 119 insertions(+), 102 deletions(-)
diff --git a/src/backend/cpu/hist_graphics.cpp b/src/backend/cpu/hist_graphics.cpp
index 21d3fdf..56f7646 100644
--- a/src/backend/cpu/hist_graphics.cpp
+++ b/src/backend/cpu/hist_graphics.cpp
@@ -11,6 +11,8 @@
#include <hist_graphics.hpp>
#include <err_cpu.hpp>
+#include <platform.hpp>
+#include <async_queue.hpp>
namespace cpu
{
@@ -18,6 +20,8 @@ namespace cpu
template<typename T>
void copy_histogram(const Array<T> &data, const fg::Histogram* hist)
{
+ data.eval();
+ getQueue().sync();
CheckGL("Begin copy_histogram");
glBindBuffer(GL_ARRAY_BUFFER, hist->vbo());
diff --git a/src/backend/cpu/image.cpp b/src/backend/cpu/image.cpp
index 947afa2..767f9d4 100644
--- a/src/backend/cpu/image.cpp
+++ b/src/backend/cpu/image.cpp
@@ -15,39 +15,43 @@
#include <Array.hpp>
#include <image.hpp>
#include <err_cpu.hpp>
-#include <cstdio>
-#include <stdexcept>
#include <graphics_common.hpp>
+#include <platform.hpp>
+#include <async_queue.hpp>
using af::dim4;
namespace cpu
{
- template<typename T>
- void copy_image(const Array<T> &in, const fg::Image* image)
- {
- CheckGL("Before CopyArrayToPBO");
- const T *d_X = in.get();
- size_t data_size = image->size();
-
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, image->pbo());
- glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, data_size, d_X);
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
-
- CheckGL("In CopyArrayToPBO");
- }
-
- #define INSTANTIATE(T) \
- template void copy_image<T>(const Array<T> &in, const fg::Image* image);
-
- INSTANTIATE(float)
- INSTANTIATE(double)
- INSTANTIATE(int)
- INSTANTIATE(uint)
- INSTANTIATE(uchar)
- INSTANTIATE(char)
- INSTANTIATE(ushort)
- INSTANTIATE(short)
+
+template<typename T>
+void copy_image(const Array<T> &in, const fg::Image* image)
+{
+ in.eval();
+ getQueue().sync();
+ CheckGL("Before CopyArrayToPBO");
+ const T *d_X = in.get();
+ size_t data_size = image->size();
+
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, image->pbo());
+ glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, data_size, d_X);
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+
+ CheckGL("In CopyArrayToPBO");
+}
+
+#define INSTANTIATE(T) \
+ template void copy_image<T>(const Array<T> &in, const fg::Image* image);
+
+INSTANTIATE(float)
+INSTANTIATE(double)
+INSTANTIATE(int)
+INSTANTIATE(uint)
+INSTANTIATE(uchar)
+INSTANTIATE(char)
+INSTANTIATE(ushort)
+INSTANTIATE(short)
+
}
#endif // WITH_GRAPHICS
diff --git a/src/backend/cpu/plot.cpp b/src/backend/cpu/plot.cpp
index 9de1993..9cc7d9d 100644
--- a/src/backend/cpu/plot.cpp
+++ b/src/backend/cpu/plot.cpp
@@ -12,37 +12,40 @@
#include <Array.hpp>
#include <plot.hpp>
#include <err_cpu.hpp>
-#include <stdexcept>
#include <graphics_common.hpp>
-#include <reduce.hpp>
-#include <memory.hpp>
+#include <platform.hpp>
+#include <async_queue.hpp>
using af::dim4;
namespace cpu
{
- template<typename T>
- void copy_plot(const Array<T> &P, fg::Plot* plot)
- {
- CheckGL("Before CopyArrayToVBO");
-
- glBindBuffer(GL_ARRAY_BUFFER, plot->vbo());
- glBufferSubData(GL_ARRAY_BUFFER, 0, plot->size(), P.get());
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- CheckGL("In CopyArrayToVBO");
- }
-
- #define INSTANTIATE(T) \
- template void copy_plot<T>(const Array<T> &P, fg::Plot* plot);
-
- INSTANTIATE(float)
- INSTANTIATE(double)
- INSTANTIATE(int)
- INSTANTIATE(uint)
- INSTANTIATE(uchar)
- INSTANTIATE(short)
- INSTANTIATE(ushort)
+
+template<typename T>
+void copy_plot(const Array<T> &P, fg::Plot* plot)
+{
+ P.eval();
+ getQueue().sync();
+ CheckGL("Before CopyArrayToVBO");
+
+ glBindBuffer(GL_ARRAY_BUFFER, plot->vbo());
+ glBufferSubData(GL_ARRAY_BUFFER, 0, plot->size(), P.get());
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ CheckGL("In CopyArrayToVBO");
+}
+
+#define INSTANTIATE(T) \
+ template void copy_plot<T>(const Array<T> &P, fg::Plot* plot);
+
+INSTANTIATE(float)
+INSTANTIATE(double)
+INSTANTIATE(int)
+INSTANTIATE(uint)
+INSTANTIATE(uchar)
+INSTANTIATE(short)
+INSTANTIATE(ushort)
+
}
#endif // WITH_GRAPHICS
diff --git a/src/backend/cpu/plot3.cpp b/src/backend/cpu/plot3.cpp
index c0e26aa..35a7b25 100644
--- a/src/backend/cpu/plot3.cpp
+++ b/src/backend/cpu/plot3.cpp
@@ -12,37 +12,40 @@
#include <Array.hpp>
#include <plot3.hpp>
#include <err_cpu.hpp>
-#include <stdexcept>
#include <graphics_common.hpp>
-#include <reduce.hpp>
-#include <memory.hpp>
+#include <platform.hpp>
+#include <async_queue.hpp>
using af::dim4;
namespace cpu
{
- template<typename T>
- void copy_plot3(const Array<T> &P, fg::Plot3* plot3)
- {
- CheckGL("Before CopyArrayToVBO");
-
- glBindBuffer(GL_ARRAY_BUFFER, plot3->vbo());
- glBufferSubData(GL_ARRAY_BUFFER, 0, plot3->size(), P.get());
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- CheckGL("In CopyArrayToVBO");
- }
-
- #define INSTANTIATE(T) \
- template void copy_plot3<T>(const Array<T> &P, fg::Plot3* plot3);
-
- INSTANTIATE(float)
- INSTANTIATE(double)
- INSTANTIATE(int)
- INSTANTIATE(uint)
- INSTANTIATE(uchar)
- INSTANTIATE(short)
- INSTANTIATE(ushort)
+
+template<typename T>
+void copy_plot3(const Array<T> &P, fg::Plot3* plot3)
+{
+ P.eval();
+ getQueue().sync();
+ CheckGL("Before CopyArrayToVBO");
+
+ glBindBuffer(GL_ARRAY_BUFFER, plot3->vbo());
+ glBufferSubData(GL_ARRAY_BUFFER, 0, plot3->size(), P.get());
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ CheckGL("In CopyArrayToVBO");
+}
+
+#define INSTANTIATE(T) \
+ template void copy_plot3<T>(const Array<T> &P, fg::Plot3* plot3);
+
+INSTANTIATE(float)
+INSTANTIATE(double)
+INSTANTIATE(int)
+INSTANTIATE(uint)
+INSTANTIATE(uchar)
+INSTANTIATE(short)
+INSTANTIATE(ushort)
+
}
#endif // WITH_GRAPHICS
diff --git a/src/backend/cpu/surface.cpp b/src/backend/cpu/surface.cpp
index 39f375a..116c784 100644
--- a/src/backend/cpu/surface.cpp
+++ b/src/backend/cpu/surface.cpp
@@ -12,37 +12,40 @@
#include <Array.hpp>
#include <surface.hpp>
#include <err_cpu.hpp>
-#include <stdexcept>
#include <graphics_common.hpp>
-#include <reduce.hpp>
-#include <memory.hpp>
+#include <platform.hpp>
+#include <async_queue.hpp>
using af::dim4;
namespace cpu
{
- template<typename T>
- void copy_surface(const Array<T> &P, fg::Surface* surface)
- {
- CheckGL("Before CopyArrayToVBO");
-
- glBindBuffer(GL_ARRAY_BUFFER, surface->vbo());
- glBufferSubData(GL_ARRAY_BUFFER, 0, surface->size(), P.get());
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- CheckGL("In CopyArrayToVBO");
- }
-
- #define INSTANTIATE(T) \
- template void copy_surface<T>(const Array<T> &P, fg::Surface* surface);
-
- INSTANTIATE(float)
- INSTANTIATE(double)
- INSTANTIATE(int)
- INSTANTIATE(uint)
- INSTANTIATE(uchar)
- INSTANTIATE(short)
- INSTANTIATE(ushort)
+
+template<typename T>
+void copy_surface(const Array<T> &P, fg::Surface* surface)
+{
+ P.eval();
+ getQueue().sync();
+ CheckGL("Before CopyArrayToVBO");
+
+ glBindBuffer(GL_ARRAY_BUFFER, surface->vbo());
+ glBufferSubData(GL_ARRAY_BUFFER, 0, surface->size(), P.get());
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ CheckGL("In CopyArrayToVBO");
+}
+
+#define INSTANTIATE(T) \
+ template void copy_surface<T>(const Array<T> &P, fg::Surface* surface);
+
+INSTANTIATE(float)
+INSTANTIATE(double)
+INSTANTIATE(int)
+INSTANTIATE(uint)
+INSTANTIATE(uchar)
+INSTANTIATE(short)
+INSTANTIATE(ushort)
+
}
#endif // WITH_GRAPHICS
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list