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
//OpenGL state management: Lights, matrices, viewport, bound objects etc
#include "Headers/GLWrapper.h"

#include "Core/Headers/ParamHandler.h"
#include "Managers/Headers/ShaderManager.h"
#include "Rendering/Lighting/Headers/Light.h"
#include "Hardware/Video/Headers/GFXDevice.h"
#include "Hardware/Video/OpenGL/Buffers/VertexBuffer/Headers/glVertexArray.h"
#include "Hardware/Video/OpenGL/Buffers/ShaderBuffer/Headers/glUniformBuffer.h"

GLuint GL_API::_activeVAOId = GL_INVALID_INDEX;
GLuint GL_API::_activeFBId  = GL_INVALID_INDEX;
GLuint GL_API::_activeBufferId[] = {GL_INVALID_INDEX, GL_INVALID_INDEX, GL_INVALID_INDEX, GL_INVALID_INDEX, GL_INVALID_INDEX, GL_INVALID_INDEX, GL_INVALID_INDEX};
GLuint GL_API::_activeTextureUnit       = GL_INVALID_INDEX;
GLuint GL_API::_activeTransformFeedback = GL_INVALID_INDEX;
GLint  GL_API::_activePackUnpackAlignments[] = {1, 1};
GLint  GL_API::_activePackUnpackRowLength[]  = {0, 0};
GLint  GL_API::_activePackUnpackSkipPixels[] = {0, 0};
GLint  GL_API::_activePackUnpackSkipRows[]   = {0, 0};

bool GL_API::_lastRestartIndexSmall   = true;
bool GL_API::_primitiveRestartEnabled = false;

GL_API::textureBoundMapDef GL_API::_textureBoundMap;
GL_API::samplerBoundMapDef GL_API::_samplerBoundMap;
GL_API::samplerObjectMap   GL_API::_samplerMap;

Unordered_map<GLuint, vec4<GLfloat> > GL_API::_prevClearColor;

void GL_API::clearStates(const bool skipShader,const bool skipTextures,const bool skipBuffers){
    if(!skipShader)
        setActiveProgram(nullptr);
    
    if(!skipTextures){
        FOR_EACH(textureBoundMapDef::value_type& it, _textureBoundMap)
            GL_API::bindTexture(it.first, 0, it.second.second);

        setActiveTextureUnit(0);
    }

    if(!skipBuffers){
        setPixelPackUnpackAlignment();
        setActiveVAO(0);
        setActiveFB(0, true, true);
        setActiveBuffer(GL_ARRAY_BUFFER, 0);
        setActiveBuffer(GL_TEXTURE_BUFFER, 0);
        setActiveBuffer(GL_UNIFORM_BUFFER, 0);
        setActiveBuffer(GL_SHADER_STORAGE_BUFFER, 0);
        setActiveBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
        setActiveBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
        setActiveBuffer(GL_DRAW_INDIRECT_BUFFER, 0);
        setActiveTransformFeedback(0);
    }

    GL_API::clearColor(DefaultColors::DIVIDE_BLUE());
}

bool GL_API::setPixelPackAlignment(GLint packAlignment, GLint rowLength, GLint skipRows, GLint skipPixels) {
    bool changed = false;
    if(_activePackUnpackAlignments[0] != packAlignment){
        glPixelStorei(GL_PACK_ALIGNMENT, packAlignment);
        _activePackUnpackAlignments[0] = packAlignment;
        changed = true;
    }
    if(_activePackUnpackRowLength[0] != rowLength){
        glPixelStorei(GL_PACK_ROW_LENGTH, rowLength);
        _activePackUnpackRowLength[0] = rowLength;
        changed = true;
    }
    if(_activePackUnpackSkipRows[0] != skipRows){
        glPixelStorei(GL_PACK_SKIP_ROWS, skipRows);
        _activePackUnpackSkipRows[0] = skipRows;
        changed = true;
    }
    if(_activePackUnpackSkipPixels[0] != skipPixels){
        glPixelStorei(GL_PACK_SKIP_PIXELS, skipPixels);
        _activePackUnpackSkipPixels[0] = skipPixels;
        changed = true;
    }

    return changed;
}

