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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
#include "Headers/glGenericVertexData.h"
#include "Hardware/Video/Headers/GFXDevice.h"

namespace Divide {

glGenericVertexData::glGenericVertexData(bool persistentMapped) : GenericVertexData(persistentMapped),
                                                                  _prevResult(nullptr),
                                                                  _bufferSet(nullptr),
                                                                  _bufferPersistent(nullptr),
                                                                  _bufferPersistentData(nullptr),
                                                                  _elementCount(nullptr),
                                                                  _elementSize(nullptr),
                                                                  _sizeFactor(nullptr),
                                                                  _startDestOffset(nullptr),
                                                                  _readOffset(nullptr),
                                                                  _lockManager(nullptr)
{
    _numQueries  = 0;
    _currentReadQuery = 0;
    _transformFeedback = 0;
    _currentWriteQuery = 0;
    _indirectDrawBuffer = 0;
    _vertexArray[GVD_USAGE_DRAW] = 0;
    _vertexArray[GVD_USAGE_FDBCK] = 0;

    for (U8 i = 0; i < 2; ++i) {
        _feedbackQueries[i] = nullptr;
        _resultAvailable[i] = nullptr;
    }

    if (Config::Profile::DISABLE_PERSISTENT_BUFFER) {
        persistentMapped = _persistentMapped = false;
    }
    // Persistently mapped buffers require explicit synchronization
    if (persistentMapped) {
        _lockManager = New glBufferLockManager(true);
    }
}

glGenericVertexData::~glGenericVertexData()
{
    if (!_bufferObjects.empty()) {
        // If we have persistently mapped buffers, we need to unmap them first
        for (U8 i = 0; i < _bufferObjects.size(); ++i) {
            if (_bufferPersistent[i]) {
                GL_API::setActiveBuffer(GL_ARRAY_BUFFER, _bufferObjects[i]);
                glUnmapBuffer(GL_ARRAY_BUFFER);
            }
        }
        // Make sure we don't have any of our buffers still bound
        GL_API::setActiveBuffer(GL_ARRAY_BUFFER, 0);
        // Delete the buffer objects
        glDeleteBuffers((GLsizei)_bufferObjects.size(), &_bufferObjects[0]);
    }
    // Make sure we don't have any of our VAOs bound
    GL_API::setActiveVAO(0);
    // Delete the rendering VAO
    if (_vertexArray[GVD_USAGE_DRAW] > 0) {
        glDeleteVertexArrays(GVD_USAGE_DRAW, &_vertexArray[0]);
        _vertexArray[GVD_USAGE_DRAW] = 0;
    }
    // Delete the transform feedback VAO
    if (_vertexArray[GVD_USAGE_FDBCK] > 0) {
        glDeleteVertexArrays(GVD_USAGE_FDBCK, &_vertexArray[0]);
        _vertexArray[GVD_USAGE_FDBCK] = 0;
    }
    // Make sure we don't have the indirect draw buffer bound
    //glBindBuffer(GL_QUERY_BUFFER_AMD, 0);
    // If we have an indirect draw buffer, delete it
    if (_indirectDrawBuffer > 0) {
        glDeleteBuffers(1, &_indirectDrawBuffer);
        _indirectDrawBuffer = 0;
    }
    // Make sure we don't have our transform feedback object bound
    GL_API::setActiveTransformFeedback(0);
    // If we have a transform feedback object, delete it
    if (_transformFeedback > 0) {
        glDeleteTransformFeedbacks(1, &_transformFeedback);
        _transformFeedback = 0;
    }
    // Delete all of our query objects
    if (_numQueries > 0) {
        for (U8 i = 0; i < 2; ++i) {
            glDeleteQueries(_numQueries, _feedbackQueries[i]);
            SAFE_DELETE_ARRAY(_feedbackQueries[i]);
            SAFE_DELETE_ARRAY(_resultAvailable[i]);
        }
    }

    // Delete the rest of the data
    SAFE_DELETE_ARRAY(_prevResult);
    SAFE_DELETE_ARRAY(_bufferSet);
    SAFE_DELETE_ARRAY(_bufferPersistent);
    SAFE_DELETE_ARRAY(_elementCount);
    SAFE_DELETE_ARRAY(_elementSize);
    SAFE_DELETE_ARRAY(_sizeFactor);
    SAFE_DELETE_ARRAY(_startDestOffset);
    SAFE_DELETE_ARRAY(_readOffset);
    SAFE_DELETE(_lockManager);
    if (_bufferPersistentData != nullptr) {
        free(_bufferPersistentData);
    }

    _bufferObjects.clear();
    _feedbackBuffers.clear();
}

/// Create the specified number of buffers and queries and attach them to this vertex data container
void glGenericVertexData::Create(U8 numBuffers, U8 numQueries) {
    // Prevent double create
    DIVIDE_ASSERT(_bufferObjects.empty(), "glGenericVertexData error: create called with no buffers specified!");
    // Create two vertex array objects. One for rendering and one for transform feedback 
    glGenVertexArrays(GVD_USAGE_PLACEHOLDER, &_vertexArray[0]);
    // Transform feedback may not be used, but it simplifies the class interface a lot
    // Create a transform feedback object
    glGenTransformFeedbacks(1, &_transformFeedback);
    // Create our buffer objects
    _bufferObjects.resize(numBuffers, 0);
    glGenBuffers(numBuffers, &_bufferObjects[0]);
    // Allocate a buffer for indirect draw used to store the query results without a round-trip to the CPU
    glGenBuffers(1, &_indirectDrawBuffer);
    // Prepare our generic queries
    _numQueries = numQueries;
    for (U8 i = 0; i < 2; ++i) {
        _feedbackQueries[i] = New GLuint[_numQueries];
        _resultAvailable[i] = New bool[_numQueries];
    }
    // Create our generic query objects
    for (U8 i = 0; i < 2; ++i) {
        memset(_feedbackQueries[i], 0, sizeof(GLuint) * _numQueries);
        memset(_resultAvailable[i], false, sizeof(bool)   * _numQueries);
        glGenQueries(_numQueries, _feedbackQueries[i]);
    }
    // How many times larger should the buffer be than the actual data to offset reading and writing
    _sizeFactor = new GLuint[numBuffers];
    memset(_sizeFactor, 0, numBuffers * sizeof(GLuint));
    // Allocate buffers for all possible data that we may use with this object
    // Query results from the previous frame
    _prevResult = New GLuint[_numQueries];
    memset(_prevResult, 0, sizeof(GLuint) * _numQueries);
    // Flags to verify if each buffer was created
    _bufferSet = new bool[numBuffers];
    memset(_bufferSet, false, numBuffers * sizeof(bool));
    // The element count for each buffer
    _elementCount = new GLuint[numBuffers];
    memset(_elementCount, 0, numBuffers * sizeof(GLuint));
    // The element size for each buffer (in bytes)
    _elementSize = new size_t[numBuffers];
    memset(_elementSize, 0, numBuffers * sizeof(size_t));
    // Current buffer write head position for 3x buffer updates
    _startDestOffset = new size_t[numBuffers];
    memset(_startDestOffset, 0, numBuffers * sizeof(size_t));
    // Current buffer read head position for 3x buffer updates
    _readOffset = new size_t[numBuffers];
    memset(_readOffset, 0, numBuffers * sizeof(size_t));
    // A flag to check if the buffer is or isn't persistently mapped
    _bufferPersistent = new bool[numBuffers];
    memset(_bufferPersistent, false, numBuffers * sizeof(bool));
    // Persistently mapped data (array of void* pointers)
    _bufferPersistentData = (void**)malloc(sizeof(void*) * numBuffers);
}

/// Called at the beginning of each frame to update the currently used queries for reading and writing
bool glGenericVertexData::frameStarted(const FrameEvent& evt) {
    // Queries are double buffered to avoid stalling (should probably be triple buffered)
    if (!_bufferObjects.empty() && _doubleBufferedQuery){
        _currentWriteQuery = (_currentWriteQuery + 1) % 2;
        _currentReadQuery  = (_currentWriteQuery + 1) % 2;
    }

    return GenericVertexData::frameStarted(evt);
}

/// Bind a specific range of the transform feedback buffer for writing (specified in the number of elements to offset by and the number of elements to be written)
void glGenericVertexData::BindFeedbackBufferRange(U32 buffer, U32 elementCountOffset, size_t elementCount) {
    // Only feedback buffers can be used with this method
    DIVIDE_ASSERT(isFeedbackBuffer(buffer), "glGenericVertexData error: called bind buffer range for non-feedback buffer!");

    GL_API::setActiveTransformFeedback(_transformFeedback);
    glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, getBindPoint(_bufferObjects[buffer]), _bufferObjects[buffer], elementCountOffset * _elementSize[buffer], elementCount * _elementSize[buffer]);
}

