NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
File.cpp
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 #include "io/File.hpp"
29 
30 using namespace FW;
31 
32 //------------------------------------------------------------------------
33 
35 {
36  wait();
37  CloseHandle(m_overlapped.hEvent);
38 }
39 
40 //------------------------------------------------------------------------
41 
43 {
44  if (m_done)
45  return true;
46 
47  if (!HasOverlappedIoCompleted(&m_overlapped))
48  return false;
49 
50  wait();
51  return true;
52 }
53 
54 //------------------------------------------------------------------------
55 
57 {
58  if (m_done)
59  return;
60 
61  DWORD numBytes = 0;
62  if (!GetOverlappedResult(m_fileHandle, &m_overlapped, &numBytes, TRUE))
63  {
64  setError("GetOverlappedResult() failed!");
65  failed();
66  }
67  else if ((int)numBytes != m_expectedBytes)
68  {
69  setError("GetOverlappedResult() returned %d bytes, expected %d!", numBytes, m_expectedBytes);
70  failed();
71  }
72  else
73  {
74  done();
75  }
76 }
77 
78 //------------------------------------------------------------------------
79 
80 File::AsyncOp::AsyncOp(HANDLE fileHandle)
81 : m_offset (0),
82  m_numBytes (0),
83  m_expectedBytes (0),
84  m_userBytes (0),
85  m_readPtr (NULL),
86  m_writePtr (NULL),
87 
88  m_copyBytes (0),
89  m_copySrc (NULL),
90  m_copyDst (NULL),
91  m_freePtr (NULL),
92 
93  m_fileHandle (fileHandle),
94  m_done (false),
95  m_failed (false)
96 {
97  memset(&m_overlapped, 0, sizeof(m_overlapped));
98 
99  // Create event object. Without one, GetOverlappedResult()
100  // occassionally fails to wait long enough on WinXP.
101 
102  m_overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
103  if (!m_overlapped.hEvent)
104  failWin32Error("CreateEvent");
105 }
106 
107 //------------------------------------------------------------------------
108 
109 void File::AsyncOp::done(void)
110 {
111  if (m_done)
112  return;
113  m_done = true;
114 
115  if (m_copyBytes && !m_failed)
116  memcpy(m_copyDst, m_copySrc, m_copyBytes);
117  if (m_freePtr)
118  free(m_freePtr);
119 }
120 
121 //------------------------------------------------------------------------
122 
123 File::File(const String& name, Mode mode, bool disableCache)
124 : m_name (name),
125  m_mode (mode),
126  m_disableCache (disableCache),
127  m_handle (NULL),
128  m_align (1),
129 
130  m_size (0),
131  m_offset (0)
132 {
133  static bool privilegeSet = false;
134  if (!privilegeSet)
135  {
136  privilegeSet = true;
137 
138  HANDLE token;
139  if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token))
140  {
141  TOKEN_PRIVILEGES tp;
142  tp.PrivilegeCount = 1;
143  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
144 
145  if (LookupPrivilegeValue(NULL, SE_MANAGE_VOLUME_NAME, &tp.Privileges[0].Luid))
146  AdjustTokenPrivileges(token, FALSE, &tp, 0, NULL, NULL);
147 
148  CloseHandle(token);
149  }
150  }
151 
152  // Select mode.
153 
154  const char* modeName;
155  DWORD access;
156  DWORD creation;
157 
158  switch (mode)
159  {
160  case Read: modeName = "read"; access = GENERIC_READ; creation = OPEN_EXISTING; break;
161  case Create: modeName = "create"; access = GENERIC_READ | GENERIC_WRITE; creation = CREATE_ALWAYS; break;
162  case Modify: modeName = "modify"; access = GENERIC_READ | GENERIC_WRITE; creation = OPEN_ALWAYS; break;
163  default: FW_ASSERT(false); return;
164  }
165 
166  // Open.
167 
168  DWORD flags = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED;
169  if (disableCache)
170  flags |= FILE_FLAG_NO_BUFFERING;
171 
172  m_handle = CreateFile(
173  name.getPtr(),
174  access,
175  FILE_SHARE_READ,
176  NULL,
177  creation,
178  flags,
179  NULL);
180 
181  if (m_handle == INVALID_HANDLE_VALUE)
182  setError("Cannot open file '%s' for %s!", m_name.getPtr(), modeName);
183 
184  // Get size.
185 
186  LARGE_INTEGER size;
187  size.QuadPart = 0;
188  if (m_handle && !GetFileSizeEx(m_handle, &size))
189  setError("GetFileSizeEx() failed on '%s'!", m_name.getPtr());
190  m_size = size.QuadPart;
191  m_actualSize = size.QuadPart;
192 
193  // Get alignment.
194 
195  if (disableCache)
196  {
197  DWORD bytesPerSector = 1;
198  if (!GetDiskFreeSpace(NULL, NULL, &bytesPerSector, NULL, NULL))
199  failWin32Error("GetDiskFreeSpace");
200  m_align = bytesPerSector;
201  }
202  FW_ASSERT((m_align & (m_align - 1)) == 0);
203 }
204 
205 //------------------------------------------------------------------------
206 
208 {
209  if (!m_handle)
210  return;
211 
212  fixSize();
213  CancelIo(m_handle);
214  CloseHandle(m_handle);
215 }
216 
217 //------------------------------------------------------------------------
218 
219 bool File::checkWritable(void) const
220 {
221  if (m_mode != File::Read)
222  return true;
223  setError("File '%s' was opened as read-only!", m_name.getPtr());
224  return false;
225 }
226 
227 //------------------------------------------------------------------------
228 
229 void File::seek(S64 ofs)
230 {
231  if (ofs >= 0 && ofs <= m_size)
232  m_offset = ofs;
233  else
234  setError("Tried to seek outside '%s'!", m_name.getPtr());
235 }
236 
237 //------------------------------------------------------------------------
238 
240 {
241  if (!checkWritable() || !m_handle)
242  return;
243  if (size >= 0)
244  m_size = size;
245  else
246  setError("Tried to set negative size for '%s'!", m_name.getPtr());
247 }
248 
249 //------------------------------------------------------------------------
250 
252 {
253  if (m_mode == Read || !m_handle || m_actualSize >= size)
254  return;
255 
256  LARGE_INTEGER ofs;
257  ofs.QuadPart = (size + m_align - 1) & -m_align;
258  if (SetFilePointerEx(m_handle, ofs, NULL, FILE_BEGIN) && SetEndOfFile(m_handle))
259  {
260  SetFileValidData(m_handle, ofs.QuadPart);
261  m_actualSize = ofs.QuadPart;
262  }
263 }
264 
265 //------------------------------------------------------------------------
266 
267 int File::read(void* ptr, int size)
268 {
269  AsyncOp* op = readAsync(ptr, size);
270  op->wait();
271  int numBytes = op->getNumBytes();
272  delete op;
273  return numBytes;
274 }
275 
276 //------------------------------------------------------------------------
277 
278 void File::write(const void* ptr, int size)
279 {
280  delete writeAsync(ptr, size);
281 }
282 
283 //------------------------------------------------------------------------
284 
285 void File::flush(void)
286 {
287  if (m_mode == Read || !m_handle)
288  return;
289 
290  profilePush("Flush file");
291  if (!FlushFileBuffers(m_handle))
292  setError("FlushFileBuffers() failed on '%s'!", m_name.getPtr());
293  profilePop();
294  fixSize();
295 }
296 
297 //------------------------------------------------------------------------
298 
300 {
301  FW_ASSERT(ptr || !size);
302  profilePush("Read file");
303 
304  // Create AsyncOp.
305 
306  AsyncOp* op = new AsyncOp(m_handle);
307  op->m_userBytes = max((int)min((S64)size, m_size - m_offset), 0);
308  if (!m_handle)
309  op->m_userBytes = 0;
310 
311  int mask = m_align - 1;
312  op->m_numBytes = min((op->m_userBytes + mask) & ~mask, max(size, 0));
313 
314  // Aligned => read directly.
315 
316  if (!op->m_numBytes || (((UPTR)ptr & (UPTR)mask) == 0 && (op->m_numBytes & mask) == 0))
317  {
318  op->m_offset = m_offset;
319  op->m_readPtr = ptr;
320  }
321 
322  // Unaligned => read through temporary buffer.
323 
324  else
325  {
326  op->m_offset = m_offset & ~(S64)mask;
327  op->m_numBytes = (((S32)m_offset & mask) + op->m_userBytes + mask) & ~(S64)mask;
328  op->m_readPtr = allocAligned(op->m_freePtr, op->m_numBytes);
329  op->m_copyBytes = op->m_userBytes;
330  op->m_copySrc = (U8*)op->m_readPtr + ((S32)m_offset & mask);
331  op->m_copyDst = ptr;
332  }
333 
334  // Execute the op.
335 
336  op->m_expectedBytes = (S32)min((S64)op->m_numBytes, m_actualSize - op->m_offset);
337  startOp(op);
338  if (!op->hasFailed())
339  m_offset += op->m_userBytes;
340 
341  profilePop();
342  return op;
343 }
344 
345 //------------------------------------------------------------------------
346 
348 {
349  FW_ASSERT(ptr || !size);
350  profilePush("Write file");
351 
352  // Write past the end of file => expand.
353 
354  int mask = m_align - 1;
355  S64 sizeNeeded = (m_offset + size + mask) & ~(S64)mask;
356  if (m_actualSize < sizeNeeded)
357  {
358  if (m_disableCache)
359  allocateSpace(max(sizeNeeded, m_actualSize * MinimumExpandNum / MinimumExpandDenom));
360  m_actualSize = max(m_actualSize, sizeNeeded);
361  }
362 
363  // Create AsyncOp.
364 
365  AsyncOp* op = new AsyncOp(m_handle);
366  op->m_userBytes = size;
367  if (op->m_userBytes < 0 || !checkWritable() || !m_handle)
368  op->m_userBytes = 0;
369 
370  // Aligned => write directly.
371 
372  if (!op->m_userBytes || (((UPTR)ptr & (UPTR)mask) == 0 && (op->m_userBytes & mask) == 0))
373  {
374  op->m_offset = m_offset;
375  op->m_numBytes = op->m_userBytes;
376  op->m_writePtr = ptr;
377  }
378 
379  // Unaligned => write through temporary buffer.
380 
381  else
382  {
383  S64 start = m_offset & ~(S64)mask;
384  S64 end = (m_offset + op->m_userBytes + mask) & ~(S64)mask;
385  op->m_offset = start;
386  op->m_numBytes = (S32)(end - start);
387  U8* buffer = (U8*)allocAligned(op->m_freePtr, op->m_numBytes);
388  op->m_writePtr = buffer;
389 
390  // Read head.
391 
392  if (start != m_offset && start < m_size)
393  if (!readAligned(start, buffer, m_align))
394  op->failed();
395 
396  // Read tail.
397 
398  if (end != m_offset + op->m_userBytes && end - m_align < m_size && (start == m_offset || end > start + m_align))
399  if (!readAligned(end - m_align, buffer + end - start - m_align, m_align))
400  op->failed();
401 
402  // Copy body.
403 
404  memcpy(buffer + m_offset - start, ptr, op->m_userBytes);
405  }
406 
407  op->m_expectedBytes = op->m_numBytes;
408  startOp(op);
409  if (!op->hasFailed())
410  {
411  m_offset += op->m_userBytes;
412  m_size = max(m_size, m_offset);
413  }
414 
415  profilePop();
416  return op;
417 }
418 
419 //------------------------------------------------------------------------
420 
421 void File::fixSize(void)
422 {
423  if (m_mode == Read || !m_handle || m_actualSize == m_size)
424  return;
425 
426  // Size is not aligned properly => reopen with buffering.
427 
428  profilePush("Resize file");
429 
430  bool reopen = ((m_size & (m_align - 1)) != 0);
431  if (reopen)
432  {
433  CloseHandle(m_handle);
434  m_handle = CreateFile(
435  m_name.getPtr(),
436  GENERIC_WRITE,
437  FILE_SHARE_READ,
438  NULL,
439  OPEN_EXISTING,
440  FILE_ATTRIBUTE_NORMAL,
441  NULL);
442 
443  if (!m_handle)
444  setError("CreateFile() failed on '%s'!", m_name.getPtr());
445  }
446 
447  // Set size.
448 
449  LARGE_INTEGER ofs;
450  ofs.QuadPart = m_size;
451  if (!SetFilePointerEx(m_handle, ofs, NULL, FILE_BEGIN))
452  setError("SetFilePointerEx() failed on '%s'!", m_name.getPtr());
453  else if (!SetEndOfFile(m_handle))
454  setError("SetEndOfFile() failed on '%s'!", m_name.getPtr());
455  else
456  m_actualSize = m_size;
457 
458  // File was reopened => reopen without buffering.
459 
460  if (reopen)
461  {
462  CloseHandle(m_handle);
463  m_handle = CreateFile(
464  m_name.getPtr(),
465  GENERIC_READ | GENERIC_WRITE,
466  FILE_SHARE_READ,
467  NULL,
468  OPEN_EXISTING,
469  FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING,
470  NULL);
471 
472  if (!m_handle)
473  setError("CreateFile() failed on '%s'!", m_name.getPtr());
474  }
475 
476  profilePop();
477 }
478 
479 //------------------------------------------------------------------------
480 
481 void File::startOp(AsyncOp* op)
482 {
483  // Backup parameters.
484 
485  FW_ASSERT(op);
486  S64 offset = op->m_offset;
487  S32 numBytes = op->m_numBytes;
488  S32 expectedBytes = op->m_expectedBytes;
489  U8* readPtr = (U8*)op->m_readPtr;
490  U8* writePtr = (U8*)op->m_writePtr;
491 
492  // Nothing to do => skip.
493 
494  if (!numBytes)
495  {
496  op->done();
497  return;
498  }
499 
500  // Loop over blocks corresponding to MaxBytesPerSysCall.
501  // Only the last one is executed asynchronously.
502 
503  S32 pos = 0;
504  for (;;)
505  {
506  // Setup AsyncOp.
507 
508  AsyncOp* blockOp = op;
509  if (pos + MaxBytesPerSysCall < numBytes)
510  blockOp = new AsyncOp(m_handle);
511 
512  blockOp->m_offset = offset + pos;
513  blockOp->m_numBytes = min(numBytes - pos, (S32)MaxBytesPerSysCall);
514  blockOp->m_expectedBytes = min(expectedBytes - pos, blockOp->m_numBytes);
515  blockOp->m_readPtr = (readPtr) ? readPtr + pos : NULL;
516  blockOp->m_writePtr = (writePtr) ? writePtr + pos : NULL;
517 
518  // Queue the op.
519 
520  BOOL ok;
521  const char* funcName;
522  blockOp->m_overlapped.Offset = (DWORD)blockOp->m_offset;
523  blockOp->m_overlapped.OffsetHigh = (DWORD)(blockOp->m_offset >> 32);
524 
525  if (op->m_readPtr)
526  {
527  ok = ReadFile(m_handle, blockOp->m_readPtr, blockOp->m_numBytes, NULL, &blockOp->m_overlapped);
528  funcName = "ReadFile";
529  }
530  else
531  {
532  ok = WriteFile(m_handle, blockOp->m_writePtr, blockOp->m_numBytes, NULL, &blockOp->m_overlapped);
533  funcName = "WriteFile";
534  }
535 
536  // Check result.
537 
538  if (ok)
539  blockOp->done();
540  else if (GetLastError() != ERROR_IO_PENDING)
541  {
542  setError("%s() failed on '%s'!", funcName, m_name.getPtr());
543  blockOp->failed();
544  }
545 
546  // Last op => done.
547 
548  if (blockOp == op)
549  break;
550 
551  // Wait for the op to finish.
552 
553  pos += blockOp->m_numBytes;
554  blockOp->wait();
555  bool failed = blockOp->hasFailed();
556  delete blockOp;
557 
558  if (failed)
559  {
560  op->failed();
561  break;
562  }
563  }
564 }
565 
566 //------------------------------------------------------------------------
567 
568 void* File::allocAligned(void*& base, int size)
569 {
570  base = (U8*)malloc(size + m_align - 1);
571  U8* ptr = (U8*)base + m_align - 1;
572  ptr -= (UPTR)ptr & (UPTR)(m_align - 1);
573  return ptr;
574 }
575 
576 //------------------------------------------------------------------------
577 
578 bool File::readAligned(S64 ofs, void* ptr, int size)
579 {
580  AsyncOp* op = new AsyncOp(m_handle);
581  op->m_offset = ofs;
582  op->m_numBytes = size;
583  op->m_readPtr = ptr;
584 
585  op->m_expectedBytes = (S32)min((S64)size, m_actualSize - ofs);
586  startOp(op);
587  op->wait();
588  bool ok = (!op->hasFailed());
589  delete op;
590  return ok;
591 }
592 
593 //------------------------------------------------------------------------
void seek(S64 ofs)
Definition: File.cpp:229
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 const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum GLint GLuint mask
Definition: DLLImports.inl:400
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 offset
Definition: DLLImports.inl:84
#define NULL
Definition: Defs.hpp:39
virtual int read(void *ptr, int size)
Definition: File.cpp:267
const char * getPtr(void) const
Definition: String.hpp:51
__w64 U32 UPTR
Definition: Defs.hpp:106
void * malloc(size_t size)
Definition: Defs.cpp:120
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
int getNumBytes(void) const
Definition: File.hpp:64
const char * name
Definition: DLLImports.cpp:42
void setError(const char *fmt,...)
Definition: Defs.cpp:253
void ** ptr
Definition: DLLImports.cpp:74
bool hasFailed(void) const
Definition: File.hpp:62
void failWin32Error(const char *funcName)
Definition: Defs.cpp:345
AsyncOp * writeAsync(const void *ptr, int size)
Definition: File.cpp:347
virtual void flush(void)
Definition: File.cpp:285
File(const String &name, Mode mode, bool disableCache=false)
Definition: File.cpp:123
AsyncOp * readAsync(void *ptr, int size)
Definition: File.cpp:299
bool isDone(void)
Definition: File.cpp:42
bool checkWritable(void) const
Definition: File.cpp:219
void free(void *ptr)
Definition: Defs.cpp:164
FW_CUDA_FUNC T min(const VectorBase< T, L, S > &v)
Definition: Math.hpp:461
void wait(void)
Definition: File.cpp:56
FW_CUDA_FUNC T max(const VectorBase< T, L, S > &v)
Definition: Math.hpp:462
void allocateSpace(S64 size)
Definition: File.cpp:251
#define FW_ASSERT(X)
Definition: Defs.hpp:67
signed int S32
Definition: Defs.hpp:88
~AsyncOp(void)
Definition: File.cpp:34
signed __int64 S64
Definition: Defs.hpp:98
void setSize(S64 size)
Definition: File.cpp:239
virtual void write(const void *ptr, int size)
Definition: File.cpp:278
unsigned char U8
Definition: Defs.hpp:83
virtual ~File(void)
Definition: File.cpp:207
void profilePop(void)
Definition: Defs.cpp:602
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
void profilePush(const char *id)
Definition: Defs.cpp:544