~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/COpenGLSLMaterialRenderer.cpp

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
 
2
// This file is part of the "Irrlicht Engine".
 
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
 
4
 
 
5
// This file was originally written by William Finlayson.  I (Nikolaus
 
6
// Gebhardt) did some minor modifications and changes to it and integrated it
 
7
// into Irrlicht. Thanks a lot to William for his work on this and that he gave
 
8
// me his permission to add it into Irrlicht using the zlib license.
 
9
 
 
10
// After Irrlicht 0.12, Michael Zoech did some improvements to this renderer, I
 
11
// merged this into Irrlicht 0.14, thanks to him for his work.
 
12
 
 
13
#include "IrrCompileConfig.h"
 
14
#ifdef _IRR_COMPILE_WITH_OPENGL_
 
15
 
 
16
#include "COpenGLSLMaterialRenderer.h"
 
17
#include "IGPUProgrammingServices.h"
 
18
#include "IShaderConstantSetCallBack.h"
 
19
#include "IMaterialRendererServices.h"
 
20
#include "IVideoDriver.h"
 
21
#include "os.h"
 
22
#include "COpenGLDriver.h"
 
23
 
 
24
namespace irr
 
25
{
 
26
namespace video
 
27
{
 
28
 
 
29
 
 
30
//! Constructor
 
31
COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(video::COpenGLDriver* driver,
 
32
                s32& outMaterialTypeNr, const c8* vertexShaderProgram,
 
33
                const c8* vertexShaderEntryPointName,
 
34
                E_VERTEX_SHADER_TYPE vsCompileTarget,
 
35
                const c8* pixelShaderProgram,
 
36
                const c8* pixelShaderEntryPointName,
 
37
                E_PIXEL_SHADER_TYPE psCompileTarget,
 
38
                const c8* geometryShaderProgram,
 
39
                const c8* geometryShaderEntryPointName,
 
40
                E_GEOMETRY_SHADER_TYPE gsCompileTarget,
 
41
                scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
 
42
                u32 verticesOut,
 
43
                IShaderConstantSetCallBack* callback,
 
44
                video::IMaterialRenderer* baseMaterial,
 
45
                s32 userData)
 
46
        : Driver(driver), CallBack(callback), BaseMaterial(baseMaterial),
 
47
                Program(0), Program2(0), UserData(userData)
 
48
{
 
49
        #ifdef _DEBUG
 
50
        setDebugName("COpenGLSLMaterialRenderer");
 
51
        #endif
 
52
 
 
53
        //entry points must always be main, and the compile target isn't selectable
 
54
        //it is fine to ignore what has been asked for, as the compiler should spot anything wrong
 
55
        //just check that GLSL is available
 
56
 
 
57
        if (BaseMaterial)
 
58
                BaseMaterial->grab();
 
59
 
 
60
        if (CallBack)
 
61
                CallBack->grab();
 
62
 
 
63
        if (!Driver->queryFeature(EVDF_ARB_GLSL))
 
64
                return;
 
65
 
 
66
        init(outMaterialTypeNr, vertexShaderProgram, pixelShaderProgram, geometryShaderProgram);
 
67
}
 
68
 
 
69
 
 
70
//! constructor only for use by derived classes who want to
 
71
//! create a fall back material for example.
 
72
COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(COpenGLDriver* driver,
 
73
                                        IShaderConstantSetCallBack* callback,
 
74
                                        IMaterialRenderer* baseMaterial, s32 userData)
 
75
: Driver(driver), CallBack(callback), BaseMaterial(baseMaterial),
 
76
                Program(0), Program2(0), UserData(userData)
 
77
{
 
78
        if (BaseMaterial)
 
79
                BaseMaterial->grab();
 
80
 
 
81
        if (CallBack)
 
82
                CallBack->grab();
 
83
}
 
84
 
 
85
 
 
86
//! Destructor
 
87
COpenGLSLMaterialRenderer::~COpenGLSLMaterialRenderer()
 
88
{
 
89
        if (CallBack)
 
90
                CallBack->drop();
 
91
 
 
92
        if (Program)
 
93
        {
 
94
                GLhandleARB shaders[8];
 
95
                GLint count;
 
96
                Driver->extGlGetAttachedObjects(Program, 8, &count, shaders);
 
97
                for (GLint i=0; i<count; ++i)
 
98
                        Driver->extGlDeleteObject(shaders[i]);
 
99
                Driver->extGlDeleteObject(Program);
 
100
                Program = 0;
 
101
        }
 
102
 
 
103
        if (Program2)
 
104
        {
 
105
                GLuint shaders[8];
 
106
                GLint count;
 
107
                Driver->extGlGetAttachedShaders(Program2, 8, &count, shaders);
 
108
                for (GLint i=0; i<count; ++i)
 
109
                        Driver->extGlDeleteShader(shaders[i]);
 
110
                Driver->extGlDeleteProgram(Program2);
 
111
                Program2 = 0;
 
112
        }
 
113
 
 
114
        UniformInfo.clear();
 
115
 
 
116
        if (BaseMaterial)
 
117
                BaseMaterial->drop();
 
118
}
 
119
 
 
120
 
 
121
void COpenGLSLMaterialRenderer::init(s32& outMaterialTypeNr,
 
122
                const c8* vertexShaderProgram,
 
123
                const c8* pixelShaderProgram,
 
124
                const c8* geometryShaderProgram,
 
125
                scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
 
126
                u32 verticesOut)
 
127
{
 
128
        outMaterialTypeNr = -1;
 
129
 
 
130
        if (!createProgram())
 
131
                return;
 
132
 
 
133
#if defined(GL_ARB_vertex_shader) && defined (GL_ARB_fragment_shader)
 
134
        if (vertexShaderProgram)
 
135
                if (!createShader(GL_VERTEX_SHADER_ARB, vertexShaderProgram))
 
136
                        return;
 
137
 
 
138
        if (pixelShaderProgram)
 
139
                if (!createShader(GL_FRAGMENT_SHADER_ARB, pixelShaderProgram))
 
140
                        return;
 
141
#endif
 
142
 
 
143
#if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_program4) || defined(GL_NV_geometry_shader4)
 
144
        if (geometryShaderProgram && Driver->queryFeature(EVDF_GEOMETRY_SHADER))
 
145
        {
 
146
                if (!createShader(GL_GEOMETRY_SHADER_EXT, geometryShaderProgram))
 
147
                        return;
 
148
#if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_shader4)
 
149
                if (Program2)
 
150
                {
 
151
                        Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType));
 
152
                        Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType));
 
153
                        if (verticesOut==0)
 
154
                                Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut);
 
