Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukasstockner97>2020-01-14 02:33:21 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2020-01-16 04:06:49 +0300
commit7d8a186335400cb7ad69d24aab89e7a215a70348 (patch)
tree0919c339e6f9a8a56fed8246af7f365473475784 /source/blender/makesdna/DNA_image_types.h
parent689a873029b9554a60ee1198344a29cd2f567659 (diff)
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
Diffstat (limited to 'source/blender/makesdna/DNA_image_types.h')
-rw-r--r--source/blender/makesdna/DNA_image_types.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 1c58d03a1a8..9a6cb24796f 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -91,11 +91,17 @@ typedef struct RenderSlot {
struct RenderResult *render;
} RenderSlot;
+typedef struct ImageTile_Runtime {
+ int tilearray_layer;
+ int _pad;
+ int tilearray_offset[2];
+ int tilearray_size[2];
+} ImageTile_Runtime;
+
typedef struct ImageTile {
struct ImageTile *next, *prev;
- /** Not written in file 2 = TEXTARGET_COUNT. */
- struct GPUTexture *gputexture[2];
+ struct ImageTile_Runtime runtime;
char ok;
char _pad[3];
@@ -114,7 +120,9 @@ typedef struct ImageTile {
enum {
TEXTARGET_TEXTURE_2D = 0,
TEXTARGET_TEXTURE_CUBE_MAP = 1,
- TEXTARGET_COUNT = 2,
+ TEXTARGET_TEXTURE_2D_ARRAY = 2,
+ TEXTARGET_TEXTURE_TILE_MAPPING = 3,
+ TEXTARGET_COUNT = 4,
};
typedef struct Image {
@@ -125,6 +133,8 @@ typedef struct Image {
/** Not written in file. */
struct MovieCache *cache;
+ /** Not written in file 4 = TEXTARGET_COUNT. */
+ struct GPUTexture *gputexture[4];
/* sources from: */
ListBase anims;