summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/conformance2/extensions/ext-color-buffer-float.html
blob: b57a6ca10d6bfb3694e8fb1ebe62310426302a5d (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
<!--
Copyright (c) 2019 The Khronos Group Inc.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE.txt file.
-->

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL EXT_color_buffer_float Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
<div id="console"></div>
<!-- Shaders for testing floating-point textures -->
<script id="testFragmentShader" type="x-shader/x-fragment">
precision mediump float;
uniform sampler2D tex;
uniform vec4 subtractor;
varying vec2 texCoord;
void main()
{
    vec4 color = texture2D(tex, texCoord);
    if (abs(color.r - subtractor.r) +
        abs(color.g - subtractor.g) +
        abs(color.b - subtractor.b) +
        abs(color.a - subtractor.a) < 16.0) {
        gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
    } else {
        gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
    }
}
</script>
<!-- Shaders for testing floating-point render targets -->
<script id="floatingPointFragmentShader" type="x-shader/x-fragment">
void main()
{
    gl_FragColor = vec4(1000.0, 1000.0, 1000.0, 1000.0);
}
</script>
<script>
"use strict";

function allocateTexture()
{
    var texture = gl.createTexture();
    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texture parameter setup should succeed");
    return texture;
}

function checkRenderingResults()
{
    wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green");
}

function arrayToString(arr, size) {
    var mySize;
    if (!size)
        mySize = arr.length;
    else
        mySize = size;
    var out = "[";
    for (var ii = 0; ii < mySize; ++ii) {
    if (ii > 0) {
        out += ", ";
    }
    out += arr[ii];
    }
    return out + "]";
}

function runReadbackTest(testProgram, subtractor)
{
    // Verify floating point readback
    debug("Checking readback of floating-point values");
    var buf = new Float32Array(4);
    gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.FLOAT , buf);
    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "readPixels from floating-point framebuffer should succeed");
    var ok = true;
    var tolerance = 8.0; // TODO: factor this out from both this test and the subtractor shader above.
    for (var ii = 0; ii < buf.length; ++ii) {
        if (Math.abs(buf[ii] - subtractor[ii]) > tolerance) {
        ok = false;
        break;
        }
    }
    if (ok) {
        testPassed("readPixels of float-type data from floating-point framebuffer succeeded");
    } else {
        testFailed("readPixels of float-type data from floating-point framebuffer failed: expected "
                   + arrayToString(subtractor, 4) + ", got " + arrayToString(buf));
    }
}

function runFloatTextureRenderTargetTest(enabled, internalFormat, format, testProgram, numberOfChannels, subtractor, texSubImageCover)
{
    var formatString = wtu.glEnumToString(gl, internalFormat);
    debug("");
    debug("testing floating-point " + formatString + " texture render target" + (texSubImageCover > 0 ? " after calling texSubImage" : ""));

    var texture = allocateTexture();
    var width = 2;
    var height = 2;
    gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0, format, gl.FLOAT, null);
    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "floating-point texture allocation should succeed");

    // Try to use this texture as a render target.
    var fbo = gl.createFramebuffer();
    gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
    gl.bindTexture(gl.TEXTURE_2D, null);

    var completeStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
    if (!enabled) {
        if (completeStatus == gl.FRAMEBUFFER_COMPLETE && !enabled)
            testFailed("floating-point " + formatString + " render target should not be supported without enabling EXT_color_buffer_float");
        else
            testPassed("floating-point " + formatString + " render target should not be supported without enabling EXT_color_buffer_float");
        return;
    }

    if (completeStatus != gl.FRAMEBUFFER_COMPLETE) {
        testFailed("floating-point " + formatString + " render target not supported");
        return;
    }

    if (texSubImageCover > 0) {
        // Ensure that replacing the whole texture or a part of it with texSubImage2D doesn't affect renderability
        gl.bindTexture(gl.TEXTURE_2D, texture);
        var data = new Float32Array(width * height * numberOfChannels * texSubImageCover);
        gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, height * texSubImageCover, format, gl.FLOAT, data);
        wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texSubImage2D should succeed if EXT_color_buffer_float is enabled");
        gl.bindTexture(gl.TEXTURE_2D, null);
        if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE) {
            testFailed("render target support changed after calling texSubImage2D");
            return;
        }
    }

    var renderProgram =
        wtu.setupProgram(gl,
                         [wtu.simpleVertexShader, "floatingPointFragmentShader"],
                         ['vPosition'],
                         [0]);
    wtu.clearAndDrawUnitQuad(gl);
    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "rendering to floating-point texture should succeed");

    // Now sample from the floating-point texture and verify we got the correct values.
    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.useProgram(testProgram);
    gl.uniform1i(gl.getUniformLocation(testProgram, "tex"), 0);
    gl.uniform4fv(gl.getUniformLocation(testProgram, "subtractor"), subtractor);
    wtu.clearAndDrawUnitQuad(gl);
    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "rendering from floating-point texture should succeed");
    checkRenderingResults();

    gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
    runReadbackTest(testProgram, subtractor);
}

