Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoCpuBufferBitSet.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2022 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#pragma once
24
25#include <Inventor/devices/SoCpuBufferObject.h>
26#include <LDM/tiles/SoBufferPropertiesInterface.h>
27#include <LDM/tiles/SoLDMBufferObjectInterface.h>
28
31class SoCpuBufferBitSetImpl;
32
48{
49 SO_TYPED_CLASS_HEADER();
50
51 // ----------------------- Public usage --------------------------------------
52public:
53
58
63
70
82 virtual void map( SoBufferObject* targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition = 0, size_t mappingSize = SO_BUFFER_SIZE_ALL );
83
89 virtual void map( SoCpuBufferObject* targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition = 0, size_t mappingSize = SO_BUFFER_SIZE_ALL);
90
96 virtual void map( SoGLBufferObject* targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition = 0, size_t mappingSize = SO_BUFFER_SIZE_ALL);
97
104 virtual void* map( SoBufferObject::AccessMode accessMode, size_t offset = 0, size_t count = SO_BUFFER_SIZE_ALL );
105
114 virtual void unmap( SoCpuBufferObject* bufferObject );
115
124 virtual void unmap( SoGLBufferObject* bufferObject );
125
134 virtual void unmap( SoBufferObject* bufferObject );
135
141 virtual void unmap();
142
144 virtual void memcpy( SoBufferObject* sourceBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
145
158 virtual void memset( void* value, size_t valueSize = 1, size_t offset = 0, size_t count = SO_BUFFER_SIZE_ALL );
159
168 virtual bool getMinMax( double& min, double& max);
169
176 virtual void setMinMax( const double& min, const double& max);
177
183 virtual size_t getRealSize() const;
184
185private:
186
189 void memcpy( SoCpuBufferBitSet* sourceBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
190
193 void memcpy( SoCpuBufferUniform* sourceBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
194
197 void memcpyInternal( SoBufferObject* sourceBufferObject, size_t dataSize, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
198
201 unsigned char* mapRawBitSet(SoBufferObject::AccessMode accessMode);
202
204 void unmapRawBitSet();
205
207 static inline unsigned char getBit(unsigned char* dataPtr, const int pos)
208 { return (((dataPtr[pos>>0x3]) >> (7- (pos & 0x7))) & 1); }
209
210 // Set the cache id allocated by the DataSet
211 virtual void setCacheSignature(const uint64_t& cacheSignature);
212
214 static inline void setBit(unsigned char* dataPtr, const size_t pos, bool v)
215 {
216 unsigned char& val = dataPtr[pos/8];
217 const unsigned char mask = 0x80 >> pos%8;
218 const unsigned char bitChar = (unsigned char)v << (7 - pos%8);
219 val = (val & ~mask) | bitChar;
220 }
221
222SoINTERNAL private:
224
226
227private:
231 virtual ~SoCpuBufferBitSet();
232};
233
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
AccessMode
This enum provides the possible access modes for a mapped buffer object.
#define SO_BUFFER_SIZE_ALL
Used to indicate that we want to use the whole buffer.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> LDM inte...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> LDM buff...
virtual void map(SoCpuBufferObject *targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL)
Map the current buffer object into the specified CPU buffer object.
virtual void map(SoBufferObject *targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL)
Map the current buffer object into the specified buffer object.
virtual void * map(SoBufferObject::AccessMode accessMode, size_t offset=0, size_t count=SO_BUFFER_SIZE_ALL)
Returns a pointer to the memory array used for the storage of the buffer.
SoCpuBufferBitSet(SoCpuBufferObject *cpuBuffer)
Constructor from a SoCpuBufferObject containing a bitset.
virtual SoBufferObject * createInstance() const
Create a new buffer with the same properties as the current one.
virtual bool getMinMax(double &min, double &max)
Get the min and max values in the buffer, if they are known.
friend class SoCpuBufferBitSetImpl
virtual void memset(void *value, size_t valueSize=1, size_t offset=0, size_t count=SO_BUFFER_SIZE_ALL)
This function sets the contents of (or a portion of) this buffer object to the specified value.
virtual void unmap(SoGLBufferObject *bufferObject)
Unmap the specified GL buffer object It is defined just to speed up the call when the type of the o...
virtual void map(SoGLBufferObject *targetBufferObject, SoBufferObject::AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL)
Map the current buffer object into the specified GL buffer object.
virtual size_t getRealSize() const
Returns the size of the buffer in bytes.
virtual void setMinMax(const double &min, const double &max)
Set min and max values for this buffer.
virtual void memcpy(SoBufferObject *sourceBufferObject, size_t destOffset=0, size_t sourceOffset=0, size_t copySize=SO_BUFFER_SIZE_ALL)
Copies data from the specified buffer object into this buffer object.
SoCpuBufferBitSet()
Default constructor.
virtual void unmap(SoBufferObject *bufferObject)
Remove the specified bufferObject from the list of buffers which map the current buffer.
virtual void unmap(SoCpuBufferObject *bufferObject)
Unmap the specified CPU buffer object It is defined just to speed up the call when the type of the ...
virtual void unmap()
Unmap a mapped buffer.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> CPU buffer objec...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> LDM buff...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> OpenGL buffer ob...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> LDM inte...