155
                        else
 
156
                                Driver->extGlProgramParameteri(Program2, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut));
 
157
                }
 
158
                else
 
159
                {
 
160
                        Driver->extGlProgramParameteri(Program, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType));
 
161
                        Driver->extGlProgramParameteri(Program, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType));
 
162
                        if (verticesOut==0)
 
163
                                Driver->extGlProgramParameteri(Program, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut);
 
164
                        else
 
165
                                Driver->extGlProgramParameteri(Program, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut));
 
166
                }
 
167
#elif defined(GL_NV_geometry_program4)
 
168
                if (verticesOut==0)
 
169
                        Driver->extGlProgramVertexLimit(GL_GEOMETRY_PROGRAM_NV, Driver->MaxGeometryVerticesOut);
 
170
                else
 
171
                        Driver->extGlProgramVertexLimit(GL_GEOMETRY_PROGRAM_NV, core::min_(verticesOut, Driver->MaxGeometryVerticesOut));
 
172
#endif
 
173
        }
 
174
#endif
 
175
 
 
176
        if (!linkProgram())
 
177
                return;
 
178
 
 
179
        // register myself as new material
 
180
        outMaterialTypeNr = Driver->addMaterialRenderer(this);
 
181
}
 
182
 
 
183
 
 
184
bool COpenGLSLMaterialRenderer::OnRender(IMaterialRendererServices* service,
 
185
                                        E_VERTEX_TYPE vtxtype)
 
186
{
 
187
        // call callback to set shader constants
 
188
        if (CallBack && (Program||Program2))
 
189
                CallBack->OnSetConstants(this, UserData);
 
190
 
 
191
        return true;
 
192
}
 
193
 
 
194
 
 
195
void COpenGLSLMaterialRenderer::OnSetMaterial(const video::SMaterial& material,
 
196
                                const video::SMaterial& lastMaterial,
 
197
                                bool resetAllRenderstates,
 
198
                                video::IMaterialRendererServices* services)
 
199
{
 
200
        if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
 
201
        {
 
202
                if (Program2)
 
203
                        Driver->extGlUseProgram(Program2);
 
204
                else if (Program)
 
205
                        Driver->extGlUseProgramObject(Program);
 
206
 
 
207
                if (BaseMaterial)
 
208
                        BaseMaterial->OnSetMaterial(material, material, true, this);
 
209
        }
 
210
 
 
211
        //let callback know used material
 
212
        if (CallBack)
 
213
                CallBack->OnSetMaterial(material);
 
214
 
 
215
        for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
 
216
                Driver->setActiveTexture(i, material.getTexture(i));
 
217
        Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
 
218
}
 