/// Submit a draw command to the GPU using this object and the specified command
void glGenericVertexData::Draw(const GenericDrawCommand& command, bool skipBind) {
    // Get the OpenGL specific command from the generic one
    const IndirectDrawCommand& cmd = command.cmd();
    // Instance count can be generated programmatically, so make sure it's valid
    if (cmd.instanceCount == 0) {
        return;
    }
    // Check if we are rendering to the screen or to a buffer
    bool feedbackActive = (command.drawToBuffer() && !_feedbackBuffers.empty());
    // Activate the appropriate vertex array object for the type of rendering we requested
    GL_API::setActiveVAO(_vertexArray[feedbackActive ? GVD_USAGE_FDBCK : GVD_USAGE_DRAW]);
    // Update vertex attributes if needed (e.g. if offsets changed)
    SetAttributes(feedbackActive);

    // Write query result to the primCount field of the indirect draw command to avoid a round trip to the CPU
    //glBindBuffer(GL_QUERY_BUFFER_AMD, _indirectDrawBuffer);
    //glGetQueryObjectuiv(queryId, GL_QUERY_RESULT_AVAILABLE, BUFFER_OFFSET(offsetof(DrawArraysIndirectCommand, primCount)));
    //GL_API::setActiveBuffer(GL_DRAW_INDIRECT_BUFFER, _indirectDrawBuffer);
    //glBufferData(GL_DRAW_INDIRECT_BUFFER, sizeof(IndirectDrawCommand), &cmd, GL_DYNAMIC_COPY);

    // Activate transform feedback if needed
    if (feedbackActive) {
       GL_API::setActiveTransformFeedback(_transformFeedback);
       glBeginTransformFeedback(GLUtil::GL_ENUM_TABLE::glPrimitiveTypeTable[command.primitiveType()]);
       // Count the number of primitives written to the buffer
       glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, _feedbackQueries[_currentWriteQuery][command.queryID()]);
    }
    
    // Submit the draw command
    if (!Config::Profile::DISABLE_DRAWS) {
        GLenum type = command.renderWireframe() ? GL_LINE_LOOP : GLUtil::GL_ENUM_TABLE::glPrimitiveTypeTable[command.primitiveType()];
        glDrawArraysIndirect(type, &cmd);
    }
    // Deactivate transform feedback if needed
    if (feedbackActive) {
        glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
        glEndTransformFeedback();
        // Mark the current query as completed and ready to be retrieved
        _resultAvailable[_currentWriteQuery][command.queryID()] = true;
    }
    // Count the draw call
    GFX_DEVICE.registerDrawCall();    
}

