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/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, bool useCmdBuffer = false) = 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,
                           bool persistentMapped = false) = 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
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