219
 
 
220
 
 
221
void COpenGLSLMaterialRenderer::OnUnsetMaterial()
 
222
{
 
223
        if (Program)
 
224
                Driver->extGlUseProgramObject(0);
 
225
        if (Program2)
 
226
                Driver->extGlUseProgram(0);
 
227
 
 
228
        if (BaseMaterial)
 
229
                BaseMaterial->OnUnsetMaterial();
 
230
}
 
231
 
 
232
 
 
233
//! Returns if the material is transparent.
 
234
bool COpenGLSLMaterialRenderer::isTransparent() const
 
235
{
 
236
        return BaseMaterial ? BaseMaterial->isTransparent() : false;
 
237
}
 
238
 
 
239
 
 
240
bool COpenGLSLMaterialRenderer::createProgram()
 
241
{
 
242
        if (Driver->Version>=200)
 
243
                Program2 = Driver->extGlCreateProgram();
 
244
        else
 
245
                Program = Driver->extGlCreateProgramObject();
 
246
        return true;
 
247
}
 
248
 
 
249
 
 
250
bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shader)
 
251
{
 
252
        if (Program2)
 
253
        {
 
254
                GLuint shaderHandle = Driver->extGlCreateShader(shaderType);
 
255
                Driver->extGlShaderSource(shaderHandle, 1, &shader, NULL);
 
256
                Driver->extGlCompileShader(shaderHandle);
 
257
 
 
258
                GLint status = 0;
 
259
 
 
260
#ifdef GL_VERSION_2_0
 
261
                Driver->extGlGetShaderiv(shaderHandle, GL_COMPILE_STATUS, &status);
 
262
#endif
 
263
 
 
264
                if (status != GL_TRUE)
 
265
                {
 
266
                        os::Printer::log("GLSL shader failed to compile", ELL_ERROR);
 
267
                        // check error message and log it
 
268
                        GLint maxLength=0;
 
269
                        GLint length;
 
270
#ifdef GL_VERSION_2_0
 
271
                        Driver->extGlGetShaderiv(shaderHandle, GL_INFO_LOG_LENGTH,
 
272
                                        &maxLength);
 
273
#endif
 
274
                        if (maxLength)
 
275
                        {
 
276
                                GLchar *infoLog = new GLchar[maxLength];
 
277
                                Driver->extGlGetShaderInfoLog(shaderHandle, maxLength, &length, infoLog);
 
278
                                os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
 
279
                                delete [] infoLog;
 
280
                        }
 
281
 
 
282
                        return false;
 
283
                }
 
284
 
 
285
                Driver->extGlAttachShader(Program2, shaderHandle);
 
286
        }
 
287
        else
 
288
        {
 
289
                GLhandleARB shaderHandle = Driver->extGlCreateShaderObject(shaderType);
 
290
 
 
291
                Driver->extGlShaderSourceARB(shaderHandle, 1, &shader, NULL);
 
292
                Driver->extGlCompileShaderARB(shaderHandle);
 
293
 
 
294
                GLint status = 0;
 
295
 
 
296
#ifdef GL_ARB_shader_objects
 
297
                Driver->extGlGetObjectParameteriv(shaderHandle, GL_OBJECT_COMPILE_STATUS_ARB, &status);
 
298
#endif
 
299
 
 
300
                if (!status)
 
301
                {
 
302
                        os::Printer::log("GLSL shader failed to compile", ELL_ERROR);
 
303
                        // check error message and log it
 
304
                        GLint maxLength=0;
 
305
                        GLsizei length;
 
306
#ifdef GL_ARB_shader_objects
 
307
                        Driver->extGlGetObjectParameteriv(shaderHandle,
 
308
                                        GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength);
 
309
#endif
 
310
                        if (maxLength)
 
311
                        {
 
312
                                GLcharARB *infoLog = new GLcharARB[maxLength];
 
313
                                Driver->extGlGetInfoLog(shaderHandle, maxLength, &length, infoLog);
 
314
                                os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
 
315
                                delete [] infoLog;
 
316
                        }
 
317
 
 
318
                        return false;
 
319
                }
 
320
 
 
321
                Driver->extGlAttachObject(Program, shaderHandle);
 
322
        }
 
323
        return true;
 
324
}
 
