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
103
/*
   Copyright (c) 2016 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 _GENERIC_VERTEX_DATA_H
#define _GENERIC_VERTEX_DATA_H

#include "config.h"

#include "AttributeDescriptor.h"
#include "Platform/Video/Headers/RenderAPIWrapper.h"
#include "Platform/Video/Buffers/VertexBuffer/Headers/VertexDataInterface.h"

/// This class is used to upload generic VB data to the GPU that can be rendered directly or instanced.
/// Use this class to create precise VB data with specific usage (such as particle systems)
/// Use IMPrimitive for on-the-fly geometry creation

namespace Divide {

class NOINITVTABLE GenericVertexData : public VertexDataInterface,
                                       public RingBuffer {
   public:
    GenericVertexData(GFXDevice& context, const U32 ringBufferLength);
    virtual ~GenericVertexData();

    inline void setIndexBuffer(U32 indicesCount, bool dynamic, bool stream) {
        vectorImpl<U32> indices;
        setIndexBuffer(indicesCount, dynamic, stream);
    }

    virtual void setIndexBuffer(U32 indicesCount, bool dynamic, bool stream, const vectorImpl<U32>& indices) = 0;
    virtual void updateIndexBuffer(const vectorImpl<U32>& indices) = 0;
    virtual void create(U8 numBuffers = 1, U8 numQueries = 1) = 0;
    virtual void setFeedbackBuffer(U32 buffer, U32 bindPoint) = 0;

    virtual void draw(const GenericDrawCommand& command) = 0;

    /// When reading and writing to the same buffer, we use a round-robin
    /// approach and
    /// offset the reading and writing to multiple copies of the data
    virtual void setBuffer(U32 buffer,
                           U32 elementCount,
                           size_t elementSize,
                           bool useRingBuffer,
                           const bufferPtr data,
                           bool dynamic,
                           bool stream) = 0;

    virtual void updateBuffer(U32 buffer,
                              U32 elementCount,
                              U32 elementCountOffset,
                              const bufferPtr data) = 0;

    virtual void setBufferBindOffset(U32 buffer, U32 elementCountOffset) = 0;

    virtual void bindFeedbackBufferRange(U32 buffer, U32 elementCountOffset, size_t elementCount) = 0;

    virtual U32 getFeedbackPrimitiveCount(U8 queryID) = 0;

    virtual void incQueryQueue() = 0;

    void toggleDoubleBufferedQueries(const bool state);
    AttributeDescriptor& attribDescriptor(U32 attribIndex);
    AttributeDescriptor& fdbkAttribDescriptor(U32 attribIndex);

   protected:
    typedef hashMapImpl<U32, AttributeDescriptor> attributeMap;
    bool _doubleBufferedQuery;
    vectorImpl<std::pair<U32 /*buffer*/, U32/*bind point*/>> _feedbackBuffers;
    attributeMap _attributeMapDraw;
    attributeMap _attributeMapFdbk;
};

};  // namespace Divide

#endif

Commits for Divide-Framework/trunk/Source Code/Platform/Video/Buffers/VertexBuffer/GenericBuffer/Headers/GenericVertexData.h

Diff revisions: vs.
Revision Author Commited Message
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

807 Diff Diff IonutCava picture IonutCava Mon 09 Jan, 2017 17:06:26 +0000

[IonutCava]
- Split PlatformDefines.h into 2. Move data type defines to PlatformDataTypes.h
- Continue to improve velocity map calculation
- Remove “destroy()” calls from most classes. Attempt to move as many classes to the RAII system.

788 Diff Diff IonutCava picture IonutCava Fri 21 Oct, 2016 16:11:37 +0000

[IonutCava]
- Added support for the Arena Allocator by Mamasha Knows (http://www.codeproject.com/Articles/44850/Arena-Allocator-DTOR-and-Embedded-Preallocated-Buf)
— Used for GFX Related objects: Textures, shaders, etc

776 Diff Diff IonutCava picture IonutCava Thu 06 Oct, 2016 15:57:56 +0000

[IonutCava]
- Improve the CommandBuffer system to include the notion of a RenderPass /RenderSubPass with output render target info stored in them (not used yet)

771 Diff Diff IonutCava picture IonutCava Tue 27 Sep, 2016 15:39:49 +0000

[IonutCava]
- Modify GFXDevice::flushRenderQueues so that it creates command buffers instead of directly calling rendering calls:
— Command buffers contain buffer, shader, texture and geometry info
— Command buffer state is now parsed and set at the API level instead of GFXDevice level
— This will allow easier porting to low level APIs later on
- Indirect draw is now a GenericDrawCommand render option instead of an explicit buffer draw parameter

737 Diff Diff IonutCava picture IonutCava Thu 23 Jun, 2016 16:20:05 +0000

[IonutCava]
- Improved GenericVertexData structure (separate buffer data from attribute data entirely)
- Added a VAO pool for OpenGL so that all requested VAOs are allocated on the main thread
- Added a mainThreadTask system to queue a task to run on the main thread and optionally wait for it to complete
- Added the option to specify generic geometry for the particle system with an optional index buffer

735 Diff Diff IonutCava picture IonutCava Wed 22 Jun, 2016 16:11:34 +0000

[IonutCava]
- Cleanup GenericVertexData class

728 IonutCava picture IonutCava Wed 15 Jun, 2016 16:04:33 +0000

[IonutCava]
- Updates and fixes to shadow mapping.
- Fixed a race condition in console::output regarding redirection of events to the GUI
- Attempting to fix particle emitter:
— Rewrite GenericVertexData for easier debugging/processing
— Split attributes and buffers into separate classes
— Not finished / buggy / crashes
- Fixed an issue with scene switching regarding PhysicsSceneInterface. Caused race conditions related crashes
- Fixed an issue with scene save data loading. Moved Load system to main thread after loading finishes