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
#include "Headers/GLWrapper.h"

#include "GUI/Headers/GUI.h"
#include "core/Headers/Application.h"
#include "Core/Headers/ParamHandler.h"
#include "Hardware/Video/Headers/GFXDevice.h"
#include <glim.h>

#include <CEGUI/CEGUI.h>

#include <chrono>
#include <thread>

namespace Divide {

/// Try and create a valid OpenGL context taking in account the specified resolution and command line arguments
ErrorCode GL_API::initRenderingApi(const vec2<GLushort>& resolution, GLint argc, char **argv) {
    // Fill our (abstract API <-> openGL) enum translation tables with proper values
    GLUtil::GL_ENUM_TABLE::fill();
    // Most runtime variables are stored in the ParamHandler, including initialization settings retrieved from XML
    ParamHandler& par = ParamHandler::getInstance();
    // Setup error callback function before window creation  to make sure any GLFW init errors are handled.
    glfwSetErrorCallback(GLUtil::glfw_error_callback);
    // Attempt to init GLFW
    if (!glfwInit()) {
    	return GLFW_INIT_ERROR;
    }

#if defined(_DEBUG) || defined(_PROFILE) || defined(_GLDEBUG_IN_RELEASE)
    // OpenGL error handling is available in any build configurations if the proper defines are in place.
    glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT,GL_TRUE);
    // Debug context also ensures more robust GLFW stress testing
#if defined(_DEBUG)
    glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, GLFW_LOSE_CONTEXT_ON_RESET);
#endif

#endif
    // Toggle multi-sampling if requested. This options requires a client-restart, sadly.    
    if (GFX_DEVICE.MSAAEnabled()) {
        glfwWindowHint(GLFW_SAMPLES, GFX_DEVICE.MSAASamples());
    }

    // OpenGL ES is not yet supported, but when added, it will need to mirror OpenGL functionality 1-to-1
    if (GFX_DEVICE.getApi() == OpenGLES) {
        glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
    } else {
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4);
    }

    // I REALLY think re-sizable windows are a bad idea. Increase the resolution instead of messing up render targets
    glfwWindowHint(GLFW_RESIZABLE, par.getParam<bool>("runtime.allowWindowResize",false));
    // 32Bit RGBA (R8G8B8A8), 24bit Depth, 8bit Stencil
    glfwWindowHint(GLFW_RED_BITS,     8);
    glfwWindowHint(GLFW_GREEN_BITS,   8);
    glfwWindowHint(GLFW_BLUE_BITS,    8);
    glfwWindowHint(GLFW_ALPHA_BITS,   8);
    glfwWindowHint(GLFW_STENCIL_BITS, 8);
    glfwWindowHint(GLFW_DEPTH_BITS,  24);
    
    // Open an OpenGL window; resolution and windowed mode is specified in the external XML files
	GLUtil::_mainWindow = glfwCreateWindow(resolution.width, 
                                           resolution.height, 
                                           par.getParam<stringImpl>("appTitle", "Divide").c_str(),
                                           par.getParam<bool>("runtime.windowedMode", true) ? nullptr : 
                                                                                              glfwGetPrimaryMonitor(), 
                                           nullptr);
    // Check if we have a valid window
    if (!GLUtil::_mainWindow) {
        glfwTerminate();
        return( GLFW_WINDOW_INIT_ERROR );
    }

    // The application window will hold the main rendering context
    glfwMakeContextCurrent(GLUtil::_mainWindow);
    // Init glew for main context
    GLUtil::initGlew();
    // Bind the window close request received from GLFW with our custom callback
    glfwSetWindowCloseCallback(GLUtil::_mainWindow, GLUtil::glfw_close_callback);
    // Bind our focus change callback to GLFW's internal wiring
    glfwSetWindowFocusCallback(GLUtil::_mainWindow, GLUtil::glfw_focus_callback);
    // Geometry shaders became core in version 3.3, shader storage buffers in 4.3, 
    // buffer storage in 4.4 so fail if we are missing the required version
    if ((Config::Profile::DISABLE_PERSISTENT_BUFFER && !GLEW_VERSION_4_3) || 
        (!Config::Profile::DISABLE_PERSISTENT_BUFFER && !GLEW_VERSION_4_4)) {
        ERROR_FN(Locale::get("ERROR_GFX_DEVICE"), Locale::get("ERROR_GL_OLD_VERSION"));
        return GLEW_OLD_HARDWARE;
    }

    // We also create a loader thread in the background with its own GL context. 
    // To do this with GLFW, we'll create a second, invisible, window
    glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
    // The loader window will share context lists with the main window
    GLUtil::_loaderWindow = glfwCreateWindow(1, 1, "divide-res-loader", nullptr, GLUtil::_mainWindow);
    // The loader window is essential to the engine structure, so fail if we can't create it
    if (!GLUtil::_loaderWindow) {
        glfwTerminate();
        return( GLFW_WINDOW_INIT_ERROR );
    }

    // Get the current display mode used by the focused monitor
    const GLFWvidmode* return_struct = glfwGetVideoMode(glfwGetPrimaryMonitor());
    // Attempt to position the window in the center of the screen. Useful for the splash screen
    glfwSetWindowPos(GLUtil::_mainWindow, 
                     (return_struct->width - resolution.width) * 0.5f, 
                     (return_struct->height - resolution.height) * 0.5f);

    // OpenGL has a nifty error callback system, available in every build configuration if required