/// Specify the structure and data of the given buffer
void glGenericVertexData::SetBuffer(U32 buffer, U32 elementCount, size_t elementSize, U8 sizeFactor, void* data, bool dynamic, bool stream, bool persistentMapped) {
    // Make sure the buffer exists
    DIVIDE_ASSERT(buffer >= 0 && buffer < _bufferObjects.size(), "glGenericVertexData error: set buffer called for invalid buffer index!");
    // glBufferData on persistentMapped buffers is not allowed
    DIVIDE_ASSERT(!_bufferSet[buffer], "glGenericVertexData error: set buffer called for an already created buffer!");
    // Make sure we allow persistent mapping
    if (persistentMapped) {
        persistentMapped = _persistentMapped;
    }
    DIVIDE_ASSERT((persistentMapped && _persistentMapped) || !persistentMapped, "glGenericVertexData error: persistent map flag is not compatible with object details!");
    // Remember the element count and size for the current buffer
    _elementCount[buffer] = elementCount;
    _elementSize[buffer] = elementSize;
    _sizeFactor[buffer] = sizeFactor;
    size_t bufferSize = elementCount * elementSize;
    // Bind the buffer object
    GL_API::setActiveBuffer(GL_ARRAY_BUFFER, _bufferObjects[buffer]);
    
    if (persistentMapped) {
        // If we requested a persistently mapped buffer, we use glBufferStorage to pin it in memory
        GLenum flag = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
        glBufferStorage(GL_ARRAY_BUFFER, bufferSize * sizeFactor, NULL, flag);
        // Map the entire buffer range
        _bufferPersistentData[buffer] = glMapBufferRange(GL_ARRAY_BUFFER, 0, bufferSize * 3, flag);
        DIVIDE_ASSERT(data != nullptr, "glGenericVertexData error: persistent mapping failed when setting the current buffer!");
        // Create sizeFactor copies of the data and store them in the buffer
        for(U8 i = 0; i < sizeFactor; ++i) {
            U8* dst = (U8*)_bufferPersistentData[buffer] + bufferSize * i;
            memcpy(dst, data, bufferSize);
        }
        // Make sure we synchronize the write commands
        _lockManager->LockRange(0, bufferSize * sizeFactor);
    } else {
        GLenum flag = isFeedbackBuffer(buffer) ? (dynamic ? (stream ? GL_STREAM_COPY : GL_DYNAMIC_COPY) : GL_STATIC_COPY) :
                                                 (dynamic ? (stream ? GL_STREAM_DRAW : GL_DYNAMIC_DRAW) : GL_STATIC_DRAW);
        // If the buffer is not persistently mapped, allocate storage the classic way
        glBufferData(GL_ARRAY_BUFFER, bufferSize * sizeFactor, NULL, flag);
        // And upload sizeFactor copies of the data
        for (U8 i = 0; i < sizeFactor; ++i) {
            glBufferSubData(GL_ARRAY_BUFFER, i * bufferSize, bufferSize, data);
        }
    }
    _bufferSet[buffer] = true;
    _bufferPersistent[buffer] = persistentMapped;
}

