NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Defs.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 "base/Defs.hpp"
29 #include "base/String.hpp"
30 #include "base/Thread.hpp"
31 #include "base/Timer.hpp"
32 #include "gui/Window.hpp"
33 #include "io/File.hpp"
34 
35 #include <stdlib.h>
36 #include <stdio.h>
37 #include <stdarg.h>
38 #include <malloc.h>
39 
40 using namespace FW;
41 
42 //------------------------------------------------------------------------
43 
44 #define FW_MEM_DEBUG 0
45 
46 //------------------------------------------------------------------------
47 
49 {
52  size_t size;
53  const char* ownerID;
54 };
55 
56 //------------------------------------------------------------------------
57 
59 {
64 };
65 
66 //------------------------------------------------------------------------
67 // Hack to guard against the fact that s_lock may be accessed by malloc()
68 // and free() before it has been initialized and/or after it has been
69 // destroyed.
70 
71 class SafeSpinlock : public Spinlock
72 {
73 public:
74  SafeSpinlock (void) { s_inited = true; }
75  ~SafeSpinlock (void) { s_inited = false; }
76 
77  void enter (void) { if (s_inited) Spinlock::enter(); }
78  void leave (void) { if (s_inited) Spinlock::leave(); }
79 
80 private:
81  static bool s_inited;
82 };
83 
84 bool SafeSpinlock::s_inited = false;
85 
86 //------------------------------------------------------------------------
87 
88 static SafeSpinlock s_lock;
89 static size_t s_memoryUsed = 0;
90 static bool s_hasFailed = false;
91 static int s_nestingLevel = 0;
92 static bool s_discardEvents = false;
93 static String s_emptyString;
94 
95 static Array<File*> s_logFiles;
96 static Array<BufferedOutputStream*> s_logStreams;
97 
98 #if FW_MEM_DEBUG
99 static bool s_memPushingOwner = false;
100 static AllocHeader s_memAllocs = { &s_memAllocs, &s_memAllocs, 0, NULL };
101 static Hash<U32, Array<const char*> > s_memOwnerStacks;
102 #endif
103 
104 static bool s_profileStarted = false;
105 static Hash<const char*, S32> s_profilePointerToToken;
106 static Hash<String, S32> s_profileStringToToken;
107 static Hash<Vec2i, S32> s_profileTimerHash; // (parentTimer, childToken) => childTimer
108 static Array<ProfileTimer> s_profileTimers;
109 static Array<S32> s_profileStack;
110 
111 //------------------------------------------------------------------------
112 
113 static void deinitString(void* str)
114 {
115  delete (String*)str;
116 }
117 
118 //------------------------------------------------------------------------
119 
120 void* FW::malloc(size_t size)
121 {
122  FW_ASSERT(size >= 0);
123 
124 #if FW_MEM_DEBUG
125  s_lock.enter();
126 
127  AllocHeader* alloc = (AllocHeader*)::malloc(sizeof(AllocHeader) + size);
128  if (!alloc)
129  fail("Out of memory!");
130 
131  void* ptr = alloc + 1;
132  alloc->prev = s_memAllocs.prev;
133  alloc->next = &s_memAllocs;
134  alloc->prev->next = alloc;
135  alloc->next->prev = alloc;
136  alloc->size = size;
137  alloc->ownerID = "Uncategorized";
138  s_memoryUsed += size;
139 
140  if (!s_memPushingOwner)
141  {
142  U32 threadID = Thread::getID();
143  if (s_memOwnerStacks.contains(threadID) && s_memOwnerStacks[threadID].getSize())
144  alloc->ownerID = s_memOwnerStacks[threadID].getLast();
145  }
146 
147  s_lock.leave();
148 
149 #else
150  void* ptr = ::malloc(size);
151  if (!ptr)
152  fail("Out of memory!");
153 
154  s_lock.enter();
155  s_memoryUsed += _msize(ptr);
156  s_lock.leave();
157 #endif
158 
159  return ptr;
160 }
161 
162 //------------------------------------------------------------------------
163 
164 void FW::free(void* ptr)
165 {
166  if (!ptr)
167  return;
168 
169 #if FW_MEM_DEBUG
170  s_lock.enter();
171 
172  AllocHeader* alloc = (AllocHeader*)ptr - 1;
173  alloc->prev->next = alloc->next;
174  alloc->next->prev = alloc->prev;
175  s_memoryUsed -= alloc->size;
176  ::free(alloc);
177 
178  s_lock.leave();
179 
180 #else
181  s_lock.enter();
182  s_memoryUsed -= _msize(ptr);
183  s_lock.leave();
184 
185  ::free(ptr);
186 #endif
187 }
188 
189 //------------------------------------------------------------------------
190 
191 void* FW::realloc(void* ptr, size_t size)
192 {
193  FW_ASSERT(size >= 0);
194 
195  if (!ptr)
196  return FW::malloc(size);
197 
198  if (!size)
199  {
200  FW::free(ptr);
201  return NULL;
202  }
203 
204 #if FW_MEM_DEBUG
205  void* newPtr = FW::malloc(size);
206  memcpy(newPtr, ptr, min(size, ((AllocHeader*)ptr - 1)->size));
207  FW::free(ptr);
208 
209 #else
210  size_t oldSize = _msize(ptr);
211  void* newPtr = ::realloc(ptr, size);
212  if (!newPtr)
213  fail("Out of memory!");
214 
215  s_lock.enter();
216  s_memoryUsed += _msize(newPtr) - oldSize;
217  s_lock.leave();
218 #endif
219 
220  return newPtr;
221 }
222 
223 //------------------------------------------------------------------------
224 
225 void FW::printf(const char* fmt, ...)
226 {
227  s_lock.enter();
228  va_list args;
229  va_start(args, fmt);
230 
231  vprintf(fmt, args);
232  for (int i = 0; i < s_logFiles.getSize(); i++)
233  s_logStreams[i]->writefv(fmt, args);
234 
235  va_end(args);
236  s_lock.leave();
237 }
238 
239 //------------------------------------------------------------------------
240 
241 String FW::sprintf(const char* fmt, ...)
242 {
243  String str;
244  va_list args;
245  va_start(args, fmt);
246  str.setfv(fmt, args);
247  va_end(args);
248  return str;
249 }
250 
251 //------------------------------------------------------------------------
252 
253 void FW::setError(const char* fmt, ...)
254 {
255  if (hasError())
256  return;
257 
258  String* str = new String;
259  va_list args;
260  va_start(args, fmt);
261  str->setfv(fmt, args);
262  va_end(args);
263 
264  Thread::getCurrent()->setUserData("error", str, deinitString);
265 }
266 
267 //------------------------------------------------------------------------
268 
270 {
271  String old = getError();
272  Thread::getCurrent()->setUserData("error", NULL);
273  return old;
274 }
275 
276 //------------------------------------------------------------------------
277 
278 bool FW::restoreError(const String& old)
279 {
280  bool had = hasError();
281  Thread::getCurrent()->setUserData("error",
282  (old.getLength()) ? new String(old) : NULL,
283  (old.getLength()) ? deinitString : NULL);
284  return had;
285 }
286 
287 //------------------------------------------------------------------------
288 
289 bool FW::hasError(void)
290 {
291  return (Thread::getCurrent()->getUserData("error") != NULL);
292 }
293 
294 //------------------------------------------------------------------------
295 
296 const String& FW::getError(void)
297 {
298  String* str = (String*)Thread::getCurrent()->getUserData("error");
299  return (str) ? *str : s_emptyString;
300 }
301 
302 //------------------------------------------------------------------------
303 
304 void FW::fail(const char* fmt, ...)
305 {
306  // Fail only once.
307 
308  s_lock.enter();
309  bool alreadyFailed = s_hasFailed;
310  s_hasFailed = true;
311  s_lock.leave();
312  if (alreadyFailed)
313  return;
314 
315  // Print message.
316 
317  String tmp;
318  va_list args;
319  va_start(args, fmt);
320  tmp.setfv(fmt, args);
321  va_end(args);
322  printf("\n%s\n", tmp.getPtr());
323 
324  // Try to prevent any user code from being executed.
325 
327  setDiscardEvents(true);
328 
329  // Display modal dialog.
330 
331  MessageBox(NULL, tmp.getPtr(), "Fatal error", MB_OK);
332 
333  // Running under a debugger => break here.
334 
335  if (IsDebuggerPresent())
336  __debugbreak();
337 
338  // Kill the app.
339 
340  FatalExit(1);
341 }
342 
343 //------------------------------------------------------------------------
344 
345 void FW::failWin32Error(const char* funcName)
346 {
347  DWORD err = GetLastError();
348  LPTSTR msgBuf = NULL;
349  FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, (LPTSTR)&msgBuf, 0, NULL);
350  String msg(msgBuf);
351  LocalFree(msgBuf);
352 
353  if (msg.getLength())
354  fail("%s() failed!\n%s", funcName, msg.getPtr());
355  else
356  fail("%s() failed!\nError %d\n", funcName, err);
357 }
358 
359 //------------------------------------------------------------------------
360 
361 void FW::failIfError(void)
362 {
363  if (hasError())
364  fail("%s", getError().getPtr());
365 }
366 
367 //------------------------------------------------------------------------
368 
369 int FW::incNestingLevel(int delta)
370 {
371  int old = s_nestingLevel;
372  s_nestingLevel += delta;
373  return old;
374 }
375 
376 //------------------------------------------------------------------------
377 
378 bool FW::setDiscardEvents(bool discard)
379 {
380  bool old = s_discardEvents;
381  s_discardEvents = discard;
382  return old;
383 }
384 
385 //------------------------------------------------------------------------
386 
388 {
389  return s_discardEvents;
390 }
391 
392 //------------------------------------------------------------------------
393 
394 void FW::pushLogFile(const String& name, bool append)
395 {
396  s_lock.enter();
397  File* file = new File(name, (append) ? File::Modify : File::Create);
398  file->seek(file->getSize());
399  s_logFiles.add(file);
400  s_logStreams.add(new BufferedOutputStream(*file, 1024, true, true));
401  s_lock.leave();
402 }
403 
404 //------------------------------------------------------------------------
405 
406 void FW::popLogFile(void)
407 {
408  s_lock.enter();
409  if (s_logFiles.getSize())
410  {
411  s_logStreams.getLast()->flush();
412  delete s_logFiles.removeLast();
413  delete s_logStreams.removeLast();
414  if (!s_logFiles.getSize())
415  {
416  s_logFiles.reset();
417  s_logStreams.reset();
418  }
419  }
420  s_lock.leave();
421 }
422 
423 //------------------------------------------------------------------------
424 
425 bool FW::hasLogFile(void)
426 {
427  return (s_logFiles.getSize() != 0);
428 }
429 
430 //------------------------------------------------------------------------
431 
432 size_t FW::getMemoryUsed(void)
433 {
434  return s_memoryUsed;
435 }
436 
437 //------------------------------------------------------------------------
438 
439 void FW::pushMemOwner(const char* id)
440 {
441 #if !FW_MEM_DEBUG
442  FW_UNREF(id);
443 #else
444  s_lock.enter();
445  s_memPushingOwner = true;
446 
447  U32 threadID = Thread::getID();
448  Array<const char*>* stack = s_memOwnerStacks.search(threadID);
449  if (!stack)
450  {
451  stack = &s_memOwnerStacks.add(threadID);
452  stack->clear();
453  }
454  stack->add(id);
455 
456  s_memPushingOwner = false;
457  s_lock.leave();
458 #endif
459 }
460 
461 //------------------------------------------------------------------------
462 
463 void FW::popMemOwner(void)
464 {
465 #if FW_MEM_DEBUG
466  U32 threadID = Thread::getID();
467  Array<const char*>* stack = s_memOwnerStacks.search(threadID);
468  if (stack)
469  {
470  stack->removeLast();
471  if (!stack->getSize())
472  {
473  s_memOwnerStacks.remove(threadID);
474  if (!s_memOwnerStacks.getSize())
475  s_memOwnerStacks.reset();
476  }
477  }
478 #endif
479 }
480 
481 //------------------------------------------------------------------------
482 
484 {
485 #if FW_MEM_DEBUG
486  // Create snapshot of the alloc list.
487 
488  s_lock.enter();
489  AllocHeader* first = NULL;
490  for (AllocHeader* src = s_memAllocs.next; src != &s_memAllocs; src = src->next)
491  {
492  AllocHeader* alloc = (AllocHeader*)::malloc(sizeof(AllocHeader));
493  *alloc = *src;
494  alloc->next = first;
495  first = alloc;
496  }
497  s_lock.leave();
498 
499  // Calculate total size per owner.
500 
501  Hash<String, S64> owners;
502  for (AllocHeader* alloc = first; alloc;)
503  {
504  if (!owners.contains(alloc->ownerID))
505  owners.add(alloc->ownerID, 0);
506  owners[alloc->ownerID] += alloc->size;
507 
508  AllocHeader* next = alloc->next;
509  ::free(alloc);
510  alloc = next;
511  }
512 
513  // Print.
514 
515  printf("\n");
516  printf("%-32s%.2f\n", "Memory usage / megs", (F32)s_memoryUsed * exp2(-20));
517  for (int slot = owners.firstSlot(); slot != -1; slot = owners.nextSlot(slot))
518  {
519  const HashEntry<String, S64>& entry = owners.getSlot(slot);
520  printf(" %-30s%-12.2f%.0f%%\n",
521  entry.key.getPtr(),
522  (F32)entry.value * exp2(-20),
523  (F32)entry.value / (F32)s_memoryUsed * 100.0f);
524  }
525  printf("\n");
526 #endif
527 }
528 
529 //------------------------------------------------------------------------
530 
532 {
533  if (!Thread::isMain())
534  fail("profileStart() can only be used in the main thread!");
535  if (s_profileStarted)
536  return;
537 
538  s_profileStarted = true;
539  profilePush("Total time spent");
540 }
541 
542 //------------------------------------------------------------------------
543 
544 void FW::profilePush(const char* id)
545 {
546  if (!s_profileStarted)
547  return;
548  if (!Thread::isMain())
549  fail("profilePush() can only be used in the main thread!");
550 
551  // Find or create token.
552 
553  S32 token;
554  S32* found = s_profilePointerToToken.search(id);
555  if (found)
556  token = *found;
557  else
558  {
559  found = s_profileStringToToken.search(id);
560  if (found)
561  token = *found;
562  else
563  {
564  token = s_profileStringToToken.getSize();
565  s_profileStringToToken.add(id, token);
566  }
567  s_profilePointerToToken.add(id, token);
568  }
569 
570  // Find or create timer.
571 
572  Vec2i timerKey(-1, token);
573  if (s_profileStack.getSize())
574  timerKey.x = s_profileStack.getLast();
575 
576  S32 timerIdx;
577  found = s_profileTimerHash.search(timerKey);
578  if (found)
579  timerIdx = *found;
580  else
581  {
582  timerIdx = s_profileTimers.getSize();
583  s_profileTimerHash.add(timerKey, timerIdx);
584  ProfileTimer& timer = s_profileTimers.add();
585  timer.id = id;
586  timer.parent = timerKey.x;
587  if (timerKey.x != -1)
588  s_profileTimers[timerKey.x].children.add(timerIdx);
589  }
590 
591  // Push timer.
592 
593  if (s_profileStack.getSize() == 1)
594  s_profileTimers[s_profileStack[0]].timer.start();
595  s_profileStack.add(timerIdx);
596  if (s_profileStack.getSize() > 1)
597  s_profileTimers[timerIdx].timer.start();
598 }
599 
600 //------------------------------------------------------------------------
601 
602 void FW::profilePop(void)
603 {
604  if (!s_profileStarted || s_profileStack.getSize() == 0)
605  return;
606  if (!Thread::isMain())
607  fail("profilePop() can only be used in the main thread!");
608 
609  if (s_profileStack.getSize() > 1)
610  s_profileTimers[s_profileStack.getLast()].timer.end();
611  s_profileStack.removeLast();
612  if (s_profileStack.getSize() == 1)
613  s_profileTimers[s_profileStack.getLast()].timer.end();
614 }
615 
616 //------------------------------------------------------------------------
617 
618 void FW::profileEnd(bool printResults)
619 {
620  if (!Thread::isMain())
621  fail("profileEnd() can only be used in the main thread!");
622  if (!s_profileStarted)
623  return;
624 
625  // Pop remaining timers.
626 
627  while (s_profileStack.getSize())
628  profilePop();
629 
630  // Recurse and print.
631 
632  if (printResults && s_profileTimers.getSize() > 1)
633  {
634  printf("\n");
635  Array<Vec2i> stack(Vec2i(0, 0));
636  while (stack.getSize())
637  {
638  Vec2i entry = stack.removeLast();
639  const ProfileTimer& timer = s_profileTimers[entry.x];
640  for (int i = timer.children.getSize() - 1; i >= 0; i--)
641  stack.add(Vec2i(timer.children[i], entry.y + 2));
642 
643  printf("%*s%-*s%-8.3f",
644  entry.y, "",
645  32 - entry.y, timer.id.getPtr(),
646  timer.timer.getTotal());
647 
648  printf("%.0f%%\n", timer.timer.getTotal() / s_profileTimers[0].timer.getTotal() * 100.0f);
649  }
650  printf("\n");
651  }
652 
653  // Clean up.
654 
655  s_profileStarted = false;
656  s_profilePointerToToken.reset();
657  s_profileStringToToken.reset();
658  s_profileTimerHash.reset();
659  s_profileTimers.reset();
660  s_profileStack.reset();
661 }
662 
663 //------------------------------------------------------------------------
void seek(S64 ofs)
Definition: File.cpp:229
#define FW_UNREF(X)
Definition: Defs.hpp:78
Definition: Hash.hpp:102
int nextSlot(int slot) const
Definition: Hash.hpp:150
F32 getTotal(void) const
Definition: Timer.hpp:47
bool contains(const K &key) const
Definition: Hash.hpp:123
#define NULL
Definition: Defs.hpp:39
Timer timer
Definition: Defs.cpp:61
const char * getPtr(void) const
Definition: String.hpp:51
static U32 getID(void)
Definition: Thread.cpp:324
bool hasLogFile(void)
Definition: Defs.cpp:425
void * malloc(size_t size)
Definition: Defs.cpp:120
void setUserData(const String &id, void *data, DeinitFunc deinitFunc=NULL)
Definition: Thread.cpp:418
String id
Definition: Defs.cpp:60
const char * name
Definition: DLLImports.cpp:42
void setError(const char *fmt,...)
Definition: Defs.cpp:253
void ** ptr
Definition: DLLImports.cpp:74
AllocHeader * prev
Definition: Defs.cpp:50
String & setfv(const char *fmt, va_list args)
Definition: String.cpp:83
String clearError(void)
Definition: Defs.cpp:269
void popMemOwner(void)
Definition: Defs.cpp:463
void failWin32Error(const char *funcName)
Definition: Defs.cpp:345
static void suspendAll(void)
Definition: Thread.cpp:457
SafeSpinlock(void)
Definition: Defs.cpp:74
bool getDiscardEvents(void)
Definition: Defs.cpp:387
void popLogFile(void)
Definition: Defs.cpp:406
void * getUserData(const String &id)
Definition: Thread.cpp:407
bool restoreError(const String &old)
Definition: Defs.cpp:278
void reset(S size=0)
Definition: Array.hpp:317
const Entry & getSlot(int slot) const
Definition: Hash.hpp:151
float F32
Definition: Defs.hpp:89
const T & getLast(void) const
Definition: Array.hpp:272
S64 getSize(void) const
Definition: File.hpp:104
const char * ownerID
Definition: Defs.cpp:53
void free(void *ptr)
Definition: Defs.cpp:164
size_t getMemoryUsed(void)
Definition: Defs.cpp:432
const String & getError(void)
Definition: Defs.cpp:296
bool setDiscardEvents(bool discard)
Definition: Defs.cpp:378
FW_CUDA_FUNC T min(const VectorBase< T, L, S > &v)
Definition: Math.hpp:461
void pushMemOwner(const char *id)
Definition: Defs.cpp:439
void * realloc(void *ptr, size_t size)
Definition: Defs.cpp:191
#define FW_ASSERT(X)
Definition: Defs.hpp:67
signed int S32
Definition: Defs.hpp:88
void pushLogFile(const String &name, bool append=true)
Definition: Defs.cpp:394
int getLength(void) const
Definition: String.hpp:49
S32 parent
Definition: Defs.cpp:62
AllocHeader * next
Definition: Defs.cpp:51
int incNestingLevel(int delta)
Definition: Defs.cpp:369
String sprintf(const char *fmt,...)
Definition: Defs.cpp:241
size_t size
Definition: Defs.cpp:52
V & add(const K &key, const V &value)
Definition: Hash.hpp:143
F32 exp2(F32 a)
Definition: Math.hpp:87
unsigned int U32
Definition: Defs.hpp:85
bool hasError(void)
Definition: Defs.cpp:289
K key
Definition: Hash.hpp:104
Array< S32 > children
Definition: Defs.cpp:63
void leave(void)
Definition: Defs.cpp:78
void printf(const char *fmt,...)
Definition: Defs.cpp:225
void profileStart(void)
Definition: Defs.cpp:531
void failIfError(void)
Definition: Defs.cpp:361
static Thread * getCurrent(void)
Definition: Thread.cpp:291
V value
Definition: Hash.hpp:105
void fail(const char *fmt,...)
Definition: Defs.cpp:304
void leave(void)
Definition: Thread.cpp:61
void profileEnd(bool printResults=true)
Definition: Defs.cpp:618
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
~SafeSpinlock(void)
Definition: Defs.cpp:75
S32 getSize(void) const
void enter(void)
Definition: Thread.cpp:54
void profilePush(const char *id)
Definition: Defs.cpp:544
void enter(void)
Definition: Defs.cpp:77
int firstSlot(void) const
Definition: Hash.hpp:149
void printMemStats(void)
Definition: Defs.cpp:483
static bool isMain(void)
Definition: Thread.cpp:316