Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
Copyright (c) 2017 DIVIDE-Studio
Copyright (c) 2009 Ionut Cava

This file is part of DIVIDE Framework.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software
and associated documentation files (the "Software"), to deal in the Software
without restriction,
including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

#ifndef _GL_GENERIC_BUFFER_H_
#define _GL_GENERIC_BUFFER_H_

#include "Platform/Video/OpenGL/Headers/glResources.h"

namespace Divide {

struct BufferParams {
    BufferParams()
        : _usage(GL_NONE),
          _ringSizeFactor(1),
          _elementCount(0),
          _elementSizeInBytes(0),
          _frequency(BufferUpdateFrequency::ONCE),
          _data(nullptr),
          _name("")
    {
    }

    GLenum _usage;
    GLuint _ringSizeFactor;
    GLuint _elementCount;
    size_t _elementSizeInBytes;
    BufferUpdateFrequency _frequency;
    bufferPtr   _data;
    const char* _name;
};

class glBufferImpl;
class glGenericBuffer {
  public:
      glGenericBuffer(GFXDevice& context, const BufferParams& params);
      ~glGenericBuffer();

      inline glBufferImpl* impl() const { return _buffer; }
      inline GLuint elementCount() const { return _elementCount; }
      inline size_t elementSize() const { return _elementSize; }

      GLuint bufferHandle() const;
      
      void writeData(GLuint elementCount,
                     GLuint elementOffset,
                     GLuint ringWriteOffset,
                     const bufferPtr data);

      void readData(GLuint elementCount,
                    GLuint elementOffset,
                    GLuint ringReadOffset,
                    bufferPtr dataOut);

      void lockData(GLuint elementCount,
                    GLuint elementOffset,
                    GLuint ringReadOffset);
                    
       GLintptr getBindOffset(GLuint ringReadOffset);

       void     setBindOffset(GLuint elementCountOffset);

  protected:
      GLuint _elementCount;
      size_t _elementSize;
      GLuint _elementCountBindOffset;
      // A flag to check if the buffer uses the RingBuffer system
      glBufferImpl* _buffer;

      GLuint _ringSizeFactor;
};

}; //namespace Divide

#endif //_GENERIC_BUFFER_H_

Commits for Divide-Framework/trunk/Source Code/Platform/Video/OpenGL/Buffers/Headers/glGenericBuffer.h

Diff revisions: vs.
Revision Author Commited Message
909 Diff Diff IonutCava picture IonutCava Thu 29 Jun, 2017 23:57:18 +0000

[Ionut]
- Rework RenderTarget class
— RTAttachment now deal with textures directly
— RT size needs to be specified upfront
- Application class is no longer a Singleton but passed around in the PlatformContext

895 Diff Diff IonutCava picture IonutCava Wed 21 Jun, 2017 21:10:26 +0000

[IonutCava]
- Reorder and cleanup OpenGL backend a bit.
- Small code cleanup
- Some small profile-guided optimizations

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

827 Diff Diff IonutCava picture IonutCava Sun 22 Jan, 2017 21:59:36 +0000

[IonutCava]
- ShaderBuffers now decide heuristically if they get persistently mapped or not (depends on size. Current limit is 512Kb for subData calls.
- Separate visible node command generation into 2 steps: onRender and getDrawPackage. onRender allows the creation of parallel tasks that should finish by the time the second call, getDrawPackage reaches the same node
- Update ParticleEmitter to take into account multiple players and increase parallelism at the cost of memory consumption and complexity.
- Add a default bounding box for Players (add extents to SceneTransform nodes)
- All buffers (ShaderBuffer, d3dConstantBuffer, glUniformBuffer, glBufferImpl, glGenericBuffer, etc) use BufferParams for creation.
— Constructor and create calls have been merged together

780 IonutCava picture IonutCava Tue 11 Oct, 2016 16:15:24 +0000

[IonutCava]
- AtomicCounter in glUniformBuffer is now based on a glGenericBuffer implementation
- GFXDevice <-> Camera relation cleaned up a bit
- Added a readback system for glGenericBuffer
- Fixed a bug with Z_PRE_PASS stage culling