Skip to content

Commit

Permalink
Add getInternalformatParameter for EXT_texture_norm16 (KhronosGroup#3267
Browse files Browse the repository at this point in the history
)

* Add getInternalformatParameter for EXT_texture_norm16

* style
  • Loading branch information
shrekshao authored Mar 26, 2021
1 parent 44ac38b commit 953aa5c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions sdk/tests/conformance2/extensions/ext-texture-norm16.html
Original file line number Diff line number Diff line change
Expand Up @@ -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()];
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion sdk/tests/js/tests/ext-color-buffer-half-float.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 953aa5c

Please sign in to comment.