00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined SOCUDACONTEXT_H
00024 #define SOCUDACONTEXT_H
00025
00026 #include <Inventor/devices/SoDeviceContext.h>
00027 #include <Inventor/threads/SbThread.h>
00028 #include <Inventor/threads/SbThreadMutex.h>
00029
00030 #include <Inventor/STL/map>
00031 #include <Inventor/STL/vector>
00032
00033 #include <Inventor/cuda/SoCudaDefs.h>
00034
00035 #ifdef _MSC_VER
00036 #pragma warning( push )
00037 #pragma warning(disable:4251)
00038 #endif
00039
00040 class SoCudaDevice;
00041
00094 class SoCudaContext : public SoDeviceContext
00095 {
00096 public:
00102 SoCudaContext( SoCudaDevice* device );
00103
00111 void bind();
00112
00117 void unbind();
00118
00124 static SoCudaContext* getCurrent();
00125
00126
00130 virtual bool isCurrent() const;
00131
00141 virtual bool isCompatible( SoDeviceContext* context ) const;
00142
00143 private:
00144
00146 virtual ~SoCudaContext();
00147
00149 static void lockListsMutex();
00150
00152 static void unlockListsMutex();
00153
00154 private:
00155
00157 void* m_context;
00158
00160 static SbThreadMutex s_contextsMutex;
00161
00163 static std::map< SbThreadId_t, std::vector< SoCudaContext* > > s_bindedContexts;
00164
00165 private:
00166
00167 virtual SbString getInfos();
00168
00169 };
00170
00171 #ifdef _MSC_VER
00172 #pragma warning( pop )
00173 #endif
00174
00175
00176 #endif //SOCUDACONTEXT_H
00177
00178