Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add THREE.CompressedArrayTexture #24745

Merged
merged 21 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bc9be5f
wip
RenaudRohlinger Oct 4, 2022
8d23278
Merge branch 'mrdoob:dev' into texture2darray_compressed
RenaudRohlinger Oct 4, 2022
c5c3157
texture array is working with hardcoded values
RenaudRohlinger Oct 5, 2022
32c1a67
KTX2Loader: Decode additional layers from array textures.
donmccurdy Oct 5, 2022
49a37a9
added compressedarraytexture
RenaudRohlinger Oct 6, 2022
c129db1
Merge remote-tracking branch 'upstream/dev' into texture2darray_compr…
RenaudRohlinger Oct 6, 2022
fbe1b6b
fix merge
RenaudRohlinger Oct 6, 2022
5e8f9ce
fixed level issues
RenaudRohlinger Oct 6, 2022
4eab10a
fix copyTextureToTexture3D, updated compressedarraytexture arguments,…
RenaudRohlinger Oct 7, 2022
739e3d0
remove build
RenaudRohlinger Oct 7, 2022
61a141d
fix deepscan
RenaudRohlinger Oct 7, 2022
c6bcf87
Update WebGLTextures.js
Mugen87 Oct 10, 2022
bc639f2
Update webgl2_texture2darray_compressed.html
Mugen87 Oct 15, 2022
e860e3e
Update webgl2_texture2darray_compressed.html
Mugen87 Oct 15, 2022
1eddd13
replaced with simple example
RenaudRohlinger Oct 17, 2022
13186da
remove build
RenaudRohlinger Oct 17, 2022
6f35ef2
Update webgl2_texture2darray_compressed.html
Mugen87 Oct 17, 2022
949dfb5
Update webgl2_texture2darray_compressed.html
Mugen87 Oct 17, 2022
5e9ea94
make the example framerate independent
RenaudRohlinger Oct 17, 2022
ce9a92f
fix init texture2darray for compressed texture in webglrenderer
RenaudRohlinger Oct 18, 2022
4ad7887
Update webgl2_texture2darray_compressed.html
Mugen87 Oct 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 62 additions & 15 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16300,6 +16300,14 @@ function WebGLState(gl, extensions, capabilities) {
}
}

function compressedTexImage3D() {
try {
gl.compressedTexImage3D.apply(gl, arguments);
} catch (error) {
console.error('THREE.WebGLState:', error);
}
}