/// Update the elementCount worth of data contained in the buffer starting from elementCountOffset size offset
void glGenericVertexData::UpdateBuffer(U32 buffer, U32 elementCount, U32 elementCountOffset, void* data, bool invalidateRange) {
    // Calculate the size of the data that needs updating
    size_t dataCurrentSize = elementCount * _elementSize[buffer];
    // Calculate the offset in the buffer in bytes from which to start writing
    size_t offset = elementCountOffset * _elementSize[buffer];
    // Calculate the entire buffer size
    size_t bufferSize = _elementCount[buffer] * _elementSize[buffer];
    // If requested we can invalidate the data in the specified range to hint at the driver to discard the old data
    if (invalidateRange) {
        glInvalidateBufferSubData(_bufferObjects[buffer], offset, dataCurrentSize);
    }

    if (!_bufferPersistent[buffer]) {
        // Update part of the data in the buffer at the specified buffer in the copy that's ready for writing
        glNamedBufferSubDataEXT(_bufferObjects[buffer], _startDestOffset[buffer] + offset, dataCurrentSize, data);
    } else {
        GL_API::setActiveBuffer(GL_ARRAY_BUFFER, _bufferObjects[buffer]);
        // Wait for the target part of the buffer to become available for writing
        _lockManager->WaitForLockedRange(_startDestOffset[buffer], bufferSize);
            // Offset the data pointer by the required offset taking in account the current data copy we are writing into
            U8* dst = (U8*)_bufferPersistentData[buffer] + _startDestOffset[buffer] + offset;
            // Update the data
            memcpy(dst, data, dataCurrentSize);
        // Lock the current buffer copy until uploading to GPU visible memory is finished
        _lockManager->LockRange(_startDestOffset[buffer], bufferSize);
    }
    // Update offset pointers for reading and writing
    _startDestOffset[buffer] = (_startDestOffset[buffer] + bufferSize) % (bufferSize * _sizeFactor[buffer]);
    _readOffset[buffer] = (_startDestOffset[buffer] + bufferSize) % (bufferSize * _sizeFactor[buffer]);
}

