From 953aa5ceaa57b0d2968f527589eaaca6171a198b Mon Sep 17 00:00:00 2001 From: ShrekShao Date: Fri, 26 Mar 2021 14:27:30 -0700 Subject: [PATCH] Add getInternalformatParameter for EXT_texture_norm16 (#3267) * Add getInternalformatParameter for EXT_texture_norm16 * style --- .../extensions/ext-color-buffer-float.html | 2 +- .../extensions/ext-texture-norm16.html | 18 ++++++++++++++++++ .../js/tests/ext-color-buffer-half-float.js | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sdk/tests/conformance2/extensions/ext-color-buffer-float.html b/sdk/tests/conformance2/extensions/ext-color-buffer-float.html index e2eebd113a..b57a6ca10d 100644 --- a/sdk/tests/conformance2/extensions/ext-color-buffer-float.html +++ b/sdk/tests/conformance2/extensions/ext-color-buffer-float.html @@ -284,7 +284,7 @@ debug("testing the internal format query"); var maxSamples = gl.getParameter(gl.MAX_SAMPLES); - var formats = new Array(gl.RGBA16F, gl.R32F, gl.RG32F, gl.RGBA32F, gl.R16F, gl.RG16F, gl.R11F_G11F_B10F); + 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); diff --git a/sdk/tests/conformance2/extensions/ext-texture-norm16.html b/sdk/tests/conformance2/extensions/ext-texture-norm16.html index 1d9ff645eb..31ed8f37ab 100644 --- a/sdk/tests/conformance2/extensions/ext-texture-norm16.html +++ b/sdk/tests/conformance2/extensions/ext-texture-norm16.html @@ -153,6 +153,23 @@ "framebuffer should not be complete with SNORM16 texture attached"); } +function runInternalFormatQueryTest() +{ + debug(""); + debug("testing the internal format query"); + + var maxSamples = gl.getParameter(gl.MAX_SAMPLES); + const formats = [ext.R16_EXT, ext.RG16_EXT, ext.RGBA16_EXT]; + for (const format of formats) { + var samples = gl.getInternalformatParameter(gl.RENDERBUFFER, format, gl.SAMPLES); + if (samples == null || samples.length == 0 || samples[0] < maxSamples) { + testFailed("the maximum value in SAMPLES should be at least " + maxSamples); + return; + } + } + testPassed("Internal format query succeeded"); +} + function runTestExtension() { textures = [gl.createTexture(), gl.createTexture()]; fbos = [gl.createFramebuffer(), gl.createFramebuffer()]; @@ -207,6 +224,7 @@ wtu.runExtensionSupportedTest(gl, "EXT_texture_norm16", ext !== null); if (ext !== null) { + runInternalFormatQueryTest(); runTestExtension(); } else { testPassed("No EXT_texture_norm16 support -- this is legal"); diff --git a/sdk/tests/js/tests/ext-color-buffer-half-float.js b/sdk/tests/js/tests/ext-color-buffer-half-float.js index 93de8b67ef..51509e8a6e 100644 --- a/sdk/tests/js/tests/ext-color-buffer-half-float.js +++ b/sdk/tests/js/tests/ext-color-buffer-half-float.js @@ -244,7 +244,7 @@ function runInternalFormatQueryTest() debug("testing the internal format query"); var maxSamples = gl.getParameter(gl.MAX_SAMPLES); - var formats = new Array(gl.RGBA16F, gl.R16F, gl.RG16F); + const formats = [gl.RGBA16F, gl.R16F, gl.RG16F]; var firstMultiOnlyFormat = 4; for (var fmt = 0; fmt < formats.length; ++fmt) { var samples = gl.getInternalformatParameter(gl.RENDERBUFFER, formats[fmt], gl.SAMPLES);