bool GL_API::setPixelUnpackAlignment(GLint unpackAlignment, GLint rowLength, GLint skipRows, GLint skipPixels) {
   bool changed = false;
    if(_activePackUnpackAlignments[1] != unpackAlignment){
        glPixelStorei(GL_UNPACK_ALIGNMENT, unpackAlignment);
        _activePackUnpackAlignments[1] = unpackAlignment;
        changed = true;
    }
    if(_activePackUnpackRowLength[1] != rowLength){
        glPixelStorei(GL_UNPACK_ROW_LENGTH, rowLength);
        _activePackUnpackRowLength[1] = rowLength;
        changed = true;
    }
    if(_activePackUnpackSkipRows[1] != skipRows){
        glPixelStorei(GL_UNPACK_SKIP_ROWS, skipRows);
        _activePackUnpackSkipRows[1] = skipRows;
        changed = true;
    }
    if(_activePackUnpackSkipPixels[1] != skipPixels){
        glPixelStorei(GL_UNPACK_SKIP_PIXELS, skipPixels);
        _activePackUnpackSkipPixels[1] = skipPixels;
        changed = true;
    }

    return changed;
}

void GL_API::togglePrimitiveRestart(bool state, bool smallIndices){
    if (_lastRestartIndexSmall != smallIndices && state){
        _lastRestartIndexSmall = smallIndices;
        glPrimitiveRestartIndex(smallIndices ? Config::PRIMITIVE_RESTART_INDEX_S : Config::PRIMITIVE_RESTART_INDEX_L);
    }
    if (_primitiveRestartEnabled != state){
        _primitiveRestartEnabled = state;
        state ? glEnable(GL_PRIMITIVE_RESTART) : glDisable(GL_PRIMITIVE_RESTART);
    }
}

void GL_API::updateClipPlanes(){
    bool clipPlaneActive = false;

    const PlaneList& list = GFX_DEVICE.getClippingPlanes();
    
    for (U8 i = 0; i < Config::MAX_CLIP_PLANES; ++i){
        clipPlaneActive = list[i].active();

        if (_activeClipPlanes[i] != clipPlaneActive){
            _activeClipPlanes[i]  = clipPlaneActive;
            clipPlaneActive ? glEnable(GL_CLIP_DISTANCE0 + i) : glDisable(GL_CLIP_DISTANCE0 + i);
        }
    }
}

bool GL_API::setActiveTextureUnit(GLuint unit){
    if(_activeTextureUnit == unit)
        return false; //< prevent double bind

    _activeTextureUnit = unit;
    glActiveTexture(GL_TEXTURE0 + unit);

    return true;
}

bool GL_API::bindSampler(GLuint unit, size_t samplerHash){
    if(_samplerBoundMap[unit] != samplerHash){
        glBindSampler(unit, getSamplerHandle(samplerHash));
        _samplerBoundMap[unit] = samplerHash;
        return true;
    }
    return false;
}
  
bool GL_API::bindTexture(GLuint unit, GLuint handle, GLenum type, size_t samplerHash){
    assert(unit < GFX_DEVICE.getMaxTextureSlots());

    GL_API::bindSampler(unit, samplerHash);

    std::pair<GLuint, GLenum>& currentMapping = _textureBoundMap[unit];
    if (currentMapping.first != handle || currentMapping.second != type){
        GL_API::setActiveTextureUnit(unit);
        glBindTexture(type, handle);
        currentMapping.first = handle;
        currentMapping.second = type;
        return true;
    }
    return false;
}

bool GL_API::setActiveFB(GLuint id, const bool read, const bool write){
    if (_activeFBId == id)
        return false; //<prevent double bind

    _activeFBId = id;
    if (read && write)      glBindFramebuffer(GL_FRAMEBUFFER, id);
    else if(read && !write) glBindFramebuffer(GL_READ_FRAMEBUFFER, id);
    else                    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, id);

    return true;
}

bool GL_API::setActiveVAO(GLuint id){
    if(_activeVAOId == id)
        return false; //<prevent double bind
        
    _activeVAOId = id;
    glBindVertexArray(id);

    return true;
}

bool GL_API::setActiveTransformFeedback(GLuint id){
    if(_activeTransformFeedback == id)
        return false;

    _activeTransformFeedback = id;
    glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
    return true;
}