/// Update the appropriate attributes (either for drawing or for transform feedback)
void glGenericVertexData::SetAttributes(bool feedbackPass) {
    // Get the appropriate list of attributes
    attributeMap& map = feedbackPass ? _attributeMapFdbk : _attributeMapDraw;
    // And update them in turn
    FOR_EACH(attributeMap::value_type& it, map) {
        SetAttributeInternal(it.second);
    }
}

/// Update internal attribute data
void glGenericVertexData::SetAttributeInternal(AttributeDescriptor& descriptor) {
    DIVIDE_ASSERT(_elementSize[descriptor.bufferIndex()] != 0, "glGenericVertexData error: attribute's parent buffer has an invalid element size!");
    // Early out if the attribute didn't change
    if (!descriptor.dirty()) {
        return;
    }
    // If the attribute wasn't activate until now, enable it
    if (!descriptor.wasSet()) {
        glEnableVertexAttribArray(descriptor.attribIndex());
        descriptor.wasSet(true);
    }
    // Persistently mapped buffers are already bound when this function is called
    if (!_persistentMapped) {
        GL_API::setActiveBuffer(GL_ARRAY_BUFFER, _bufferObjects[descriptor.bufferIndex()]);
    }
    // Update the attribute data
    glVertexAttribPointer(descriptor.attribIndex(), 
                          descriptor.componentsPerElement(), 
                          GLUtil::GL_ENUM_TABLE::glDataFormat[descriptor.dataType()],
                          descriptor.normalized() ? GL_TRUE : GL_FALSE,
                          (GLsizei)descriptor.stride(),
                          (void*)(descriptor.offset() * _elementSize[descriptor.bufferIndex()]));

    if (descriptor.instanceDivisor() > 0) {
        glVertexAttribDivisor(descriptor.attribIndex(), descriptor.instanceDivisor());
    }
    // Inform the descriptor that the data was updated
    descriptor.clean();
}

/// Return the number of primitives written to a transform feedback buffer that used the specified query ID
U32 glGenericVertexData::GetFeedbackPrimitiveCount(U8 queryID) {
    DIVIDE_ASSERT(queryID < _numQueries && !_bufferObjects.empty(), "glGenericVertexData error: Current object isn't ready for query processing!");
    // Double buffered queries return the results from the previous draw call to avoid stalling the GPU pipeline
    U32 queryEntry = _doubleBufferedQuery ? _currentReadQuery : _currentWriteQuery;
    // If the requested query has valid data available, retrieve that data from the GPU
    if (_resultAvailable[queryEntry][queryID]){
        // Get the result of the previous query about the generated primitive count
        glGetQueryObjectuiv(_feedbackQueries[queryEntry][queryID], GL_QUERY_RESULT, &_prevResult[queryID]);
        // Mark the query entry data as invalid now
        _resultAvailable[queryEntry][queryID] = false;
    }
    // Return either the previous value or the current one depending on the previous check
    return _prevResult[queryID];
}

};

Commits for Divide-Framework/trunk/Source Code/Hardware/Video/OpenGL/Buffers/VertexBuffer/glGenericVertexData.cpp

Diff revisions: vs.
Revision Author Commited Message
318 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 17:35:53 +0000

[Ionut]
- Wrapped the entire code in a “Divide” namespace
- VertexBuffers now call “shrink_to_fit” on all internal data storage
- Improved some vector performance by preferring “emplace_back” instead of “push_back” + proepr usage of reserve / resize
- Wrapped OIS specific types and classes in Divide::Input namespace
- Added the messageBox.layout file (forgot it in the previous few commits)

307 Diff Diff IonutCava picture IonutCava Tue 12 Aug, 2014 19:45:12 +0000

[Ionut]
- More editor work:
— Per object skeleton rendering, bounding box rendering and shadow map toggling
— Full screen depth preview toggle
— Text entry based transforms

303 Diff Diff IonutCava picture IonutCava Sat 09 Aug, 2014 19:12:32 +0000