#if defined(_DEBUG) || defined(_PROFILE) || defined(_GLDEBUG_IN_RELEASE)
    // GL_DEBUG_OUTPUT_SYNCHRONOUS is essential for debugging gl commands in the IDE
    glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
    // hardwire our debug callback function with OpenGL's implementation
    glDebugMessageCallback(&GLUtil::DebugCallback, NULL);
    // nVidia flushes a lot of useful info about buffer allocations and shader recompiles due to state and what now,
    // but those aren't needed until that's what's actually causing the bottlenecks
    U32 nvidiaBufferErrors[] = {131185, 131218};
    // Disable shader compiler errors (shader class handles that)
    glDebugMessageControl(GL_DEBUG_SOURCE_SHADER_COMPILER, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, nullptr, GL_FALSE);
    // Disable nVidia buffer allocation info (an easy enable is to change the count param to 0)
    glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 2, nvidiaBufferErrors, GL_FALSE);
    // Shader will be recompiled nVidia error
    glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_PERFORMANCE, GL_DONT_CARE, 2, nvidiaBufferErrors, GL_FALSE);
#endif

    // If we got here, let's figure out what capabilities we have available
    // Maximum addressable texture image units in the fragment shader
	par.setParam<I32>("rendering.maxTextureSlots", GLUtil::getIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS));
    // Maximum number of color attachments per framebuffer
	par.setParam<I32>("rendering.maxRenderTargetOutputs", GLUtil::getIntegerv(GL_MAX_COLOR_ATTACHMENTS));
    // Query GPU vendor to enable/disable vendor specific features
    stringImpl gpuVendorByte(reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
    if (!gpuVendorByte.empty()) {
        if(gpuVendorByte.compare(0,5,"Intel")  == 0) {
			GFX_DEVICE.setGPUVendor(GPU_VENDOR_INTEL);  
		} else if (gpuVendorByte.compare(0, 6, "NVIDIA") == 0) { 
			GFX_DEVICE.setGPUVendor(GPU_VENDOR_NVIDIA); 
		} else if (gpuVendorByte.compare(0, 3, "ATI") == 0 || gpuVendorByte.compare(0, 3, "AMD") == 0) {
			GFX_DEVICE.setGPUVendor(GPU_VENDOR_AMD); 
		}
    } else {
        gpuVendorByte = "Unknown GPU Vendor";
        GFX_DEVICE.setGPUVendor(GPU_VENDOR_OTHER);
    }

    // Cap max anisotropic level to what the hardware supports
    par.setParam("rendering.anisotropicFilteringLevel", std::min(GLUtil::getIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT), 
                                                                 par.getParam<GLint>("rendering.anisotropicFilteringLevel", 1)));
    // OpenGL major version ( we do not support OpenGL versions lower than 4.x )
    if (GLUtil::getIntegerv(GL_MAJOR_VERSION) < 4) {
        ERROR_FN(Locale::get("ERROR_GFX_DEVICE"), Locale::get("ERROR_GL_OLD_VERSION"));
        return GLEW_OLD_HARDWARE;
    } else {
        PRINT_FN(Locale::get( "GL_MAX_VERSION" ), 
                 4, 
                 /*GLEW_VERSION_4_5 ? 5 :*/
                                      GLEW_VERSION_4_4 ? 4 : 
                                                         GLEW_VERSION_4_3 ? 3 : 
                                                                            GLEW_VERSION_4_2 ? 2 : 
                                                                                               GLEW_VERSION_4_1 ? 1 : 
                                                                                                                  0 );
    }

    // Number of sample buffers associated with the framebuffer & MSAA sample count
    GLint samplerBuffers = GLUtil::getIntegerv(GL_SAMPLES);
    GLint sampleCount =  GLUtil::getIntegerv(GL_SAMPLE_BUFFERS);
    PRINT_FN(Locale::get("GL_MULTI_SAMPLE_INFO"), sampleCount, samplerBuffers);
    // If we do not support MSAA on a hardware level for whatever reason, override user set MSAA levels
    U8 msaaSamples = par.getParam<I32>("rendering.MSAAsampless", 0);
    if (samplerBuffers == 0 || sampleCount == 0) {
        msaaSamples = 0;
    }
    GFX_DEVICE.initAA(par.getParam<I32>("rendering.FXAAsamples", 0), msaaSamples);
    // Print all of the OpenGL functionality info to the console and log
    // How many uniforms can we send to fragment shaders
    PRINT_FN(Locale::get("GL_MAX_UNIFORM"), GLUtil::getIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS));
    // How many varying floats can we use inside a shader program
    PRINT_FN(Locale::get("GL_MAX_FRAG_VARYING"), GLUtil::getIntegerv(GL_MAX_VARYING_FLOATS));
    // How many uniforms can we send to vertex shaders
    PRINT_FN(Locale::get("GL_MAX_VERT_UNIFORM"),GLUtil::getIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS));
    // How many attributes can we send to a vertex shader
    PRINT_FN(Locale::get("GL_MAX_VERT_ATTRIB"),GLUtil::getIntegerv(GL_MAX_VERTEX_ATTRIBS));
    // Maximum number of texture units we can address in shaders
	PRINT_FN(Locale::get("GL_MAX_TEX_UNITS"), GLUtil::getIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS), 
             par.getParam<I32>("rendering.maxTextureSlots", 16));
    // Query shading language version support
    PRINT_FN(Locale::get("GL_GLSL_SUPPORT"), glGetString(GL_SHADING_LANGUAGE_VERSION));
    // GPU info, including vendor, gpu and driver
    PRINT_FN(Locale::get("GL_VENDOR_STRING"), gpuVendorByte.c_str(), glGetString(GL_RENDERER), glGetString(GL_VERSION));
    // In order: Maximum number of uniform buffer binding points, 
    //           maximum size in basic machine units of a uniform block and
    //           minimum required alignment for uniform buffer sizes and offset
    PRINT_FN(Locale::get("GL_UBO_INFO"), GLUtil::getIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS), 
                                         GLUtil::getIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE) / 1024, 
                                         GLUtil::getIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT));

    // In order: Maximum number of shader storage buffer binding points, 
    //           maximum size in basic machine units of a shader storage block,
    //           maximum total number of active shader storage blocks that may be accessed by all active shaders and 
    //           minimum required alignment for shader storage buffer sizes and offset.
    PRINT_FN(Locale::get("GL_SSBO_INFO"), GLUtil::getIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS),
                                         (GLUtil::getIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE) / 1024) / 1024, 
                                          GLUtil::getIntegerv(GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS), 
                                          GLUtil::getIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT));

    // Maximum number of subroutines and maximum number of subroutine uniform locations usable in a shader
    PRINT_FN(Locale::get("GL_SUBROUTINE_INFO"), 
             GLUtil::getIntegerv(GL_MAX_SUBROUTINES), 
             GLUtil::getIntegerv(GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS));
        
    // Set the clear color to the blue color used since the initial OBJ loader days
    GL_API::clearColor(DefaultColors::DIVIDE_BLUE());
    // Seamless cubemaps are a nice feature to have enabled (core since 3.2)
    glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
    // Enable multisampling if we actually support and request it
    if (GFX_DEVICE.MSAAEnabled()) {
        glEnable(GL_MULTISAMPLE);
    }

    // Line smoothing should almost always be used
    if (Config::USE_HARDWARE_AA_LINES) {
        glEnable(GL_LINE_SMOOTH);
        glGetIntegerv(GL_SMOOTH_LINE_WIDTH_RANGE, &_lineWidthLimit);
    } else {
        glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, &_lineWidthLimit);
    }

    // Culling is enabled by default, but RenderStateBlocks can toggle it on a per-draw call basis
    glEnable(GL_CULL_FACE);
    // Primitive restart indexes can either be a predefined short value (_S) or a predefined int value (_L),
    // depending on the index buffer
    glPrimitiveRestartIndex(Config::PRIMITIVE_RESTART_INDEX_S);
    // Vsync is toggled on or off via the external config file
    glfwSwapInterval(par.getParam<bool>("runtime.enableVSync",false) ? 1 : 0);

    // Query available display modes (resolution, bit depth per channel and refresh rates)
    GLint numberOfDisplayModes;
    const GLFWvidmode* modes = glfwGetVideoModes(glfwGetPrimaryMonitor(), &numberOfDisplayModes );
    DIVIDE_ASSERT(modes != nullptr, "GLFWWrapper error: No display modes found for the current monitor!");
    PRINT_FN(Locale::get("AVAILABLE_VIDEO_MODES"), numberOfDisplayModes);
    // Register the display modes with the GFXDevice object
    GFXDevice::GPUVideoMode tempDisplayMode;
    for(U16 i = 0; i < numberOfDisplayModes; ++i){
        const GLFWvidmode& temp = modes[i];
        tempDisplayMode._resolution.set(temp.width, temp.height);
        tempDisplayMode._bitDepth.set(temp.redBits, temp.greenBits, temp.blueBits);
        tempDisplayMode._refreshRate =  temp.refreshRate;
        GFX_DEVICE.registerDisplayMode(tempDisplayMode);
        // Optionally, output to console/file each display mode
        D_PRINT_FN(Locale::get("CURRENT_DISPLAY_MODE"), 
                   temp.width, 
                   temp.height, 
                   temp.redBits, 
                   temp.greenBits, 
                   temp.blueBits, 
                   temp.refreshRate);
    }

    // Prepare font rendering subsystem
    createFonsContext();  
    if (_fonsContext == nullptr) {
        ERROR_FN(Locale::get("ERROR_FONT_INIT"));
        return GLFW_WINDOW_INIT_ERROR;
    }

    // Prepare immediate mode emulation rendering
    NS_GLIM::glim.SetVertexAttribLocation(VERTEX_POSITION_LOCATION);

    // We need a dummy VAO object for point rendering
    glGenVertexArrays(1, &_pointDummyVAO);
    // Allocate a buffer for indirect draw used to store the query results without a round-trip to the CPU
    glGenBuffers(1, &_indirectDrawBuffer);
    // In debug, we also have various performance counters to profile GPU rendering operations
