gegl-buffer-cl-iterator.h 3.22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/* This file is part of GEGL
 *
 * GEGL is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * GEGL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
14
 * License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
15 16 17 18
 *
 * Copyright 2012 Victor Oliveira (victormatheus@gmail.com)
 */

19 20 21 22 23 24 25 26 27 28 29
#ifndef __GEGL_BUFFER_CL_ITERATOR_H__
#define __GEGL_BUFFER_CL_ITERATOR_H__

#include "gegl-buffer.h"
#include "opencl/gegl-cl.h"

#define GEGL_CL_BUFFER_MAX_ITERATORS 6

enum
{
  GEGL_CL_BUFFER_READ   = 1,
30 31
  GEGL_CL_BUFFER_WRITE  = 2,
  GEGL_CL_BUFFER_AUX    = 3
32 33 34 35
};

typedef struct GeglBufferClIterator
{
36 37 38
  size_t        size [GEGL_CL_BUFFER_MAX_ITERATORS];  /* length of current data in pixels */
  cl_mem        tex  [GEGL_CL_BUFFER_MAX_ITERATORS];
  GeglRectangle roi  [GEGL_CL_BUFFER_MAX_ITERATORS];
39 40 41 42 43 44
} GeglBufferClIterator;

gint gegl_buffer_cl_iterator_add (GeglBufferClIterator  *iterator,
                                  GeglBuffer            *buffer,
                                  const GeglRectangle   *roi,
                                  const Babl            *format,
45 46
                                  guint                  flags,
                                  GeglAbyssPolicy        abyss_policy);
47

48 49 50 51 52 53 54 55
gint gegl_buffer_cl_iterator_add_2 (GeglBufferClIterator  *iterator,
                                    GeglBuffer            *buffer,
                                    const GeglRectangle   *roi,
                                    const Babl            *format,
                                    guint                  flags,
                                    gint                   left,
                                    gint                   right,
                                    gint                   top,
56 57
                                    gint                   bottom,
                                    GeglAbyssPolicy        abyss_policy);
58

59 60 61 62 63 64 65 66
gint gegl_buffer_cl_iterator_add_aux (GeglBufferClIterator  *iterator,
                                      const GeglRectangle   *roi,
                                      const Babl            *format,
                                      gint                   left,
                                      gint                   right,
                                      gint                   top,
                                      gint                   bottom);

67
gboolean gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err);
68

69 70
void gegl_buffer_cl_iterator_stop (GeglBufferClIterator *iterator);

71 72 73
GeglBufferClIterator *gegl_buffer_cl_iterator_new (GeglBuffer          *buffer,
                                                   const GeglRectangle *roi,
                                                   const Babl          *format,
74
                                                   guint                flags);
75
#endif