325
 
 
326
 
 
327
bool COpenGLSLMaterialRenderer::linkProgram()
 
328
{
 
329
        if (Program2)
 
330
        {
 
331
                Driver->extGlLinkProgram(Program2);
 
332
 
 
333
                GLint status = 0;
 
334
 
 
335
#ifdef GL_VERSION_2_0
 
336
                Driver->extGlGetProgramiv(Program2, GL_LINK_STATUS, &status);
 
337
#endif
 
338
 
 
339
                if (!status)
 
340
                {
 
341
                        os::Printer::log("GLSL shader program failed to link", ELL_ERROR);
 
342
                        // check error message and log it
 
343
                        GLint maxLength=0;
 
344
                        GLsizei length;
 
345
#ifdef GL_VERSION_2_0
 
346
                        Driver->extGlGetProgramiv(Program2, GL_INFO_LOG_LENGTH, &maxLength);
 
347
#endif
 
348
                        if (maxLength)
 
349
                        {
 
350
                                GLchar *infoLog = new GLchar[maxLength];
 
351
                                Driver->extGlGetProgramInfoLog(Program2, maxLength, &length, infoLog);
 
352
                                os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
 
353
                                delete [] infoLog;
 
354
                        }
 
355
 
 
356
                        return false;
 
357
                }
 
358
 
 
359
                // get uniforms information
 
360
 
 
361
                GLint num = 0;
 
362
#ifdef GL_VERSION_2_0
 
363
                Driver->extGlGetProgramiv(Program2, GL_ACTIVE_UNIFORMS, &num);
 
364
#endif
 
365
 
 
366
                if (num == 0)
 
367
                {
 
368
                        // no uniforms
 
369
                        return true;
 
370
                }
 
371
 
 
372
                GLint maxlen = 0;
 
373
#ifdef GL_VERSION_2_0
 
374
                Driver->extGlGetProgramiv(Program2, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxlen);
 
375
#endif
 
376
 
 
377
                if (maxlen == 0)
 
378
                {
 
379
                        os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR);
 
380
                        return false;
 
381
                }
 
382
 
 
383
                // seems that some implementations use an extra null terminator
 
384
                ++maxlen;
 
385
                c8 *buf = new c8[maxlen];
 
386
 
 
387
                UniformInfo.clear();
 
388
                UniformInfo.reallocate(num);
 
389
 
 
390
                for (GLint i=0; i < num; ++i)
 
391
                {
 
392
                        SUniformInfo ui;
 
393
                        memset(buf, 0, maxlen);
 
394
 
 
395
                        GLint size;
 
396
                        Driver->extGlGetActiveUniform(Program2, i, maxlen, 0, &size, &ui.type, reinterpret_cast<GLchar*>(buf));
 
397
                        ui.name = buf;
 
398
 
 
399
                        UniformInfo.push_back(ui);
 
400
                }
 
401
 
 
402
                delete [] buf;
 
403
        }
 
404
        else
 
405
        {
 
406
                Driver->extGlLinkProgramARB(Program);
 
407
 
 
408
                GLint status = 0;
 
409
 
 
410
#ifdef GL_ARB_shader_objects
 
411
                Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_LINK_STATUS_ARB, &status);
 
412
#endif
 
413
 
 
414
                if (!status)
 
415
                {
 
416
                        os::Printer::log("GLSL shader program failed to link", ELL_ERROR);
 
417
                        // check error message and log it
 
418
                        GLint maxLength=0;
 
419
                        GLsizei length;
 
420
#ifdef GL_ARB_shader_objects
 
421
                        Driver->extGlGetObjectParameteriv(Program,
 
422
                                        GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength);
 
423
#endif
 
424
                        if (maxLength)
 
425
                        {
 
426
                                GLcharARB *infoLog = new GLcharARB[maxLength];
 
427
                                Driver->extGlGetInfoLog(Program, maxLength, &length, infoLog);
 
428
                                os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
 
429
                                delete [] infoLog;
 
430
                        }
 
431
 
 
432
                        return false;
 
433
                }
 
434
 
 
435
                // get uniforms information
 
436
 
 
437
                GLint num = 0;
 
438
        #ifdef GL_ARB_shader_objects
 
439
                Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &num);
 
440
        #endif
 
441
 
 
442
                if (num == 0)
 
443
                {
 
444
                        // no uniforms
 
445
                        return true;
 
446
                }
 
447
 
 
448
                GLint maxlen = 0;
 
449
        #ifdef GL_ARB_shader_objects
 