#   ifdef _DEBUG
        // We have multiple counter buffers, and each can be multi-buffered (currently, only double-buffered, front and back)
        // to avoid pipeline stalls
        for (U8 i = 0; i < PERFORMANCE_COUNTER_BUFFERS; ++i) {
            glGenQueries(PERFORMANCE_COUNTERS, _queryID[i]);
            DIVIDE_ASSERT(_queryID[i][0] != 0, "GLFWWrapper error: Invalid performance counter query ID!");
        }

        _queryBackBuffer = 4;
        // Initialize an initial time query as it solves certain issues with consecutive queries later
        glBeginQuery(GL_TIME_ELAPSED, _queryID[0][0]);
        glEndQuery(GL_TIME_ELAPSED);
        // Wait until the results are available
        GLint stopTimerAvailable = 0;
        while (!stopTimerAvailable) {
            glGetQueryObjectiv(_queryID[0][0], GL_QUERY_RESULT_AVAILABLE, &stopTimerAvailable);
        }
#   endif

    // That's it. Everything should be ready for draw calls
    PRINT_FN(Locale::get("START_OGL_API_OK"));

    // Once OpenGL is ready for rendering, init CEGUI
    _enableCEGUIRendering =  !(ParamHandler::getInstance().getParam<bool>("GUI.CEGUI.SkipRendering"));
	_GUIGLrenderer = &CEGUI::OpenGL3Renderer::create();
    _GUIGLrenderer->enableExtraStateSettings(par.getParam<bool>("GUI.CEGUI.ExtraStates"));
    CEGUI::System::create(*_GUIGLrenderer);

	Application::getInstance().registerShutdownCallback( DELEGATE_BIND(&GLUtil::destroyGlew ) );
    return NO_ERR;
}

