Blender Git Loki

Git Commits -> Revision 7d8a186

Revision 7d8a186 by Lukas Stockner (master)
January 16, 2020, 01:06 (GMT)
Fix T73133: UDIM texture count in Eevee is limited by OpenGL

Based on @fclem's suggestion in D6421, this commit implements support for
storing all tiles of a UDIM texture in a single 2D array texture on the GPU.

Previously, Eevee was binding one OpenGL texture per tile, quickly running
into hardware limits with nontrivial UDIM texture sets.
Workbench meanwhile had no UDIM support at all, as reusing the per-tile
approach would require splitting the mesh by tile as well as texture.

With this commit, both Workbench as well as Eevee now support huge numbers
of tiles, with the eventual limits being GPU memory and ultimately
GL_MAX_ARRAY_TEXTURE_LAYERS, which tends to be in the 1000s on modern GPUs.

Initially my plan was to have one array texture per unique size, but managing
the different textures and keeping everything consistent ended up being way
too complex.

Therefore, we now use a simpler version that allocates a texture that
is large enough to fit the largest tile and then packs all tiles into as many
layers as necessary.

As a result, each UDIM texture only binds two textures (one for the actual
images, one for metadata) regardless of how many tiles are used.

Note that this rolls back per-tile GPUTextures, meaning that we again have
per-Image GPUTextures like we did before the original UDIM commit,
but now with four instead of two types.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D6456

Commit Details:

Full Hash: 7d8a186335400cb7ad69d24aab89e7a215a70348
Parent Commit: 689a873
Lines Changed: +929, -263

25 Modified Paths:

/source/blender/blenkernel/intern/image.c (+26, -12) (Diff)
/source/blender/blenlib/BLI_boxpack_2d.h (+13, -0) (Diff)
/source/blender/blenlib/intern/boxpack_2d.c (+108, -0) (Diff)
/source/blender/blenlib/intern/math_vector_inline.c (+6, -0) (Diff)
/source/blender/blenloader/intern/readfile.c (+11, -21) (Diff)
/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl (+47, -0) (Diff)
/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl (+10, -0) (Diff)
/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl (+10, -0) (Diff)
/source/blender/draw/engines/workbench/workbench_deferred.c (+16, -12) (Diff)
/source/blender/draw/engines/workbench/workbench_forward.c (+20, -15) (Diff)
/source/blender/draw/engines/workbench/workbench_materials.c (+24, -2) (Diff)
/source/blender/draw/engines/workbench/workbench_private.h (+8, -2) (Diff)
/source/blender/draw/intern/draw_manager_data.c (+11, -9) (Diff)
/source/blender/gpu/GPU_material.h (+7, -5) (Diff)
/source/blender/gpu/intern/gpu_codegen.c (+18, -8) (Diff)
/source/blender/gpu/intern/gpu_codegen.h (+2, -3) (Diff)
/source/blender/gpu/intern/gpu_draw.c (+483, -81) (Diff)
/source/blender/gpu/intern/gpu_texture.c (+2, -10) (Diff)
/source/blender/gpu/shaders/material/gpu_shader_material_tex_image.glsl (+60, -35) (Diff)
/source/blender/makesdna/DNA_image_types.h (+13, -3) (Diff)
/source/blender/makesdna/DNA_movieclip_types.h (+2, -2) (Diff)
/source/blender/makesrna/intern/rna_image.c (+1, -2) (Diff)
/source/blender/makesrna/intern/rna_image_api.c (+4, -8) (Diff)
/source/blender/nodes/shader/nodes/node_shader_tex_environment.c (+5, -9) (Diff)
/source/blender/nodes/shader/nodes/node_shader_tex_image.c (+22, -24) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021