bool GL_API::setActiveBuffer(GLenum target, GLuint id){
    GLint index = -1;
    switch (target){
        case GL_ARRAY_BUFFER          : index = 0; break;
        case GL_TEXTURE_BUFFER        : index = 1; break;
        case GL_UNIFORM_BUFFER        : index = 2; break;
        case GL_SHADER_STORAGE_BUFFER : index = 3; break;
        case GL_ELEMENT_ARRAY_BUFFER  : index = 4; break;
        case GL_PIXEL_UNPACK_BUFFER   : index = 5; break;
        case GL_DRAW_INDIRECT_BUFFER  : index = 6; break;
    };

    DIVIDE_ASSERT(index != -1, "GLStates error: attempted to bind an invalid buffer target!");

    if (_activeBufferId[index] == id)
        return false; //<prevent double bind

    _activeBufferId[index] = id;
    glBindBuffer(target, id);

    return true;
}

bool GL_API::setActiveProgram(glShaderProgram* const program){
    GLuint newProgramId = (program != nullptr) ? program->getId() : 0;
    GLuint oldProgramId = (GFX_DEVICE.activeShaderProgram() != nullptr) ? GFX_DEVICE.activeShaderProgram()->getId() : 0;
    if(oldProgramId == newProgramId)
        return false; //<prevent double bind

    if (GFX_DEVICE.activeShaderProgram() != nullptr)
        GFX_DEVICE.activeShaderProgram()->unbind(false);

    GFX_DEVICE.activeShaderProgram(program);

    glUseProgram(newProgramId);
    return true;
}

void GL_API::clearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLuint renderTarget){
    vec4<F32>& prevClearColor = _prevClearColor[renderTarget];
    if (prevClearColor != vec4<F32>(r,g,b,a)){
        prevClearColor.set(r, g, b, a);
        glClearColor(r,g,b,a);
    }
}

void GL_API::changeViewport(const vec4<I32>& newViewport) const {
    if (Config::Profile::USE_1x1_VIEWPORT)
        glViewport(newViewport.x, newViewport.y, 1, 1);
    else
        glViewport(newViewport.x, newViewport.y, newViewport.z, newViewport.w);

}

#ifndef SHOULD_TOGGLE
    #define SHOULD_TOGGLE(state) (!oldBlock || oldBlock->getDescriptor().state != newDescriptor.state)
    #define SHOULD_TOGGLE_2(state1, state2)  (!oldBlock ||SHOULD_TOGGLE(state1) || SHOULD_TOGGLE(state2))
    #define SHOULD_TOGGLE_3(state1, state2, state3) (!oldBlock ||SHOULD_TOGGLE_2(state1, state2) || SHOULD_TOGGLE(state3))
    #define SHOULD_TOGGLE_4(state1, state2, state3, state4) (!oldBlock || SHOULD_TOGGLE_3(state1, state2, state3) || SHOULD_TOGGLE(state4))
    #define TOGGLE_NO_CHECK(state, enumValue) newDescriptor.state ? glEnable(enumValue) : glDisable(enumValue)
    #define TOGGLE_WITH_CHECK(state, enumValue) if(SHOULD_TOGGLE(state)) TOGGLE_NO_CHECK(state, enumValue);
#endif