/// Clear everything that was setup in initRenderingApi()
void GL_API::closeRenderingApi() {
	CEGUI::OpenGL3Renderer::destroy(*_GUIGLrenderer);
	_GUIGLrenderer = nullptr;
    // Close the loading thread 
    _closeLoadingThread = true;
    while ( GFX_DEVICE.loadingThreadAvailable() ) {
        std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
    }

    // Destroy sampler objects
    MemoryManager::DELETE_HASHMAP(_samplerMap);

    // Destroy the text rendering system
    deleteFonsContext();
    _fonts.clear();
    // If we have an indirect draw buffer, delete it
    if (_indirectDrawBuffer > 0) {
        glDeleteBuffers(1, &_indirectDrawBuffer);
        _indirectDrawBuffer = 0;
    }
    if (_pointDummyVAO > 0) {
        glDeleteVertexArrays(1, &_pointDummyVAO);
        _pointDummyVAO = 0;
    }
    // Destroy application windows and close GLFW
    glfwDestroyWindow( GLUtil::_loaderWindow );
    glfwDestroyWindow( GLUtil::_mainWindow );
    glfwTerminate();
}

/// changeResolutionInternal is simply asking GLFW to do the resizing and updating the resolution cache
void GL_API::changeResolutionInternal(GLushort w, GLushort h) {
    glfwSetWindowSize(GLUtil::_mainWindow, w, h);
    _cachedResolution.set(w, h);
}