[Ionut]
- Fixed mouse movement (change resolution callback properly informs inputInterface of the new window’s width and height)
- Fixed immediate mode emulation rendering (destroyed index buffers for some reason)
- Added axis gizmos for Scene / Scene + Selected Object / Scene + All object cycled via the F5 key in debug

302 Diff Diff IonutCava picture IonutCava Wed 06 Aug, 2014 22:09:55 +0000

[Ionut]
- GenericVertexData buffer size (for read/write buffering) is now configurable instead of a fixed 3x and also applies to non-persistently mapped buffers
- Moved OpenGL enum tables to Divide::GLUtil::GL_ENUM_TABLE
- More code cleanups (glResources, glError, glVertexArray, glGenericVertexData, glIMPrimitive)

297 Diff Diff k1ngp1n picture k1ngp1n Sun 03 Aug, 2014 15:30:04 +0000

[Ionut]
- A couple of crash fixes

293 Diff Diff k1ngp1n picture k1ngp1n Tue 29 Jul, 2014 20:01:28 +0000

[Ionut]
- Code cleanup and comments in GLFWWrapper (for starters. more to follow)
- Reworked main loop logic (no more delegates and rendering api querying)
- Replaced all GLvoid with regular void
- replaced all boost::this_thread::sleep (deprecated calls) with boost::this_thread::sleep_for

292 Diff Diff k1ngp1n picture k1ngp1n Mon 28 Jul, 2014 20:23:56 +0000

[Ionut]
- More nVidia compatibility issues (including the ability to disable persistent mapped buffer altogether. Thanks nsight ....)
- Cross-platform compatibility fixes for types (custom types now mirror types in stdint.h and are now typdefed instead of defined)
- Removed redundant files

288 Diff Diff IonutCava picture IonutCava Wed 23 Jul, 2014 20:34:25 +0000

[Ionut]
- Added a common interface to GenericVertexData and VertexBuffer
- Removed deferred deletion of FrameListeners from FrameListenerManager. It complicated the code with no added benefit
- Added proper FrameListener unregister calls

286 Diff Diff IonutCava picture IonutCava Fri 18 Jul, 2014 16:32:03 +0000

[Ionut] [[BR]]

    • very buggy commit ** [[BR]]

- New rendering pipeline: [[BR]]
— Bumped OpenGL version to 4.4 [[BR]]
— Command based rendering. GFXDevice dispatches rendering commands to their respective buffers [[BR]]
— State changing is exclusively controlled by the GFXDevice class [[BR]]
— Material properties and transform matrices are stored in shader storage buffers that are updated after culling and uploaded once per RenderPass. Objects use drawIDs to index data in shaders [[BR]]
— Removed all custom matrices and other, per shader, bind data [[BR]]
— Removed per node light data. Light culling and shader buffers will replace the old light management system [[BR]]
— Framebuffers now use the Texture class for attachments [[BR]]
— Sampler objects now work like RenderStateBlocks. GL_API handles them and stores them in a hash indexed map [[BR]]
— Removed “prepareMaterial” calls. Pre-draw material setup is now only limited to texture binding [[BR]]
— Moved immediate mode emulation and primitive rendering from API level to GFXDevice level [[BR]]
— Framebuffer rendering must be completed with a call to end() to ensure proper MSAA resolve (asserts, otherwise) [[BR]]
- Fixed hash code generation for RenderStateBlock (and now, glSamplerObject) using boost::hash_combine [[BR]]
- Temporarily disabled XML caching for materials [[BR]]

280 IonutCava picture IonutCava Sat 28 Jun, 2014 19:11:37 +0000

[Ionut] [[BR]]
- Improve ClipPlane management (bunch equations into the matrix shader buffer) [[BR]]
- Immediate mode emulation primitives set their own state based on specified hash instead of relying on state functions to be defined [[BR]]
- updateStates() function is now called right before the actual draw call to facilitate future batching work [[BR]]
- added tracked bool values (similar to those in ShaderInfo) to SGN class to fix selection bug. [[BR]]
— will probably create a “stateTracker” class to allow multiple classes to use tracked variables without all of the code duplication [[BR]]