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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
#include "Headers/glGenericVertexData.h"
#include "Platform/Video/Headers/GFXDevice.h"
#include "Platform/Video/OpenGL/Buffers/Headers/glMemoryManager.h"

#include "Utility/Headers/Localization.h"

namespace Divide {

hashMapImpl<GLuint, glGenericVertexData::BufferBindConfig> glGenericVertexData::_bindConfigs;

bool glGenericVertexData::setIfDifferentBindRange(GLuint bindIndex, const BufferBindConfig& bindConfig) {

    // If this is a new index, this will just create a default config
    BufferBindConfig& crtConfig = _bindConfigs[bindIndex];
    if (bindConfig == crtConfig) {
        return false;
    }

    crtConfig.set(bindConfig);
    glBindVertexBuffer(bindIndex, bindConfig._buffer, bindConfig._offset, bindConfig._stride);
    return true;
}

glGenericVertexData::glGenericVertexData(GFXDevice& context, bool persistentMapped, const U32 ringBufferLength)
    : GenericVertexData(context, persistentMapped, ringBufferLength),
      _bufferSet(nullptr),
      _bufferPersistent(nullptr),
      _bufferIsRing(nullptr),
      _elementCount(nullptr),
      _elementSize(nullptr),
      _bufferPersistentData(nullptr),
      _prevResult(nullptr)
{
    _numQueries = 0;
    _indexBuffer = 0;
    _indexBufferSize = 0;
    _indexBufferUsage = GL_NONE;
    _currentReadQuery = 0;
    _transformFeedback = 0;
    _currentWriteQuery = 0;
    _vertexArray[to_const_uint(GVDUsage::DRAW)] = 0;
    _vertexArray[to_const_uint(GVDUsage::FDBCK)] = 0;
    _feedbackQueries.fill(nullptr);
    _resultAvailable.fill(nullptr);
}

glGenericVertexData::~glGenericVertexData() {
    if (!_bufferObjects.empty()) {
        for (U8 i = 0; i < _bufferObjects.size(); ++i) {
            if (_persistentMapped) {
                _lockManagers[i]->WaitForLockedRange(0,
                                                     _elementCount[i] * _elementSize[i] 
                                                        * (_bufferIsRing[i] ? queueLength() : 1),
                                                     true);
            }
            GLUtil::freeBuffer(_bufferObjects[i]._id, _bufferPersistentData[i]);
        }
    }
    // Make sure we don't have any of our VAOs bound
    GL_API::setActiveVAO(0);
    // Delete the rendering VAO
    if (_vertexArray[to_const_uint(GVDUsage::DRAW)] > 0) {
        glDeleteVertexArrays(1, &_vertexArray[to_const_uint(GVDUsage::DRAW)]);
        _vertexArray[to_const_uint(GVDUsage::DRAW)] = 0;
    }
    // Delete the transform feedback VAO
    if (_vertexArray[to_const_uint(GVDUsage::FDBCK)] > 0) {
        glDeleteVertexArrays(1, &_vertexArray[to_const_uint(GVDUsage::FDBCK)]);
        _vertexArray[to_const_uint(GVDUsage::FDBCK)] = 0;
    }
    // Make sure we don't have the indirect draw buffer bound
    // 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]);
            MemoryManager::DELETE_ARRAY(_feedbackQueries[i]);
            MemoryManager::DELETE_ARRAY(_resultAvailable[i]);
        }
    }
    GLUtil::freeBuffer(_indexBuffer);
    _indexBufferSize = 0;
    // Delete the rest of the data
    MemoryManager::DELETE_ARRAY(_prevResult);
    MemoryManager::DELETE_ARRAY(_bufferSet);
    MemoryManager::DELETE_ARRAY(_bufferPersistent);
    MemoryManager::DELETE_ARRAY(_bufferIsRing);
    MemoryManager::DELETE_ARRAY(_elementCount);
    MemoryManager::DELETE_ARRAY(_elementSize);
    if (_bufferPersistentData != nullptr) {
        free(_bufferPersistentData);
    }

    _bufferObjects.clear();
    _feedbackBuffers.clear();
    _lockManagers.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(to_const_uint(GVDUsage::COUNT), &_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);
    // Prepare our generic queries
    _numQueries = numQueries;
    for (U8 i = 0; i < 2; ++i) {
        _feedbackQueries[i] = MemoryManager_NEW GLuint[_numQueries];
        _resultAvailable[i] = MemoryManager_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]);
    }
    // Allocate buffers for all possible data that we may use with this object
    // Query results from the previous frame
    _prevResult = MemoryManager_NEW GLuint[_numQueries];
    memset(_prevResult, 0, sizeof(GLuint) * _numQueries);
    // Flags to verify if each buffer was created
    _bufferSet = MemoryManager_NEW bool[numBuffers];
    memset(_bufferSet, false, numBuffers * sizeof(bool));
    // The element count for each buffer
    _elementCount = MemoryManager_NEW GLuint[numBuffers];
    memset(_elementCount, 0, numBuffers * sizeof(GLuint));
    // The element size for each buffer (in bytes)
    _elementSize = MemoryManager_NEW size_t[numBuffers];
    memset(_elementSize, 0, numBuffers * sizeof(size_t));
    // A flag to check if the buffer is or isn't persistently mapped
    _bufferPersistent = MemoryManager_NEW bool[numBuffers];
    memset(_bufferPersistent, false, numBuffers * sizeof(bool));
    // A flag to check if the buffer uses the RingBuffer system
    _bufferIsRing = MemoryManager_NEW bool[numBuffers];
    memset(_bufferIsRing, false, numBuffers * sizeof(bool));
    // Persistently mapped data (array of void* pointers)
    _bufferPersistentData =
        (bufferPtr*)malloc(sizeof(bufferPtr) * numBuffers);

    for (U8 i = 0; i < numBuffers; ++i) {
        _bufferPersistentData[i] = nullptr;
    }

    if (_persistentMapped) {
        _lockManagers.reserve(numBuffers);
        for (U8 i = 0; i < numBuffers; ++i) {
            _lockManagers.push_back(std::make_unique<glBufferLockManager>());
        }
    }
}

