summaryrefslogtreecommitdiffstats
path: root/tests/auto/runtime/geometry/Qt3DSRenderTestTessellation.cpp
blob: f2724a4a99a73cde52c21563758c9e3efa73559b (plain)
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
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
/****************************************************************************
**
** Copyright (C) 2008-2012 NVIDIA Corporation.
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "Qt3DSRenderTestTessellation.h"
#include "../Qt3DSRenderTestMathUtil.h"
#include "render/Qt3DSRenderShaderProgram.h"
#include "render/backends/gl/Qt3DSOpenGLUtil.h"

#include <string>

using namespace qt3ds;
using namespace qt3ds::render;

static const char *vertShader(std::string &prog, bool binESContext)
{
    if (binESContext) {
        prog += "#version 310 es\n"
                "precision highp float;\n"
                "precision highp int;\n";
    } else {
        prog += "#version 400\n";
    }

    prog += "uniform mat4 mat_mvp;\n"
            "in vec3 attr_pos;			// Vertex pos\n"
            "void main()\n"
            "{\n"
            "	gl_Position = vec4(attr_pos, 1.0);\n"
            "}\n";

    return prog.c_str();
}

static const char *vertPhongShader(std::string &prog, bool binESContext)
{
    if (binESContext) {
        prog += "#version 310 es\n"
                "precision highp float;\n"
                "precision highp int;\n";
    } else {
        prog += "#version 400\n";
    }

    prog += "uniform mat4 mat_mvp;\n"
            "in vec3 attr_pos;			// Vertex pos\n"
            "in vec3 attr_norm;			// normal pos\n"
            "out vec3 ctNorm;			// output normal control patch\n"
            "void main()\n"
            "{\n"
            "	ctNorm = attr_norm;\n"
            "	gl_Position = vec4(attr_pos, 1.0);\n"
            "}\n";

    return prog.c_str();
}

static const char *fragShader(std::string &prog, bool binESContext)
{
    if (binESContext) {
        prog += "#version 310 es\n"
                "precision highp float;\n"
                "precision highp int;\n";
    } else {
        prog += "#version 400\n";
    }

    prog += "uniform vec3 color;\n"
            "out vec4 fragColor;\n"
            "void main()\n"
            "{\n"
            "	fragColor = vec4(color, 1.0);\n"
            "}\n";

    return prog.c_str();
}

static const char *fragPhongShader(std::string &prog, bool binESContext)
{
    if (binESContext) {
        prog += "#version 310 es\n"
                "precision highp float;\n"
                "precision highp int;\n";
    } else {
        prog += "#version 400\n";
    }

    prog += "uniform vec3 color;\n"
            "in vec3 normWorld;\n"
            "out vec4 fragColor;\n"
            "void main()\n"
            "{\n"
            "	fragColor = vec4(color, 1.0);\n"
            "}\n";

    return prog.c_str();
}

static const char *tessControlShader(std::string &prog, bool binESContext)
{
    if (binESContext) {
        prog += "#version 310 es\n"
                "#extension GL_EXT_tessellation_shader : enable\n"
                "precision highp float;\n"
                "precision highp int;\n";
    } else {
        prog += "#version 400\n";
    }

    prog += "// number of CPs in patch\n"
            "layout (vertices = 3) out;\n"
            "uniform float tessLevelInner; // controlled by keyboard buttons\n"
            "uniform float tessLevelOuter; // controlled by keyboard buttons\n"
            "void main () {\n"
            "gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;\n"
            "// Calculate the tessellation levels\n"
            "gl_TessLevelInner[0] = tessLevelInner; // number of nested primitives to generate\n"
            "gl_TessLevelOuter[0] = tessLevelOuter; // times to subdivide first side\n"
            "gl_TessLevelOuter[1] = tessLevelOuter; // times to subdivide second side\n"
            "gl_TessLevelOuter[2] = tessLevelOuter; // times to subdivide third side\n"
            "}\n";

    return prog.c_str();
}

static const char *tessPhongControlShader(std::string &prog, bool binESContext)
{
    if (binESContext) {
        prog += "#version 310 es\n"
                "#extension GL_EXT_tessellation_shader : enable\n"
                "precision highp float;\n"
                "precision highp int;\n";
    } else {
        prog += "#version 400\n";
    }

    prog +=
        "// number of CPs in patch\n"
        "layout (vertices = 3) out;\n"
        "// phong tessellation per patch data\n"
        "struct PhongTessPatch {\n"
        "  float projIJ;\n"
        "  float projJK;\n"
        "  float projIK;\n"
        "};\n"
        "in vec3 ctNorm[];				// control point normal\n"
        "out vec3 normObj[];			// output normal pos\n"
        "uniform float tessLevels;\n"
        "uniform float tessBlend;\n"
        "out PhongTessPatch tcTessPatch[3];\n"
        "float PIi(int i, vec3 q)\n"
        "{\n"
        "  vec3 q_minus_p = q - gl_in[i].gl_Position.xyz;\n"
        "  return q[gl_InvocationID] - dot(q_minus_p, ctNorm[i]) * ctNorm[i][gl_InvocationID];\n"
        "}\n"
        "void main () {\n"
        "  // path through data\n"
        "  gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;\n"
        "  normObj[gl_InvocationID] = ctNorm[gl_InvocationID];\n"
        "  // compute projections separate for each xyz component\n"
        "  tcTessPatch[gl_InvocationID].projIJ = PIi(0, gl_in[1].gl_Position.xyz) + PIi(1, "
        "gl_in[0].gl_Position.xyz);\n"
        "  tcTessPatch[gl_InvocationID].projJK = PIi(1, gl_in[2].gl_Position.xyz) + PIi(2, "
        "gl_in[1].gl_Position.xyz);\n"
        "  tcTessPatch[gl_InvocationID].projIK = PIi(2, gl_in[0].gl_Position.xyz) + PIi(0, "
        "gl_in[2].gl_Position.xyz);\n"
        "  // set the tessellation levels\n"
        "  gl_TessLevelInner[0] = tessLevels; // number of nested primitives to generate\n"
        "  gl_TessLevelOuter[gl_InvocationID] = tessLevels; // times to subdivide first side\n"
        "}\n";

    return prog.c_str();
}

static const char *tessEvaluationShader(std::string &prog, bool binESContext)
{
    if (binESContext) {
        prog += "#version 310 es\n"
                "#extension GL_EXT_tessellation_shader : enable\n"
                "precision highp float;\n"
                "precision highp int;\n";
    } else {
        prog += "#version 400\n";
    }

    prog += "// triangles, quads, or isolines\n"
            "layout (triangles, equal_spacing, ccw) in;\n"
            "uniform mat4 mat_mvp;\n"
            "// gl_TessCoord is location within the patch\n"
            "// (barycentric for triangles, UV for quads)\n"
            "void main () {\n"
            "vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position; // x is one corner\n"
            "vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position; // y is the 2nd corner\n"
            "vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position; // z is the 3rd corner (ignore when "
            "using quads)\n"
            "vec4 pos = p0 + p1 + p2;\n"
            "gl_Position = mat_mvp * pos;\n"
            "}\n";

    return prog.c_str();
}

static const char *tessPhongEvaluationShader(std::string &prog, bool binESContext)
{
    if (binESContext) {
        prog += "#version 310 es\n"
                "#extension GL_EXT_tessellation_shader : enable\n"
                "precision highp float;\n"
                "precision highp int;\n";
    } else {
        prog += "#version 400\n";
    }

    prog += "// triangles, quads, or isolines\n"
            "layout (triangles, fractional_odd_spacing, ccw) in;\n"
            "struct PhongTessPatch {\n"
            "  float projIJ;\n"
            "  float projJK;\n"
            "  float projIK;\n"
            "};\n"
            "in vec3 normObj[];				// control point normal\n"
            "out vec3 normWorld;				// output normal pos\n"
            "in PhongTessPatch tcTessPatch[];\n"
            "uniform mat4 mat_mvp;\n"
            "uniform float tessBlend;\n"
            "// gl_TessCoord is location within the patch\n"
            "// (barycentric for triangles, UV for quads)\n"
            "void main () {\n"
            "  // output normal\n"
            "  // pre compute square tesselation coord\n"
            "  vec3 tessSquared = gl_TessCoord * gl_TessCoord;\n"
            "  vec3 norm = gl_TessCoord.x * normObj[0]\n"
            "		     + gl_TessCoord.y * normObj[1]\n"
            "		     + gl_TessCoord.z * normObj[2]; // z is the 3rd corner (ignore when "
            "using quads)\n"
            "  // barycentric linear position\n"
            "  vec3 linearPos = gl_TessCoord.x * gl_in[0].gl_Position.xyz\n"
            "		    + gl_TessCoord.y * gl_in[1].gl_Position.xyz\n"
            "		    + gl_TessCoord.z * gl_in[2].gl_Position.xyz;\n"
            "  // projective terms\n"
            "  vec3 projJI = vec3(tcTessPatch[0].projIJ, tcTessPatch[1].projIJ, "
            "tcTessPatch[2].projIJ);\n"
            "  vec3 projKJ = vec3(tcTessPatch[0].projJK, tcTessPatch[1].projJK, "
            "tcTessPatch[2].projJK);\n"
            "  vec3 projIK = vec3(tcTessPatch[0].projIK, tcTessPatch[1].projIK, "
            "tcTessPatch[2].projIK);\n"
            "  // phong interpolated position\n"
            "  vec3 phongPos = tessSquared.x * gl_in[0].gl_Position.xyz\n"
            "				 + tessSquared.y * gl_in[1].gl_Position.xyz\n"
            "				 + tessSquared.z * gl_in[2].gl_Position.xyz\n"
            "				 + gl_TessCoord.x * gl_TessCoord.y * projJI\n"
            "				 + gl_TessCoord.y * gl_TessCoord.z * projKJ\n"
            "				 + gl_TessCoord.z * gl_TessCoord.x * projIK;\n"
            "  // final position\n"
            "  vec3 finalPos = (1.0-tessBlend)*linearPos + tessBlend*phongPos;\n"
            "  gl_Position = mat_mvp * vec4(finalPos, 1.0);\n"
            "  normWorld = norm;\n"
            "}\n";

    return prog.c_str();
}

struct Vertex
{
    QT3DSVec3 positions;
    QT3DSVec3 normals;
};

NVRenderTestTessellation::NVRenderTestTessellation()
{
    _curTest = 0;
    _maxColumn = 4;
}

NVRenderTestTessellation::~NVRenderTestTessellation()
{
}

bool NVRenderTestTessellation::isSupported(NVRenderContext *context)
{
    NVRenderContextType ctxType = context->GetRenderContextType();
    NVRenderContextType nonSupportedFlags(
        NVRenderContextValues::GL2 | NVRenderContextValues::GLES2 | NVRenderContextValues::GL3
        | NVRenderContextValues::GLES3 | NVRenderContextValues::GLES3PLUS);

    // This is currently only supported on >= GL4 && >= GLES 3.1
    if ((ctxType & nonSupportedFlags))
        return false;

    return true;
}

////////////////////////////////
// test for functionality
////////////////////////////////

inline NVConstDataRef<QT3DSI8> toRef(const char *data)
{
    size_t len = strlen(data) + 1;
    return NVConstDataRef<QT3DSI8>((const QT3DSI8 *)data, (QT3DSU32)len);
}

bool NVRenderTestTessellation::run(NVRenderContext *context, userContextData *pUserData)
{
    bool success = true;

    context->SetRenderTarget(NULL);
    // conpute cell width
    _cellSize = pUserData->winWidth / _maxColumn;

    context->SetClearColor(QT3DSVec4(.0f, .0f, .0f, 1.f));
    context->Clear(NVRenderClearFlags(NVRenderClearValues::Color | NVRenderClearValues::Depth));

    success &= trianglePatches(context, pUserData);
    _curTest++;
    success &= phongPatches(context, pUserData);
    _curTest++;

    return success;
}

bool NVRenderTestTessellation::trianglePatches(NVRenderContext *context, userContextData *pUserData)
{
    static const Vertex vertexPositions[] = { { QT3DSVec3(-0.9, -0.9, 0) },
                                              { QT3DSVec3(0.9, -0.9, 0) },
                                              { QT3DSVec3(0.0, 0.9, 0) } };

    qt3ds::QT3DSVec3 color(0.0, 1.0, 0.0);

    NVScopedRefCounted<NVRenderVertexBuffer> mVertexBuffer;
    NVScopedRefCounted<NVRenderAttribLayout> mAttribLayout;
    NVScopedRefCounted<NVRenderInputAssembler> mInputAssembler;
    NVScopedRefCounted<NVRenderIndexBuffer> mIndexBuffer;
    QT3DSMat44 mvp = QT3DSMat44::createIdentity();
    NvGl2DemoMatrixOrtho(&mvp, -1, 1, -1, 1, -10, 10);

    // create shaders
    std::string vtxProg;
    std::string frgProg;
    std::string tcProg;
    std::string teProg;
    NVRenderVertFragCompilationResult compResult = context->CompileSource(
        "NVRenderTestTessellation shader", toRef(vertShader(vtxProg, isGLESContext(context))),
        toRef(fragShader(frgProg, isGLESContext(context))),
        toRef(tessControlShader(tcProg, isGLESContext(context))),
        toRef(tessEvaluationShader(teProg, isGLESContext(context))));
    if (!compResult.mShader) {
        return false;
    }

    unsigned int curY = 0;
    unsigned int curX = _curTest;
    if (_curTest >= _maxColumn) {
        curY = (_curTest / _maxColumn);
        curX = (_curTest % _maxColumn);
    }

    // set viewport
    context->SetViewport(NVRenderRect(curX * _cellSize, curY * _cellSize, _cellSize, _cellSize));

    // this is the layout
    NVRenderVertexBufferEntry entries[] = {
        NVRenderVertexBufferEntry("attr_pos", NVRenderComponentTypes::QT3DSF32, 3, 0),
    };

    QT3DSU32 bufSize = 3 * sizeof(Vertex);
    NVDataRef<QT3DSU8> vertData((QT3DSU8 *)vertexPositions, bufSize);
    mVertexBuffer = context->CreateVertexBuffer(NVRenderBufferUsageType::Static, bufSize,
                                                6 * sizeof(QT3DSF32), vertData);
    if (!mVertexBuffer) {
        qWarning() << "NVRenderTestFboMsaa: Failed to create vertex buffer";
        return false;
    }

    // create our attribute layout
    mAttribLayout = context->CreateAttributeLayout(toConstDataRef(entries, 1));
    // create input Assembler
    QT3DSU32 strides = mVertexBuffer->GetStride();
    QT3DSU32 offsets = 0;
    mInputAssembler = context->CreateInputAssembler(
        mAttribLayout, toConstDataRef(&mVertexBuffer.mPtr, 1), mIndexBuffer.mPtr,
        toConstDataRef(&strides, 1), toConstDataRef(&offsets, 1), NVRenderDrawMode::Patches, 3);
    if (!mInputAssembler) {
        qWarning() << "NVRenderTestFboMsaa: Failed to create input assembler";
        return false;
    }

    // make input assembler active
    context->SetInputAssembler(mInputAssembler);
    // set program
    context->SetActiveShader(compResult.mShader);
    compResult.mShader->SetPropertyValue("mat_mvp", mvp);
    // set color
    compResult.mShader->SetPropertyValue("color", color);
    // set tessellation values
    float tessLevelInner = 4.0;
    compResult.mShader->SetPropertyValue("tessLevelInner", tessLevelInner);
    float tessLevelOuter = 4.0;
    compResult.mShader->SetPropertyValue("tessLevelOuter", tessLevelOuter);

    context->SetDepthTestEnabled(true);
    context->SetDepthWriteEnabled(true);

    // draw
    context->Draw(mInputAssembler->GetPrimitiveType(), 3, 0);

    context->SetActiveShader(0);
    compResult.mShader->release();

    return true;
}

bool NVRenderTestTessellation::phongPatches(NVRenderContext *context, userContextData *pUserData)
{
    QT3DSVec3 n1(-1.0, 0.5, 1.0);
    n1.normalize();
    QT3DSVec3 n2(1.0, 0.5, 1.0);
    n2.normalize();
    QT3DSVec3 n3(0.0, 1.0, 1.0);
    n3.normalize();
    static const Vertex vertexPositions[] = { { QT3DSVec3(-0.9, -0.9, 0.0), n1 },
                                              { QT3DSVec3(0.9, -0.9, 0.0), n2 },
                                              { QT3DSVec3(0.0, 0.9, -0.0), n3 } };

    qt3ds::QT3DSVec3 color(0.0, 1.0, 0.0);

    NVScopedRefCounted<NVRenderVertexBuffer> mVertexBuffer;
    NVScopedRefCounted<NVRenderAttribLayout> mAttribLayout;
    NVScopedRefCounted<NVRenderInputAssembler> mInputAssembler;
    NVScopedRefCounted<NVRenderIndexBuffer> mIndexBuffer;
    QT3DSMat44 p = QT3DSMat44::createIdentity();
    QT3DSMat44 rotX = QT3DSMat44::createIdentity();
    QT3DSMat44 rotY = QT3DSMat44::createIdentity();
    QT3DSMat44 mv = QT3DSMat44::createIdentity();
    QT3DSMat44 mvp = QT3DSMat44::createIdentity();
    NvGl2DemoMatrixOrtho(&p, -1, 1, -1, 1, -10, 10);
    // NvRenderTestMatrixRotY( &rotY, 45.0 );
    // NvRenderTestMatrixRotX( &rotX, 90.0 );
    mv = rotY * rotX;
    mvp = mv * p;

    // create shaders
    std::string vtxProg;
    std::string frgProg;
    std::string tcProg;
    std::string teProg;
    NVRenderVertFragCompilationResult compResult = context->CompileSource(
        "NVRenderTestTessellation shader", toRef(vertPhongShader(vtxProg, isGLESContext(context))),
        toRef(fragPhongShader(frgProg, isGLESContext(context))),
        toRef(tessPhongControlShader(tcProg, isGLESContext(context))),
        toRef(tessPhongEvaluationShader(teProg, isGLESContext(context))));
    if (!compResult.mShader) {
        return false;
    }

    unsigned int curY = 0;
    unsigned int curX = _curTest;
    if (_curTest >= _maxColumn) {
        curY = (_curTest / _maxColumn);
        curX = (_curTest % _maxColumn);
    }

    // set viewport
    context->SetViewport(NVRenderRect(curX * _cellSize, curY * _cellSize, _cellSize, _cellSize));

    // this is the layout
    NVRenderVertexBufferEntry entries[] = {
        NVRenderVertexBufferEntry("attr_pos", NVRenderComponentTypes::QT3DSF32, 3, 0),
        NVRenderVertexBufferEntry("attr_norm", NVRenderComponentTypes::QT3DSF32, 3, 12),
    };

    QT3DSU32 bufSize = 3 * sizeof(Vertex);
    NVDataRef<QT3DSU8> vertData((QT3DSU8 *)vertexPositions, bufSize);
    mVertexBuffer = context->CreateVertexBuffer(NVRenderBufferUsageType::Static, bufSize,
                                                6 * sizeof(QT3DSF32), vertData);
    if (!mVertexBuffer) {
        qWarning() << "NVRenderTestFboMsaa: Failed to create vertex buffer";
        return false;
    }

    // create our attribute layout
    mAttribLayout = context->CreateAttributeLayout(toConstDataRef(entries, 2));
    // create input Assembler
    QT3DSU32 strides = mVertexBuffer->GetStride();
    QT3DSU32 offsets = 0;
    mInputAssembler = context->CreateInputAssembler(
        mAttribLayout, toConstDataRef(&mVertexBuffer.mPtr, 1), mIndexBuffer.mPtr,
        toConstDataRef(&strides, 1), toConstDataRef(&offsets, 1), NVRenderDrawMode::Patches, 3);
    if (!mInputAssembler) {
        qWarning() << "NVRenderTestFboMsaa: Failed to create input assembler";
        return false;
    }

    // make input assembler active
    context->SetInputAssembler(mInputAssembler);
    // set program
    context->SetActiveShader(compResult.mShader);
    compResult.mShader->SetPropertyValue("mat_mvp", mvp);
    // set color
    compResult.mShader->SetPropertyValue("color", color);
    // set tessellation values
    float tessLevels = 8.0;
    compResult.mShader->SetPropertyValue("tessLevels", tessLevels);
    float tessBlend = 1.0;
    compResult.mShader->SetPropertyValue("tessBlend", tessBlend);

    context->SetDepthTestEnabled(true);
    context->SetDepthWriteEnabled(true);

    // draw
    context->Draw(mInputAssembler->GetPrimitiveType(), 3, 0);

    context->SetActiveShader(0);
    compResult.mShader->release();

    return true;
}

////////////////////////////////
// performance test
////////////////////////////////
bool NVRenderTestTessellation::runPerformance(NVRenderContext *context, userContextData *pUserData)
{
    return true;
}

////////////////////////////////
// test cleanup
////////////////////////////////
void NVRenderTestTessellation::cleanup(NVRenderContext *context, userContextData *pUserData)
{
    context->SetClearColor(QT3DSVec4(.0f, .0f, .0f, 0.f));
    // dummy
    context->SetViewport(NVRenderRect(0, 0, pUserData->winWidth, pUserData->winHeight));
}