function runFloatRenderbufferRenderTargetTest(enabled, internalFormat, testProgram, numberOfChannels, subtractor)
{
    var formatString = wtu.glEnumToString(gl, internalFormat);
    var samples = [0];
    if (enabled) {
        samples = Array.prototype.slice.call(gl.getInternalformatParameter(gl.RENDERBUFFER, internalFormat, gl.SAMPLES));
        samples.push(0);
    }
    for (var ndx = 0; ndx < samples.length; ++ndx) {
        debug("");
        debug("testing floating-point " + formatString + " renderbuffer render target with number of samples " + samples[ndx]);

        var colorbuffer = gl.createRenderbuffer();
        var width = 2;
        var height = 2;
        gl.bindRenderbuffer(gl.RENDERBUFFER, colorbuffer);
        if (samples[ndx] == 0)
            gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
        else
            gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples[ndx], internalFormat, width, height);
        if (!enabled) {
            wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "floating-point renderbuffer allocation should fail if EXT_color_buffer_float is not enabled");
            return;
        } else {
            wtu.glErrorShouldBe(gl, gl.NO_ERROR, "floating-point renderbuffer allocation should succeed if EXT_color_buffer_float is enabled");
        }

        // Try to use this renderbuffer as a render target.
        var fbo = gl.createFramebuffer();
        gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
        gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorbuffer);

        var completeStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
        if (completeStatus != gl.FRAMEBUFFER_COMPLETE) {
            testFailed("floating-point " + formatString + " render target not supported");
            return;
        }
        var resolveColorRbo = null;
        var resolveFbo = null;
        if (samples[ndx] > 0) {
            resolveColorRbo = gl.createRenderbuffer();
            gl.bindRenderbuffer(gl.RENDERBUFFER, resolveColorRbo);
            gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);
            resolveFbo = gl.createFramebuffer();
            gl.bindFramebuffer(gl.FRAMEBUFFER, resolveFbo);
            gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, resolveColorRbo);
            completeStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
            if (completeStatus != gl.FRAMEBUFFER_COMPLETE) {
                testFailed("Failed to create resolve framebuffer");
                return;
            }
        }
        gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
        gl.clearColor(1000.0, 1000.0, 1000.0, 1000.0);
        gl.clear(gl.COLOR_BUFFER_BIT);

        if (samples[ndx] > 0) {
            gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, resolveFbo);
            gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, gl.COLOR_BUFFER_BIT, gl.NEAREST);
            gl.bindFramebuffer(gl.READ_FRAMEBUFFER, resolveFbo);
        }
        runReadbackTest(testProgram, subtractor);
    }
}

function runRGB16FNegativeTest()
{
    debug("");
    debug("testing RGB16F isn't color renderable");

    var texture = allocateTexture();
    var width = 2;
    var height = 2;
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB16F, width, height, 0, gl.RGB, gl.FLOAT, null);
    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "RGB16F texture allocation should succeed");

    // Try to use this texture as a render target.
    var fbo = gl.createFramebuffer();
    gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
    gl.bindTexture(gl.TEXTURE_2D, null);

    var completeStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
    if (completeStatus == gl.FRAMEBUFFER_COMPLETE)
        testFailed("RGB16F render target should not be supported with or without enabling EXT_color_buffer_float");
    else
        testPassed("RGB16F render target should not be supported with or without enabling EXT_color_buffer_float");
    gl.deleteTexture(texture);

    var colorbuffer = gl.createRenderbuffer();
    gl.bindRenderbuffer(gl.RENDERBUFFER, colorbuffer);
    gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGB16F, width, height);
    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "RGB16F renderbuffer allocation should fail with or without enabling EXT_color_buffer_float");
    gl.bindRenderbuffer(gl.RENDERBUFFER, null);
    gl.deleteRenderbuffer(colorbuffer);

    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    gl.deleteFramebuffer(fbo);
}

function runUniqueObjectTest()
{
    debug("");
    debug("Testing that getExtension() returns the same object each time");
    gl.getExtension("EXT_color_buffer_float").myProperty = 2;
    webglHarnessCollectGarbage();
    shouldBe('gl.getExtension("EXT_color_buffer_float").myProperty', '2');
}

