00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2021 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 00021 #ifndef SO_GPU_BUFFER_OBJECT_H 00022 #define SO_GPU_BUFFER_OBJECT_H 00023 00024 #include <Inventor/devices/SoBufferObject.h> 00025 #include <Inventor/devices/SoCpuBufferObject.h> 00026 00028 namespace inventor 00029 { 00030 namespace renderer 00031 { 00032 template<typename ResourceType> struct Resource; 00033 } 00034 } 00037 SO_PIMPL_PUBLIC_DECLARATION(SoGpuBufferObject) 00038 00039 00197 class SoGpuBufferObject : public SoBufferObject 00198 { 00199 SO_TYPED_CLASS_HEADER(); 00200 SO_PIMPL_PUBLIC_HEADER(SoGpuBufferObject) 00201 00202 public: 00203 00208 enum BufferAccessFrequency 00209 { 00211 STATIC, 00212 00214 DYNAMIC 00215 }; 00216 00223 enum BufferAccessNature 00224 { 00229 SHARED, 00230 00237 DEVICE 00238 }; 00239 00246 SoGpuBufferObject( BufferAccessFrequency accessFrequency = STATIC, BufferAccessNature accessNature = SHARED ); 00247 00251 virtual bool setSize( size_t size ); 00252 00258 virtual SoBufferObject* createInstance() const; 00259 00263 virtual void clearInstance(); 00264 00266 BufferAccessFrequency getAccessFrequency() const; 00267 00269 BufferAccessNature getAccessNature() const; 00270 00271 private: 00272 00273 void copyToCpuBuffer(SoCpuBufferObject* targetBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL); 00274 00275 private: 00280 virtual ~SoGpuBufferObject(); 00281 00282 friend struct inventor::renderer::Resource<SoBufferObject>; 00283 }; 00284 00285 #endif // SO_GPU_BUFFER_OBJECT_H 00286