void GL_API::activateStateBlock(const RenderStateBlock& newBlock, RenderStateBlock* const oldBlock) const {
    // ------------------- PASS INDEPENDENT STATES -------------------------------------- //
    const RenderStateBlockDescriptor& newDescriptor = newBlock.getDescriptor();

    TOGGLE_WITH_CHECK(_blendEnable,   GL_BLEND);
    TOGGLE_WITH_CHECK(_cullEnabled,   GL_CULL_FACE);
    TOGGLE_WITH_CHECK(_stencilEnable, GL_STENCIL_TEST);
    TOGGLE_WITH_CHECK(_zEnable,       GL_DEPTH_TEST);

    if (SHOULD_TOGGLE_2(_blendSrc, _blendDest))
        glBlendFuncSeparate(glBlendTable[newDescriptor._blendSrc], glBlendTable[newDescriptor._blendDest], GL_ONE, GL_ZERO);

    if (SHOULD_TOGGLE(_blendOp))
        glBlendEquation(glBlendOpTable[newDescriptor._blendOp]);
    
    if (SHOULD_TOGGLE(_cullMode))
        glCullFace(glCullModeTable[newDescriptor._cullMode]);
    
    if (SHOULD_TOGGLE(_fillMode))
        glPolygonMode(GL_FRONT_AND_BACK, glFillModeTable[newDescriptor._fillMode]);
    
    if (SHOULD_TOGGLE(_zFunc))
        glDepthFunc(glCompareFuncTable[newDescriptor._zFunc]);
    
    if (SHOULD_TOGGLE(_zWriteEnable))
        glDepthMask(newDescriptor._zWriteEnable ? GL_TRUE : GL_FALSE);
    
    if (SHOULD_TOGGLE(_stencilWriteMask))
        glStencilMask(newDescriptor._stencilWriteMask);
    
    if (SHOULD_TOGGLE_3(_stencilFunc, _stencilRef, _stencilMask))
        glStencilFunc(glCompareFuncTable[newDescriptor._stencilFunc], newDescriptor._stencilRef, newDescriptor._stencilMask);
    
    if (SHOULD_TOGGLE_3(_stencilFailOp, _stencilZFailOp, _stencilPassOp))
        glStencilOp(glStencilOpTable[newDescriptor._stencilFailOp], glStencilOpTable[newDescriptor._stencilZFailOp], glStencilOpTable[newDescriptor._stencilPassOp]);
    
    if (SHOULD_TOGGLE(_zBias)){
        if (IS_ZERO(newDescriptor._zBias)){
            glDisable(GL_POLYGON_OFFSET_FILL);
        }else {
            glEnable(GL_POLYGON_OFFSET_FILL);
            glPolygonOffset(newDescriptor._zBias, newDescriptor._zUnits);
        }
    }

    if (SHOULD_TOGGLE_4(_colorWrite.b.b0, _colorWrite.b.b1, _colorWrite.b.b2, _colorWrite.b.b3)) {
        glColorMask(newDescriptor._colorWrite.b.b0 == GL_TRUE, // R
                    newDescriptor._colorWrite.b.b1 == GL_TRUE, // G
                    newDescriptor._colorWrite.b.b2 == GL_TRUE, // B
                    newDescriptor._colorWrite.b.b3 == GL_TRUE);// A
    }
}

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

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

279 Diff Diff IonutCava picture IonutCava Sat 28 Jun, 2014 16:20:46 +0000

[Ionut][[BR]]
- Unified draw command system into GenericDrawCommand [[BR]]
- Fixed double VB creation in Object3D [[BR]]
- Reworked triangle data computation (now Object3D’s responsibility) [[BR]]
- VertexArrays can now render using the primitive type specified in the draw command instead of the fixed type specified at creation [[BR]]
- Optimized terrain shader [[BR]]

275 Diff Diff IonutCava picture IonutCava Fri 13 Jun, 2014 15:11:02 +0000