450
                Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB, &maxlen);
 
451
        #endif
 
452
 
 
453
                if (maxlen == 0)
 
454
                {
 
455
                        os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR);
 
456
                        return false;
 
457
                }
 
458
 
 
459
                // seems that some implementations use an extra null terminator
 
460
                ++maxlen;
 
461
                c8 *buf = new c8[maxlen];
 
462
 
 
463
                UniformInfo.clear();
 
464
                UniformInfo.reallocate(num);
 
465
 
 
466
                for (int i=0; i < num; ++i)
 
467
                {
 
468
                        SUniformInfo ui;
 
469
                        memset(buf, 0, maxlen);
 
470
 
 
471
                        GLint size;
 
472
                        Driver->extGlGetActiveUniformARB(Program, i, maxlen, 0, &size, &ui.type, reinterpret_cast<GLcharARB*>(buf));
 
473
                        ui.name = buf;
 
474
 
 
475
                        UniformInfo.push_back(ui);
 
476
                }
 
477
 
 
478
                delete [] buf;
 
479
        }
 
480
 
 
481
        return true;
 
482
}
 
483
 
 
484
 
 
485
void COpenGLSLMaterialRenderer::setBasicRenderStates(const SMaterial& material,
 
486
                                                const SMaterial& lastMaterial,
 
487
                                                bool resetAllRenderstates)
 
488
{
 
489
        // forward
 
490
        Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
 
491
}
 
492
 
 
493
 
 
494
bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const f32* floats, int count)
 
495
{
 
496
        return setPixelShaderConstant(name, floats, count);
 
497
}
 
498
 
 
499
 
 
500
void COpenGLSLMaterialRenderer::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
 
501
{
 
502
        os::Printer::log("Cannot set constant, please use high level shader call instead.", ELL_WARNING);
 
503
}
 
504
 
 
505
bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32* floats, int count)
 
506
{
 
507
        u32 i;
 
508
        const u32 num = UniformInfo.size();
 
509
 
 
510
        for (i=0; i < num; ++i)
 
511
        {
 
512
                if (UniformInfo[i].name == name)
 
513
                        break;
 
514
        }
 
515
 
 
516
        if (i == num)
 
517
                return false;
 
518
 
 
519
#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects)
 
520
        GLint Location=0;
 
521
        if (Program2)
 
522
                Location=Driver->extGlGetUniformLocation(Program2,name);
 
523
        else
 
524
                Location=Driver->extGlGetUniformLocationARB(Program,name);
 
525
 
 
526
        switch (UniformInfo[i].type)
 
527
        {
 
528
                case GL_FLOAT:
 
529
                        Driver->extGlUniform1fv(Location, count, floats);
 
530
                        break;
 
531
                case GL_FLOAT_VEC2_ARB:
 
532
                        Driver->extGlUniform2fv(Location, count/2, floats);
 
533
                        break;
 
534
                case GL_FLOAT_VEC3_ARB:
 
535
                        Driver->extGlUniform3fv(Location, count/3, floats);
 
536
                        break;
 
537
                case GL_FLOAT_VEC4_ARB:
 
538
                        Driver->extGlUniform4fv(Location, count/4, floats);
 
539
                        break;
 
540
                case GL_FLOAT_MAT2_ARB:
 
541
                        Driver->extGlUniformMatrix2fv(Location, count/4, false, floats);
 
542
                        break;
 
543
                case GL_FLOAT_MAT3_ARB:
 
544
                        Driver->extGlUniformMatrix3fv(Location, count/9, false, floats);
 
545
                        break;
 
546
                case GL_FLOAT_MAT4_ARB:
 
547
                        Driver->extGlUniformMatrix4fv(Location, count/16, false, floats);
 
548
                        break;
 
549
                default:
 
550
                        Driver->extGlUniform1iv(Location, count, reinterpret_cast<const GLint*>(floats));
 
551
                        break;
 
552
        }
 
553
        return true;
 
554
#else
 
555
        return false;
 
556
#endif
 
557
}
 
558
 
 
559
 
 
560
void COpenGLSLMaterialRenderer::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
 
561
{
 
562
        os::Printer::log("Cannot set constant, use high level shader call.", ELL_WARNING);
 
563
}
 
564
 
 
565
IVideoDriver* COpenGLSLMaterialRenderer::getVideoDriver()
 
566
{
 
567
        return Driver;
 
568
}
 
569
 
 
570
} // end namespace video
 
571
} // end namespace irr
 
572
 
 
573
 
 
574
#endif
 
575