/// Window positioning is handled by GLFW
void GL_API::setWindowPos(GLushort w, GLushort h) const {
    glfwSetWindowPos(GLUtil::_mainWindow, w, h);
}

/// Mouse positioning is handled by GLFW
void GL_API::setCursorPosition(GLushort x, GLushort y) const {
    glfwSetCursorPos(GLUtil::_mainWindow, (GLdouble)x, (GLdouble)y);
}

/// This functions should be run in a separate, consumer thread.
/// The main app thread, the producer, adds tasks via a lock-free queue that is checked every 20 ms
void GL_API::createLoaderThread() {
    // We need a valid OpenGL context to make current in this thread
    assert(GLUtil::_loaderWindow != nullptr);
    glfwMakeContextCurrent(GLUtil::_loaderWindow);

#   ifdef GLEW_MX
        GLUtil::initGlew();
        // Enable OpenGL debug callbacks for this context as well
#       if defined(_DEBUG) || defined(_PROFILE) || defined(_GLDEBUG_IN_RELEASE)
            glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
            // Debug callback in a separate thread requires a flag to distinguish it from the main thread's callbacks
            glDebugMessageCallback(&GLUtil::DebugCallback, (void*)(1));
#      endif
#   endif

    // This will be our target container for new items pulled from the queue
    DELEGATE_CBK<> callback;
    // Delay startup of the thread by a 1/4 of a second. No real reason
    std::this_thread::sleep_for(std::chrono::milliseconds(250));
    // Use an atomic bool to check if the thread is still active (cheap and easy)
    GFX_DEVICE.loadingThreadAvailable(true);
    // Run an infinite loop until we actually request otherwise
    while (!_closeLoadingThread) {
        // Try to pull a new element from the queue
        if (GFX_DEVICE.getLoadQueue().pop(callback)) {
            // If we manage, we run it and force the gpu to process it
            callback();
            glFlush();
        } else {  // If there are no new items to process in the queue, just stall
            // Avoid burning the CPU - Ionut
            std::this_thread::sleep_for(std::chrono::milliseconds(10));
        }
    }
	GLUtil::destroyGlew();
    // If we close the loading thread, update our atomic bool to make sure the application isn't using it anymore
    GFX_DEVICE.loadingThreadAvailable(false);
}

};