[Ionut [[BR]]
- Removed all GLM dependencies (great library, but my math class can handle all of my requirements now) [[BR]]
- Moved view/projection/texture matrix management to GFXDevice class (from API specific classes) [[BR]]

273 Diff Diff IonutCava picture IonutCava Wed 11 Jun, 2014 20:34:00 +0000

[Ionut] [[BR]]
- Improved batching part2: [[BR]]
— Moved all bone transformation matrices upload from uniform functions in SceneNode to Shader Storage Buffers in AnimationController class with updates controlled by SceneGraphNode’s AnimationComponent [[BR]]
-— No double-buffering or efficient mapping of data yet. Just raw buffer updates [[BR]]
— Replaced all RenderStateBlock* pointers with I64 hash values [[BR]]
-— Will be used later in draw commands as per-shader state hash [[BR]]
— Moved getShaderProgram from Material to Material::ShaderInfo [[BR]]
-— Improved redundant uniform checks [[BR]]
— Improved texture unit changing in case of redundant texture bind case (i.e. skip changing the texture unit) [[BR]]
[[BR]]
- Improved float and double comparison functions using algorithms described in http://randomascii.wordpress.com/2012/02/13/dont-store-that-in-a-float/ [[BR]]
- Added a new utility function, DIVIDE_ASSERT, to more easily bind an assert check with a specific message [[BR]]
- Added missing files from Forward+ renderer’s initial code [[BR]]

272 Diff Diff IonutCava picture IonutCava Wed 11 Jun, 2014 11:30:51 +0000

[Ionut] [[BR]]
- Added initial code for Forward+ rendering (grid based light culling) [[BR]]
- Simplified Light class [[BR]]
- Moved more light uniform data to ShaderBuffers [[BR]]
- Double buffered grass rendering [[BR]]
- Added a better attribute interface to GenericVertexData [[BR]]
- Fixed screenshot capture [[BR]]
- Fixed texture double-bind checks [[BR]]

268 Diff Diff IonutCava picture IonutCava Wed 04 Jun, 2014 10:20:27 +0000

[IonutCava] [[BR]]
- Terrain and vegetation updates: [[BR]]
— Use standard phong lighting model [[BR]]
— Separate grass patches per chunk [[BR]]
— Reduce number of required texture bind points for terrain by adding both textures and normal maps in a single texture array [[BR]]
— Draw terrain with 2 drawcalls (using glMultiDrawElements twice, once for LoD == 0 and once for LoD > 0) [[BR]]
[[BR]]
- Buffer management updates: [[BR]]
— Unified buffer binding system [[BR]]
— Made Uniform buffer objects visible to all classes and moved lightUBO to LightManager, matricesUBO to GFXDevice etc [[BR]]
— Added initial support for Shader Buffer Objects [[BR]]
— Moved viewport management to GFXDevice class [[BR]]
[[BR]]
- Rendering improvements: [[BR]]
— Added Hi-Z occlusion culling to instanceCull shader (using Hi-Z depth buffer constructed in GFXDevice class) [[BR]]
— Resolved issues with shadow maps overriding texture bind locations [[[BR]]
— Improved shader and shader program loading [[BR]]
— Improved material transparency support [[BR]]
— Added buffer lock manager class from “Approaching Zero Driver Overhead in OpenGL (Presented by NVIDIA)” speech at GDC14 [[BR]]

267 Diff Diff k1ngp1n picture k1ngp1n Wed 28 May, 2014 11:08:12 +0000

[Ionut] [[BR]]
- Improved texture handling: [[BR]]
— No more texture unbind (except when clearing the frame state) [[BR]]
— Moved texture bind checking to the GL_API class [[BR]]
- Fixed a crash related to vegetation loading due to compiler optimizations [[BR]]
- removed all “releaseMaterial” functions as they are no longer needed [[BR]]

265 Diff Diff k1ngp1n picture k1ngp1n Tue 27 May, 2014 19:47:56 +0000

[Ionut] [[BR]]
- reworked uniform buffer binding [[BR]]
- modified framebuffer mipmap update [[BR]]

264 k1ngp1n picture k1ngp1n Tue 27 May, 2014 13:04:38 +0000

[Ionut] [[BR]]
- New camera system: [[BR]]
— Stack based (push/pop active camera) [[BR]]
— Per camera frustum [[BR]]
— Per camera projection [[BR]]
— Shadow mapping now uses the new camera system (each light has a shadow camera) [[BR]]
[[BR]]
- New terrain, water and vegetation system: [[BR]]
— Direct import of terrain from L3DT both as 8-bit grayscale and 16-bit raw formats [[BR]]
— Multiple alpha maps for texture splatting support [[BR]]
— Per texture detail map support [[BR]]
— Transform feedback based visibility culling for vegetation [[BR]]
— Alpha-map based vegetation placing on terrain [[BR]]
— Water now uses a refraction map instead of alpha blending for better refraction effects [[BR]]
[[BR]]
- SceneGraph improvements: [[BR]]
— Better bounding box updates from child to parent [[BR]]
— Better onDraw / postDraw implementation [[BR]]
[[BR]]
- Performance improvements: [[BR]]
— Batch 2D rendering tasks together as much as possible[[BR]]
— Improve renderStateBlock hash generation for better sorting [[BR]]
— Move most state related gfx changes from API implementation to the GFXDevice class [[BR]]
— Move viewport stack to the GFXDevice class [[BR]]
— Added various performance counters (frame duration with round-robin query system, draw call count, etc) [[BR]]
— Fixed and improved clip plane management [[BR]]
— Delete client-side texture data after GPU upload [[BR]]
[[BR]]
- New features: [[BR]]
— Added callback support to the Task class so that a specific task may call a function in the main thread upon completion [[BR]]
— Added mouse-wheel zoom support to Orbit/ThirdPerson cameras [[BR]]
— Added 2D Texture Array support (e.g. used for terrain textures) [[BR]]