NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Image.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2011, NVIDIA Corporation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of NVIDIA Corporation nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #pragma once
29 #include "gpu/Buffer.hpp"
30 
31 namespace FW
32 {
33 //------------------------------------------------------------------------
34 
36 {
37 public:
38  enum ID
39  {
40  R8_G8_B8 = 0,
42  A8,
45 
48 
52 
55  };
56 
57  enum ChannelType // allows arbitrary values
58  {
64 
66  };
67 
69  {
70  ChannelFormat_Clamp = 0, // [0, 1]
71  ChannelFormat_Int, // [0, n[
73 
75  };
76 
77  struct Channel
78  {
81  S32 wordOfs; // bytes
82  S32 wordSize; // bytes
83  S32 fieldOfs; // bits
84  S32 fieldSize; // bits
85  };
86 
87  struct StaticFormat
88  {
93  GLenum glFormat;
94  GLenum glType;
96  };
97 
98 public:
99  ImageFormat (void) { clear(); }
100  ImageFormat (ID id) : m_id(id) { FW_ASSERT(id >= 0 && id < ID_Generic); }
101  ImageFormat (const ImageFormat& other) { set(other); }
102  ~ImageFormat (void) {}
103 
104  ID getID (void) const;
105  const StaticFormat* getStaticFormat (void) const;
106  int getBPP (void) const;
107  int getNumChannels (void) const;
108  const Channel& getChannel (int idx) const;
109  int findChannel (ChannelType type) const;
110  bool hasChannel (ChannelType type) const { return (findChannel(type) != -1); }
111 
112  void set (const ImageFormat& other);
113  void clear (void);
114  void addChannel (const Channel& channel);
115 
116  ID getGLFormat (void) const;
117 
118  ImageFormat& operator= (const ImageFormat& other) { set(other); return *this; }
119  bool operator== (const ImageFormat& other) const;
120  bool operator!= (const ImageFormat& other) const { return (!operator==(other)); }
121 
122 private:
123  static const StaticFormat s_staticFormats[];
124 
125  mutable ID m_id; // ID_Max if unknown
126  S32 m_genericBPP; // only if m_id >= ID_Generic
127  Array<Channel> m_genericChannels; // only if m_id >= ID_Generic
128 };
129 
130 //------------------------------------------------------------------------
131 
132 class Image
133 {
134 public:
135  Image (const Vec2i& size, const ImageFormat& format = ImageFormat::ABGR_8888) { init(size, format); createBuffer(); }
136  Image (const Vec2i& size, const ImageFormat& format, void* ptr, S64 stride);
137  Image (const Vec2i& size, const ImageFormat& format, Buffer& buffer, S64 ofs, S64 stride);
138  Image (const Image& other) { init(other.getSize(), other.getFormat()); createBuffer(); set(other); }
139  ~Image (void);
140 
141  bool contains (const Vec2i& pos, const Vec2i& size) const { return (pos.x >= 0 && pos.y >= 0 && pos.x + size.x <= m_size.x && pos.y + size.y <= m_size.y); }
142 
143  const Vec2i& getSize (void) const { return m_size; }
144  const ImageFormat& getFormat (void) const { return m_format; }
145  int getBPP (void) const { return m_format.getBPP(); }
146  S64 getStride (void) const { return m_stride; }
147 
148  Buffer& getBuffer (void) const { return *m_buffer; }
149  S64 getOffset (const Vec2i& pos = 0) const { FW_ASSERT(contains(pos, 0)); return m_offset + pos.x * getBPP() + pos.y * getStride(); }
150  const U8* getPtr (const Vec2i& pos = 0) const { return (const U8*)m_buffer->getPtr(getOffset(pos)); }
151  U8* getMutablePtr (const Vec2i& pos = 0) { return (U8*)m_buffer->getMutablePtr(getOffset(pos)); }
152 
153  void read (const ImageFormat& format, void* ptr, S64 stride, const Vec2i& pos, const Vec2i& size) const { FW_ASSERT(contains(pos, size)); blit(format, (U8*)ptr, stride, getFormat(), getPtr(pos), getStride(), size); }
154  void read (const ImageFormat& format, void* ptr, S64 stride) const { blit(format, (U8*)ptr, stride, getFormat(), getPtr(), getStride(), getSize()); }
155  void write (const ImageFormat& format, const void* ptr, S64 stride, const Vec2i& pos, const Vec2i& size) { FW_ASSERT(contains(pos, size)); blit(getFormat(), getMutablePtr(pos), getStride(), format, (const U8*)ptr, stride, size); }
156  void write (const ImageFormat& format, const void* ptr, S64 stride) { blit(getFormat(), getMutablePtr(), getStride(), format, (const U8*)ptr, stride, getSize()); }
157  void set (const Vec2i& dstPos, const Image& src, const Vec2i& srcPos, const Vec2i& size) { FW_ASSERT(contains(dstPos, size) && src.contains(srcPos, size)); blit(getFormat(), getMutablePtr(dstPos), getStride(), src.getFormat(), src.getPtr(srcPos), src.getStride(), size); }
158  void set (const Image& src) { blit(getFormat(), getMutablePtr(), getStride(), src.getFormat(), src.getPtr(), src.getStride(), Vec2i(min(getSize().x, src.getSize().x), min(getSize().y, src.getSize().y))); }
159 
160  void clear (U32 abgr = 0) { if (m_size.min() != 0) setABGR(0, abgr); replicatePixel(); }
161  void clear (const Vec4f& color) { if (m_size.min() != 0) setVec4f(0, color); replicatePixel(); }
162  U32 getABGR (const Vec2i& pos) const;
163  void setABGR (const Vec2i& pos, U32 value);
164  Vec4f getVec4f (const Vec2i& pos) const;
165  void setVec4f (const Vec2i& pos, const Vec4f& value);
166 
167  void getChannels (F32* values, const Vec2i& pos, int first, int num) const { getChannels(values, getPtr(pos), getFormat(), first, num); }
168  void getChannels (F32* values, const Vec2i& pos) const { getChannels(values, getPtr(pos), getFormat(), 0, getFormat().getNumChannels()); }
169  const Array<F32>& getChannels (const Vec2i& pos) const { getChannels(m_channelTmp.getPtr(), getPtr(pos), getFormat(), 0, getFormat().getNumChannels()); return m_channelTmp; }
170  F32 getChannel (const Vec2i& pos, int idx) const { F32 res; getChannels(&res, getPtr(pos), getFormat(), idx, 1); return res; }
171  void setChannels (const Vec2i& pos, const F32* values, int first, int num) { setChannels(getMutablePtr(pos), values, getFormat(), first, num); }
172  void setChannels (const Vec2i& pos, const F32* values) { setChannels(getMutablePtr(pos), values, getFormat(), 0, getFormat().getNumChannels()); }
173  void setChannel (const Vec2i& pos, int idx, F32 value) { setChannels(getMutablePtr(pos), &value, getFormat(), idx, 1); }
174 
175  void flipX (void);
176  void flipY (void);
177 
178  GLuint createGLTexture (ImageFormat::ID desiredFormat = ImageFormat::ID_Max, bool generateMipmaps = true) const;
179 
180  ImageFormat chooseCudaFormat(CUDA_ARRAY_DESCRIPTOR* desc = NULL, ImageFormat::ID desiredFormat = ImageFormat::ID_Max) const;
181  CUarray createCudaArray (ImageFormat::ID desiredFormat = ImageFormat::ID_Max) const;
182 
183  Image* downscale2x (void) const; // Returns ImageFormat::ABGR_8888, or NULL if size <= 1x1.
184 
185  Image& operator= (const Image& other) { if (&other != this) set(other); return *this; }
186 
187 private:
188  void init (const Vec2i& size, const ImageFormat& format);
189  void createBuffer (void);
190  void replicatePixel (void);
191 
192  static bool canBlitDirectly (const ImageFormat& format);
193  static bool canBlitThruABGR (const ImageFormat& format);
194 
195  static void blit (const ImageFormat& dstFormat, U8* dstPtr, S64 dstStride,
196  const ImageFormat& srcFormat, const U8* srcPtr, S64 srcStride,
197  const Vec2i& size);
198 
199  static void blitToABGR (U32* dstPtr, const ImageFormat& srcFormat, const U8* srcPtr, int width);
200  static void blitFromABGR (const ImageFormat& dstFormat, U8* dstPtr, const U32* srcPtr, int width);
201 
202  static void getChannels (F32* values, const U8* pixelPtr, const ImageFormat& format, int first, int num);
203  static void setChannels (U8* pixelPtr, const F32* values, const ImageFormat& format, int first, int num);
204 
205 private:
206  Vec2i m_size;
207  ImageFormat m_format;
208  S64 m_stride;
209  Buffer* m_buffer;
210  bool m_ownBuffer;
211  S64 m_offset;
212 
213  mutable Array<F32> m_channelTmp;
214 };
215 
216 //------------------------------------------------------------------------
217 
218 Image* importImage (const String& fileName);
219 void exportImage (const String& fileName, const Image* image);
220 String getImageImportFilter (void);
221 String getImageExportFilter (void);
222 
223 //------------------------------------------------------------------------
224 }
void exportImage(const String &fileName, const Image *image)
Definition: Image.cpp:1069
bool operator==(const ImageFormat &other) const
Definition: Image.cpp:226
#define NULL
Definition: Defs.hpp:39
void addChannel(const Channel &channel)
Definition: Image.cpp:168
F32 getChannel(const Vec2i &pos, int idx) const
Definition: Image.hpp:170
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer
Definition: DLLImports.inl:315
void clear(U32 abgr=0)
Definition: Image.hpp:160
int getNumChannels(void) const
Definition: Image.cpp:119
ImageFormat(const ImageFormat &other)
Definition: Image.hpp:101
const StaticFormat * getStaticFormat(void) const
Definition: Image.cpp:102
void ** ptr
Definition: DLLImports.cpp:74
Image * importImage(const String &fileName)
Definition: Image.cpp:1051
void clear(void)
Definition: Image.cpp:159
void write(const ImageFormat &format, const void *ptr, S64 stride, const Vec2i &pos, const Vec2i &size)
Definition: Image.hpp:155
void setChannels(const Vec2i &pos, const F32 *values)
Definition: Image.hpp:172
~Image(void)
Definition: Image.cpp:274
void clear(const Vec4f &color)
Definition: Image.hpp:161
U32 getABGR(const Vec2i &pos) const
Definition: Image.cpp:282
CUarray createCudaArray(ImageFormat::ID desiredFormat=ImageFormat::ID_Max) const
Definition: Image.cpp:608
ID getID(void) const
Definition: Image.cpp:78
Image(const Vec2i &size, const ImageFormat &format=ImageFormat::ABGR_8888)
Definition: Image.hpp:135
const U8 * getPtr(const Vec2i &pos=0) const
Definition: Image.hpp:150
ID getGLFormat(void) const
Definition: Image.cpp:184
const U8 * getPtr(S64 ofs=0)
Definition: Buffer.hpp:106
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat x
Definition: DLLImports.inl:363
void write(const ImageFormat &format, const void *ptr, S64 stride)
Definition: Image.hpp:156
~ImageFormat(void)
Definition: Image.hpp:102
Image & operator=(const Image &other)
Definition: Image.hpp:185
void getChannels(F32 *values, const Vec2i &pos) const
Definition: Image.hpp:168
float F32
Definition: Defs.hpp:89
void set(const Image &src)
Definition: Image.hpp:158
GLuint createGLTexture(ImageFormat::ID desiredFormat=ImageFormat::ID_Max, bool generateMipmaps=true) const
Definition: Image.cpp:475
void getChannels(F32 *values, const Vec2i &pos, int first, int num) const
Definition: Image.hpp:167
bool operator!=(const ImageFormat &other) const
Definition: Image.hpp:120
void set(const Vec2i &dstPos, const Image &src, const Vec2i &srcPos, const Vec2i &size)
Definition: Image.hpp:157
S64 getOffset(const Vec2i &pos=0) const
Definition: Image.hpp:149
Image * downscale2x(void) const
Definition: Image.cpp:673
Image(const Image &other)
Definition: Image.hpp:138
U8 * getMutablePtr(S64 ofs=0)
Definition: Buffer.hpp:110
void setVec4f(const Vec2i &pos, const Vec4f &value)
Definition: Image.cpp:406
void setABGR(const Vec2i &pos, U32 value)
Definition: Image.cpp:329
FW_CUDA_FUNC T min(const VectorBase< T, L, S > &v)
Definition: Math.hpp:461
Vec4f getVec4f(const Vec2i &pos) const
Definition: Image.cpp:369
bool contains(const Vec2i &pos, const Vec2i &size) const
Definition: Image.hpp:141
ChannelType type
Definition: Image.hpp:79
ImageFormat(ID id)
Definition: Image.hpp:100
#define FW_ASSERT(X)
Definition: Defs.hpp:67
signed int S32
Definition: Defs.hpp:88
void flipY(void)
Definition: Image.cpp:459
U8 * getMutablePtr(const Vec2i &pos=0)
Definition: Image.hpp:151
ImageFormat & operator=(const ImageFormat &other)
Definition: Image.hpp:118
const Channel & getChannel(int idx) const
Definition: Image.cpp:127
signed __int64 S64
Definition: Defs.hpp:98
unsigned int U32
Definition: Defs.hpp:85
ImageFormat chooseCudaFormat(CUDA_ARRAY_DESCRIPTOR *desc=NULL, ImageFormat::ID desiredFormat=ImageFormat::ID_Max) const
Definition: Image.cpp:531
Buffer & getBuffer(void) const
Definition: Image.hpp:148
void flipX(void)
Definition: Image.cpp:440
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei stride
Definition: DLLImports.inl:365
const Vec2i & getSize(void) const
Definition: Image.hpp:143
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value
Definition: DLLImports.inl:84
const ImageFormat & getFormat(void) const
Definition: Image.hpp:144
S64 getStride(void) const
Definition: Image.hpp:146
String getImageImportFilter(void)
Definition: Image.cpp:1088
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: DLLImports.inl:349
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei width
Definition: DLLImports.inl:347
void set(const ImageFormat &other)
Definition: Image.cpp:147
unsigned char U8
Definition: Defs.hpp:83
void read(const ImageFormat &format, void *ptr, S64 stride) const
Definition: Image.hpp:154
int getBPP(void) const
Definition: Image.hpp:145
void read(const ImageFormat &format, void *ptr, S64 stride, const Vec2i &pos, const Vec2i &size) const
Definition: Image.hpp:153
ImageFormat(void)
Definition: Image.hpp:99
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type
Definition: DLLImports.inl:323
void setChannels(const Vec2i &pos, const F32 *values, int first, int num)
Definition: Image.hpp:171
const T * getPtr(S idx=0) const
Definition: Array.hpp:202
int findChannel(ChannelType type) const
Definition: Image.cpp:136
ChannelFormat format
Definition: Image.hpp:80
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void * image
Definition: DLLImports.inl:60
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr size
Definition: DLLImports.inl:319
const Array< F32 > & getChannels(const Vec2i &pos) const
Definition: Image.hpp:169
int getBPP(void) const
Definition: Image.cpp:111
FW_CUDA_FUNC T min(void) const
Definition: Math.hpp:146
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint color
Definition: DLLImports.inl:367
void setChannel(const Vec2i &pos, int idx, F32 value)
Definition: Image.hpp:173
bool hasChannel(ChannelType type) const
Definition: Image.hpp:110
String getImageExportFilter(void)
Definition: Image.cpp:1100