Commits for Divide-Framework/trunk/Source Code/Hardware/Video/OpenGL/GLFWWrapper.cpp

Diff revisions: vs.
Revision Author Commited Message
331 Diff Diff IonutCava picture IonutCava Sat 06 Dec, 2014 20:53:45 +0000

[Ionut]
- Limited line length to 132 characters to improve readability and diff-comparisons
- Refactored memory allocation/deallocation functions
- Fixed a few compatibility issues with HashMap.h
- Fixed a bug in GPU Skinning shaders (cast a float to int)

330 Diff Diff IonutCava picture IonutCava Fri 10 Oct, 2014 17:19:11 +0000

[Ionut]
- New rendering algorithm :
— Perform second pass for visible nodes gathering all render commands and uploading them to an indirect draw buffer
— Render geometry with indirect draw commands
— Removed per-node range binding of the node buffer. Instead, bind the entire buffer once and index data in shaders
— Use “baseInstance” parameter from IndirectDrawCommand as a node buffer index
— Prefer DSA extensions for updating buffer data where applicable
- Moved all rendering specific code from SceneGraphNode to a new RenderingComponent
- Optimized “toString” utility function

326 Diff Diff IonutCava picture IonutCava Tue 30 Sep, 2014 21:11:32 +0000

[Ionut]
- Fixed more memory leaks
- Simplified Task interface and timing System
- Improved compatibility between Boost, STL and EASTL with random combinations of vectors, strings and maps
- Simplified Light class by removing the “slot” member
- Random optimizations

325 Diff Diff IonutCava picture IonutCava Wed 17 Sep, 2014 20:06:13 +0000

[Ionut]
- Reworked transform system:
— Parent transform chain system moved from Transform class to the PhysicsComponent
— PhysicsComponent now returns all transform values needed both global and local (still needs heavy optimization and caching)

- Reworked SceneGraph node management:
— Proper ref counting of SceneNodes and proper removing of resource (ResourceCache is now empty on destruction, as it should be)
— Removed parent transform tracking as that’s the PhysicsComponent’s responsibility
— Only nodes loaded via the ResourceCache are allowed to be added to the SceneGraph (added proper loaders for Impostors, Sky, etc)

- Optimized some of the math classes (mat4, mat3)

323 Diff Diff IonutCava picture IonutCava Thu 11 Sep, 2014 20:58:50 +0000

[Ionut]
- Reworked GFXDevice API initialization system
- Added a separate map for boolean values in ParamHandler
- More cleanups in GFXDevice class
- Fixed an infinite loop issue in Task class

322 Diff Diff IonutCava picture IonutCava Sat 06 Sep, 2014 20:33:47 +0000

[Ionut]
- Refactored most of Boost related code to be C++11 based
— Boost is only used for ThreadPool, Mutex handling, XML parsing and networking (ASIO)
— Function binds, threads, regex, NonCopyable base, Hashing algorithms and more are now using C++11 libraries
- Replaced all FOR_EACH calls with standard, range, “for” calls

321 Diff Diff IonutCava picture IonutCava Wed 03 Sep, 2014 22:05:15 +0000

[Ionut]
- Added support (and enabled by default) for the EASTL library (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html / https://github.com/paulhodge/EASTL)
— Strings, vectors and hash_maps can be combined from EASTL, STL and Boost (not all combinations work. e.g. EASTL strings with STL/Boost containers due to the lack of a proper hash function)

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)

314 Diff Diff IonutCava picture IonutCava Sun 24 Aug, 2014 19:54:33 +0000

[Ionut]
- More AI work
- Added some needed audio dlls

303 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