function texSubImage2D() {
try {
gl.texSubImage2D.apply(gl, arguments);
Expand All @@ -16324,6 +16332,14 @@ function WebGLState(gl, extensions, capabilities) {
}
}

function compressedTexSubImage3D() {
try {
gl.compressedTexSubImage3D.apply(gl, arguments);
} catch (error) {
console.error('THREE.WebGLState:', error);
}
}

function texStorage2D() {
try {
gl.texStorage2D.apply(gl, arguments);
Expand Down Expand Up @@ -16486,6 +16502,7 @@ function WebGLState(gl, extensions, capabilities) {
bindTexture: bindTexture,
unbindTexture: unbindTexture,
compressedTexImage2D: compressedTexImage2D,
compressedTexImage3D: compressedTexImage3D,
texImage2D: texImage2D,
texImage3D: texImage3D,
updateUBOMapping: updateUBOMapping,
Expand All @@ -16495,6 +16512,7 @@ function WebGLState(gl, extensions, capabilities) {
texSubImage2D: texSubImage2D,
texSubImage3D: texSubImage3D,
compressedTexSubImage2D: compressedTexSubImage2D,
compressedTexSubImage3D: compressedTexSubImage3D,
scissor: scissor,
viewport: viewport,
reset: reset
Expand Down Expand Up @@ -17086,28 +17104,56 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
}
}
} else if (texture.isCompressedTexture) {
if (useTexStorage && allocateMemory) {
state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
}
if (texture.isDataArrayTexture) {
if (useTexStorage && allocateMemory) {
state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);
}

for (let i = 0, il = mipmaps.length; i < il; i++) {
mipmap = mipmaps[i];
for (let i = 0, il = mipmaps.length; i < il; i++) {
mipmap = mipmaps[i];

if (texture.format !== RGBAFormat) {
if (glFormat !== null) {
if (useTexStorage) {
state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
if (texture.format !== RGBAFormat) {
if (glFormat !== null) {
if (useTexStorage) {
state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, glType, 0);
} else {
state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data);
}
} else {
state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
}
} else {
console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
if (useTexStorage) {
state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);
} else {
state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);
}
}
} else {
if (useTexStorage) {
state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
}
} else {
if (useTexStorage && allocateMemory) {
state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
}

for (let i = 0, il = mipmaps.length; i < il; i++) {
mipmap = mipmaps[i];

if (texture.format !== RGBAFormat) {
if (glFormat !== null) {
if (useTexStorage) {
state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
} else {
state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
}
} else {
console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
}
} else {
state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
if (useTexStorage) {
state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
} else {
state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
}
}
}
}
Expand Down Expand Up @@ -36033,3 +36079,4 @@ exports.ZeroSlopeEnding = ZeroSlopeEnding;
exports.ZeroStencilOp = ZeroStencilOp;
exports._SRGBAFormat = _SRGBAFormat;
exports.sRGBEncoding = sRGBEncoding;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhyZWUuY2pzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
77 changes: 62 additions & 15 deletions build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -16302,6 +16302,14 @@
}
}

function compressedTexImage3D() {
try {
gl.compressedTexImage3D.apply(gl, arguments);
} catch (error) {
console.error('THREE.WebGLState:', error);
}
}

function texSubImage2D() {
try {
gl.texSubImage2D.apply(gl, arguments);
Expand All @@ -16326,6 +16334,14 @@
}
}

function compressedTexSubImage3D() {
try {
gl.compressedTexSubImage3D.apply(gl, arguments);
} catch (error) {
console.error('THREE.WebGLState:', error);
}
}

function texStorage2D() {
try {
gl.texStorage2D.apply(gl, arguments);
Expand Down Expand Up @@ -16488,6 +16504,7 @@
bindTexture: bindTexture,
unbindTexture: unbindTexture,
compressedTexImage2D: compressedTexImage2D,
compressedTexImage3D: compressedTexImage3D,
texImage2D: texImage2D,
texImage3D: texImage3D,
updateUBOMapping: updateUBOMapping,
Expand All @@ -16497,6 +16514,7 @@
texSubImage2D: texSubImage2D,
texSubImage3D: texSubImage3D,
compressedTexSubImage2D: compressedTexSubImage2D,
compressedTexSubImage3D: compressedTexSubImage3D,
scissor: scissor,
viewport: viewport,
reset: reset
Expand Down Expand Up @@ -17088,28 +17106,56 @@
}
}
} else if (texture.isCompressedTexture) {
if (useTexStorage && allocateMemory) {
state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
}
if (texture.isDataArrayTexture) {
if (useTexStorage && allocateMemory) {
state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);
}

for (let i = 0, il = mipmaps.length; i < il; i++) {
mipmap = mipmaps[i];
for (let i = 0, il = mipmaps.length; i < il; i++) {
mipmap = mipmaps[i];

if (texture.format !== RGBAFormat) {
if (glFormat !== null) {
if (useTexStorage) {
state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
if (texture.format !== RGBAFormat) {
if (glFormat !== null) {
if (useTexStorage) {
state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, glType, 0);
} else {
state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data);
}
} else {
state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
}
} else {
console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
if (useTexStorage) {
state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);
} else {
state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);
}
}
} else {
if (useTexStorage) {
state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
}
} else {
if (useTexStorage && allocateMemory) {
state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
}

for (let i = 0, il = mipmaps.length; i < il; i++) {
mipmap = mipmaps[i];

if (texture.format !== RGBAFormat) {
if (glFormat !== null) {
if (useTexStorage) {
state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
} else {
state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
}
} else {
console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
}
} else {
state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
if (useTexStorage) {
state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
} else {
state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
}
}
}
}
Expand Down Expand Up @@ -36039,3 +36085,4 @@
Object.defineProperty(exports, '__esModule', { value: true });

}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhyZWUuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
3 changes: 2 additions & 1 deletion build/three.min.js

Large diffs are not rendered by default.

Loading