function runInternalFormatQueryTest()
{
    debug("");
    debug("testing the internal format query");

    var maxSamples = gl.getParameter(gl.MAX_SAMPLES);
    const formats = [gl.RGBA16F, gl.R32F, gl.RG32F, gl.RGBA32F, gl.R16F, gl.RG16F, gl.R11F_G11F_B10F];
    var firstMultiOnlyFormat = 4;
    for (var fmt = 0; fmt < formats.length; ++fmt) {
        var samples = gl.getInternalformatParameter(gl.RENDERBUFFER, formats[fmt], gl.SAMPLES);
        if (fmt >= firstMultiOnlyFormat && (samples.length == 0 || samples[0] < maxSamples)) {
            testFailed("the maximum value in SAMPLES should be at least " + maxSamples);
            return;
        }

        var prevSampleCount = 0;
        var sampleCount;
        for (var ndx = 0; ndx < samples.length; ++ndx, prevSampleCount = sampleCount) {
            sampleCount = samples[ndx];
            // sample count must be > 0
            if (sampleCount <= 0) {
                testFailed("Expected sample count to be at least one; got " + sampleCount);
                return;
            }

            // samples must be ordered descending
            if (ndx > 0 && sampleCount >= prevSampleCount) {
                testFailed("Expected sample count to be ordered in descending order; got " + prevSampleCount + " at index " + (ndx - 1) + ", and " + sampleCount + " at index " + ndx);
                return;
            }
        }
    }
    testPassed("Internal format query succeeded");
}

function runCopyTexImageTest(enabled)
{
    var width = 16;
    var height = 16;
    var level = 0;
    var cases = [
        {
            internalformat: "RGBA16F",
            format: "RGBA",
            type: "HALF_FLOAT",
            destInternalformat: "R16F",
            data: new Uint16Array(width * height * 4)
        },
        {
            internalformat: "RGBA32F",
            format: "RGBA",
            type: "FLOAT",
            destInternalformat: "R32F",
            data: new Float32Array(width * height * 4)
        },
        {
            internalformat: "RGBA16F",
            format: "RGBA",
            type: "HALF_FLOAT",
            destInternalformat: "RG16F",
            data: new Uint16Array(width * height * 4)
        },
        {
            internalformat: "RGBA32F",
            format: "RGBA",
            type: "FLOAT",
            destInternalformat: "RG32F",
            data: new Float32Array(width * height * 4)
        },
        {
            internalformat: "RGBA16F",
            format: "RGBA",
            type: "HALF_FLOAT",
            destInternalformat: "RGB16F",
            data: new Uint16Array(width * height * 4)
        },
        {
            internalformat: "RGBA32F",
            format: "RGBA",
            type: "FLOAT",
            destInternalformat: "RGB32F",
            data: new Float32Array(width * height * 4)
        },
        {
            internalformat: "RGBA16F",
            format: "RGBA",
            type: "HALF_FLOAT",
            destInternalformat: "RGBA16F",
            data: new Uint16Array(width * height * 4)
        },
        {
            internalformat: "RGBA32F",
            format: "RGBA",
            type: "FLOAT",
            destInternalformat: "RGBA32F",
            data: new Float32Array(width * height * 4)
        },
        {
            internalformat: "R11F_G11F_B10F",
            format: "RGB",
            type: "FLOAT",
            destInternalformat: "R11F_G11F_B10F",
            data: new Float32Array(width * height * 3)
        }
    ];
    cases.forEach(function(testcase) {
        debug("");
        debug("Testing CopyTexImage2D for internalformat: " + testcase.destInternalformat);

        var internalformat = gl[testcase.internalformat];
        var format = gl[testcase.format];
        var type = gl[testcase.type];
        var destInternalformat = gl[testcase.destInternalformat];
        var texSrc = gl.createTexture();
        gl.bindTexture(gl.TEXTURE_2D, texSrc);
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
        var data = testcase.data;
        gl.texImage2D(gl.TEXTURE_2D, level, internalformat, width, height, 0, format, type, data);
        var fbo = gl.createFramebuffer();
        gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texSrc, level);
        var texDest = gl.createTexture();
        gl.bindTexture(gl.TEXTURE_2D, texDest);
        wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Setup framebuffer with texture should succeed.");
        if (enabled) {
            shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
            gl.copyTexImage2D(gl.TEXTURE_2D, level, destInternalformat, 0, 0, width, height, 0);
            wtu.glErrorShouldBe(gl, gl.NO_ERROR, "CopyTexImage2D should succeed.");
        } else {
            shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
            gl.copyTexImage2D(gl.TEXTURE_2D, level, destInternalformat, 0, 0, width, height, 0);
            wtu.glErrorShouldBe(gl, [gl.INVALID_ENUM, gl.INVALID_FRAMEBUFFER_OPERATION], "CopyTexImage2D should fail.");
        }

        gl.deleteTexture(texDest);
        gl.deleteTexture(texSrc);
        gl.deleteFramebuffer(fbo);
    });
}

description("This test verifies the functionality of the EXT_color_buffer_float extension, if it is available.");

debug("");

var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
var gl = wtu.create3DContext(canvas, null, 2);

