diff --git a/sdk/tests/conformance/textures/misc/00_test_list.txt b/sdk/tests/conformance/textures/misc/00_test_list.txt index 01d34aae08..febb0a8ad3 100644 --- a/sdk/tests/conformance/textures/misc/00_test_list.txt +++ b/sdk/tests/conformance/textures/misc/00_test_list.txt @@ -4,7 +4,7 @@ copy-tex-image-and-sub-image-2d.html --min-version 1.0.2 copy-tex-image-2d-formats.html --min-version 1.0.4 copy-tex-image-crash.html --min-version 1.0.4 copytexsubimage2d-large-partial-copy-corruption.html ---min-version 1.0.4 copytexsubimage2d-subrects.html +--min-version 1.0.4 copytexsubimage2d-subrects.html --min-version 1.0.4 cube-incomplete-fbo.html --min-version 1.0.4 cube-map-uploads-out-of-order.html --min-version 1.0.3 default-texture.html @@ -38,6 +38,7 @@ texture-complete.html --min-version 1.0.3 --max-version 1.9.9 texture-fakeblack.html --min-version 1.0.2 --max-version 1.9.9 texture-formats-test.html --min-version 1.0.2 texture-hd-dpi.html +--min-version 1.0.4 texture-min-mag-filter.html texture-mips.html --max-version 1.9.9 texture-npot-video.html --max-version 1.9.9 texture-npot.html diff --git a/sdk/tests/conformance/textures/misc/texture-min-mag-filter.html b/sdk/tests/conformance/textures/misc/texture-min-mag-filter.html new file mode 100644 index 0000000000..f041712ece --- /dev/null +++ b/sdk/tests/conformance/textures/misc/texture-min-mag-filter.html @@ -0,0 +1,191 @@ + + + + + + +Test TEXTURE_MIN/MAG_FILTER and TEXTURE_MAX_ANISOTROPY + + + + + +
+
+ + + + + + diff --git a/sdk/tests/js/tests/ext-texture-filter-anisotropic.js b/sdk/tests/js/tests/ext-texture-filter-anisotropic.js index 0793e4c364..631ac44e7b 100644 --- a/sdk/tests/js/tests/ext-texture-filter-anisotropic.js +++ b/sdk/tests/js/tests/ext-texture-filter-anisotropic.js @@ -34,6 +34,7 @@ if (!gl) { if (contextVersion >= 2) { runSamplerTestEnabled(); } + testFiltering(); } } @@ -162,5 +163,64 @@ function runSamplerTestEnabled() { gl.deleteSampler(sampler); } +function makeRgbaFramebuffer(gl, w, h) { + const tex = gl.createTexture(); + + let was = gl.getParameter(gl.TEXTURE_2D_BINDING); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, w, h, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + gl.bindTexture(gl.TEXTURE_2D, was); + + const fb = gl.createFramebuffer(); + was = gl.getParameter(gl.FRAMEBUFFER_BINDING); + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, + gl.TEXTURE_2D, tex, 0); + gl.bindFramebuffer(gl.FRAMEBUFFER, was); + + return fb; +} + +function testFiltering() { + const fb = makeRgbaFramebuffer(gl, 1, 1); + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + + const DATA_LEVEL_0 = new Uint8Array([ + 255, 0, 0, 255, + 0, 255, 0, 255, + 0, 255, 0, 255, + 255, 0, 0, 255, + ]); + + const DATA_LEVEL_1 = new Uint8Array([ + 0, 0, 255, 255, + ]); + + const tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, DATA_LEVEL_0); + gl.texImage2D(gl.TEXTURE_2D, 1, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, DATA_LEVEL_1); + + const VS = ` +void main() { + gl_Position = vec4(0, 0, 0, 1); +} + `; + const FS = ` +uniform sampler2D u_tex0; +void main() { + gl_FragColor = texture2D(u_tex0, vec2(0.3, 0.3), 0.3); +} + `; + + + + + + + + + + debug(""); var successfullyParsed = true;