void glGenericVertexData::incQueryQueue() {
    // Queries are double buffered to avoid stalling (should probably be triple
    // buffered)
    if (!_bufferObjects.empty() && _doubleBufferedQuery) {
        _currentWriteQuery = (_currentWriteQuery + 1) % 2;
        _currentReadQuery = (_currentWriteQuery + 1) % 2;
    }
}

/// 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]._id),
        _bufferObjects[buffer]._id,
        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 useCmdBuffer) {

    U32 drawBufferID = command.drawToBuffer();
    // Check if we are rendering to the screen or to a buffer
    bool feedbackActive = (drawBufferID > 0 && !_feedbackBuffers.empty());
    // Activate the appropriate vertex array object for the type of rendering we
    // requested
    GL_API::setActiveVAO(_vertexArray[feedbackActive ? to_const_uint(GVDUsage::FDBCK) 
                                                     : to_const_uint(GVDUsage::DRAW)]);
    // Update vertex attributes if needed (e.g. if offsets changed)
    setAttributes(feedbackActive);

    // Activate transform feedback if needed
    if (feedbackActive) {
        GL_API::setActiveTransformFeedback(_transformFeedback);
        glBeginTransformFeedback(GLUtil::glPrimitiveTypeTable[to_uint(command.primitiveType())]);
        // Count the number of primitives written to the buffer
        glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, _feedbackQueries[_currentWriteQuery][drawBufferID]);
    }

    // Submit the draw command
    GLUtil::submitRenderCommand(command, useCmdBuffer, GL_UNSIGNED_INT, _indexBuffer);

    // 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.drawToBuffer()] = true;
    }

    if (_persistentMapped) {
        vectorAlg::vecSize bufferCount = _bufferObjects.size();
        for (vectorAlg::vecSize i = 0; i < bufferCount; ++i) {
            size_t bufferSize = _elementCount[i] * _elementSize[i];
            if (_bufferPersistent[i]) {
                size_t offset = 0;
                if (_bufferIsRing[i]) {
                    offset += bufferSize * queueReadIndex();
                }
                _lockManagers[i]->LockRange(offset, bufferSize);
            }
        }
    }
}

void glGenericVertexData::setIndexBuffer(U32 indicesCount, bool dynamic,  bool stream) {
    if (indicesCount > 0) {
        DIVIDE_ASSERT(_indexBuffer == 0,
            "glGenericVertexData::SetIndexBuffer error: Tried to double create index buffer!");

        _indexBufferUsage = dynamic ? (stream ? GL_STREAM_DRAW : GL_DYNAMIC_DRAW)
                                    : GL_STATIC_DRAW;
        // Generate an "Index Buffer Object"
        GLUtil::createAndAllocBuffer(
                static_cast<GLsizeiptr>(indicesCount * sizeof(GLuint)),
                _indexBufferUsage,
                _indexBuffer,
                NULL);
        _indexBufferSize = indicesCount;
        // Assert if the IB creation failed
        DIVIDE_ASSERT(_indexBuffer != 0, Locale::get(_ID("ERROR_IB_INIT")));
    } else {
        GLUtil::freeBuffer(_indexBuffer);
    }
}