if (!gl) {
  testFailed("WebGL context does not exist");
} else {
  testPassed("WebGL context exists");

  var texturedShaders = [
      wtu.simpleTextureVertexShader,
      "testFragmentShader"
  ];
  var testProgram =
      wtu.setupProgram(gl,
                       texturedShaders,
                       ['vPosition', 'texCoord0'],
                       [0, 1]);
  var quadParameters = wtu.setupUnitQuad(gl, 0, 1);

  // Ensure these formats can't be used for rendering if the extension is disabled
  runFloatTextureRenderTargetTest(false, gl.R16F, gl.RED);
  runFloatTextureRenderTargetTest(false, gl.RG16F, gl.RG);
  runFloatTextureRenderTargetTest(false, gl.RGBA16F, gl.RGBA);
  runFloatTextureRenderTargetTest(false, gl.R32F, gl.RED);
  runFloatTextureRenderTargetTest(false, gl.RG32F, gl.RG);
  runFloatTextureRenderTargetTest(false, gl.RGBA32F, gl.RGBA);
  runFloatTextureRenderTargetTest(false, gl.R11F_G11F_B10F, gl.RGB);

  runFloatRenderbufferRenderTargetTest(false, gl.R16F);
  runFloatRenderbufferRenderTargetTest(false, gl.RG16F);
  runFloatRenderbufferRenderTargetTest(false, gl.RGBA16F);
  runFloatRenderbufferRenderTargetTest(false, gl.R32F);
  runFloatRenderbufferRenderTargetTest(false, gl.RG32F);
  runFloatRenderbufferRenderTargetTest(false, gl.RGBA32F);
  runFloatRenderbufferRenderTargetTest(false, gl.R11F_G11F_B10F);

  // Ensure RGB16F can't be used for rendering.
  runRGB16FNegativeTest();

  runCopyTexImageTest(false);

  if (!gl.getExtension("EXT_color_buffer_float")) {
      testPassed("No EXT_color_buffer_float support -- this is legal");
  } else {
      testPassed("Successfully enabled EXT_color_buffer_float extension");

      runInternalFormatQueryTest();

      runFloatTextureRenderTargetTest(true, gl.R16F, gl.RED, testProgram, 1, [1000, 1, 1, 1], 0);
      runFloatTextureRenderTargetTest(true, gl.RG16F, gl.RG, testProgram, 2, [1000, 1000, 1, 1], 0);
      runFloatTextureRenderTargetTest(true, gl.RGBA16F, gl.RGBA, testProgram, 4, [1000, 1000, 1000, 1000], 0);
      runFloatTextureRenderTargetTest(true, gl.R32F, gl.RED, testProgram, 1, [1000, 1, 1, 1], 0);
      runFloatTextureRenderTargetTest(true, gl.RG32F, gl.RG, testProgram, 2, [1000, 1000, 1, 1], 0);
      runFloatTextureRenderTargetTest(true, gl.RGBA32F, gl.RGBA, testProgram, 4, [1000, 1000, 1000, 1000], 0);
      runFloatTextureRenderTargetTest(true, gl.R11F_G11F_B10F, gl.RGB, testProgram, 3, [1000, 1000, 1000, 1], 0);
      runFloatTextureRenderTargetTest(true, gl.RGBA32F, gl.RGBA, testProgram, 4, [1000, 1000, 1000, 1000], 1);
      runFloatTextureRenderTargetTest(true, gl.RGBA32F, gl.RGBA, testProgram, 4, [1000, 1000, 1000, 1000], 0.5);

      runFloatRenderbufferRenderTargetTest(true, gl.R16F, testProgram, 1, [1000, 1, 1, 1]);
      runFloatRenderbufferRenderTargetTest(true, gl.RG16F, testProgram, 2, [1000, 1000, 1, 1]);
      runFloatRenderbufferRenderTargetTest(true, gl.RGBA16F, testProgram, 4, [1000, 1000, 1000, 1000]);
      runFloatRenderbufferRenderTargetTest(true, gl.R32F, testProgram, 1, [1000, 1, 1, 1]);
      runFloatRenderbufferRenderTargetTest(true, gl.RG32F, testProgram, 2, [1000, 1000, 1, 1]);
      runFloatRenderbufferRenderTargetTest(true, gl.RGBA32F, testProgram, 4, [1000, 1000, 1000, 1000]);
      runFloatRenderbufferRenderTargetTest(true, gl.R11F_G11F_B10F, testProgram, 3, [1000, 1000, 1000, 1]);

      // Ensure EXT_color_buffer_float does not enable RGB16F as color renderable.
      runRGB16FNegativeTest();

      runCopyTexImageTest(true);

      runUniqueObjectTest();
  }
}

debug("");
var successfullyParsed = true;
</script>
<script src="../../js/js-test-post.js"></script>

</body>
</html>