void glGenericVertexData::updateIndexBuffer(const vectorImpl<U32>& indices) {
    DIVIDE_ASSERT(!indices.empty() && _indexBufferSize >= to_uint(indices.size()),
        "glGenericVertexData::UpdateIndexBuffer error: Invalid index buffer data!");

    DIVIDE_ASSERT(_indexBuffer != 0,
        "glGenericVertexData::UpdateIndexBuffer error: no valid index buffer found!");

    glNamedBufferData(_indexBuffer,
                      static_cast<GLsizeiptr>(_indexBufferSize * sizeof(GLuint)),
                      NULL,
                      _indexBufferUsage);

    glNamedBufferSubData(_indexBuffer, 
        0, 
        static_cast<GLsizeiptr>(indices.size() * sizeof(GLuint)),
        (bufferPtr)(indices.data()));
}

/// Specify the structure and data of the given buffer
void glGenericVertexData::setBuffer(U32 buffer,
                                    U32 elementCount,
                                    size_t elementSize,
                                    bool useRingBuffer,
                                    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;
    _bufferIsRing[buffer] = useRingBuffer;

    size_t bufferSize = elementCount * elementSize;
    GLuint sizeFactor = useRingBuffer ? queueLength() : 1;
    size_t totalSize = bufferSize * sizeFactor;
    GLuint currentBuffer = _bufferObjects[buffer]._id;
    if (persistentMapped) {
        // If we requested a persistently mapped buffer, we use glBufferStorage
        // to pin it in memory
        BufferStorageMask storageMask = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;
        BufferAccessMask accessMask =   GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT;

        if (currentBuffer == 0) {
            _bufferPersistentData[buffer] = 
                GLUtil::createAndAllocPersistentBuffer(totalSize, storageMask, accessMask, currentBuffer);
            _bufferObjects[buffer]._id = currentBuffer;
        } else {
            _bufferPersistentData[buffer] = 
                GLUtil::allocPersistentBuffer(currentBuffer, totalSize, storageMask, accessMask);
        }
        DIVIDE_ASSERT(_bufferPersistentData[buffer] != nullptr,
                      "glGenericVertexData error: persistent mapping failed "
                      "when setting the current buffer!");

        // Create sizeFactor copies of the data and store them in the buffer
        if (data != nullptr) {
            for (U8 i = 0; i < sizeFactor; ++i) {
                bufferPtr dst = (U8*)_bufferPersistentData[buffer] + (bufferSize * i);
                memcpy(dst, data, bufferSize);
            }
        }
       
    } 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 (currentBuffer == 0) {
            GLUtil::createAndAllocBuffer(totalSize, flag, currentBuffer);
            _bufferObjects[buffer]._id = currentBuffer;
        } else {
            // If the buffer is not persistently mapped, allocate storage the classic way
            glNamedBufferData(currentBuffer, totalSize, NULL, flag);
        }
        // And upload sizeFactor copies of the data
        if (data != nullptr) {
            for (U8 i = 0; i < sizeFactor; ++i) {
                glNamedBufferSubData(currentBuffer, 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) {
    // 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];

    if (_bufferIsRing[buffer]) {
        offset += _elementCount[buffer] * _elementSize[buffer] * queueWriteIndex();
    }

    if (!_bufferPersistent[buffer]) {
        // Update part of the data in the buffer at the specified buffer in the
        // copy that's ready for writing
        glNamedBufferSubData(_bufferObjects[buffer]._id, offset, dataCurrentSize, data);
    } else {
        // Wait for the target part of the buffer to become available for
        // writing
        _lockManagers[buffer]->WaitForLockedRange(offset, dataCurrentSize, true);
        // Offset the data pointer by the required offset taking in account the
        // current data copy we are writing into
        bufferPtr dst = (U8*)_bufferPersistentData[buffer] + offset;
        // Update the data
        memcpy(dst, data, dataCurrentSize);
    }
}

/// 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 (attributeMap::value_type& it : map) {
        setAttributeInternal(it.second);
    }
}

/// Update internal attribute data
void glGenericVertexData::setAttributeInternal(AttributeDescriptor& descriptor) {
    U32 bufferIndex = descriptor.bufferIndex();

    GLintptr offset = descriptor.offset() * _elementSize[bufferIndex];
    if (_bufferIsRing[bufferIndex]) {
        offset += _elementCount[bufferIndex] * _elementSize[bufferIndex] * queueReadIndex();
    }

    BufferBindConfig crtConfig = BufferBindConfig(_bufferObjects[bufferIndex]._id,
                                                  offset,
                                                  static_cast<GLsizei>(_elementSize[bufferIndex]));

    setIfDifferentBindRange(bufferIndex, crtConfig);

    // 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());
        glVertexAttribBinding(descriptor.attribIndex(), bufferIndex);
        descriptor.wasSet(true);
    }
    // Update the attribute data

    GFXDataFormat format = descriptor.dataType();

    bool isIntegerType = format != GFXDataFormat::FLOAT_16 &&
                         format != GFXDataFormat::FLOAT_32;
    
    if (!isIntegerType || (isIntegerType && descriptor.normalized())) {
        glVertexAttribFormat(descriptor.attribIndex(),
                             descriptor.componentsPerElement(),
                             GLUtil::glDataFormat[to_uint(format)],
                             descriptor.normalized() ? GL_TRUE : GL_FALSE,
                             0);
    } else {
        glVertexAttribIFormat(descriptor.attribIndex(),
                              descriptor.componentsPerElement(),
                              GLUtil::glDataFormat[to_uint(format)],
                              0);
    }

    if (descriptor.instanceDivisor() > 0) {
        glVertexBindingDivisor(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/Platform/Video/OpenGL/Buffers/VertexBuffer/glGenericVertexData.cpp

Diff revisions: vs.
Revision Author Commited Message
631 Diff Diff IonutCava picture IonutCava Sun 24 Jan, 2016 20:28:21 +0000

[IonutCava]
- Fix and optimize particle rendering system
- Temporarily disable Z_PRE_PASS system for testing
- Improve thread pool destruction system a bit
- Fix texture loading when used as fb attachment
- Forward+ renderer now takes the entire light buffer (no need to split up by light type)
- Start work on occlusion culling fixes:
— ToDo: Take into account batching system
— Fix gl_DrawIDARB usage

629 Diff Diff IonutCava picture IonutCava Thu 21 Jan, 2016 17:08:04 +0000

[IonutCava]
- New environment mapping system:
— Use previous frame’s list of nodes sorted front to back
— Update reflection for each if they meet the necessary criteria
- Cleanup particle system classes
- Cleanup GenericVertexData class
- Improve argument forwarding to frustum culling tasks

628 Diff Diff IonutCava picture IonutCava Wed 20 Jan, 2016 17:17:53 +0000

[IonutCava]
- Reworked GenericVertexData ring-buffering system and changed vertex attributes to the vertex format system
— Might be buggy
- Disabled bump-mapping for low-LoD level entities
- Removed a forgotten test line in BRDF shader that prevented lighting calculations to occur properly (an early return)
- Updated auto-reflection system for high shininess materials
- Converted a lot of ‘to_xyz’ calls to ‘to_const_xyz’ calls where appropriate to reduce runtime cost (‘to_const_xyz’ is evaluated at compile time)

617 Diff Diff IonutCava picture IonutCava Tue 05 Jan, 2016 16:47:21 +0000

[IonutCava]
- Depth writing is now a rendering API level toggle instead of a renderstateblock option
- Z-Pre-pass fixes and improvements
- Moved normal render target to the display stage from the pre-pass stage
— Normals are only used in post-processing. This improves pre-pass performance

591 Diff Diff IonutCava picture IonutCava Wed 02 Dec, 2015 17:17:23 +0000

[IonutCava]
- More work on the ForwardPlus renderer
- Singleton cleanup
- First steps for reducing scope of GFXDevice class

577 Diff Diff IonutCava picture IonutCava Fri 20 Nov, 2015 15:59:10 +0000

[IonutCava]
- Replace all string indexed maps with unsigned long long indexed maps and add both compile time and runtime hashing functions to convert strings to the proper indices
— Balancing the calls between _ID and _ID_RT can reduce map lookup overhead, especially with ParamHandler and Locale::get

558 Diff Diff IonutCava picture IonutCava Tue 10 Nov, 2015 14:39:30 +0000

[IonutCava]
- Add support for environment mapping to materials:
— No auto-environment map generation yet, but added the render target to GFXDevice
— Reflection state is controlled by the material shininess for now
- Cleaned up GenericDrawCommand by removing “queryID” and “locked” members

557 Diff Diff IonutCava picture IonutCava Tue 10 Nov, 2015 12:00:20 +0000

[IonutCava]
- Gather all rendering calls from glVertexArray and glGenericVertexData into a single function in glResources: submitRenderCommand.
— This allows both classes to interpret GenericDrawCommands in the same way
- Use unsigned ints for all hasehs instead of size_t to avoid negative number hashes (useful for debugging)

556 Diff Diff IonutCava picture IonutCava Mon 09 Nov, 2015 23:10:09 +0000

[IonutCava]
- Fixed faulty VB partitioning code
- Cleanup in state management system:
— Remove some useless clearing of buffers (e.g. in glimBatch code)
— Changing a VAO will invalidate the element buffer cache
-— ToDo: Investigate all states that need to invalidate cache on VAO change
- Don’t add RenderingComponent to the SceneRoot node

Known bug:
- If we are rendering only the skybox, it is not rendered properly until a different node comes into view. Needs investigation. Not state/shader or texture issue!

555 IonutCava picture IonutCava Sun 08 Nov, 2015 22:39:36 +0000

[IonutCava]
- Crash fix related to persistently mapped buffer’s lock managers
- Anaglyph shader fix